[Mesa-dev] RFC: r300 compiler loop emulation

Marek Olšák maraeo at gmail.com
Sun Jun 6 16:00:29 PDT 2010


On Sun, Jun 6, 2010 at 10:53 AM, Tom Stellard <tstellar at gmail.com> wrote:

> Hi,
>
> I have just published a branch with loop emulation for the r300
> compiler here: http://cgit.freedesktop.org/~tstellar/mesa/<http://cgit.freedesktop.org/%7Etstellar/mesa/>
>
> This adds support for unrolling of loops that have a constant number of
> iterations (e.g. for(i=0; i<10; i++) or for(i=10; i>0; i--)
> It only handles cases where the counter is either added to or subtracted
> from, like the examples above, but I think this covers a majority
> of loops.
>
> Loops that have an unknown number of iterations are unrolled as many
> times as possible without going over the instruction limit for the
> shader program.
>

If you're expecting e.g. ENDIF, please check whether the instruction is
really there. Also, unrolling loops until the instruction limit is reached
seems rather itchy, but still better than my idea of loading dummy shaders.
;)

I haven't reviewed the commits line by line, but generally it looks good,
thanks. If it passes enough tests, I'll be happy to push it.

-Marek

PS: BTW piglit/glsl-fs-loop-const-incr passes even without loop emulation.
The simplest loops seem to be unrolled by the GLSL compiler. The "decr" test
does need the loop emulation though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100607/dac87d64/attachment.html>


More information about the mesa-dev mailing list