[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Weird shader compiler error - casting a mat4 into a mat3.



> On Sun, Mar 13, 2011 at 10:50 PM, Benoit Jacob <bjacob@mozilla.com> wrote:
>>
>> ----- Original Message -----
>>> I have an odd vertex shader compiler error that's happening on just
>>> one
>>> of my machines.
>>>
>>> The shader is utterly minimal (it renders a sky box) - and the error
>>> message is cryptic:
>>>
>>> error C0201: unsupported version 120
>>>
>>> ...the problem appears to be that I'm trying to cast a 4x4 matrix into
>>> a
>>> 3x3 matrix.
>>
>> It seems that GLSL ES 1.0 doesn't have a mat3(mat4) constructor, as far
>> as I can see. Either this warning is telling you that you need to add
>> '#version 120' at the beginning of your shader, or it's telling you that
>> your GPU driver doesn't support version 120 on this GPU. It can be
>> interesting to check with webgl.shader_validator=false, which disables
>> ANGLE validation/translation, to see if the warning is coming from ANGLE
>> or straight from the driver.
>
> The issue is actually that GLSL 1.10 (for the desktop) reserved the
> matrix constructor calls taking matrix as argument. They were exposed
> for the first time in GLSL 1.20. ANGLE's GLSL shader translator emits
> the #version 120 directive if it encounters a matrix/matrix
> constructor call, so the issue is that your hardware doesn't support
> GLSL 1.20. You should be able to rewrite your shader to avoid this
> constructor call which will be problematic on some older desktop
> machines.
>
> -Ken

Thanks!

It's worrying that something as seemingly simple as a cast could be
something that WebGL developers have to be careful about...although it's
no problem at all to restructure the shader to fix the problem.

What's worrying is that I've been testing pretty widely and I thought I'd
ironed out all of the portability wrinkles.

I guess we should clarify the limitations of the oldest version of GLSL
that is supported.  Almost everyone should be writing against that minimal
spec.  We also need to find some way to test against that set of
restrictions without having every WebGL developer having to own an entire
antique computer collection.

Perhaps a good first step would be to have a flag to tell ANGLE to emit a
"#version" directive for the lowest supported GLSL version so we can see
the "real" error messages.

  -- Steve



-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------