In HLSL, is there a way to limit the number of constant registers that the compiler uses?
In particular, if I have something like:
float4 foobar[300];
In the vs_2_0 vertex shader, the compiler will generate an effect with more than 256 constant registers. But the Ver.2 Vertex Shader is only guaranteed to access 256 constant registers, so when I try to use the effect, it does not work in ambiguity mode and depends on the GPU at runtime. I would rather refuse at compile time.
This problem is particularly annoying because the compiler itself allocates constant registers behind the scenes on top of the ones I ask. I have to check the assembly to make sure that I have exceeded the limit.
Ideally, I would like to do this in HLSL (I use the XNA content pipeline), but if there is a flag that can be passed to the compiler, it will also be interesting.
source
share