Microsoft DirectX 8.1 (C++) |
Converting Texture Operations
Pixel shaders extend and generalize the multi-texture capabilities of Microsoft® DirectX® 6.0 and 7.0 in the following ways.
- A set of general read/write registers is added to enable more flexible expression. The serial cascade using D3DTA_CURRENT requires the specification of a separate result register argument for each stage.
- The D3DTOP_MODULATE2X and D3DTOP_MODULATE4X texture operations are broken into separate modifiers applicable to any instruction orthogonally. This eliminates the need for separate D3DTOP_MODULATE and D3DTOP_MODULATE2X operations.
- The bias and unbias texture operation modifiers are orthogonal. This eliminates the need for separate add and add bias operations.
- An optional third argument is added to modulate add, so the procedural pixel shader can do arg1×arg2 + arg0. This eliminates the D3DTOP_MODULATEALPHA_ADDCOLOR and D3DTOP_MODULATECOLOR_ADDALPHA texture operations.
- An optional third argument is added to the blend operation, so the procedural pixel shader can use arg0 as the blend proportion between arg1 and arg2. This eliminates the D3DTOP_BLENDDIFFUSEALPHA, D3DTOP_BLENDTEXTUREALPHA, D3DTOP_BLENDFACTORALPHA, D3DTOP_BLENDTEXTUREALPHAPM, and D3DTOP_BLENDCURRENTALPHA texture operations.
- Texture address modifying operations, such as D3DTOP_BUMPENVMAP, are broken out from the color and alpha operations and defined as a third operation type, specifically for operating on texture addresses.
To support this increased flexibility efficiently, the application programming interface (API) syntax is changed from DWORD pairs to an ASCII assemble code syntax. This exposes the functionality offered by procedural pixel shaders.
Note When you use pixel shaders, specular add is not specifically controlled by a render state, and it is up to the pixel shader to implement if needed. However, fog blending is still applied by the fixed function pipeline.