D3D11_SHADER_RESOURCE_VIEW_DESC structure (d3d11.h)

Describes a shader-resource view.

Syntax

typedef struct D3D11_SHADER_RESOURCE_VIEW_DESC {
  DXGI_FORMAT         Format;
  D3D11_SRV_DIMENSION ViewDimension;
  union {
    D3D11_BUFFER_SRV        Buffer;
    D3D11_TEX1D_SRV         Texture1D;
    D3D11_TEX1D_ARRAY_SRV   Texture1DArray;
    D3D11_TEX2D_SRV         Texture2D;
    D3D11_TEX2D_ARRAY_SRV   Texture2DArray;
    D3D11_TEX2DMS_SRV       Texture2DMS;
    D3D11_TEX2DMS_ARRAY_SRV Texture2DMSArray;
    D3D11_TEX3D_SRV         Texture3D;
    D3D11_TEXCUBE_SRV       TextureCube;
    D3D11_TEXCUBE_ARRAY_SRV TextureCubeArray;
    D3D11_BUFFEREX_SRV      BufferEx;
  };
} D3D11_SHADER_RESOURCE_VIEW_DESC;

Members

Format

Type: DXGI_FORMAT

A DXGI_FORMAT specifying the viewing format. See remarks.

ViewDimension

Type: D3D11_SRV_DIMENSION

The resource type of the view. See D3D11_SRV_DIMENSION. You must set ViewDimension to the same resource type as that of the underlying resource. This parameter also determines which _SRV to use in the union below.

Buffer

Type: D3D11_BUFFER_SRV

View the resource as a buffer using information from a shader-resource view (see D3D11_BUFFER_SRV).

Texture1D

Type: D3D11_TEX1D_SRV

View the resource as a 1D texture using information from a shader-resource view (see D3D11_TEX1D_SRV).

Texture1DArray

Type: D3D11_TEX1D_ARRAY_SRV

View the resource as a 1D-texture array using information from a shader-resource view (see D3D11_TEX1D_ARRAY_SRV).

Texture2D

Type: D3D11_TEX2D_SRV

View the resource as a 2D-texture using information from a shader-resource view (see D3D11_TEX2D_SRV).

Texture2DArray

Type: D3D11_TEX2D_ARRAY_SRV

View the resource as a 2D-texture array using information from a shader-resource view (see D3D11_TEX2D_ARRAY_SRV).

Texture2DMS

Type: D3D11_TEX2DMS_SRV

View the resource as a 2D-multisampled texture using information from a shader-resource view (see D3D11_TEX2DMS_SRV).

Texture2DMSArray

Type: D3D11_TEX2DMS_ARRAY_SRV

View the resource as a 2D-multisampled-texture array using information from a shader-resource view (see D3D11_TEX2DMS_ARRAY_SRV).

Texture3D

Type: D3D11_TEX3D_SRV

View the resource as a 3D texture using information from a shader-resource view (see D3D11_TEX3D_SRV).

TextureCube

Type: D3D11_TEXCUBE_SRV

View the resource as a 3D-cube texture using information from a shader-resource view (see D3D11_TEXCUBE_SRV).

TextureCubeArray

Type: D3D11_TEXCUBE_ARRAY_SRV

View the resource as a 3D-cube-texture array using information from a shader-resource view (see D3D11_TEXCUBE_ARRAY_SRV).

BufferEx

Type: D3D11_BUFFEREX_SRV

View the resource as a raw buffer using information from a shader-resource view (see D3D11_BUFFEREX_SRV). For more info about raw viewing of buffers, see Raw Views of Buffers.

Remarks

A view is a format-specific way to look at the data in a resource. The view determines what data to look at, and how it is cast when read.

When viewing a resource, the resource-view description must specify a typed format, that is compatible with the resource format. So that means that you cannot create a resource-view description using any format with _TYPELESS in the name. You can however view a typeless resource by specifying a typed format for the view. For example, a DXGI_FORMAT_R32G32B32_TYPELESS resource can be viewed with one of these typed formats: DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_R32G32B32_UINT, and DXGI_FORMAT_R32G32B32_SINT, since these typed formats are compatible with the typeless resource.

Create a shader-resource-view description by calling ID3D11Device::CreateShaderResourceView. To view a shader-resource-view description, call ID3D11ShaderResourceView::GetDesc.

Requirements

Requirement Value
Header d3d11.h (include D3D11Shader.h)

See also

Resource Structures