While trying Horde3D on nouveau I found out that Mesa rejects the
following shader which correctly compiles on the proprietary drivers
and, as far as I can see, seems to be correct according to the GLSL specs:
uniform sampler2D tex;
void main()
{
vec3 tex = texture2D(tex, gl_TexCoord[0].st);
gl_FragColor.rgb = tex;
}
Here Mesa chokes on the first parameter to texture2D because it inserts
an (undefined?) vec3 there, the same way as C/C++ would react here,
which results in the following error:
Error: undefined function 'texture2D'
Error: incompatible types in assignment
The GLSL spec (1.20) however says:
Within a declaration, the scope of a name starts immediately after the
initializer if present or immediately
after the name being declared if not.
Did I miss something here, did I interpret the specs wrong? I looked
into the sources in order to maybe fix the problem, but without any
knowledge of Mesa's internals, that's a bit to high for me.
Mathias Gottschlag
|