Mesa (master): mesa: move convolution image adjustment code for glCopyTexSubImage1/2/3D()

Brian Paul brianp at kemper.freedesktop.org
Wed Oct 22 06:56:16 PDT 2008


Module: Mesa
Branch: master
Commit: 95c04cccfef2e5743279e1f5a6a13f3925c7024c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=95c04cccfef2e5743279e1f5a6a13f3925c7024c

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

mesa: move convolution image adjustment code for glCopyTexSubImage1/2/3D()

Do it after initial error checking, after we know the texture's internal format.

---

 src/mesa/main/teximage.c |   36 +++++++++++++++++++++---------------
 1 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 4c48370..f9360b4 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2991,6 +2991,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
                                          &postConvHeight);
    }
 #endif
+
    if (copytexture_error_check(ctx, 2, target, level, internalFormat,
                                postConvWidth, postConvHeight, border))
       return;
@@ -3052,11 +3053,6 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
    if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
       _mesa_update_state(ctx);
 
-#if FEATURE_convolve
-   /* XXX should test internal format */
-   _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
-#endif
-
    if (copytexsubimage_error_check1(ctx, 1, target, level))
       return;
 
@@ -3067,6 +3063,12 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
+#if FEATURE_convolve
+      if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
+         _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
+      }
+#endif
+
       if (copytexsubimage_error_check2(ctx, 1, target, level,
 				       xoffset, 0, 0, postConvWidth, 1,
 				       texImage))
@@ -3106,11 +3108,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
    if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
       _mesa_update_state(ctx);
 
-#if FEATURE_convolve
-   /* XXX should test internal format */
-   _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight);
-#endif
-
    if (copytexsubimage_error_check1(ctx, 2, target, level))
       return;
 
@@ -3121,6 +3118,13 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
+#if FEATURE_convolve
+      if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
+         _mesa_adjust_image_for_convolution(ctx, 2,
+                                            &postConvWidth, &postConvHeight);
+      }
+#endif
+
       if (copytexsubimage_error_check2(ctx, 2, target, level, xoffset, yoffset, 0,
 				       postConvWidth, postConvHeight, texImage))
 	 goto out;
@@ -3159,11 +3163,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
    if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
       _mesa_update_state(ctx);
 
-#if FEATURE_convolve
-   /* XXX should test internal format */
-   _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight);
-#endif
-
    if (copytexsubimage_error_check1(ctx, 3, target, level))
       return;
 
@@ -3174,6 +3173,13 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
+#if FEATURE_convolve
+      if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
+         _mesa_adjust_image_for_convolution(ctx, 2,
+                                            &postConvWidth, &postConvHeight);
+      }
+#endif
+
       if (copytexsubimage_error_check2(ctx, 3, target, level, xoffset, yoffset,
 				       zoffset, postConvWidth, postConvHeight,
 				       texImage))



More information about the mesa-commit mailing list