Microsoft DirectX 9.0

Vertex Textures

This shader model supports texture lookup in the vertex shader using texldl. The vertex engine contains four texture sampler stages, named D3DVERTEXTEXTURESAMPLER, D3DVERTEXTEXTURESAMPLER+1, D3DVERTEXTEXTURESAMPLER+2, and D3DVERTEXTEXTURESAMPLER+3 (these are distinct from the displacement map sampler and texture samplers in the pixel engine).

To sample textures set at those four stages, you can use the vertex engine and program the stages with IDirect3D9::CheckDeviceFormat. Set textures at those stages using IDirect3DDevice9::SetTexture, with the stage index D3DVERTEXTEXTURESAMPLER through D3DVERTEXTEXTURESAMPLER+3. A new register has been introduced in the vertex shader, the sampler register (like in ps_2_0), which represents the vertex texture sampler. This register needs to be defined in the shader before using it.

An application can query if a format is supported as a vertex texture by calling IDirect3D9::CheckDeviceFormat with D3DUSAGE_QUERY_VERTEXTEXTURE.

Note  This is a query flag so it is not accepted in the Createxxx function. A vertex texture created in POOL_DEFAULT can be set as a pixel texture and vice versa. However, to use the software vertex processing, the vertex texture must be created in the POOL_SCRATCH (no matter if it is a mixed-mode device or a software vertex processing device).

The functionality is identical to the pixel textures, except for the following:

Restrictions include:

Sampling Stage Registers

A sampling stage register identifies a sampling unit that can be used in texture load statements. A sampling unit corresponds to the texture sampling stage, encapsulating the sampling-specific state provided in IDirect3DDevice9::SetSamplerState.

Each sampler uniquely identifies a single texture surface that is set to the corresponding sampler using IDirect3DDevice9::SetTexture. However, the same texture surface can be set at multiple samplers.

At draw time, a texture cannot be simultaneously set as a render target and a texture at a stage.

Because vs_3_0 supports four samplers, up to four texture surfaces can be read from in a single shader pass. A sampler register might appear only as an argument in the texture load statement: texldl.

In vs_3_0, if you use a sampler, it must be declared at the beginning of the shader program, using the dcl_textureType (as in ps_2_0).

Software Processing

This feature will be supported in software vertex processing. The specific filter types supported can be checked by calling IDirect3DDevice9::GetDeviceCaps and checking the VertexTextureFilterCaps member of D3DCAPS9. All published texture formats will be supported as vertex textures in software vertex processing.

Applications can check if a particular texture format is supported in the software vertex processing mode by calling IDirect3D9::CheckDeviceFormat and providing (D3DUSAGE_QUERY_VERTEXTEXTURE | D3DUSAGE_SOFTWAREPROCESSING) as usage. All formats are supported for software vertex processing. POOL_SCRATCH is required for software vertex processing.

API Changes

// New define
// New usage

// New caps field in D3DCAPS9
DWORD VertexTextureFilterCaps;

© 2002 Microsoft Corporation. All rights reserved.