[Mesa-dev] [PATCH v2 26/29] mesa: Remove _mesa_(un)pack_index_span

Iago Toral Quiroga itoral at igalia.com
Mon Dec 1 03:05:19 PST 2014


These are not used anywhere.
---
 src/mesa/main/pack.c | 219 ---------------------------------------------------
 src/mesa/main/pack.h |  15 ----
 2 files changed, 234 deletions(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index b46a6fb..cb0956c 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -481,225 +481,6 @@ clamp_half_to_uint(GLhalfARB h)
 
 
 /*
- * Unpack a row of color index data from a client buffer according to
- * the pixel unpacking parameters.
- * This is (or will be) used by glDrawPixels, glTexImage[123]D, etc.
- *
- * Args:  ctx - the context
- *        n - number of pixels
- *        dstType - destination data type
- *        dest - destination array
- *        srcType - source pixel type
- *        source - source data pointer
- *        srcPacking - pixel unpacking parameters
- *        transferOps - the pixel transfer operations to apply
- */
-void
-_mesa_unpack_index_span( struct gl_context *ctx, GLuint n,
-                         GLenum dstType, GLvoid *dest,
-                         GLenum srcType, const GLvoid *source,
-                         const struct gl_pixelstore_attrib *srcPacking,
-                         GLbitfield transferOps )
-{
-   ASSERT(srcType == GL_BITMAP ||
-          srcType == GL_UNSIGNED_BYTE ||
-          srcType == GL_BYTE ||
-          srcType == GL_UNSIGNED_SHORT ||
-          srcType == GL_SHORT ||
-          srcType == GL_UNSIGNED_INT ||
-          srcType == GL_INT ||
-          srcType == GL_HALF_FLOAT_ARB ||
-          srcType == GL_FLOAT);
-
-   ASSERT(dstType == GL_UNSIGNED_BYTE ||
-          dstType == GL_UNSIGNED_SHORT ||
-          dstType == GL_UNSIGNED_INT);
-
-
-   transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT);
-
-   /*
-    * Try simple cases first
-    */
-   if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE
-       && dstType == GL_UNSIGNED_BYTE) {
-      memcpy(dest, source, n * sizeof(GLubyte));
-   }
-   else if (transferOps == 0 && srcType == GL_UNSIGNED_INT
-            && dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) {
-      memcpy(dest, source, n * sizeof(GLuint));
-   }
-   else {
-      /*
-       * general solution
-       */
-      GLuint *indexes = malloc(n * sizeof(GLuint));
-
-      if (!indexes) {
-         _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
-         return;
-      }
-
-      extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source,
-                           srcPacking);
-
-      if (transferOps)
-         _mesa_apply_ci_transfer_ops(ctx, transferOps, n, indexes);
-
-      /* convert to dest type */
-      switch (dstType) {
-         case GL_UNSIGNED_BYTE:
-            {
-               GLubyte *dst = (GLubyte *) dest;
-               GLuint i;
-               for (i = 0; i < n; i++) {
-                  dst[i] = (GLubyte) (indexes[i] & 0xff);
-               }
-            }
-            break;
-         case GL_UNSIGNED_SHORT:
-            {
-               GLuint *dst = (GLuint *) dest;
-               GLuint i;
-               for (i = 0; i < n; i++) {
-                  dst[i] = (GLushort) (indexes[i] & 0xffff);
-               }
-            }
-            break;
-         case GL_UNSIGNED_INT:
-            memcpy(dest, indexes, n * sizeof(GLuint));
-            break;
-         default:
-            _mesa_problem(ctx, "bad dstType in _mesa_unpack_index_span");
-      }
-
-      free(indexes);
-   }
-}
-
-
-void
-_mesa_pack_index_span( struct gl_context *ctx, GLuint n,
-                       GLenum dstType, GLvoid *dest, const GLuint *source,
-                       const struct gl_pixelstore_attrib *dstPacking,
-                       GLbitfield transferOps )
-{
-   GLuint *indexes = malloc(n * sizeof(GLuint));
-
-   if (!indexes) {
-      _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
-      return;
-   }
-
-   transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT);
-
-   if (transferOps & (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT)) {
-      /* make a copy of input */
-      memcpy(indexes, source, n * sizeof(GLuint));
-      _mesa_apply_ci_transfer_ops(ctx, transferOps, n, indexes);
-      source = indexes;
-   }
-
-   switch (dstType) {
-   case GL_UNSIGNED_BYTE:
-      {
-         GLubyte *dst = (GLubyte *) dest;
-         GLuint i;
-         for (i = 0; i < n; i++) {
-            *dst++ = (GLubyte) source[i];
-         }
-      }
-      break;
-   case GL_BYTE:
-      {
-         GLbyte *dst = (GLbyte *) dest;
-         GLuint i;
-         for (i = 0; i < n; i++) {
-            dst[i] = (GLbyte) source[i];
-         }
-      }
-      break;
-   case GL_UNSIGNED_SHORT:
-      {
-         GLushort *dst = (GLushort *) dest;
-         GLuint i;
-         for (i = 0; i < n; i++) {
-            dst[i] = (GLushort) source[i];
-         }
-         if (dstPacking->SwapBytes) {
-            _mesa_swap2( (GLushort *) dst, n );
-         }
-      }
-      break;
-   case GL_SHORT:
-      {
-         GLshort *dst = (GLshort *) dest;
-         GLuint i;
-         for (i = 0; i < n; i++) {
-            dst[i] = (GLshort) source[i];
-         }
-         if (dstPacking->SwapBytes) {
-            _mesa_swap2( (GLushort *) dst, n );
-         }
-      }
-      break;
-   case GL_UNSIGNED_INT:
-      {
-         GLuint *dst = (GLuint *) dest;
-         GLuint i;
-         for (i = 0; i < n; i++) {
-            dst[i] = (GLuint) source[i];
-         }
-         if (dstPacking->SwapBytes) {
-            _mesa_swap4( (GLuint *) dst, n );
-         }
-      }
-      break;
-   case GL_INT:
-      {
-         GLint *dst = (GLint *) dest;
-         GLuint i;
-         for (i = 0; i < n; i++) {
-            dst[i] = (GLint) source[i];
-         }
-         if (dstPacking->SwapBytes) {
-            _mesa_swap4( (GLuint *) dst, n );
-         }
-      }
-      break;
-   case GL_FLOAT:
-      {
-         GLfloat *dst = (GLfloat *) dest;
-         GLuint i;
-         for (i = 0; i < n; i++) {
-            dst[i] = (GLfloat) source[i];
-         }
-         if (dstPacking->SwapBytes) {
-            _mesa_swap4( (GLuint *) dst, n );
-         }
-      }
-      break;
-   case GL_HALF_FLOAT_ARB:
-      {
-         GLhalfARB *dst = (GLhalfARB *) dest;
-         GLuint i;
-         for (i = 0; i < n; i++) {
-            dst[i] = _mesa_float_to_half((GLfloat) source[i]);
-         }
-         if (dstPacking->SwapBytes) {
-            _mesa_swap2( (GLushort *) dst, n );
-         }
-      }
-      break;
-   default:
-      _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
-   }
-
-   free(indexes);
-}
-
-
-/*
  * Unpack a row of stencil data from a client buffer according to
  * the pixel unpacking parameters.
  * This is (or will be) used by glDrawPixels
diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h
index 5c02f8b..cd6d0aa 100644
--- a/src/mesa/main/pack.h
+++ b/src/mesa/main/pack.h
@@ -47,21 +47,6 @@ _mesa_pack_bitmap(GLint width, GLint height, const GLubyte *source,
 
 
 extern void
-_mesa_unpack_index_span(struct gl_context *ctx, GLuint n,
-                        GLenum dstType, GLvoid *dest,
-                        GLenum srcType, const GLvoid *source,
-                        const struct gl_pixelstore_attrib *srcPacking,
-                        GLbitfield transferOps);
-
-
-extern void
-_mesa_pack_index_span(struct gl_context *ctx, GLuint n,
-                      GLenum dstType, GLvoid *dest, const GLuint *source,
-                      const struct gl_pixelstore_attrib *dstPacking,
-                      GLbitfield transferOps);
-
-
-extern void
 _mesa_unpack_stencil_span(struct gl_context *ctx, GLuint n,
                           GLenum dstType, GLvoid *dest,
                           GLenum srcType, const GLvoid *source,
-- 
1.9.1



More information about the mesa-dev mailing list