Closed Bug 616978 Opened 14 years ago Closed 14 years ago

WebGL - Julia and Mandelbrot demos stopped working with shader validator enabled

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX
Tracking Status
blocking2.0 --- -

People

(Reporter: spammaaja, Unassigned)

References

()

Details

(Keywords: regression)

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7) Gecko/20100101 Firefox/4.0b7
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101205 Firefox/4.0b8pre

http://people.mozilla.com/~sicking/webgl/juliaanim.html
http://people.mozilla.com/~sicking/webgl/mandjulia.html

The Julia and Mandelbrot demos stopped working. Two alert boxes pop up:

ERROR: 0:44: 'do' : This type of loop is not allowed

Could not initialise shaders

Regression window:

Works: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101203 Firefox/4.0b8pre
http://hg.mozilla.org/mozilla-central/rev/0ff6d5984287

Fails: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101204 Firefox/4.0b8pre
http://hg.mozilla.org/mozilla-central/rev/cd392793b0c0

Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=0ff6d5984287&tochange=cd392793b0c0

I'd guess it's caused by Bug 603367 - Use ANGLE to render WebGL.

Reproducible: Always
blocking2.0: --- → ?
Keywords: regression
Version: unspecified → Trunk
Or Bug 616290 - upgrade ANGLE to r498.

The pref webgl.shader_validator;false fixes.
Summary: WebGL - Julia and Mandelbrot demos stopped working → WebGL - Julia and Mandelbrot demos stopped working with shader validator enabled
Status: UNCONFIRMED → NEW
Ever confirmed: true
The ANGLE shader validator says specifically that do loops aren't allowed in shaders. This is probably a wontfix.
blocking2.0: ? → -
(In reply to comment #2)
> The ANGLE shader validator says specifically that do loops aren't allowed in
> shaders. This is probably a wontfix.

Tech Evangelism then?
Jonas, can you just fix your demos? :)
Yep, wontfix/invalid.  See http://www.khronos.org/webgl/public-mailing-list/archives/1012/msg00063.html -- note that this will likely make it impossible for jonas to fix his demos.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
Not impossible, just a little harder :-)

the shader code is

    int runaway = 0;
    do
    {
      tempX = x2 - y2 + cx;
      y = 2.0 * x * y + cy;
      x = tempX;
      x2 = x * x;
      y2 = y * y;
      vel = x2 + y2;
      if (vel > 10000.0)
      {
        runaway = 1;
      }
      i ++;
    }
    while (i < 60 && runaway == 0);

This is very fixable afaics by taking the runaway test out of the while().
In other cases, one can work around the limitation by unrolling a loop; in yet other cases, one can work around the limitation by compiling multiple versions of a shader and selecting one just before rendering.
Two things that are annoying with the current limitations:

1. Why does the iterating variable have to be declared as part of the loop? This always limits its lifetime to that of the loop, meaning that if you want to know how many times the loop ran you have to create a second variable. It makes sense that the variable has to be initialized in the beginning of the loop, and that it has to be of a specific type. But why limit its scope?

2. Why forbid additional loop constraints in addition to the loop_index op constant_expression? I.e. why not allow

for (type_specifier identifier = constant_expression ;
           loop_index op constant_expression && expression ;
           loop_expression )
        statement

And although the message in comment 5 doesn't say this, I assume that |statement| is forbidden from modifying |loop_expression|?


Anyhow, uploading fixed demos now.
Err.. i mean forbidden from modifying |loop_index| of course.
You need to log in before you can comment on or make changes to this bug.