Sampler
Microsoft DirectX 9.0 SDK Update (October 2004)

Sampler


A sampler is a input pseudo-register for a vertex shader, which is used to identify the sampling stage. There are four vertex shader samplers: s0 to s3. Four texture surfaces can be read in a single shader pass.

Samplers are pseudo registers because you cannot directly read or write to them.

A sampling unit corresponds to the texture sampling stage, encapsulating the sampling-specific state provided by IDirect3DDevice9::SetSamplerState. Each sampler uniquely identifies a single texture surface, which is set to the corresponding sampler using the 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 there are four samplers, up to four texture surfaces can be read from in a single shader pass. A sampler might appear as the only argument in the texture load instruction: texldl.

In vs_3_0, if a sampler is used, it needs to be declared at the beginning of the shader program using the dcl_samplerType instruction.

Vertex shader versions1_12_02_sw2_x3_03_sw
Samplerxx

Related Topics



© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.