Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Declare the association between vertex shader output and pixel shader input.
Syntax
dcl_semantics [_centroid] dst[.write_mask]
Where:
- _semantics: Identifies the intended data usage, and may be any of the values in D3DDECLUSAGE (without the D3DDECLUSAGE_ prefix). Additionally, an integer index can be appended to the semantic to distinguish parameters that use similar semantics.
- [_Centroid] is an optional instruction modifier. It is supported on dcl_usage instructions that declare the input registers and on texture lookup instructions. The centroid is appended with no space.
- dst: destination register. See ps_3_0 Registers.
- write_mask: The same output register may be declared multiple times, each time with a unique write mask (so different semantics can be applied to individual components). However, the same semantic cannot be used multiple times in a declaration. This means that vectors must be four components or less, and cannot go across four-component register boundaries (individual output registers). When the _psize semantic is used, it should have a full write mask because it is considered a scalar. When the _position semantic is used, it should have full write mask because all four components have to be written.
Remarks
| Pixel shader versions | 1_1 | 1_2 | 1_3 | 1_4 | 2_0 | 2_x | 2_sw | 3_0 | 3_sw |
|---|---|---|---|---|---|---|---|---|---|
| dcl_usage | x | x |
All dcl_usage instructions must appear before the first executable instruction.
Declaration Examples
ps_3_0
; Declaring inputs
dcl_normal v0.xyz
dcl_blendweight v0.w ; Must be same reg# as normal, matching vshader packing
dcl_texcoord1 v1.y ; Mask can be any subset of mask from vshader semantic
dcl_texcoord0 v1.zw; Has to be same reg# as texcoord1, to match vshader
; Declaring samplers
dcl_2d s0
dcl_2d s1
def c0, 0, 0, 0, 0
mov r0.x, v1.y ; texcoord1
mov r0.y, c0
texld r0, r0, s0
texld r1, v1.zw, s1
...
(output regs in ps_3_0 are same as ps_2_0: oC0-oC3, oDepth)
Related topics