Sign in to follow this  
Xanather

Direct3D11 without a Depth/Stencil (back)buffer

Recommended Posts

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

Edited by Xanather

Share this post


Link to post
Share on other sites


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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this