Examples: DirectX11: Fixed uninitialized fields. Disabling depth-write (#640, #636)

This commit is contained in:
ocornut 2016-05-07 20:53:55 +02:00
parent f4633d09ac
commit 656b1e848c

View File

@ -454,14 +454,17 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState); g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);
} }
// Create Depth-Stencil State // Create depth-stencil State
{ {
D3D11_DEPTH_STENCIL_DESC desc; D3D11_DEPTH_STENCIL_DESC desc;
ZeroMemory(&desc, sizeof(desc)); ZeroMemory(&desc, sizeof(desc));
desc.DepthEnable = true; desc.DepthEnable = false;
desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
desc.DepthFunc = D3D11_COMPARISON_ALWAYS; desc.DepthFunc = D3D11_COMPARISON_ALWAYS;
desc.StencilEnable = false; desc.StencilEnable = false;
desc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
desc.BackFace = desc.FrontFace;
g_pd3dDevice->CreateDepthStencilState(&desc, &g_pDepthStencilState); g_pd3dDevice->CreateDepthStencilState(&desc, &g_pDepthStencilState);
} }