From 5b1ad7482413e7f6b51671c0a42a52e5fa377886 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 13 Oct 2011 10:25:15 -0700 Subject: [PATCH] swrast: Drop the remaining GetRow-based glReadPixels() fast-path. In all of piglit, only two tests hit it (reading to RGBA float, where GetRow would drop floats into place from R, RG, or RGB). Mostly this is because _ColorReadClamp has been causing transferOps to always be set, skipping any fast-paths anyway. Reviewed-by: Brian Paul --- src/mesa/swrast/s_readpix.c | 90 ------------------------------------- 1 file changed, 90 deletions(-) diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 2c047908ae6..f556213815f 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -185,91 +185,6 @@ read_stencil_pixels( struct gl_context *ctx, ctx->Driver.UnmapRenderbuffer(ctx, rb); } - - -/** - * Optimized glReadPixels for particular pixel formats when pixel - * scaling, biasing, mapping, etc. are disabled. - * \return GL_TRUE if success, GL_FALSE if unable to do the readpixels - */ -static GLboolean -fast_read_rgba_pixels( struct gl_context *ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - GLbitfield transferOps) -{ - struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; - - if (!rb) - return GL_FALSE; - - ASSERT(rb->_BaseFormat == GL_RGBA || - rb->_BaseFormat == GL_RGB || - rb->_BaseFormat == GL_RG || - rb->_BaseFormat == GL_RED || - rb->_BaseFormat == GL_LUMINANCE || - rb->_BaseFormat == GL_INTENSITY || - rb->_BaseFormat == GL_LUMINANCE_ALPHA || - rb->_BaseFormat == GL_ALPHA); - - /* clipping should have already been done */ - ASSERT(x + width <= (GLint) rb->Width); - ASSERT(y + height <= (GLint) rb->Height); - - /* check for things we can't handle here */ - if (transferOps || - packing->SwapBytes || - packing->LsbFirst) { - return GL_FALSE; - } - - if (format == GL_RGBA && rb->DataType == type) { - const GLint dstStride = _mesa_image_row_stride(packing, width, - format, type); - GLubyte *dest - = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, - format, type, 0, 0); - GLint row; - ASSERT(rb->GetRow); - for (row = 0; row < height; row++) { - rb->GetRow(ctx, rb, width, x, y + row, dest); - dest += dstStride; - } - return GL_TRUE; - } - - if (format == GL_RGB && - rb->DataType == GL_UNSIGNED_BYTE && - type == GL_UNSIGNED_BYTE) { - const GLint dstStride = _mesa_image_row_stride(packing, width, - format, type); - GLubyte *dest - = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, - format, type, 0, 0); - GLint row; - ASSERT(rb->GetRow); - for (row = 0; row < height; row++) { - GLubyte tempRow[MAX_WIDTH][4]; - GLint col; - rb->GetRow(ctx, rb, width, x, y + row, tempRow); - /* convert RGBA to RGB */ - for (col = 0; col < width; col++) { - dest[col * 3 + 0] = tempRow[col][0]; - dest[col * 3 + 1] = tempRow[col][1]; - dest[col * 3 + 2] = tempRow[col][2]; - } - dest += dstStride; - } - return GL_TRUE; - } - - /* not handled */ - return GL_FALSE; -} - static GLboolean fast_read_rgba_pixels_memcpy( struct gl_context *ctx, GLint x, GLint y, @@ -376,11 +291,6 @@ read_rgba_pixels( struct gl_context *ctx, transferOps)) { return; } - - if (fast_read_rgba_pixels(ctx, x, y, width, height, - format, type, pixels, packing, transferOps)) { - return; - } } slow_read_rgba_pixels(ctx, x, y, width, height, -- 2.30.2