mesa: Add new helper function _mesa_unpack_depth_stencil_row()
authorAnuj Phogat <anuj.phogat@gmail.com>
Fri, 21 Mar 2014 18:05:55 +0000 (11:05 -0700)
committerAnuj Phogat <anuj.phogat@gmail.com>
Thu, 1 May 2014 17:58:40 +0000 (10:58 -0700)
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@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/format_unpack.c
src/mesa/main/format_unpack.h
src/mesa/main/texgetimage.c

index cf96609ea0761804e52db35ba37fa03465e216a5..c9d793f66cfaca16dfb959fde9aeb2aa39001255 100644 (file)
@@ -4263,3 +4263,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;
+   }
+}
index 1fcfc04b331519a154c794d0519a84a31ae3ae7a..5904a28e755d5c83bb5d3a5ab5d608a4898d1765 100644 (file)
@@ -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 */
index 754c3658ced7780b5e28da70202d6d2855e96c99..09c22357a03f41ce29b929315a81398876ed8cd2 100644 (file)
@@ -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);
             }