[Glamor] [PATCH] Optimize gradient_fs_template shader

Michel Dänzer michel at daenzer.net
Tue Jun 11 03:23:10 PDT 2013


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.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the Glamor mailing list