Mesa (10.1): mesa: Add new helper function _mesa_unpack_depth_stencil_row( )

Carl Worth cworth at kemper.freedesktop.org
Fri May 2 00:06:09 UTC 2014


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

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Fri Mar 21 11:05:55 2014 -0700

mesa: Add new helper function _mesa_unpack_depth_stencil_row()

This patch makes non-functional changes in the code. New helper
function added here will make it easier to support more data
types in the following patches.

Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
(cherry picked from commit 7a8045d2f7b7f749a555dbe5f51c327ab0cd6cc8)

---

 src/mesa/main/format_unpack.c |   24 ++++++++++++++++++++++++
 src/mesa/main/format_unpack.h |    5 ++++-
 src/mesa/main/texgetimage.c   |    9 ++++-----
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index f22a42d..ca4b26f 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -4234,3 +4234,27 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n,
       return;
    }
 }
+
+/**
+ * Unpack depth/stencil
+ * \param format  the source data format
+ * \param type the destination data type
+ */
+void
+_mesa_unpack_depth_stencil_row(mesa_format format, GLuint n,
+	                       const void *src, GLenum type,
+                               GLuint *dst)
+{
+   assert(type == GL_UNSIGNED_INT_24_8);
+
+   switch (type) {
+   case GL_UNSIGNED_INT_24_8:
+      _mesa_unpack_uint_24_8_depth_stencil_row(format, n, src, dst);
+      break;
+   default:
+      _mesa_problem(NULL,
+                    "bad type 0x%x in _mesa_unpack_depth_stencil_row",
+                    type);
+      return;
+   }
+}
diff --git a/src/mesa/main/format_unpack.h b/src/mesa/main/format_unpack.h
index 1fcfc04..5904a28 100644
--- a/src/mesa/main/format_unpack.h
+++ b/src/mesa/main/format_unpack.h
@@ -63,5 +63,8 @@ void
 _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n,
 					 const void *src, GLuint *dst);
 
-
+void
+_mesa_unpack_depth_stencil_row(mesa_format format, GLuint n,
+                              const void *src, GLenum type,
+                              GLuint *dst);
 #endif /* FORMAT_UNPACK_H */
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 290f333..0965b83 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -149,11 +149,10 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
             void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
                                              width, height, format, type,
                                              img, row, 0);
-            /* Unpack from texture's format to GL's z24_s8 layout */
-            _mesa_unpack_uint_24_8_depth_stencil_row(texImage->TexFormat,
-                                                     width,
-                                                     (const GLuint *) src,
-                                                     dest);
+            _mesa_unpack_depth_stencil_row(texImage->TexFormat,
+                                           width,
+                                           (const GLuint *) src,
+                                           type, dest);
             if (ctx->Pack.SwapBytes) {
                _mesa_swap4((GLuint *) dest, width);
             }




More information about the mesa-commit mailing list