Page 1 of 1

DirectX 11 - Depth Buffer

Posted: Mon Oct 31, 2016 15:18
by Brouilles
Hi, I have a problem with the Depth Buffer context of my DirectX 11 when viewing the menu. The Depth Buffer, which is activated, works perfectly if I do not show the menu. I clear at every frame.

Code: Select all

//Type of variable
CEGUI::Direct3D11Renderer*  m_pRenderer;
CEGUI::GUIContext*          m_pContext;

//Call render
m_pRenderer->beginRendering();
        m_pContext->draw(); // <-- this line must disable buffer, after being called once the buffer is deactivated until the end of the program
m_pRenderer->endRendering();


It is normal that the buffer is disabled for UI, but I not understand why he does not wake up later.

Code: Select all

m_renderingEngine.Restore();
        m_game.Render();
        m_GUI.Draw();
m_renderingEngine.Clear();


So m_renderingEngine.Restore(); :

Code: Select all

m_deviceContext->ClearRenderTargetView(m_pRenderTargetView, D3DXCOLOR(0.0f, 0.2f, 0.4f, 1.0f));
m_deviceContext->ClearDepthStencilView(m_pDepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);


and m_pRenderer->endRendering(); :

Code: Select all

m_swapchain->Present(0, 0); //Switch the back to front buffer
D3DXMatrixIdentity(&m_worldMatrix);


Image

Cegui Version: 0.8.7.

Thank you for your answers.

Re: DirectX 11 - Depth Buffer

Posted: Tue Nov 01, 2016 07:27
by YaronCT
@Brouilles: Thanx for (re)reporting the problem! We'll look into it.

Re: DirectX 11 - Depth Buffer

Posted: Sat Nov 12, 2016 18:06
by YaronCT
As my knowledge in DirectX equals the abosulute 0, and honestly, I prefer to keep it that way, I find it difficult to tackle this problem. I hereby assign this to our #1 DirectX expert.

@Ident: Any way u can give it a look? Grepping for "depth" in "cegui/src/RendererModules/Direct3D11/shader.txt" definitely gives a few results where it seems like the depth buffer is disabled. However that's the most I can make of it..

Re: DirectX 11 - Depth Buffer

Posted: Sat Nov 12, 2016 21:11
by Ident
I am actually a total OpenGL guy. Although I did write the new Direct3D 11 renderer on default (not the 0.8.X one), it was tough for me and mostly done using my OpenGL knowledge and with the goal to unify our rendering system for easier maintainability. I just followed the status-quo on our practices there.

In OpenGLRenderer 2 and 3 we use a function called "enableExtraStateSettings", which, if true, will reset all states to default or previous values after rendering. The API docu reveals that the D3D11 renderer doesnt have such a function and I do not know what the best practice here is for Direct3D on this matter.

Would it fix your problem if you reactivated the depth buffer each time after rendering CEGUI? As well as everything else that might be altered?