glamor poorly accelerates the geometry requests
By "geometry" here I mean lines arcs and polygons. There are a few cutouts for axis-aligned zero-width lines and the like, but the general cases all fall down to mi
's span path, which is like "eh" efficient for lines and polys but brutally slow for arcs.
You'd like to move that math to the GPU side, and ideally keep within the GLES2 target feature set. One thing GLES2 does have is discard
. Think about a wide line: draw a tri fan that covers the line with a ~1 pixel border, hit test inside the fragment shader and discard
if the X primitive shouldn't touch that pixel, otherwise fill as usual. You waste a few fragment shader invocations but those are cheap and CPU time is not. Arcs are the hard case, hit testing isn't trivial and you'd like to emit a somewhat-optimal tri fan covering the arc rather than just resort to axis-aligned rectangle and a lot of discard
s.
The other hard part of this is join and cap styles and self-intersection and all that other fluff. Ideally the mi
code would have a clean separation between decomposing those style rules into other truly primitive geometry requests, and decomposing primitives into spans. But it probably doesn't (I no longer remember and am not about to look), and refactoring all of mi
is a much larger task, so complicated GC state will likely still hit the span code; oh well.