Bug 28055 - glsl-texcoord-array fails GLSL compilation
glsl-texcoord-array fails GLSL compilation
Status: CLOSED FIXED
Product: piglit
Classification: Unclassified
Component: tests
unspecified
All All
: medium normal
Assigned To: Kenneth Graunke
Eric Anholt
:
Depends on:
Blocks: 29044
  Show dependency treegraph
 
Reported: 2010-05-10 15:54 UTC by Vinson Lee
Modified: 2010-07-16 15:50 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vinson Lee 2010-05-10 15:54:42 UTC
piglit: 0059532ce58bf33d611530d2adc38a92d04a1ace

The piglit glsl-texcoord-array test fails GLSL compilation with compilers other the Mesa GLSL compiler.

NVIDIA
Failed to link:
Vertex info
-----------
0(4) : warning C7011: implicit cast from "int" to "float"
0(5) : warning C7011: implicit cast from "int" to "float"
0(5) : error C5025: lvalue in assignment too complex

Fragment info
-------------
0(4) : warning C7011: implicit cast from "float" to "int"
0(4) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable


fglrx
Failed to compile FS: Fragment shader failed to compile with the following errors:
ERROR: 0:4: error(#166) Integer expression required []
ERROR: error(#273) 1 compilation errors.  No code generated


Mac OS X
Failed to compile VS: ERROR: 0:4: '<' :  wrong operand types no operation '<' exists that takes a left-hand operand of type 'int' and a right operand of type 'uniform float' (or there is no acceptable conversion)
ERROR: 0:5: '[' :  array must be redeclared with a size before being indexed with a variable
ERROR: 0:5: '*' :  wrong operand types no operation '*' exists that takes a left-hand operand of type 'const 4-component vector of float' and a right operand of type 'int' (or there is no acceptable conversion)
Comment 1 Vinson Lee 2010-07-13 19:33:21 UTC
piglit: c29c45f21eef7378e1c93cef8ac452e65c1ec6f8

glsl-texcoord-array compiles with fglrx now, but still fails with the NVIDIA and Apple compilers.


NVIDIA
Failed to link:
Vertex info
-----------
0(6) : error C5025: lvalue in assignment too complex

Fragment info
-------------
0(4) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable


Mac OS X 10.6.4
Failed to compile VS: ERROR: 0:6: '[' :  array must be redeclared with a size before being indexed with a variable
Comment 2 Ian Romanick 2010-07-14 15:33:06 UTC
The test is incorrect.  The gl_TexCoord array should be explicitly sized before being variably accessed.  We should do two things:

1. Add 'varying vec4 gl_TexCoord[5];' declarations to both the vertex and fragment shader in this test.

2. Add a parser test that tries to access gl_TexCoord with a variable index without an explicit size.  This test should expect the compiler to generate an error.

I'm going to assign this bug to Ken to fix.
Comment 3 Kenneth Graunke 2010-07-16 12:02:37 UTC
This should be fixed in piglit master.

I created a new failing parser test, unsized-array-non-const-index.vert, based on glsl-texcoord-array's vertex shader.  The only change is an extra cast so it's 1.10 compatible...there isn't any real reason it has to be 1.20.

I then added the array redeclarations as idr suggested.  glsl-texcoord-array now compiles on ATI and nVidia.
Comment 4 Vinson Lee 2010-07-16 14:28:43 UTC
piglit: 1d7d2a04e29f2986212225461d65ee24acd06a35

glsl-texcoord-array compiles now with the fglrx and Apple compilers, but still fails with the NVIDIA GLSL compiler.


Both NVIDIA 197.45 and 256.35 result in the following error.

Failed to link:
Vertex info
-----------
0(7) : error C5025: lvalue in assignment too complex

Fragment info
-------------
0(5) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
Comment 5 Vinson Lee 2010-07-16 14:35:51 UTC
The NVIDIA compiler error is dependent on the hardware or possibly the OpenGL version.

GeForce 9600 3.3.0 NVIDIA 256.35 - pass
GeForce 7300 2.1.2 NVIDIA 256.35 - fail
GeForce 6600 2.1.2 NVIDIA 197.45 - fail
Comment 6 Vinson Lee 2010-07-16 14:54:06 UTC
The NVIDIA GLSL compilation error seems to be attributable to the shading language version of the NVIDIA Cg compiler.

GeForce 6600 1.20 Cg - fail
GeForce 7300 1.20 Cg - fail
GeForce 8800 3.30 Cg - pass
GeForce 9600 3.30 Cg - pass


Marking is bug as resolved again.
Comment 7 Ian Romanick 2010-07-16 15:22:05 UTC
(In reply to comment #6)
> The NVIDIA GLSL compilation error seems to be attributable to the shading
> language version of the NVIDIA Cg compiler.
> 
> GeForce 6600 1.20 Cg - fail
> GeForce 7300 1.20 Cg - fail
> GeForce 8800 3.30 Cg - pass
> GeForce 9600 3.30 Cg - pass
> 
> 
> Marking is bug as resolved again.

It's more likely that the Geforce6 and Geforce7 hardware can't do the required indexing of arrays.  I'm pretty sure the Geforce6 can't do it (neither can R300), but I'm not so sure about Geforce7.

Either way, it's not our problem (as you noted). :)
Comment 8 Vinson Lee 2010-07-16 15:50:29 UTC
Closing this bug.

For the record, glsl-texcoord-array also compiles with the Windows Intel GLSL compiler.