I'm working with DX9/SM3 at the moment, and the MSDN documentation on HLSL samplers seems to be sorely lacking in explaining how to use the different sampler types. What's worse is they try to cover DX9 and DX10 in a single article, so they jumble together all the keywords:
sampler Name = SamplerType { Texture = <texture_variable>; [state_name = state_value;] ... };
...
SamplerType
[in] The sampler type, which is one of the following: sampler, sampler1D, sampler2D, sampler3D, samplerCUBE, sampler_state, SamplerState.
Differences between Direct3D 9 and Direct3D 10:
Direct3D 10 supports one additional sampler type: SamplerComparisonState.
I get the feeling that contrary to this writeup, SamplerState is DX10 only. Virtually all the code I see uses sampler_state for SamplerType. A quick example from BasicHLSL (DX9):
sampler MeshTextureSampler =
sampler_state
{
Texture = <g_MeshTexture>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
};
Why do all the different _SamplerType_s exist and when would you use, say, sampler or sampler2D instead of sampler_state? You need to be explicit when fetching anyhow, e.g. tex2D, texCUBE, so what is going on here?