Mesa (mesa_7_2_branch): mesa: in textore.c, only adjust image for convolution if image is a color format

Brian Paul brianp at kemper.freedesktop.org
Wed Oct 22 14:03:34 UTC 2008


Module: Mesa
Branch: mesa_7_2_branch
Commit: 0138533621c8e8daf2fcbf5e992d6dad1e782644
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0138533621c8e8daf2fcbf5e992d6dad1e782644

Author: Brian Paul <brian.paul at tungstengraphics.com>
Date:   Wed Oct 22 07:59:20 2008 -0600

mesa: in textore.c, only adjust image for convolution if image is a color format

Makes things consistant with the code in teximage.c.
We only want to apply convolution to color formats (not depth/index formats)

Conflicts:

	src/mesa/main/teximage.c
	src/mesa/main/teximage.h

---

 src/mesa/main/teximage.c |   26 ++++++++++++++------------
 src/mesa/main/teximage.h |    4 ++++
 src/mesa/main/texstore.c |    4 ++--
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index adf3d37..59373c4 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -387,9 +387,10 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
  * index, depth, stencil, etc).
  * \param format  the image format value (may by an internal texture format)
  * \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise.
+ * XXX maybe move this func to image.c
  */
-static GLboolean
-is_color_format(GLenum format)
+GLboolean
+_mesa_is_color_format(GLenum format)
 {
    switch (format) {
       case GL_RED:
@@ -490,6 +491,7 @@ is_color_format(GLenum format)
 #endif /* FEATURE_EXT_texture_sRGB */
          return GL_TRUE;
       case GL_YCBCR_MESA:  /* not considered to be RGB */
+         /* fall-through */
       default:
          return GL_FALSE;
    }
@@ -1569,9 +1571,9 @@ texture_error_check( GLcontext *ctx, GLenum target,
    }
 
    /* make sure internal format and format basically agree */
-   colorFormat = is_color_format(format);
+   colorFormat = _mesa_is_color_format(format);
    indexFormat = is_index_format(format);
-   if ((is_color_format(internalFormat) && !colorFormat && !indexFormat) ||
+   if ((_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) ||
        (is_index_format(internalFormat) && !indexFormat) ||
        (is_depth_format(internalFormat) != is_depth_format(format)) ||
        (is_ycbcr_format(internalFormat) != is_ycbcr_format(format)) ||
@@ -2319,8 +2321,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
        * texture's format.  Note that a color index texture can be converted
        * to RGBA so that combo is allowed.
        */
-      if (is_color_format(format)
-	  && !is_color_format(texImage->TexFormat->BaseFormat)
+      if (_mesa_is_color_format(format)
+	  && !_mesa_is_color_format(texImage->TexFormat->BaseFormat)
 	  && !is_index_format(texImage->TexFormat->BaseFormat)) {
 	 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
 	 goto out;
@@ -2412,7 +2414,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   if (is_color_format(internalFormat)) {
+   if (_mesa_is_color_format(internalFormat)) {
       _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
    }
 
@@ -2507,7 +2509,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   if (is_color_format(internalFormat)) {
+   if (_mesa_is_color_format(internalFormat)) {
       _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
 					 &postConvHeight);
    }
@@ -2730,7 +2732,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
       _mesa_update_state(ctx);
 
    /* XXX should test internal format */
-   if (is_color_format(format)) {
+   if (_mesa_is_color_format(format)) {
       _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
    }
 
@@ -2788,7 +2790,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
       _mesa_update_state(ctx);
 
    /* XXX should test internal format */
-   if (is_color_format(format)) {
+   if (_mesa_is_color_format(format)) {
       _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
                                          &postConvHeight);
    }
@@ -2901,7 +2903,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
    if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
       _mesa_update_state(ctx);
 
-   if (is_color_format(internalFormat)) {
+   if (_mesa_is_color_format(internalFormat)) {
       _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
    }
 
@@ -2964,7 +2966,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
    if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
       _mesa_update_state(ctx);
 
-   if (is_color_format(internalFormat)) {
+   if (_mesa_is_color_format(internalFormat)) {
       _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
                                          &postConvHeight);
    }
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index f2cad7e..08bb485 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -107,6 +107,10 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
                          GLint width, GLint height, GLint depth, GLint border);
 
 
+extern GLboolean
+_mesa_is_color_format(GLenum format);
+
+
 /**
  * Lock a texture for updating.  See also _mesa_lock_context_textures().
  */
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index e6eb1e2..58fcec8 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3017,7 +3017,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
    GLint sizeInBytes;
    (void) border;
 
-   if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
+   if (_mesa_is_color_format(internalFormat)) {
       _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
    }
 
@@ -3091,7 +3091,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
    GLint texelBytes, sizeInBytes;
    (void) border;
 
-   if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
+   if (_mesa_is_color_format(internalFormat)) {
       _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
                                          &postConvHeight);
    }




More information about the mesa-commit mailing list