I've been messing with some HLSL shaders and I've run to the following error :
error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Input index range defined from 12 to 22 includes input register [13] that was not declared.
error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Input index range defined from 12 to 22 includes input register [15] that was not declared.
error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Input index range defined from 12 to 22 includes input register [17] that was not declared.
error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Input index range defined from 12 to 22 includes input register [19] that was not declared.
error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Input index range defined from 12 to 22 includes input register [21] that was not declared.
The procedure is as follows:
1. Declare a static const nively bound lookup table in the global space
(all following in pixel shader)
2. Compute an index based on comparison of values in the input struct ( say a minimum)
3. Use that index to get the appropriate element of another input struct array.
Step No 3 fails with the above. I'm pretty sure that all the indexing is sane in all paths, although just from eyeballing ( the shader's not that complex yet anyway)
The offending code chunk (slightly simplified) is :
PS_Struct
{
..various stuff..
vec3 arg[8] : SOMEARG;
vec3 data[6]: SOMEDATA;
}
static const uint3 lookup[8] = {init values, all of them from 0 to 5 inclusive}
...
// In pixel shader, given 'PS_Struct input'
int i;
// Compute vals
float vals[8];
[unroll]
for(i=0;i<8;++i)
{
vals = DoSomeStuff(input.arg)
}
// Compute minval & minindex
float minval = vals[0];
int min_i=0;
[unroll]
for(i=1;i<8;++i)
{
if(vals < minval)
{
minval = vals;
min_i = i;
}
}
uint3 iv_min = lookup[min_i];
// return float4(iv_min, 1); // this works
// return float4( input.data[iv_min[0]], 1); // this works
return float4( input.data[iv_min[0]], 1); // THIS DOESN'T
Compiler is 9.29.952.3111 from the June 2010 SDK.
Shader model used is either 4 or 5, doesn't make a difference
Thanks,
Babis