Previous Next

Direct3D Driver Shader Codes

This section describes the tokens that comprise pixel and vertex shader codes and how those tokens are formatted within an individual shader code. 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.

The following sections describe the format of an individual shader code and the tokens that comprise each shader code:

Shader Code Format

Shader Code Tokens

Shader Operation Codes

Shader Register Types

Shader Relative Addressing