Jump to content
  • Advertisement
Sign in to follow this  
belfegor

DX11 DS / RT dimensions

This topic is 441 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was using DX9 long time. Before i could use depth/stencil buffer with render target that has smaller size without a problem. 

Now i get this error:

D3D11 ERROR: ID3D11DeviceContext::OMSetRenderTargets: The RenderTargetView at slot 0 is not compatable with the DepthStencilView. DepthStencilViews may only be used with RenderTargetViews if the effective dimensions of the Views are equal, as well as the Resource types, multisample count, and multisample quality. The RenderTargetView at slot 0 has (w:640,h:360,as:1), while the Resource is a Texture2D with (mc:1,mq:0). The DepthStencilView has (w:1280,h:720,as:1), while the Resource is a Texture2D with (mc:1,mq:0). D3D11_RESOURCE_MISC_TEXTURECUBE factors into the Resource type, unless GetFeatureLevel() returns D3D_FEATURE_LEVEL_10_1 or greater. [ STATE_SETTING ERROR #388: OMSETRENDERTARGETS_INVALIDVIEW]

 

I thought i could reuse same DS.

Such a waste if i have to create DS for every RT that doesnt match in size.

 

Share this post


Link to post
Share on other sites
Advertisement

That error message is correct: the dimensions and MSAA counts need to match between your render targets and your depth-stencil buffers. You can't use a larger depth-stencil buffer with a smaller render target. Depth buffers tend to be complicated in modern GPU's: they have all kinds of compression features, and they will often use tiled memory layouts to improve bandwidth. Allowing  a larger depth buffer to work with a smaller render target would probably get in the way with these things.

In D3D12 you can alias two different depth buffer resources onto the same heap range to avoid wasting memory, but in D3D11 you don't have control over resource memory placement.

Share this post


Link to post
Share on other sites

I forgot about that D3D9 feature. It must be doing a lot of hidden work under the hood. The memory layouts of different resolution depth buffers will be different, so the fact that the data is preserved in the resource afterwards means that it's doing much more than D3D12 style aliasing. I'd be wary of a hidden perf penalty or memory overhead. 

You can achieve the same thing by reusing large-sized color targets too and setting a small viewport ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!