WIP: Cleanups to achieve to fully software-based picking
This is the result of some research I've done to get us closer to 100% software picking based on CoglJournal. Some of these patches are controversial, so I'm opening this for discussion.
This branch achieves a
glReadPixels()-less pick implementation on some circumstations.
There were a few journal flush triggers found:
cogl_framebuffer_set_dither_enabled()always flushes the journal. Because it is executed both before and after painting the pick colored rectangles, all painting done at pick time was being submitted to GPU.
cogl_framebuffer_clear4f()requires both DEPTH and COLOR buffers to go through the fast path. However, it also modifies the
buffervariable and remove the DEPTH bit if it is not needed. That means the fast path was never hit.
cogl_framebuffer_set_viewport()flushes the journal the viewport changes. After a big call chain, it ends up marking
CoglFramebuffer->clear_clip_dirty = TRUE, which makes
cogl_framebuffer_clear4f()not hit the fast path.
COGL_CLIP_STACK_RECTto the clip stack. However,
ClutterStagealso uncoditionally pushes a scissor clip (and that adds a
COGL_CLIP_STACK_WINDOW_RECTto the stack). The consequence of the rectangle + scissor clip together is that the journal fails to check if the point is cached.
1-3 are fixed by this merge request.