In Direct3D 9, after assigning a few textures to samplers using SetTexture, what is the correct way to access/create the samplers in the relevant pixel shader? Previously I was creating samplers like this:
texture tex : register(r0);
sampler2D sam = sampler_state {
texture = <tex>;
minfilter = none;
magfilter = none;
mipfilter = none;
};
Which seemed to work fine, however, now that I'm binding multiple textures this doesn't work consistently. However, the following appears to work:
sampler2D sam : register(s0);
sampler2D sam1 : register(s1);
The documentation for SetTexture says:
Programmable shaders reference textures using the sampler number.
But I'm not sure whether or not this means that the sampler registers should be used to sample textures set with SetTexture, or whether the sampler requires any further initialisation aside from the call to SetTexture.
D3DX9
utility library. See MSDN. \$\endgroup\$