Direct3D11 without a Depth/Stencil (back)buffer

Started by
1 comment, last by Xanather 9 years, 2 months ago

I was wondering if a depth/stencil buffer is required for Direct3D11 to function correctly - it seems pretty integrated into the pipeline. I will be developing a personal 2D game engine soon and I really have no use for a depth/stencil buffer. I will be using the painters algorithm and multiple render targets to draw everything well enough.

I made a quick test and noticed Direct3D11 seems to run alright without a depth/stencil buffer. Other than not setting up a depth-stencil Texture2D, DepthStencilView and specificing null when assigning rendertargets to the swap chain is there anything else I should inform the state machine about?

Thanks,

Xanather

Advertisement


Other than not setting up a depth-stencil Texture2D, DepthStencilView and specificing null when assigning rendertargets to the swap chain is there anything else I should inform the state machine about?

That's pretty much it. If you wanted to enable/disable the depth-stencil buffer, you would also need to create a ID3D11DepthStencilState object, and bind it with OMSetDepthStencilState. I think OMSetDepthStencilState takes NULL too, but you don't have to set it if you're never going to enable depth testing/writing - they are disabled by default.

Thanks for the reply.

I think the default value for the DepthStencilState (even when it's initially null) is to have DepthEnable enabled https://msdn.microsoft.com/en-us/library/windows/desktop/ff476110%28v=vs.85%29.aspx, so maybe I should just create a state object for that and set it to false there too just incase.

This topic is closed to new replies.

Advertisement