Paletted Textures

Direct3D allows palettes to be used with textures. A palette can be attached to a texture, just as it can to any other DirectDrawSurface object. To support paletted textures, drivers must respond to the D3DDP2OP_SETPALETTE and D3DDP2OP_UPDATEPALETTE operation codes in their implementation of D3dDrawPrimitives2. These operation codes are followed by D3DHAL_DP2SETPALETTE and D3DHAL_DP2UPDATEPALETTE structures, respectively, in the command stream. D3DDP2OP_SETPALETTE creates an association between a palette handle and a surface handle (already created by D3dCreateSurfaceEx). Later, D3DDP2OP_UPDATEPALETTE can be sent multiple times to set the values of the palette entries for this texture.