> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# D3D12_SHADER_RESOURCE_VIEW_DESC

> Describes a shader-resource view. (D3D12_SHADER_RESOURCE_VIEW_DESC)

Describes a shader-resource view (SRV).

## Syntax

```cpp theme={null}
typedef struct D3D12_SHADER_RESOURCE_VIEW_DESC
{
    DXGI_FORMAT Format;
    D3D12_SRV_DIMENSION ViewDimension;
    UINT Shader4ComponentMapping;
    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;
    UNKNOWN_TYPE RaytracingAccelerationStructure;
} D3D12_SHADER_RESOURCE_VIEW_DESC
```

### Members

*Format*\
Type: DXGI\_FORMAT

A [DXGI\_FORMAT](https://learn.microsoft.com/en-us/windows/desktop/api/dxgiformat/ne-dxgiformat-dxgi_format)-typed value that specifies the viewing format. See remarks.

*ViewDimension*\
Type: D3D12\_SRV\_DIMENSION

A [D3D12\_SRV\_DIMENSION](/reference/graphics/d3d12_x/enums/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*\
Type: UINT

A value, constructed using the [D3D12\_ENCODE\_SHADER\_4\_COMPONENT\_MAPPING](/reference/graphics/d3d12/enums/d3d12_shader_component_mapping_public) 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*\
Type: D3D12\_BUFFER\_SRV

A [D3D12\_BUFFER\_SRV](/reference/graphics/d3d12/structs/d3d12_buffer_srv_public) structure that views the resource as a buffer.

*Texture1D*\
Type: D3D12\_TEX1D\_SRV

A [D3D12\_TEX1D\_SRV](/reference/graphics/d3d12/structs/d3d12_tex1d_srv_public) structure that views the resource as a 1D texture.

*Texture1DArray*\
Type: D3D12\_TEX1D\_ARRAY\_SRV

A [D3D12\_TEX1D\_ARRAY\_SRV](/reference/graphics/d3d12/structs/d3d12_tex1d_array_srv_public) structure that views the resource as a 1D-texture array.

*Texture2D*\
Type: D3D12\_TEX2D\_SRV

A [D3D12\_TEX2D\_SRV](/reference/graphics/d3d12/structs/d3d12_tex2d_srv_public) structure that views the resource as a 2D-texture.

*Texture2DArray*\
Type: D3D12\_TEX2D\_ARRAY\_SRV

A [D3D12\_TEX2D\_ARRAY\_SRV](/reference/graphics/d3d12/structs/d3d12_tex2d_array_srv_public) structure that views the resource as a 2D-texture array.

*Texture2DMS*\
Type: D3D12\_TEX2DMS\_SRV

A [D3D12\_TEX2DMS\_SRV](/reference/graphics/d3d12/structs/d3d12_tex2dms_srv_public) structure that views the resource as a 2D-multisampled texture.

*Texture2DMSArray*\
Type: D3D12\_TEX2DMS\_ARRAY\_SRV

A [D3D12\_TEX2DMS\_ARRAY\_SRV](/reference/graphics/d3d12/structs/d3d12_tex2dms_array_srv_public) structure that views the resource as a 2D-multisampled-texture array.

*Texture3D*\
Type: D3D12\_TEX3D\_SRV

A [D3D12\_TEX3D\_SRV](/reference/graphics/d3d12/structs/d3d12_tex3d_srv_public) structure that views the resource as a 3D texture.

*TextureCube*\
Type: D3D12\_TEXCUBE\_SRV

A [D3D12\_TEXCUBE\_SRV](/reference/graphics/d3d12/structs/d3d12_texcube_srv_public) structure that views the resource as a 3D-cube texture.

*TextureCubeArray*\
Type: D3D12\_TEXCUBE\_ARRAY\_SRV

A [D3D12\_TEXCUBE\_ARRAY\_SRV](/reference/graphics/d3d12/structs/d3d12_texcube_array_srv_public) structure that views the resource as a 3D-cube-texture array.

*RaytracingAccelerationStructure*\
A [D3D12\_RAYTRACING\_ACCELERATION\_STRUCTURE\_SRV](/reference/graphics/d3d12/structs/d3d12_raytracing_acceleration_structure_srv_public) 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](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createshaderresourceview_public).

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[Core structures](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-structures)


## Related topics

- [CreateShaderResourceView](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createshaderresourceview_public.md)
- [D3D12_BUFFER_SRV](/reference/graphics/d3d12/structs/d3d12_buffer_srv_public.md)
- [D3D12_TEXCUBE_SRV](/reference/graphics/d3d12/structs/d3d12_texcube_srv_public.md)
- [D3D12_TEX3D_SRV](/reference/graphics/d3d12/structs/d3d12_tex3d_srv_public.md)
- [D3D12_TEXCUBE_ARRAY_SRV](/reference/graphics/d3d12/structs/d3d12_texcube_array_srv_public.md)
