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

[Public WebGL] Two shader validator issues.

I've been putting some of my more complex GLSL shaders through the new
checking gizmo in yesterday's Firefox nightly build and I'm seeing some
inconsistancies between the Linux 64 bit version and the Windows XP 32 bit
version (those are the only two I've tried).

Two shader constructs are accepted by Linux but not by Windows:

   #ifdef GL_ES
   precision highp float;
   vec3   A ;
   vec3   B ;
   float  C ;
   float  D ;
   A = ( C > D ) ? 0.0 : B ;

...the compiler under Windows complains about that last line:

   ERROR: 0:50: ':' : wrong operand types no operation ':' exists
   that takes a left-hand operand of type 'const mediump float'
   and a right operand of type '3-component vector of float'
   (or there is no acceptable conversion)
   ERROR: 1 compilation errors. No code generated.

I could understand if maybe the new 'no automatic conversions' thing were
refusing to widen '0.0' to 'vec3(0.0,0.0,0.0)' - but the problem doesn't
seem to be that - it looks like it's widening it into a 'mediump' instead
of to the 'highp' that my 'precision' statement demands...which would be a

The second problem is that (in a fragment shader), I say:

   #ifdef GL_ES
   precision highp float;
   varying vec2 texCoord ;
   texCoord.x += 0.1 ;

...and under Windows, I get:

  ERROR: 0:77: 'assign' : l-value required "texCoord" (can't modify
  a varying)
  ERROR: 1 compilation errors. No code generated.

...this machine has OpenGL installed on it - but I wonder if the 'no
assignment to varying' restriction comes from some HLSL/Cg restriction in
the underlying implementation?

In both cases, the shader code compiles and runs just fine under regular
C++/OpenGL 3.x and under the Linux FireFox (with or without the validator)
- and it also works OK under Windows if the webgl.shader_validator
variable is set to false.

The Windows XP machine has a fancy high end nVidia GPU - and the various
Linux boxes I've run it on have everything from a 6800 up to a really
recent nVidia GPU.

I know the validator is working under Linux because it caught a couple of:

   float X ;
   X = 6 ;

...kinds of thing, and it stopped complaining when I changed '6' to '6.0'.

Obviously, neither of these things are serious problems for me - it's
mostly just annoying that I can't develop under Linux and expect my shader
code to "just work" under Windows.

  -- 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: