D3D12_SHADER_RESOURCE_VIEW_DESC structure

Describes a shader-resource view.

Syntax

typedef struct D3D12_SHADER_RESOURCE_VIEW_DESC {
  DXGI_FORMAT         Format;
  D3D12_SRV_DIMENSION ViewDimension;
  UINT                Shader4ComponentMapping;
  union {
    D3D12_BUFFER_SRV                            Buffer;
    D3D12_TEX1D_SRV                             Texture1D;
    D3D12_TEX1D_ARRAY_SRV                       Texture1DArray;
    D3D12_TEX2D_SRV                             Texture2D;
    D3D12_TEX2D_ARRAY_SRV                       Texture2DArray;
    D3D12_TEX2DMS_SRV                           Texture2DMS;
    D3D12_TEX2DMS_ARRAY_SRV                     Texture2DMSArray;
    D3D12_TEX3D_SRV                             Texture3D;
    D3D12_TEXCUBE_SRV                           TextureCube;
    D3D12_TEXCUBE_ARRAY_SRV                     TextureCubeArray;
    D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV RaytracingAccelerationStructure;
  };
} D3D12_SHADER_RESOURCE_VIEW_DESC;

Members

Format

A DXGI_FORMAT-typed value that specifies the viewing format. See remarks.

ViewDimension

A D3D12_SRV_DIMENSION-typed value that specifies the resource type of the view. This type is the same as the resource type of the underlying resource. This member also determines which _SRV to use in the union below.

Shader4ComponentMapping

A D3D12_SHADER_COMPONENT_MAPPING enumeration constant, such as return component 0 (red) from memory, or force the resulting value to 0. This mapping enables the shader resource view (SRV) to choose how memory gets routed to the 4 return components in a shader after a memory fetch.

Buffer

A D3D12_BUFFER_SRV structure that views the resource as a buffer.

Texture1D

A D3D12_TEX1D_SRV structure that views the resource as a 1D texture.

Texture1DArray

A D3D12_TEX1D_ARRAY_SRV structure that views the resource as a 1D-texture array.

Texture2D

A D3D12_TEX2D_SRV structure that views the resource as a 2D-texture.

Texture2DArray

A D3D12_TEX2D_ARRAY_SRV structure that views the resource as a 2D-texture array.

Texture2DMS

A D3D12_TEX2DMS_SRV structure that views the resource as a 2D-multisampled texture.

Texture2DMSArray

A D3D12_TEX2DMS_ARRAY_SRV structure that views the resource as a 2D-multisampled-texture array.

Texture3D

A D3D12_TEX3D_SRV structure that views the resource as a 3D texture.

TextureCube

A D3D12_TEXCUBE_SRV structure that views the resource as a 3D-cube texture.

TextureCubeArray

A D3D12_TEXCUBE_ARRAY_SRV structure that views the resource as a 3D-cube-texture array.

RaytracingAccelerationStructure

A D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV structure that views the resource as a raytracing acceleration structure.

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 can't 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 ID3D12Device::CreateShaderResourceView.

Requirements

   
Header d3d12.h

See Also

Core Structures