dcl_constantBuffer (sm4 - asm)

Declares a shader constant buffer.

dcl_constantBuffer cbN[size], AccessPattern




[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.


[in] The way that the buffer will be accessed by shader code, which is one of the following:

immediateIndexedIndex the buffer with a literal value.
dynamic_indexedIndex the buffer with the result of an evaluated expression.



This instruction applies to the following shader stages:

Vertex ShaderGeometry ShaderPixel Shader


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


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 ModelSupported
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


Related topics

Shader Model 4 Assembly (DirectX HLSL)