[Mesa-dev] [PATCH 2/3] glsl: add continue/break/return unification/elimination pass

Luca Barbieri luca at luca-barbieri.com
Tue Sep 7 11:24:03 PDT 2010


I pushed yet another commit that teaches the unroller to unroll loops like this:

uniform int texcoords;
float4 gl_TexCoord[8];

for(i = 0; i < texcoords; ++i)
   do_something_with(gl_TexCoord[i]);

After this, we should now be able to inline all functions and unroll
all loops with reasonably obvious iteration count.

The next step, which is left to the reader, is to actually do so intelligently.

In particular, ir_lower_jumps.cpp needs to be invokable on a single
loop or single function by the inliner to unify returns, and by the
unroller to lower breaks and continues so that it can unroll loops.

Then, sensible heuristics must be put in place to avoid the
exponential growth of the code size that currently happens, as
illustrated by the "explosion" testcases on piglit ML. These shoud be
put in gl_shader_compiler_options, so that the Mesa/Gallium driver can
have a say in this.

I now plan to add a pass to lower unsupported non-constant addressing,
since that is currently the greatest cause of piglit failures on
nv30/nv40.


More information about the mesa-dev mailing list