Texture Stage States
Texture stage states control texture coordinate generation and texture coordinate state such as wrapping modes.
Applications written in C++ control the characteristics of the texture-related render states by invoking the IDirect3DDevice9::SetTextureStageState method. The D3DTEXTURESTAGESTATETYPE enumerated type specifies all the possible texture-related rendering states. Your application passes a value from the D3DTEXTURESTAGESTATETYPE enumeration as the first parameter to the IDirect3DDevice9::SetTextureStageState method.
Applications set the texture for a stage by calling the IDirect3DDevice9::SetTexture method.
SetTextureStageState
SetTextureStageState now sets the following states.
- Fixed function vertex processing state. These states control the manipulation of texture coordinates: D3DTSS_TEXTURETRANSFORMFLAGS and D3DTSS_TEXCOORDINDEX. Up to eight of each can be set (because eight texture coordinates are always supported).
- Fixed function pixel shader state (the legacy TextureStageState). D3DTSS_COLOROP, D3DTSS_ALPHAOP, D3DTSS_COLORARG0, D3DTSS_COLORARG1, D3DTSS_COLORARG2, D3DTSS_ALPHAARG0, D3DTSS_ALPHAARG1, D3DTSS_ALPHAARG2, D3DTSS_BUMPENVMAT00, D3DTSS_BUMPENVMAT01, D3DTSS_BUMPENVMAT10, D3DTSS_BUMPENVMAT11, D3DTSS_BUMPENVLSCALE, D3DTSS_BUMPENVLOFFSET, and D3DTSS_RESULTARG. Up to MaxTextureBlendStages of these can be set.
D3DTSS_TEXCOORDINDEX is a fixed function vertex processing state. If a programmable vertex shader is used, this state is ignored.
The number of texture samplers available to the application is determined by the pixel shader version.
- Fixed function pixel shader: MaxTextureBlendStages/MaxSimultaneousTextures texture samplers.
- ps_1_1 to ps_1_3: 4 texture samplers.
- ps_1_4: 6 texture samplers.
- ps_2_0: 16 texture samplers.
- Devices that support displacement mapping in Microsoft® DirectX® 9.0 will support an additional sampler (D3DDMAPSAMPLER), which samples the displacement maps in the tessellator unit.
For more information about texture blending, see Texture Blending.