Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

D3D12_SHADER_RESOURCE_VIEW_DESC structure (d3d12.h)

Describes a shader-resource view (SRV).

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 value, constructed using the D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING macro. The D3D12_SHADER_COMPONENT_MAPPING enumeration specifies what values from memory should be returned when the texture is accessed in a shader via this shader resource view (SRV). For example, it can route component 1 (green) from memory, or the constant 0, into component 2 (.b) of the value given to the shader.

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

Requirement Value
Header d3d12.h

See also

Core structures


Feedback

Was this page helpful?

Additional resources