dcl_indexRange (sm4 - asm)

Declares a range of registers that will be accessed by index (an integer computed in the shader).

dcl_indexRange minRegisterM, maxRegisterN




[in] The first register to access by index.

  • minRegister is either v for a vertex or pixel shader input register, or o for a vertex shader output register.
  • M is an integer that denotes the register number.


[in] The last register to access by index. Same form as minRegister except N is the register number.


The following restrictions apply to all registers:

  • The min and max registers must be the same type and have the same component masks (if masks are declared).
  • A register may have multiple index ranges, as long as they do no not overlap.
  • The min register number must be less than the max register number.
  • An index register cannot contain a system-value.
  • Indexing a register outside of the max index declaration produces undefined results.

Pixel shader input registers must use the same interpolation mode; pixel shader output registers are not indexable.

A geometry shader input register has two dimensions (vertex axis, attribute axis); the index range applies only to the attribute axis because the vertex axis is always fully indexable.

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.


Here is an example.

dcl_indexRange v1, v3
dcl_indexRange v4, v9

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)