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.
Performs the final row of a 3x2 matrix multiply and uses the result to do a texture lookup. texm3x2tex must be used in conjunction with the texm3x2pad - ps instruction.
Syntax
texm3x2tex dst, src |
---|
where
- dst is the destination register.
- src is a source register.
Remarks
Pixel shader versions | 1_1 | 1_2 | 1_3 | 1_4 | 2_0 | 2_x | 2_sw | 3_0 | 3_sw |
---|---|---|---|---|---|---|---|---|---|
texm3x2tex | x | x | x |
The instruction is used as one of two instructions representing a 3x2 matrix multiply operation. This instruction must be used with the texm3x2pad - ps 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
// Perform first row of matrix multiply
texm3x2tex t(m+1), t(n) // Perform second row of matrix multiply
// to get (u,v) to sample texture
// associated with stage m+1
Here is more detail about how the 3x2 multiply is accomplished.
The texm3x2pad instruction performs the first row of the multiply to find u'.
u' = t(n)RGB * TextureCoordinates(stage m)UVW
The texm3x2tex instruction performs the second row of the multiply to find v'.
v' = t(n)RGB * TextureCoordinates(stage m+1)UVW
The texm3x2tex instruction samples the texture on stage (m+1) with (u',v') and stores the result in t(m+1).
t(m+1)RGB = TextureSample(stage m+1)RGB using (u', v' ) as coordinates
Examples
Here is an example shader with the texture maps and the texture stages identified.
ps_1_1
tex t0 // Bind texture in stage 0 to register t0
texm3x2pad t1, t0 // First row of matrix multiply
texm3x2tex t2, t0 // Second row of matrix multiply to get (u,v)
// with which to sample texture in stage 2
mov r0, t2 // Output result
This example requires the following textures in the following texture stages.
- Stage 0 takes a map with (x,y,z) perturbation data.
- Stage 1 holds texture coordinates. No texture is required in the texture stage.
- Stage 2 holds both texture coordinates as well as a 2D texture set at that texture stage.
Related topics