Constant integer register (HLSL PS reference)

Constant integer registers are used only by loop - ps and rep - ps.

They can be set using defi - ps or SetPixelShaderConstantI.

When used as an argument to the loop - ps instruction:

  • .x is the iteration count. (rep - ps uses only this component).
  • .y is the initial value for the loop counter.
  • .z is the increment step for the loop counter.
Pixel shader versions 1_1 1_2 1_3 1_4 2_0 2_sw 2_x 3_0 3_sw
Constant Integer Register x x x


The behavior of shader constants has changed between Direct3D 8 and Direct3D 9.

  • For Direct3D 9, constants set with defx assign values to the shader constant space. The lifetime of a constant declared with defx is confined to the execution of that shader only. Conversely, constants set using the APIs SetXXXShaderConstantX initialize constants in global space. Constants in global space are not copied to local space (visible to the shader) until SetxxxShaderConstants is called.
  • For Direct3D 8, constants set with defx or the APIs both assign values to the shader constant space. Each time the shader is executed, the constants are used by the current shader regardless of the technique used to set them.