[Glamor] [PATCH] Optimize gradient_fs_template shader

Tom Stellard tom at stellard.net
Tue Jun 11 07:13:45 PDT 2013


On Tue, Jun 11, 2013 at 12:23:10PM +0200, Michel Dänzer wrote:
> On Mon, 2013-06-10 at 19:11 -0700, Tom Stellard wrote:
> > From: Tom Stellard <thomas.stellard at amd.com>
> > 
> > Replace:
> > 
> > while(t > 1.0)
> >    t = t - 1.0;
> > while(t < 0.0)
> >    t = t + 1.0;
> > 
> > With:
> > 
> > t = fract(t);
> > ---
> > 
> > This code is untested since I'm not usre which test suite to use
> > for glamor.  Any suggestions?
> 
> E.g. rendercheck? rendercheck -t gradients might hit this path. It's
> failing some tests for me even without your patch, but at least you
> could make sure it doesn't get any worse. :)
> 
> 
> > This should improve the performance of any app that uses this shader via glamor.
> > I think the cairo perf test firefox-canvas uses this, but the patch didn't
> > improve perfomance.
> 
> Your patch can only make a big difference if t is much larger than 1.0
> or much smaller than 0.0 initially.
>

For Southern Islands, I think you are right, because it doesn't have the same
overhead for initializing loops that previous generations have.  This patch
may only save a few ALU instructions.

Your comment made me realize that I need to add a special case for 1.0,
so I'll send out a new patch.

-Tom


More information about the Glamor mailing list