Microsoft DirectX 8.0 (Visual Basic) |
The Direct3DX pixel shader assembler can take instruction arguments (operands) with modifier flags that affect the input argument before it is processed in the instruction. There are two types of input argument modifiers: color and alpha blending input argument modifiers and texture addressing input argument modifiers.
The input argument modifiers are defined by the following table, where rn is an input argument (register).
Instruction | Syntax | Description |
---|---|---|
Alpha Replicate | rn.a | Replicates the alpha channel to all colors. |
Invert | 1-rn | Complements y = 1.0 - x. Unsigned x is required. |
Negate | -rn | Negates the value y = -x. Signed x is required. |
Bias | rn_bias | Shifts value down by ½, y = (x-0.5). |
Signed Scaling | rn_bx2 | Shifts value down and scales data by 2, y = 2*(x-0.5). |
For example, the lrp instruction can be implemented using input argument modifiers.
; Using diffuse alpha to blend between r0 and t0 lrp r0, v0.a, r0, t0 ; can be written (using more clocks) as: sub r0, r0, t0 mad r0, t0, v0.a, r0
Unlike vertex shaders, component swizzles are not supported by the pixel shader. The x, y, and z components are treated together as an RGB color component, and the w component is treated as alpha which can be routed separately.