[Mesa-dev] [PATCH v4 27/28] mesa: Remove _mesa_rebase_rgba_uint and _mesa_rebase_rgba_float

Iago Toral Quiroga itoral at igalia.com
Wed Jan 7 23:21:46 PST 2015


These are no longer used anywhere now that we have _mesa_format_convert.

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
---
 src/mesa/main/pack.c | 126 ---------------------------------------------------
 src/mesa/main/pack.h |   7 ---
 2 files changed, 133 deletions(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index e59ea59..be8bc6c 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -1325,132 +1325,6 @@ _mesa_unpack_image( GLuint dimensions,
    }
 }
 
-
-
-/**
- * If we unpack colors from a luminance surface, we'll get pixel colors
- * such as (l, l, l, a).
- * When we call _mesa_pack_rgba_span_float(format=GL_LUMINANCE), that
- * function will compute L=R+G+B before packing.  The net effect is we'll
- * accidentally store luminance values = 3*l.
- * This function compensates for that by converting (aka rebasing) (l,l,l,a)
- * to be (l,0,0,a).
- * It's a similar story for other formats such as LUMINANCE_ALPHA, ALPHA
- * and INTENSITY.
- *
- * Finally, we also need to do this when the actual surface format does
- * not match the logical surface format.  For example, suppose the user
- * requests a GL_LUMINANCE texture but the driver stores it as RGBA.
- * Again, we'll get pixel values like (l,l,l,a).
- */
-void
-_mesa_rebase_rgba_float(GLuint n, GLfloat rgba[][4], GLenum baseFormat)
-{
-   GLuint i;
-
-   switch (baseFormat) {
-   case GL_ALPHA:
-      for (i = 0; i < n; i++) {
-         rgba[i][RCOMP] = 0.0F;
-         rgba[i][GCOMP] = 0.0F;
-         rgba[i][BCOMP] = 0.0F;
-      }
-      break;
-   case GL_INTENSITY:
-      /* fall-through */
-   case GL_LUMINANCE:
-      for (i = 0; i < n; i++) {
-         rgba[i][GCOMP] = 0.0F;
-         rgba[i][BCOMP] = 0.0F;
-         rgba[i][ACOMP] = 1.0F;
-      }
-      break;
-   case GL_LUMINANCE_ALPHA:
-      for (i = 0; i < n; i++) {
-         rgba[i][GCOMP] = 0.0F;
-         rgba[i][BCOMP] = 0.0F;
-      }
-      break;
-   case GL_RGB:
-      for (i = 0; i < n; i++) {
-         rgba[i][ACOMP] = 1.0F;
-      }
-      break;
-   case GL_RG:
-      for (i = 0; i < n; i++) {
-         rgba[i][BCOMP] = 0.0F;
-         rgba[i][ACOMP] = 1.0F;
-      }
-      break;
-   case GL_RED:
-      for (i = 0; i < n; i++) {
-         rgba[i][GCOMP] = 0.0F;
-         rgba[i][BCOMP] = 0.0F;
-         rgba[i][ACOMP] = 1.0F;
-      }
-      break;
-
-   default:
-      /* no-op */
-      ;
-   }
-}
-
-
-/**
- * As above, but GLuint components.
- */
-void
-_mesa_rebase_rgba_uint(GLuint n, GLuint rgba[][4], GLenum baseFormat)
-{
-   GLuint i;
-
-   switch (baseFormat) {
-   case GL_ALPHA:
-      for (i = 0; i < n; i++) {
-         rgba[i][RCOMP] = 0;
-         rgba[i][GCOMP] = 0;
-         rgba[i][BCOMP] = 0;
-      }
-      break;
-   case GL_INTENSITY:
-      /* fall-through */
-   case GL_LUMINANCE:
-      for (i = 0; i < n; i++) {
-         rgba[i][GCOMP] = 0;
-         rgba[i][BCOMP] = 0;
-         rgba[i][ACOMP] = 1;
-      }
-      break;
-   case GL_LUMINANCE_ALPHA:
-      for (i = 0; i < n; i++) {
-         rgba[i][GCOMP] = 0;
-         rgba[i][BCOMP] = 0;
-      }
-      break;
-   case GL_RGB:
-      for (i = 0; i < n; i++) {
-         rgba[i][ACOMP] = 1;
-      }
-      break;
-   case GL_RG:
-      for (i = 0; i < n; i++) {
-         rgba[i][BCOMP] = 0;
-         rgba[i][ACOMP] = 1;
-      }
-      break;
-   case GL_RED:
-      for (i = 0; i < n; i++) {
-         rgba[i][GCOMP] = 0;
-         rgba[i][BCOMP] = 0;
-         rgba[i][ACOMP] = 1;
-      }
-   default:
-      /* no-op */
-      ;
-   }
-}
-
 void
 _mesa_pack_luminance_from_rgba_float(GLuint n, GLfloat rgba[][4],
                                      GLvoid *dstAddr, GLenum dst_format,
diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h
index 6d1dce7..ac0a099 100644
--- a/src/mesa/main/pack.h
+++ b/src/mesa/main/pack.h
@@ -85,13 +85,6 @@ _mesa_unpack_image(GLuint dimensions,
                    GLenum format, GLenum type, const GLvoid *pixels,
                    const struct gl_pixelstore_attrib *unpack);
 
-
-extern void
-_mesa_rebase_rgba_float(GLuint n, GLfloat rgba[][4], GLenum baseFormat);
-
-extern void
-_mesa_rebase_rgba_uint(GLuint n, GLuint rgba[][4], GLenum baseFormat);
-
 extern void
 _mesa_pack_luminance_from_rgba_float(GLuint n, GLfloat rgba[][4],
                                      GLvoid *dstAddr, GLenum dst_format,
-- 
1.9.1



More information about the mesa-dev mailing list