Direct3D Shader Codes
Pixel shader code follows the D3DHAL_DP2CREATEPIXELSHADER structure in the command stream. For DirectX 8.1 and earlier, vertex shader code follows the D3DHAL_DP2CREATEVERTEXSHADER structure. For DirectX 9.0 and later, vertex shader code follows the D3DHAL_DP2CREATEVERTEXSHADERFUNC structure. The runtime creates either a pixel or vertex shader when it calls a driver's D3dDrawPrimitives2 function. To create a pixel shader, the runtime calls D3dDrawPrimitives2 with the D3DDP2OP_CREATEPIXELSHADER operation code. To create a vertex shader in DirectX 8.1 and earlier, the runtime calls D3dDrawPrimitives2 with the D3DDP2OP_CREATEVERTEXSHADER operation code. To create a vertex shader in DirectX 9.0 and later, the runtime calls D3dDrawPrimitives2 with the D3DDP2OP_CREATEVERTEXSHADERFUNC operation code.
This section describes the format of an individual shader code and the tokens that comprise each shader code.