?/TD> |
Microsoft DirectX 9.0 |
Calculate the depth value to be used in depth testing for this pixel.
Syntax
texm3x2depth (Pixel Shader) dest, src
Registers
- dest
- Destination register.
- src
- Input source register.
Remarks
Pixel shader versions 1_1 1_2 1_3 1_4 2_0 2_x 2_sw 3_0 3_sw texm3x2depth x This instruction must be used with the texm3x2pad instruction.
When using these two instructions, texture registers must use the following sequence.
tex t(n) // Define tn as a standard 3-vector.(tn must be // defined in some way before it is used. texm3x2pad t(m), t(n) // Where m > n // Calculate z value. texm3x2depth t(m+1), t(n) // Calculate w value; use both z and w to // find depth.The depth calculation is done after using a dot product operation to find z and w. Here is more detail about how the depth calculation is accomplished.
The texm3x2pad instruction calculates z.
z = TextureCoordinates(stage m)UVW t(n)RGBThe texm3x2depth instruction calculates w.
w = TextureCoordinates(stage m+1)UVW t(n)RGBCalculate depth and store the result in t(m+1).
if (w == 0) t(m+1) = 1.0 else t(m+1) = z/wThe calculated depth is tagged to be used in the depth test for the pixel, replacing the existing depth test value for the pixel.
Be sure to clamp z/w to be in the range of (0-1). If z/w is outside this range, the result stored in the depth buffer will be undefined.
After running tex3x2depth, register t(m+1) is no longer available for use in the shader.
When multisampling, using this instruction eliminates most of the benefit of the higher resolution depth buffer. Because the pixel shader runs once per pixel, the single depth value output by texm3x2depth (Pixel Shader) or texdepth will be used for each of the subpixel depth comparison tests.
Instruction Information
Minimum operating systems Windows 98