Jump to content

  • Log In with Google      Sign In   
  • Create Account


D3D11 - RenderTargetView at slot 0 is not compatable with the DepthStencilView


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Migi0027   Crossbones+   -  Reputation: 1234

Like
0Likes
Like

Posted 13 March 2013 - 03:00 PM

Hi guys,

 

right now I'm trying to follow a tutorial from raster tek, tutorial 22 about Render To Texture: http://www.rastertek.com/dx11tut22.html , but stuff isn't going as well as i thought because this pops up:

 

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:800,h:600,as:1), while the Resource is a Texture2D with (mc:1,mq:0). The DepthStencilView has (w:800,h:600,as:1), while the Resource is a Texture2D with (mc:4,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 ]

 

So as I understand, theres something wrong with my Texture2D, now some code:

 

For the render to texture class: (textureWidth debugged 800, textureHeight debugged 600)

// Setup the render target texture description.
textureDesc.Width = textureWidth;
textureDesc.Height = textureHeight;
textureDesc.MipLevels = 1;
textureDesc.ArraySize = 1;
textureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
textureDesc.SampleDesc.Count = 1;
textureDesc.Usage = D3D11_USAGE_DEFAULT;
textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
textureDesc.CPUAccessFlags = 0;
textureDesc.MiscFlags = 0;

 

 

In the system class (the default texture) (sw debugged 800, sh debugged 600)

 

texd.Width = sw;
texd.Height = sh;
texd.ArraySize = 1;
texd.MipLevels = 1;
texd.SampleDesc.Count = 4;
texd.Format = DXGI_FORMAT_D32_FLOAT;
texd.BindFlags = D3D11_BIND_DEPTH_STENCIL;

 

 

Now I've never touched Render To Texture before this, so if you wan't more information, please tell me.

 

Thank You

 

 



Sponsor:

#2 Tsus   Members   -  Reputation: 955

Like
2Likes
Like

Posted 13 March 2013 - 05:01 PM

Hi!


Your render target view (that views the texture to render into) and your depth stencil view (the corresponding depth buffer) have different multi-sampling settings.
When using multi-sampling, every pixel needs to store extra data for the sub-samples (their depth and the coverage bits). Each texture resource is prepared for one certain multi-sampling setting and to make them work together, both the color texture and the depth buffer (after all, it’s just another texture) need the same setting. You can have resources with different settings, but you can only bind them together, if their settings coincide.


If you disable multi-sampling, it would be:

sampleDesc.Count = 1;
sampleDesc.Quality = 0;


High-quality 4x MSAA (for instance) is achieved by setting:

sampleDesc.Count = 4;
sampleDesc.Quality = 16.


Keep in mind that MSAA comes at a cost. If you don’t need it, try to avoid it. Also, combining multi-sampled with single-sampled textures requires you to convert one into the other. (I'd advise you to first familarize yourself with the rendering to textures, before working with multi-sampling)

 

Okay, so try to set in your default texture (system class):

texd.SampleDesc.Count = 1; 

and make sure that your view dimensions are set to the single-sampled types, e.g.,

for the depth stencil view: D3D11_DSV_DIMENSION_TEXTURE2D  (not: D3D11_DSV_DIMENSION_TEXTURE2DMS).
 

Cheers!


Acagamics e.V. – IGDA Student Game Development Club (University of Magdeburg, Germany)


#3 Migi0027   Crossbones+   -  Reputation: 1234

Like
0Likes
Like

Posted 13 March 2013 - 05:20 PM

Thank! 

 

My render to texture works perfectly, MVUHAHAHAH!

 

..sorry, but awesome feeling.

 

Cheers!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS