Closed discosultan closed 8 years ago
Can you please be more specific on what code changes are needed to get this to work.
Hey!
I found my solution from this StackOverflow thread.
If I remember correctly, you need to change the format for depth stencil resource description in D3DApp.cpp from
to (my impl is in C#)
Thanks discosultan,
Here's how I fixed the C++ code:
In d3dApp.cpp find the D2DApp::OnResize method.
Change
depthStencilDesc.Format = mDepthStencilFormat;
to
depthStencilDesc.Format = DXGI_FORMAT_R24G8_TYPELESS;
Then before md3dDevice->CreateDepthStencilView add
D3D12_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc = {};
depthStencilViewDesc.Format = mDepthStencilFormat;
depthStencilViewDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
Finally change
md3dDevice->CreateDepthStencilView(mDepthStencilBuffer.Get(), nullptr, DepthStencilView());
to
md3dDevice->CreateDepthStencilView(mDepthStencilBuffer.Get(), &depthStencilViewDesc, DepthStencilView());
Fixed by 4cfd00afa59210a272f62caf0660478d18b9ffed
SSAO sample (chapter 21: Ambient Occlusion) fails with the following error message:
Edit: The problem is that the depth stencil resource is defined as
D24_UNORM_S8_UINT
with DSV matching the resource format. The resource should be defined asR24G8_TYPELESS
instead and DSV asD24_UNORM_S8_UINT
.