Mesa (master): mesa: Make unpack_uint_z_row return 32 bits of data.

Eric Anholt anholt at kemper.freedesktop.org
Tue Nov 1 22:57:57 UTC 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Oct 13 09:38:30 2011 -0700

mesa: Make unpack_uint_z_row return 32 bits of data.

Some of the return values were u32, some were 24 bits, and z16
returned 16 bits.  The caller would have to do all the work of
interpreting the format all over again.  However, there are no callers
of this function at this point.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/format_unpack.c |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index 2051f68..fbda031 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -1415,37 +1415,26 @@ _mesa_unpack_float_z_row(gl_format format, GLuint n,
 typedef void (*unpack_uint_z_func)(const void *src, GLuint *dst);
 
 static void
-unpack_uint_z_Z24_S8(const void *src, GLuint *dst)
+unpack_uint_z_Z24_X8(const void *src, GLuint *dst)
 {
    /* only return Z, not stencil data */
    const GLuint s = *((const GLuint *) src);
-   *dst = (s >> 8);
+   *dst = (s & 0xffffff00) | (s >> 24);
 }
 
 static void
-unpack_uint_z_S8_Z24(const void *src, GLuint *dst)
+unpack_uint_z_X8_Z24(const void *src, GLuint *dst)
 {
    /* only return Z, not stencil data */
    const GLuint s = *((const GLuint *) src);
-   *dst = s & 0x00ffffff;
+   *dst = (s << 8) | ((s >> 16) & 0xff);
 }
 
 static void
 unpack_uint_z_Z16(const void *src, GLuint *dst)
 {
-   *dst = *((const GLushort *) src);
-}
-
-static void
-unpack_uint_z_X8_Z24(const void *src, GLuint *dst)
-{
-   unpack_uint_z_S8_Z24(src, dst);
-}
-
-static void
-unpack_uint_z_Z24_X8(const void *src, GLuint *dst)
-{
-   unpack_uint_z_Z24_S8(src, dst);
+   const GLushort s = *((const GLushort *)src);
+   *dst = (s << 16) | s;
 }
 
 static void
@@ -1466,19 +1455,15 @@ _mesa_unpack_uint_z_row(gl_format format, GLuint n,
 
    switch (format) {
    case MESA_FORMAT_Z24_S8:
-      unpack = unpack_uint_z_Z24_S8;
+   case MESA_FORMAT_Z24_X8:
+      unpack = unpack_uint_z_Z24_X8;
       break;
    case MESA_FORMAT_S8_Z24:
-      unpack = unpack_uint_z_S8_Z24;
-      break;
-   case MESA_FORMAT_Z16:
-      unpack = unpack_uint_z_Z16;
-      break;
    case MESA_FORMAT_X8_Z24:
       unpack = unpack_uint_z_X8_Z24;
       break;
-   case MESA_FORMAT_Z24_X8:
-      unpack = unpack_uint_z_Z24_X8;
+   case MESA_FORMAT_Z16:
+      unpack = unpack_uint_z_Z16;
       break;
    case MESA_FORMAT_Z32:
       unpack = unpack_uint_z_Z32;




More information about the mesa-commit mailing list