Mesa (master): mesa: remove unnecessary checks in _mesa_readpixels_needs_slow_path

Iago Toral Quiroga itoral at kemper.freedesktop.org
Fri Jun 26 05:43:51 UTC 2015


Module: Mesa
Branch: master
Commit: fbba25bba017b3dde5f6613698004b0086bdea00
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fbba25bba017b3dde5f6613698004b0086bdea00

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Tue Jun 23 08:42:14 2015 +0200

mesa: remove unnecessary checks in _mesa_readpixels_needs_slow_path

readpixels_can_use_memcpy will later call _mesa_format_matches_format_and_type
which does much tighter checks than these to decide if we can use
memcpy for readpixels.

Also, the checks do not seem to be extensive enough anyway, since we are
checking for signed/unsigned conversion only when the framebuffer has integers,
but the same checks could be done for other types anyway, since as long as
there is a signed/unsigned conversion we can't memcpy.

No regressions observed on i965/llvmpipe.

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/main/readpix.c |   16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index a3357cd..e256695 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -128,7 +128,6 @@ _mesa_readpixels_needs_slow_path(const struct gl_context *ctx, GLenum format,
 {
    struct gl_renderbuffer *rb =
          _mesa_get_read_renderbuffer_for_format(ctx, format);
-   GLenum srcType;
 
    assert(rb);
 
@@ -153,21 +152,6 @@ _mesa_readpixels_needs_slow_path(const struct gl_context *ctx, GLenum format,
          return GL_TRUE;
       }
 
-      /* Conversion between signed and unsigned integers needs masking
-       * (it isn't just memcpy). */
-      srcType = _mesa_get_format_datatype(rb->Format);
-
-      if ((srcType == GL_INT &&
-           (type == GL_UNSIGNED_INT ||
-            type == GL_UNSIGNED_SHORT ||
-            type == GL_UNSIGNED_BYTE)) ||
-          (srcType == GL_UNSIGNED_INT &&
-           (type == GL_INT ||
-            type == GL_SHORT ||
-            type == GL_BYTE))) {
-         return GL_TRUE;
-      }
-
       /* And finally, see if there are any transfer ops. */
       return get_readpixels_transfer_ops(ctx, rb->Format, format, type,
                                          uses_blit) != 0;




More information about the mesa-commit mailing list