Microsoft DirectX 8.0 (C++) |
This section contains reference information for the texture addressing instructions implemented by the Direct3DX pixel shader assembler. The texture addressing instructions are provided to enable manipulations of texture address data (as opposed to texture color contents).
The textures set at the sampling stages are sampled from the corresponding textures using the sampling, filtering, and wrapping modes selected by the Microsoft® Direct3D® application programming interface (API) texture stage states. When these textures are sampled, some operations may be applied to the address used to sample them. These operations are referred to as texture addressing operations.
A subset of the texture addressing instructions and the texture perturbation operations are listed in the following table.
Instruction | Description |
---|---|
tex | No Modification |
texbem | Bump Environment Map |
texbeml | Bump Environment Map with Luminance |
texcoord | Texture Coordinate |
texkill | Mask Out Pixel |
texm3x2pad | Input to 3×2 Matrix Multiply |
texm3x2tex | 3×2 Matrix Multiply Result |
texreg2ar | Remapping Alpha and Red Components |
texreg2gb | Remapping Green and Blue Components |
In addition, the pixel shader API supports a number of methods to perform a per-pixel 3×3 matrix multiply on the vector sampled from a texture. The 3×3 matrix is comprised of the texture coordinates from three consecutive texture declaration stages. These matrix multiply operations are constructed from multiple texture address operations.
The following table lists the remaining texture addressing instructions, those that are concerned with per-pixel 3×3 matrix multiplies.
Instruction | Description |
---|---|
texm3x3pad | Input to 3×3 Matrix Multiply |
texm3x3spec | Specular Reflection and Environment Mapping |
texm3x3tex | 3×3 Matrix Multiply Result |
texm3x3vspec | Specular Reflection/Environment Mapping without Constant Eye Vector |
Texture address instructions define an output argument (result) being the texture register that they declare/define. Some instructions require an input operand to be specified. This input operand must be a previously defined texture. These can also be thought of as declarations of the texture colors emitted by the texture sampling units into the color operation/alpha operation/blending shader. These texture registers can be declared in terms of previously declared textures, but not in terms of later textures, or other pixel color registers.
All texture address operations must be declared in the order of the texture they define. No texture address operation can refer to another texture that is after it —that is, of a higher stage number.
Performance Note Texture addressing operations need to support sufficient precision for representing texture addresses. For example, precision should be sufficient enough to represent perturbations in the elements of the bump environment mapping matrix that can perturb to a fraction of a texel in an environment map of the maximum texture dimensions supported by the device. Furthermore, all iterated quantities in these operations must be iterated with perspective correction.