allow blit path for read pixels if pack->alignment isn't 1.
authorRoland Scheidegger <sroland@tungstengraphics.com>
Mon, 16 Jul 2007 09:51:08 +0000 (11:51 +0200)
committerRoland Scheidegger <sroland@tungstengraphics.com>
Mon, 16 Jul 2007 09:51:08 +0000 (11:51 +0200)
pack->alignment doesn't matter usually if the image is sufficiently aligned
anyway. Speeds up some tests/readrate cases by a factor of 100 (since
the pack->alignment default which noone ever bothers to change is 4).

src/mesa/drivers/dri/i915tex/intel_pixel_read.c

index c7bdb6bc855bfc56fa8d60d0bc6a07e0eeba0813..c41ca33f8f56d26018a021994d4a21328fae04a9 100644 (file)
@@ -203,17 +203,18 @@ do_blit_readpixels(GLcontext * ctx,
       return GL_FALSE;
    }
 
-   if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
-      if (INTEL_DEBUG & DEBUG_PIXEL)
-         _mesa_printf("%s: bad packing params\n", __FUNCTION__);
-      return GL_FALSE;
-   }
-
    if (pack->RowLength > 0)
       rowLength = pack->RowLength;
    else
       rowLength = width;
 
+   if (((rowLength * src->cpp) % pack->Alignment) ||
+      pack->SwapBytes || pack->LsbFirst) {
+      if (INTEL_DEBUG & DEBUG_PIXEL)
+         _mesa_printf("%s: bad packing params\n", __FUNCTION__);
+      return GL_FALSE;
+   }
+
    if (pack->Invert) {
       if (INTEL_DEBUG & DEBUG_PIXEL)
          _mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);