Mathias Gottschlag wrote:
> 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.

It's probably incorrect in our compiler.

You're best off playing it safe and using another variable name.  I 
wouldn't be surprised if other GLSL compilers got this wrong too.

-Brian


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to