dcl_usage (Pixel Shader)
Declare the association between a vertex shader outputs and pixel shader inputs.
Syntax
dcl_semantics [_centroid] dest[.write_mask] |
Where:
- _semantics: The same set of semantics as for the input declaration can be used. Semantic names come from the enum D3DDECLUSAGE (and are paired with an index, that is, position3). There always has to be one o register with _positiont0 declaration when not used for process vertices. The positiont0 semantic and the pointsize0 semantic are the only ones that have meaning to Microsoft?Direct3D? beyond simply allowing linkage from vertex to pixel shaders. For shaders with flow control, it is assumed that the worst-case output is dcl'd. There are no defaults if a shader does not actually output what it declares it should (due to flow control).
- [_centroid] is an optional instruction modifier. It is is supported on dcl_usage instructions that declare the input registers and on texture lookup instructions. The centroid is appended with no space. See Centroid.
- dest: destination register. See Registers - ps_3_0.
- write_mask: The same "out" register may be dcl'd multiple times (so different semantics can be applied to individual components), each time with a unique write mask. 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 "out" registers). When the _pointsize 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)
Minimum operating system | Windows 98 |
---|