dcl_constantBuffer (sm4 - asm)

Declares a shader constant buffer.

dcl_constantBuffer cbN[size], AccessPattern
Item Description
cbN[size]
[in] A shader constant buffer where N is an integer that denotes the constant-buffer-register number and size is an integer that denotes the number of elements in the buffer.
AccessPattern
[in] The way that the buffer will be accessed by shader code, which is one of the following:
Name Description
immediateIndexed Index the buffer with a literal value.
dynamic_indexed Index the buffer with the result of an evaluated expression.

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

This example declares a constant buffer for register cb0, which has 19 elements. These elements are accessed with a literal index.

dcl_constantbuffer  cb0[19], immediateIndexed

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)