[Public WebGL] Infinite loops allowed in WebGL 1.0 currently?

Ben Constable [email protected]
Fri Mar 6 13:04:01 PST 2015

We were looking at a bug in IE recently and came across an interesting case:


This has this fragment of GLSL code:

                               "for ( int i = 0; i == 0; i += 0 ) {",

This is obviously an infinite loop. I am assuming that the site is working because the code is never hit in practice.

The way that we translate GLSL, this is a bit tricky for us. It appears that ANGLE is outputting [loop] in HLSL, and on most hardware this will happily generate an infinite loop that causes TDRs in the shader (we can make Chrome TDR using loop constructs like this).

The specification for loops in GLSL seems to have a lot of effort put into preventing unverifiable loops - is the case of a zero increment an oversight in the specification? I would love to return an error for this kind of case but if I do that now, I will end up not working on a site that works in ANGLE based browsers, and this is not good for interoperability.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20150306/0776abc9/attachment.html>

More information about the public_webgl mailing list