[Mesa-dev] Mesa (master): glsl: add pass to lower variable array indexing to conditional assignments

Luca Barbieri luca at luca-barbieri.com
Fri Sep 17 17:57:59 PDT 2010

Thanks a lot for your work in fixing, adapting, improving and merging
this, and sorry for the previous bugginess.

How about the loop unrolling patches?

In particular, unless I'm wrong on this bug existing,
"glsl/loop_analysis: fix miscompilation with continues before cond
breaks" should probably be added to 7.9 too.

The iteration bound on array accesses is more controversial, but I
think it's OK as long as it honors the robust access flag, given the
language in the ARB_robustness specification and in the GLSL
If we want to be extra-cautious, we might turn this on only for
drivers that don't support control flow.
Also, unlike the first version, the current code tries to ignore array
dereferences that aren't always executed. It has only been tested on a
simple example though.

Another thing that ought to be done is to allow lower_jumps to be
called on-demand by the loop unroller and inliner on the specific
function/loop, so that we can unroll and inline anything, but we don't
burden non-unrolled and non-inlined code with unneeded lowering.

More information about the mesa-dev mailing list