Output Registers

Unlike the vertex shaders, pixel shaders do not have any specialized output, but use the temporary register r0 register as the single color output. See the temporary register section for more information.

 

For pixel shaders 1.3

The temporary registers can hold an output depth value.

 

For pixel shaders 1.4

The r5 register can hold a depth value, not the temporary registers.

 

For pixel shaders 2.0

PS 2.0 now supports a new type of output register. If these types aren’t supported, then the output register oC0 takes the place of r0.

In PS 2.0 the mov instruction is the only instruction that can be used to set the MET color elements or the oDepth register. The restrictions on using the MET elements as a destination are:

 

 

·        The MET color elements can only be written with an .rgba mask.

·        You can write to an oCn or oDepth register only once per shader.

·        You must write to the oC0 register.

·        No _sat or source modifiers, but oDepth must specify a replicate swizzle.

·        You cannot specify a write mask when writing to oDepth.

 

Output Registers – The Multi-Element Texture (MET)

 

In DirectX 8 pixel shaders only the r0 register was used to hold the output color. In DirectX 9 there is better support for specifying a texture as a render target – this is called the Multi-Element Texture or MET. This allows one to specify up to a four-dimensional texture (with an optional depth value) as output from a pixel shader. If you’re not using a MET, the syntax is to use the first MET element as the output color. These registers are oC0 though oC3. Thus oC0 in PS 2.0 is equivalent to r0 in PS 1.0-1.4. The output register must be written to in ascending order, and all elements of the register must be written to, and each register can only be written to once in a shader.

 

If there’s a depth buffer attached to the surface you can specify a depth value for the pixel in the oDepth register. This is a scalar register.