dcl_resource (sm4 - asm)

Declares a non-multisampled shader-input resource.

dcl_resource tN, resourceType, returnType(s)

Declares a multisampled shader-input resource.

dcl_resource tN, resourceType[size]NN, returnType(s)
Item Description
tN
[in] The texture register, where N is an integer that denotes the register number.
resourceType
[in] Any object type listed in the texture-object page.
resourceType[size]NN
[in] A Texture2D or a Texture2DArray object type (see the texture-object page); size is an optional integer that denotes the number of elements in the array; NN is an integer that denotes the number of multisamples.
returnType(s)
[in] Per-component return type which is one of the following: UNORM, SNORM, SINT, UINT, or FLOAT. The number of return types can be as few as 1 (if all components are the same type), but can be as many as four.

A resource is accessed in HLSL using load; a non-multisampled texture can also be accessed using any of the HLSL texture object sample methods.

If a resource is bound to a shader stage, the resource format will be validated against the return type.

This instruction applies to the following shader stages:

Vertex Shader Geometry Shader Pixel Shader
x x x

This instruction is included to aid in debugging a shader in assembly; you cannot author a shader in assembly language using Shader Model 4.

Example

Here is an example.

dcl_resource t3, buffer, UNORM

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 5 yes
Shader Model 4.1 yes
Shader Model 4 yes
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no

Shader Model 4 Assembly (DirectX HLSL)