[Mesa-dev] RFC: r300 compiler loop emulation

Tom Stellard tstellar at gmail.com
Thu Jun 10 20:38:10 PDT 2010


On Mon, Jun 07, 2010 at 01:00:29AM +0200, Marek Olšák wrote:
> 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.

I cleaned up the code a little bit and made a few changes as a result
of this bug: https://bugs.freedesktop.org/show_bug.cgi?id=28487 I am
going to move on from loop emulation and start working on loops for
r500, so these changes are ready to pull.

-Tom


More information about the mesa-dev mailing list