Donnerstag, 5. März 2009

Shader Trapezoids

Lately I've been playing with shaders a bit, investigating the possibility of implementing XRender's more complex features (trapezoids and gradients) using shaders instead of falling back to software all the time.

I started with trapezoids because they're used a lot, and because pixman's strange implementation made me curious:



I used NVidia's Cg language because it can be compiled down to ARG_fragment_program, which is the best my i945GM can do. Performance could be better and I am limited to 0,25px subpixel precision because of the i915's 64 ALU instruction limit.
But at least from what I can tell the traps should conform to the spec for imprecise trapezoid mode (default), I'll try to feed some cairo output at it and see what will go wrong ;)

On my i945GM I get 25fps fullscreen, a RedeonHD3850 is able to do ~1000fps and is still not ALU limited :)

Hopefully some day that stuff will find its way into one of the opensource drivers, I guess on more powerful hardware like AMD's R600/700 GPU setup costs will dominate :)

1 Kommentar:

suokko hat gesagt…

Have you published your trapezoid code somewhere? I think it would be helpful if I find time to implement the trapezoid acceleration to radeon.