intel: Update Mesa state before span setup in glReadPixels.
authorEric Anholt <eric@anholt.net>
Sat, 20 Jun 2009 05:03:37 +0000 (22:03 -0700)
committerEric Anholt <eric@anholt.net>
Sat, 20 Jun 2009 05:17:46 +0000 (22:17 -0700)
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 [new symlink]
src/mesa/drivers/dri/intel/intel_pixel.c
src/mesa/drivers/dri/intel/intel_pixel_read.c

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 (symlink)
index 0000000..cc4589f
--- /dev/null
@@ -0,0 +1 @@
+../intel/intel_pixel_read.c
\ No newline at end of file
index 36a684b3b855c8feecadd15da8c64aef50f26137..da9ccb23f146b9015b8665d67475065e36dd0548 100644 (file)
@@ -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
index 2c57b470f57f4a50ea9e37937a5dfaf404909d4c..538da28c50e22846ab5371d51d57013891965f2b 100644 (file)
@@ -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);
 }