• Advertisement
Sign in to follow this  

Allowed format in Create View

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

When creating a DepthStencilView I'm able to pass a D3D11_DEPTH_STENCIL_VIEW_DESC as an argument, specifying a format from a list.

I'd like to know which format are allowed, respect to the Resouce format.

I.e. Can I use a DXGI_FORMAT which is smaller then the selected resource format?

Can I create a DEPTH_STENCIL_VIEW with format DXGI_FORMAT_D16_UNORM is the selected resource format is DXGI_FORMAT_R32?

Does it have other limitations, like a Depth stencil view cannot be created when the subresource has a some DXGI formats?

 

I am not albe to find a specification for this. Moreover the same question apply when creating a RenderTargetView.

 

Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement

From MSDN:

 

 

These are valid formats for a depth-stencil view:

  • DXGI_FORMAT_D16_UNORM
  • DXGI_FORMAT_D24_UNORM_S8_UINT
  • DXGI_FORMAT_D32_FLOAT
  • DXGI_FORMAT_D32_FLOAT_S8X24_UINT
  • DXGI_FORMAT_UNKNOWN

A depth-stencil view cannot use a typeless format. If the format chosen is DXGI_FORMAT_UNKNOWN, then the format of the parent resource is used.

 

And for RenderTargetView:

 

 

A render-target-view cannot use the following formats:

  • Any typeless format.
  • DXGI_FORMAT_R32G32B32 if the view will be used to bind a buffer (vertex, index, constant, or stream-output).

If the format is set to DXGI_FORMAT_UNKNOWN, then the format of the resource that the view binds to the pipeline will be used.

Share this post


Link to post
Share on other sites

If you want to know which formats are supported for different uses, then go here and browse to the appropriate page for the feature level that you're targetting.

Share this post


Link to post
Share on other sites

If you want to know which formats are supported for different uses, then go here and browse to the appropriate page for the feature level that you're targetting.

Let's have a look at D3D11, HW supported formats for depth stencil are

  • DXGI_FORMAT_D32_FLOAT_S8X24_UINT
  • DXGI_FORMAT_D32_FLOAT
  • DXGI_FORMAT_D24_UNORM_S8_UINT
  • DXGI_FORMAT_D16_UNORM

- From my undesrtanding these are the only format allowed for resources to be selected in a depth-stencil view, NOT the format allowed in the depth-stencil view, those are listed here https://msdn.microsoft.com/en-us/library/windows/desktop/ff476112%28v=vs.85%29.aspx. Is this correct?

 

- Still I can't find is it is legal to use in the view a format with different size from the selected resource. E.g. is it legal to use DXGI_FORMAT_D16_UNORM as a format in a D3D11_DEPTH_STENCIL_VIEW_DESC structure when the selected subresource has format DXGI_FORMAT_D32_FLOAT_S8X24_UINT? I only suppose is not legal but cannot find a proper specification for this.

 

[Edit - Clarification]

Edited by krywen

Share this post


Link to post
Share on other sites

That list from the DXGI programming guide is the same exact list given in the documentation that you linked to. The only difference is that the DESC documentation states that you can also specify DXGI_FORMAT_UNKNOWN, which is just a way of telling the API "use the same exact format that was used when creating the texture".

 

You can't create a resource with one format, and then create a resource view with a format that has a different size. See the docs here about strong vs. weak typing. Basically if you create a resource with a TYPELESS format, then you can only create a resource view from the same format "family".

Share this post


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

  • Advertisement