Mesa (master): mesa: handle some srgb cases in the fast path in _mesa_get_teximage

Roland Scheidegger sroland at kemper.freedesktop.org
Thu May 19 23:42:56 UTC 2011


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Thu Apr 14 23:36:51 2011 +0200

mesa: handle some srgb cases in the fast path in _mesa_get_teximage

Previously, always did unorm8->float/nonlinear-to-linear conversion (using
lookup table), then convert back to nonlinear (using the expensive math
func pow among others), and finally convert back to int (assuming caller
wants unorm8), because the float texture fetch function is used for getting
the actual texel values. This should probably all be changed at some point,
but for now simply enable the memcpy path also for srgb formats (but if for
instance swizzling is required, still the whole conversion will be done).

---

 src/mesa/main/texgetimage.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 467baa2..b23317c 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -418,21 +418,24 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, GLvoid *pixel
         texObj->Target == GL_TEXTURE_RECTANGLE ||
         (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
          texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
-      if (texImage->TexFormat == MESA_FORMAT_ARGB8888 &&
+      if ((texImage->TexFormat == MESA_FORMAT_ARGB8888 ||
+             texImage->TexFormat == MESA_FORMAT_SARGB8) &&
           format == GL_BGRA &&
-          type == GL_UNSIGNED_BYTE &&
+          (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) &&
           !ctx->Pack.SwapBytes &&
           _mesa_little_endian()) {
          memCopy = GL_TRUE;
       }
-      else if (texImage->TexFormat == MESA_FORMAT_AL88 &&
+      else if ((texImage->TexFormat == MESA_FORMAT_AL88 ||
+                  texImage->TexFormat == MESA_FORMAT_SLA8) &&
                format == GL_LUMINANCE_ALPHA &&
                type == GL_UNSIGNED_BYTE &&
                !ctx->Pack.SwapBytes &&
                _mesa_little_endian()) {
          memCopy = GL_TRUE;
       }
-      else if (texImage->TexFormat == MESA_FORMAT_L8 &&
+      else if ((texImage->TexFormat == MESA_FORMAT_L8 ||
+                  texImage->TexFormat == MESA_FORMAT_SL8) &&
                format == GL_LUMINANCE &&
                type == GL_UNSIGNED_BYTE) {
          memCopy = GL_TRUE;




More information about the mesa-commit mailing list