Jump to content
  • Advertisement
Sign in to follow this  
paperplane

DirectX11 DepthStencil problem with SampleDesc

This topic is 874 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

Hello,

I have a problem with creation of depthstencil view.

When creating DXGI_SWAP_CHAIN_DESC, I set the following: 

sd.SampleDesc.Count = 4;
sd.SampleDesc.Quality = m_4xMSaaQuality - 1;

After that, if I put the following:

D3D11_TEXTURE2D_DESC depthStencilDesc;
depthStencilDesc.SampleDesc.Count =  4;
depthStencilDesc.SampleDesc.Quality = m_4xMSaaQuality - 1;

 CreateDepthStencilView() fails, and HRESULT is E_INVALIDARG One or more arguments are invalid.

 

 

If I set SampleDesc.Count = 1 and SampleDesc.Quality = 0 in both places everything works properly.

 

Also, some code that might matter:

 

Microsoft::WRL:: ComPtr<ID3D11Texture2D> mDepthStencilBufer;
CD3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDescription(D3D11_DSV_DIMENSION_TEXTURE2D);
HRESULT dsHR = m_d3dDevice->CreateTexture2D(&depthStencilDesc, 0, mDepthStencilBufer.GetAddressOf());
dsHR = m_d3dDevice->CreateDepthStencilView(mDepthStencilBufer.Get(), &depthStencilViewDescription, m_depthStencilView.GetAddressOf());

Thanks in advance for help!

Edited by paperplane

Share this post


Link to post
Share on other sites
Advertisement

You probably wanted:

CD3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDescription(D3D11_DSV_DIMENSION_TEXTURE2DMS);

when using Multisampling counts > 1.

Share this post


Link to post
Share on other sites

You probably wanted:

CD3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDescription(D3D11_DSV_DIMENSION_TEXTURE2DMS);

when using Multisampling counts > 1.

 

Thanks a lot!
It's working now.

Share this post


Link to post
Share on other sites

Friendly reminder to turn on the Debug Layer, I suspect there was a well-formatted warning telling you exactly what was wrong!

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!