[d3d11] Initialize all D3D11ContextState members

Otherwise, SwapDeviceContextState may swap in some uninitialized data.
Closes #1512.

Reported-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
This commit is contained in:
Philip Rebohle 2020-03-16 18:39:46 +01:00
parent 26798eb312
commit bf480ce659
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 39 additions and 39 deletions

View File

@ -31,8 +31,8 @@ namespace dxvk {
struct D3D11ShaderResourceBindings {
std::array<Com<D3D11ShaderResourceView>, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> views;
DxvkBindingSet<D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> hazardous;
std::array<Com<D3D11ShaderResourceView>, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> views = { };
DxvkBindingSet<D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT> hazardous = { };
};
@ -41,52 +41,52 @@ namespace dxvk {
struct D3D11ContextStateVS {
Com<D3D11VertexShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
Com<D3D11VertexShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
};
struct D3D11ContextStateHS {
Com<D3D11HullShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
Com<D3D11HullShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
};
struct D3D11ContextStateDS {
Com<D3D11DomainShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
Com<D3D11DomainShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
};
struct D3D11ContextStateGS {
Com<D3D11GeometryShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
Com<D3D11GeometryShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
};
struct D3D11ContextStatePS {
Com<D3D11PixelShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
D3D11UnorderedAccessBindings unorderedAccessViews;
Com<D3D11PixelShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
D3D11UnorderedAccessBindings unorderedAccessViews = { };
};
struct D3D11ContextStateCS {
Com<D3D11ComputeShader> shader;
D3D11ConstantBufferBindings constantBuffers;
D3D11SamplerBindings samplers;
D3D11ShaderResourceBindings shaderResources;
D3D11UnorderedAccessBindings unorderedAccessViews;
Com<D3D11ComputeShader> shader = nullptr;
D3D11ConstantBufferBindings constantBuffers = { };
D3D11SamplerBindings samplers = { };
D3D11ShaderResourceBindings shaderResources = { };
D3D11UnorderedAccessBindings unorderedAccessViews = { };
DxvkBindingSet<D3D11_1_UAV_SLOT_COUNT> uavMask = { };
};
@ -113,17 +113,17 @@ namespace dxvk {
struct D3D11ContextStateIA {
Com<D3D11InputLayout> inputLayout;
Com<D3D11InputLayout> inputLayout = nullptr;
D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
std::array<D3D11VertexBufferBinding, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> vertexBuffers;
D3D11IndexBufferBinding indexBuffer;
std::array<D3D11VertexBufferBinding, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> vertexBuffers = { };
D3D11IndexBufferBinding indexBuffer = { };
};
struct D3D11ContextStateOM {
std::array<Com<D3D11RenderTargetView, false>, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT> renderTargetViews;
Com<D3D11DepthStencilView, false> depthStencilView;
std::array<Com<D3D11RenderTargetView, false>, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT> renderTargetViews = { };
Com<D3D11DepthStencilView, false> depthStencilView = { };
D3D11BlendState* cbState = nullptr;
D3D11DepthStencilState* dsState = nullptr;
@ -141,21 +141,21 @@ namespace dxvk {
uint32_t numViewports = 0;
uint32_t numScissors = 0;
std::array<D3D11_VIEWPORT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> viewports;
std::array<D3D11_RECT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors;
std::array<D3D11_VIEWPORT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> viewports = { };
std::array<D3D11_RECT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors = { };
D3D11RasterizerState* state;
D3D11RasterizerState* state = nullptr;
};
struct D3D11ContextSoTarget {
Com<D3D11Buffer> buffer;
UINT offset;
Com<D3D11Buffer> buffer = nullptr;
UINT offset = 0;
};
struct D3D11ContextStateSO {
std::array<D3D11ContextSoTarget, D3D11_SO_BUFFER_SLOT_COUNT> targets;
std::array<D3D11ContextSoTarget, D3D11_SO_BUFFER_SLOT_COUNT> targets = { };
};