GNOME Bugzilla – Bug 656303
Improve cogl-pango's journal usage
Last modified: 2011-08-11 13:52:41 UTC
When drawing text on the Sodaville platform Thomas was seeing the pipeline validation of cogl_rectangle quite high in the list. As an experiment I thought it would be good to get it to use cogl_rectangles instead so that it can add multiple rectangles to the journal in one call. That way it would only have to validate the pipeline once. In the process of implementing this I took the opportunity to switch it to use CoglAttributeBuffer instead of CoglVertexBuffer. The results when using test-text-perf were: With patch Font size String length FPS N 10 10 77.54 N 10 100 161.19 Y 10 10 83.06 Y 10 100 168.7 When the string length is 10 cogl-pango should be submitting the layout through the journal, and when it is 100 it should be submitting it through a VBO. The patch makes both cases slightly faster, although I can't explain why it would be faster in the VBO case. It would could be useful to test this on the Sodaville platform where the balance between GPU and CPU is probably different. I think we should just land the first patch but I'm not totally sure whether the second patch is a good idea or not.
Created attachment 193576 [details] [review] cogl-pango-display-list: Use CoglPrimitive instead of CoglVertexBuffer When rendering text through a VBO, CoglPangoDisplayList now uses the CoglPrimitive API instead of CoglVertexBuffer. CoglVertexBuffer is just a layer on top of the attirbute buffer API anyway so it should be slightly faster.
Created attachment 193577 [details] [review] cogl-pango-display-list: Use cogl_rectangles_with_texture_coords Instead of storing four vertices per rectangle in the array for a texture node in the display list, it now only stores two in a format that is acceptable to cogl_rectangles_with_texture_coords. That way it can pass the array directly to that function. That function has the advantage over cogl_rectangle that it doesn't need to validate the pipeline for every quad so it should be slightly faster. When the texture node is being rendered with a CoglPrimitive we now map the buffer and expand the rectangles into 4 vertices as the data is copied.
Pushed as 9270412..df30641