Just FYI, the ‘[SM5] error X4532: cannot map expression to cs_5_0 instruction set’ error happens when you use an instruction that is only valid in a pixel shader. There’s a compute shader compiled for a misc feature that will trigger this error. To solve it, we have several built in functions that provide a workaround using the COMPUTESHADER define, for example:
float DDX(float Input)
{
#if COMPUTESHADER
return 0;
#else
return ddx(Input);
#endif
}
So these things will cause the error (off the top of my head)
ddx / ddy (use DDX / DDY instead)
clip (surround with #if !COMPUTESHADER…#endif)
Tex.SampleGrad (use Texture2DSampleGrad instead)