Is it possible to do something like this in HLSL:
SamplerState Sampler0 : register(s0, space1);
SamplerState Sampler1 : register(s1, space1);
int samplerIndex;
// ...
float4 color = texture.Sample(samplerIndex == 1 ? Sampler0 : Sampler1, uv);
I got an error that: local resource not guaranteed to map to unique global resource
For this scenario, you are better off either:
(a) Building the same shader twice with two different static samplers.
-or-
(b) Use heap-based samplers so you can switch it out.