Don't call glFinish in _clutter_do_pick

Calling glReadPixels is bad enough in forcing us to synchronize the CPU with
the GPU, but glFinish has even stronger synchonization semantics than
glReadPixels which may negate some driver optimizations possible in
glReadPixels.
This commit is contained in:
Robert Bragg 2009-05-06 19:01:09 +01:00
parent 10783e053b
commit 08a73a215f

View File

@ -379,7 +379,8 @@ _clutter_do_pick (ClutterStage *stage,
/* Disable dithering (if any) when doing the painting in pick mode */ /* Disable dithering (if any) when doing the painting in pick mode */
dither_was_on = glIsEnabled (GL_DITHER); dither_was_on = glIsEnabled (GL_DITHER);
glDisable (GL_DITHER); if (dither_was_on)
glDisable (GL_DITHER);
/* Render the entire scence in pick mode - just single colored silhouette's /* Render the entire scence in pick mode - just single colored silhouette's
* are drawn offscreen (as we never swap buffers) * are drawn offscreen (as we never swap buffers)
@ -391,11 +392,6 @@ _clutter_do_pick (ClutterStage *stage,
/* Calls should work under both GL and GLES, note GLES needs RGBA */ /* Calls should work under both GL and GLES, note GLES needs RGBA */
glGetIntegerv(GL_VIEWPORT, viewport); glGetIntegerv(GL_VIEWPORT, viewport);
/* Below to be safe, particularly on GL ES. an EGL wait call or full
* could be nicer.
*/
glFinish();
/* Read the color of the screen co-ords pixel */ /* Read the color of the screen co-ords pixel */
glReadPixels (x, viewport[3] - y -1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); glReadPixels (x, viewport[3] - y -1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);