   Shader compiler bug? (DX10)
  Hi,I have a geometry shader (DirectX 10 SDK, June 2008), like the following:#define MAXTEXCOORDS 8struct VSOutput{    float4 pos:    SV_POSITION;    float2 UV[MAXTEXCOORDS]: TEXCOORD;};int normalMapUVChannel;  // From 0 to 7[maxvertexcount(3)]void GS(triangle VSOutput input[3], inout TriangleStream<GSOutput> OutputStream){    float DeltaU1 = input[2].UV[normalMapUVChannel].x - input[1].UV[normalMapUVChannel].x;etc...}The shader compiler report the following errors:error X8000: D3D10 Internal Compiler Error: Invalid Bytecode: Overlapping input index range decl encountered. Opcode #28 (count is 1-based).error X8000: D3D10 Internal Compiler Error: Invalid Bytecode: Can't continue validation - aborting.The error is generated by the first line. Note if I make the index constant, the error disappear:float DeltaU1 = input[2].UV[0].x - input[1].UV[0].x;but in this way I need to replicate the shader 8 times (that moreover it's already replicated for other reasons), that's quite a problem.Someone know a workaround to this? Thanks in advance.- AGPX   
  Ok man,I have received an e-mail from Microsoft's man. He wrote: "Barring any unforeseen circumstances, this issue should get fixed in the November release. In the meantime, a workaround is to make the vertex indices dynamic as well as the interior index (ie, vert[someindex].tex[otherindex])."That is, instead of:float DeltaU1 = input[2].UV[normalMapUVChannel].x - input[1].UV[normalMapUVChannel].x;you have to write:uint baseindex = 0; float DeltaU1 = input[baseindex + 2].UV[normalMapUVChannel].x - input[baseindex + 1].UV[normalMapUVChannel].x;...and this works!Ok, I've learned the lesson: next time, instead of try to simplify the expression, I will try to make it more complex!I hope this post can help somebody else.Bye for now,- AGPX   