Microsoft DirectX 8.1 (pixel shader versions 1.0, 1.1, 1.2, 1.3, 1.4) |
Provides a method to define constants to be used within the pixel shader.
def dest, fVal0, fVal1, fVal2, fVal3
Argument | Description | Registers | Version | |||
---|---|---|---|---|---|---|
vn | cn | tn | rn | |||
dest | Destination register | x | 1.0, 1.1, 1.2, 1.3, 1.4 | |||
fVal0, fVal1, fVal2, fVal3 | Source floating point value | N/A | N/A | N/A | N/A | 1.0, 1.1, 1.2, 1.3, 1.4 |
N/A Not applicable. The float values do not use registers.
Each of the float values in fVal0, fVal1, fVal2, fVal3 is between -1.0 and 1.0. This is not necessarily the number specified in MAXPIXELSHADERVALUE.
To learn more about registers, see Registers.
def instructions must be placed after the version instruction and before any arithmetic or texture address instructions.
The def instruction is an alternative to setting pixel shader constants by calling SetPixelShaderConstant. When SetPixelShader is called, the def instruction is effectively translated into a SetPixelShaderConstant call. Constant registers that are initialized by the def instruction during SetPixelShader, may be overwritten by calling SetPixelShaderConstant manually.
This instruction does not count against the instruction limit. It is stripped from the instruction stream prior to being sent to the driver.
For more information about MAXPIXELSHADERVALUE, see D3DCAPS8.
// This example outputs a constant color. // The shader is shown below. ps.1.0 // version instruction def c0, 1.0f, 0.0f, 0.0f, 1.0f // set c0 register mov r0, c0 // output constant color