Mesa (master): intel: Update Mesa state before span setup in glReadPixels.
Eric Anholt
anholt at kemper.freedesktop.org
Sat Jun 20 18:42:49 UTC 2009
Module: Mesa
Branch: master
Commit: afc981ee46791838f3cb83e11eb33938aa3efc83
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=afc981ee46791838f3cb83e11eb33938aa3efc83
Author: Eric Anholt <eric at anholt.net>
Date: Fri Jun 19 22:03:37 2009 -0700
intel: Update Mesa state before span setup in glReadPixels.
We could have mapped the wrong set of draw buffers. Noticed while looking
into a DRI2 glean ReadPixels issue.
---
src/mesa/drivers/dri/i965/intel_pixel_read.c | 1 +
src/mesa/drivers/dri/intel/intel_pixel.c | 4 +---
src/mesa/drivers/dri/intel/intel_pixel_read.c | 11 +++++++++++
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c
new file mode 120000
index 0000000..cc4589f
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -0,0 +1 @@
+../intel/intel_pixel_read.c
\ No newline at end of file
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c
index 36a684b..da9ccb2 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel.c
@@ -424,10 +424,8 @@ intelInitPixelFuncs(struct dd_function_table *functions)
functions->Bitmap = intelBitmap;
functions->CopyPixels = intelCopyPixels;
functions->DrawPixels = intelDrawPixels;
-#ifdef I915
- functions->ReadPixels = intelReadPixels;
-#endif
}
+ functions->ReadPixels = intelReadPixels;
}
void
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index 2c57b47..538da28 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c
@@ -291,6 +291,7 @@ intelReadPixels(GLcontext * ctx,
intelFlush(ctx);
+#ifdef I915
if (do_blit_readpixels
(ctx, x, y, width, height, format, type, pack, pixels))
return;
@@ -298,9 +299,19 @@ intelReadPixels(GLcontext * ctx,
if (do_texture_readpixels
(ctx, x, y, width, height, format, type, pack, pixels))
return;
+#endif
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
+ /* Update Mesa state before calling down into _swrast_ReadPixels, as
+ * the spans code requires the computed buffer states to be up to date,
+ * but _swrast_ReadPixels only updates Mesa state after setting up
+ * the spans code.
+ */
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
_swrast_ReadPixels(ctx, x, y, width, height, format, type, pack, pixels);
}
More information about the mesa-commit
mailing list