Constant Float Register
Pixel shader input register for a 4-D floating-point constant.
They can be set using def or IDirect3DDevice9::SetPixelShaderConstantF.
The behavior of shader constants has changed between Microsoft DirectX 8.0 and DirectX 9.0.
- For DirectX 9.0, 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 application programming interfaces (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 DirectX 8.0, 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.
Examples
Here is an example declaring two floating-point constants within a shader.
def c40, 0.0f,0.0f,0.0f,0.0f;
These constants are loaded every time IDirect3DDevice9::SetPixelShader is called.
If you are setting constant values with the API, there is no shader declaration required.