[Mesa-dev] glsl2 compiler regression

Ian Romanick idr at freedesktop.org
Wed Aug 11 12:40:28 PDT 2010

Hash: SHA1

Thomas Jones wrote:
> On 10-08-11 02:23 PM, Kenneth Graunke wrote:
>> On Wednesday 11 August 2010 10:13:13 Thomas Jones wrote:
>>> This shader does
>> not compile with glsl2 and did with the old one
>>> #version 110
>>> void
>> main() {
>>>       gl_TexCoord[1] = gl_MultiTexCoord0*2-1;
>>>       gl_Position =
>> gl_Vertex;
>>> }
>>> The compiler gives the message:
>>> 0:5(38): error:
>> Could not implicitly convert operands to arithmetic
>>> operator 0:5(40):
>> error: Operands to arithmetic operators must be numeric
>>> If I change the
>> #version 110 to #version 120 it works
>> This is correct behavior.  GLSL 1.10
>> explicitly forbids implicit conversions; they were added in 1.20.  So
>> you'll
>> either need to use version 1.20 or do gl_MultiTexCoord0 * 2.0 -
>> 1.0.
>> --Kenneth
> ah I see, the error message isn't terribly helpful for figuring out
> what the real problem is... it should probably not say that they
> must be numeric (since both operands are numbers...)

I think you overlooked the first error message: "Could not implicitly
convert operands to arithmetic operator" :)  We've tried to prevent
cascading error messages, but some cases still slip through.  The second
message happens because the type of the expression 'gl_MultiTexCoord0*2'
is "error", and "error"+"int" is invalid.  We should fix that.

> Also I think at least ATI's compiler accepted the shader (I don't
> remember for sure if I've tested this version of it on a machine
> with proprietary drivers or not) so if it actually does (and NVIDIA
> too) it might be a problem...

Several closed source drivers incorrectly allow this.  Several others
(e.g., Apple) do not.  Whatever happens in current drivers, if you try
to run on an old driver that supports GLSL 1.10 (but not 1.20), you will
almost certainly get an error.  To keep OpenGL a portable graphics
interface, we choose to actually follow the spec.

You'll get the same error if you ever port to OpenGL ES.
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the mesa-dev mailing list