4 ms·
> There's no way to bail out of the loop early, at least with OpenGL ES 2.0 (WebGL) shaders. We can't break or do any sort of branching on the loop variable. I
by __david__ 12y ago
> There's no way to bail out of the loop early, at least with OpenGL ES 2.0 (WebGL) shaders. We can't break or do any sort of branching on the loop variable.
Is this true? I was recently playing around with a webgl Mandelbrot [1] and the core algorithm escapes with a break. I wrote it without thinking and it worked on my computer and the computers of the people to whom I showed it. Was this just luck that it works?
[1] http://caldwell.github.io/mandelbrot-html http://caldwell.github.io/mandelbrot-html
- jacquesm 12y agoIt likely just causes a rendez-vous so the threads that hit the 'break' will stop executing until those that did not hit the 'break' have reached the same point. Depending on what architecture you use this included a smaller or larger portion of the active cores. This is the usual way in which thread divergence is dealt with in GPU land.
- deleted 12y ago[deleted]