Some notes on optimization work in progress (was: Re: [cairo] WinXp benchmarks)

Soeren Sandmann sandmann at daimi.au.dk
Fri Mar 4 13:42:45 PST 2005


David Reveman <davidr at novell.com> writes:

> > I haven't actually written the code and tried it, so I could be wrong
> > of course.
> > 
> > (Why is it that we can't use the GPU shader for this?)
> 
> Oh, we can, the glitz backend is doing almost every gradient supported
> by cairo using shaders, if hardware supports it of course. But there's a
> lot of hardware that doesn't support shaders and a fast software
> implementation is always useful. 
> 
> I can easily accelerate simple 2-stop linear gradients on hardware
> without shader support in the glitz backend, just haven't got around
> doing that yet.

Actually what I meant was: Can't we take a gradient pattern and break
it down into a number of triangles, then compute the desired color at
each corner of the triangle, then use the hardware to interpolate?
Even old hardware should be able to that, right?
 
It is an approximation of course, but if the triangles are small
enough and/or chosen cleverly enough, the result would be
indistinguishable from the real thing. The number of triangles chosen
could perhaps depend on the cairo quality setting.


Søren



More information about the cairo mailing list