From d8cfdbe894be8691242df4e812601320fbf6c5e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 10 May 2010 16:01:38 -0400 Subject: [PATCH] intel: Don't mark front buffer dirty if we're only reading When we call intel_prepare_render() from intelReadPixels(), we'll mark the front buffer dirty. That's silly, since we're only reading from it and marking it dirty will cause us to copy from fake front to front eventually. Just clear the dirty flag after doing the read. --- src/mesa/drivers/dri/intel/intel_pixel_read.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index 2ac3da7f42f..0c95a975ff4 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -170,11 +170,19 @@ intelReadPixels(GLcontext * ctx, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) { + struct intel_context *intel = intel_context(ctx); + GLboolean dirty; + if (INTEL_DEBUG & DEBUG_PIXEL) fprintf(stderr, "%s\n", __FUNCTION__); intelFlush(ctx); - intel_prepare_render(intel_context(ctx)); + + /* glReadPixels() wont dirty the front buffer, so reset the dirty + * flag after calling intel_prepare_render(). */ + dirty = intel->front_buffer_dirty; + intel_prepare_render(intel); + intel->front_buffer_dirty = dirty; if (do_blit_readpixels (ctx, x, y, width, height, format, type, pack, pixels)) @@ -193,4 +201,7 @@ intelReadPixels(GLcontext * ctx, _mesa_update_state(ctx); _swrast_ReadPixels(ctx, x, y, width, height, format, type, pack, pixels); + + /* There's an intel_prepare_render() call in intelSpanRenderStart(). */ + intel->front_buffer_dirty = dirty; } -- 2.30.2