Export (0) Print
Expand All

Sampler (Direct3D 9 asm-ps)

A sampler is a input pseudo-register for a pixel shader, which is used to identify the sampling stage. There are 16 pixel shader sampling stage registers: s0 to s15. Therefore, up to 16 texture surfaces can be read in a single shader pass. The instructions that use a sampler register are texld and texldp.

Sampler must be declared before use with the dcl_samplerType (sm2, sm3 - ps asm) instruction.

Pixel shader versions1_11_21_31_42_02_sw2_x3_03_sw
Samplerxxxxx

 

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 SetSamplerState. Each sampler uniquely identifies a single texture surface, which is set to the corresponding sampler using the 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.

A sampler might appear as the only argument in the texture load instruction: texldl - ps.

In ps_3_0, if a sampler is used, it needs to be declared at the beginning of the shader program using the dcl_samplerType (sm2, sm3 - ps asm) instruction.

Sampling a texture with a higher dimension than is present in the texture coordinates is illegal. Sampling a texture with a lower dimension than is present in the texture coordinates will ignore the extra texture coordinates.

 

 

Community Additions

ADD
Show:
© 2014 Microsoft