Elad8a
Topic Author
Posts: 11
Joined: 17 Jun 2018, 20:52

D3D11RenderContext does not properly clear the depth buffer?

01 Mar 2019, 19:10

I tried following the "Integration" sample and integrate my own D3D11 rendering logics with noesis engine.

I have 2 questions:

1. The integration sample uses a Noesis::RenderContext object. I could not find how to create this object using my own D3D11DeviceContext & D3D11Device.
I currently added my own custom factory function to the NoesisApp::D3D11RenderContext code that accepts native handles to these objects. Is this the right approach?

2. The same sample has a RenderView() function thar calls D3D11RenderContext::SetDefaultRenderTarget. this function seems to not clear the depth buffer properly as eveything I draw fails the depth test. Again after fixing the noesis code to do
mContext->ClearDepthStencilView(mDepthStencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
insead of
mContext->ClearDepthStencilView(mDepthStencil, D3D11_CLEAR_STENCIL, 0.0f, 0);
everything renders ok (for now) but I am afraid I'm missing something.
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: D3D11RenderContext does not properly clear the depth buffer?

02 Mar 2019, 13:33

1. The integration sample uses a Noesis::RenderContext object. I could not find how to create this object using my own D3D11DeviceContext & D3D11Device.
I currently added my own custom factory function to the NoesisApp::D3D11RenderContext code that accepts native handles to these objects. Is this the right approach?
The RenderContext is not part of Noesis core. It is a helper we use to initialize the GPU in each platform. if you have a look at the minimal IntegrationGLUT sample (download the latest beta please) you will see that it is not used. So, if you already have your own code to initialize D3D11 you only need to provide us a valid RenderDevice implementation.
2. The same sample has a RenderView() function thar calls D3D11RenderContext::SetDefaultRenderTarget. this function seems to not clear the depth buffer properly as eveything I draw fails the depth test.
All the classes in the NoesisApp framework are helpers for our samples. You should cherry pick pick and modify the code to your own purposes. As, for now :), we don't use 3D in our demos, we don't use depth buffer only stencil. If you have a look at each RenderContext implementation you can confirm that only stencil is created in each platform.

The only surface need by Noesis is the stencil buffer. It is used to implement masking efficiently.

Who is online

Users browsing this forum: Ahrefs [Bot] and 22 guests