Describes a shader-resource view.


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;



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


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.


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.














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.


Header d3d12.h

See Also

Core Structures