Microsoft DirectX 8.1 (pixel shader version 1.4) |
Calculate depth values to be used in the depth buffer comparison test for this pixel.
texdepth dest
Argument | Description | Registers | Version | |||
---|---|---|---|---|---|---|
vn | cn | tn | rn | |||
dest | Destination register | r5 | 1.4 phase 2 only |
To learn more about registers, see Registers.
This instruction uses r5.r / r5.g in the depth buffer comparison test for this pixel. The data in the blue and alpha channels is ignored. If r5.g = 0, the result of r5.r / r5.g = 1.0.
Temporary register r5 is the only register that this instruction can use.
After executing this instruction, temporary register r5 is unavailable for additional use in the shader.
When multisampling, using this instruction eliminates most of the benefit of the higher resolution depth buffer. Because the pixel shader executes once per pixel, the single depth value output by texm3x2depth or texdepth will be used for each of the sub-pixel depth comparison tests.
Here is an example using texdepth.
ps.1.4 texld r0, t0 // Sample texture from texture stage 0 (dest // register number) into r0. // Use texture coordinate data from t0. texcrd r1.rgb, t1 // Load a second set of texture coordinate data into r1. add r5.rg, r0, r1 // Add the two sets of texture coordinate data. phase // Phase marker, required when using texdepth instruction. texdepth r5 // Calculate pixel depth as r5.r / r5.g. // Do other color calculations with shader output r0.