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