From 656b1e848cc77a7a0f057113d8bccc49d5c04cda Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 7 May 2016 20:53:55 +0200 Subject: [PATCH] Examples: DirectX11: Fixed uninitialized fields. Disabling depth-write (#640, #636) --- examples/directx11_example/imgui_impl_dx11.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/directx11_example/imgui_impl_dx11.cpp b/examples/directx11_example/imgui_impl_dx11.cpp index c43c6cf1..d595e6c0 100644 --- a/examples/directx11_example/imgui_impl_dx11.cpp +++ b/examples/directx11_example/imgui_impl_dx11.cpp @@ -454,14 +454,17 @@ bool ImGui_ImplDX11_CreateDeviceObjects() g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState); } - // Create Depth-Stencil State + // Create depth-stencil State { D3D11_DEPTH_STENCIL_DESC desc; ZeroMemory(&desc, sizeof(desc)); - desc.DepthEnable = true; + desc.DepthEnable = false; desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; desc.DepthFunc = D3D11_COMPARISON_ALWAYS; 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); }