This is something that's been present on desktop/laptop hw for over a decade. WebGL 1 could really use an extension to allow this to work with fragment shaders. Fragment shader ints and loops can only be hard-coded to a constant. I'm assuming that WebGL 2 will be the first way to access this (as per ES3). I'm assuming that WebGL vertex shaders support dynamic and static branching properly. The caller could always switch to a series of shaders for multiple loop constants, but at least on the majority of hardware looping is already supported.
--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I actually found a nice workaround for WebGL 1 using break/continue that works quite well. You can specify a fixed loop, and then break/continue to skip loop portions that you don't want. It's certainly better to hardcode loop counts that are closer to what you need, but this lets one shader apply to several limiter values.uniform float limiter; // set this to 2.0for (int i = -10; i < 10; ++i) { // fixed countfloat t = float(i);
if (abs(t) > limiter)
--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
WebGL2 is the path forward for this. I don't think we're going to backport support to WebGL1.
As Jeff pointed out, section 12.30 "Dynamic Indexing" in the GLSL ES
3.00.4 specification lifts most of the restrictions in OpenGL ES 2.0
and therefore WebGL 1.0. However, and unfortunately, in OpenGL ES 3.0,
arrays of samplers can only be indexed with
constant-integral-expressions. I don't know the reason for this
restriction. Perhaps an OpenGL ES extension could be defined which
would lift it, and that could then be exposed in WebGL.