[cairo] Bug with paint_with_alpha and perfissues when compositing with SOURCE

Owen Taylor otaylor at redhat.com
Tue May 27 14:25:10 PDT 2008


On Tue, 2008-05-27 at 15:15 -0400, Antoine Azar wrote:
> > Extending pixman to handle SOURCE the cairo way is certainly 
> > possible, but the pain of adding stuff in pixman that:
> > 
> >  A) Does not match RENDER (as used by the xlib/xcb backends)
> >  B) Does not match what can easily be done with 3D hardware (glitz
> >     backend, future Direct3D backend)
> 
> Shaders can allow us to implement any operation, so for sure that will be
> possible to implement in a Direct3D backend. In which case we'll have to let
> that backend handle SOURCE and CLEAR natively, with or without mask if we
> want to take advantage of that.

Traditionally, the the way that hardware works is:

 - The fragment shader runs, combining many textures, fixed values, etc,
   into a final single ARGB value

 - That final single ARGB value is combined with the destination
   in a non-programmable way.

You can't express:

 dest_c = src_c * mask_a + dest_c * (1 - mask_a)

Like that because we have two different bits of input going into the
combining 'src_c * mask_a' and 'mask_a'. (You can get around this if
mask_a is a constant value) That's why you need two passes to implement
it.

I've heard rumors that programmable combination with the destination is
going to be possible in future versions of GLSL... but if you have
future generation 3D hardware the two-pass approach we take currently is
going to be so fast, that it's just not worth worrying about. (Compared
to all the other possible stuff that could be optimized)

- Owen




More information about the cairo mailing list