intel: Clip to window after calling Driver.TexImage2D
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 18 May 2009 20:26:16 +0000 (13:26 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 2 Jun 2009 15:52:03 +0000 (16:52 +0100)
This prevents the width / height from being clipped to the window size before
the texture is allocated.  This matches intelCopyTexImage1D.

This should fix bug #21227

Signed-off-by: Ian Romanick <ian.romanick@intel.com>
(cherry picked from commit 129f311673c99eb912d659023e50bc5f0ef53249)

src/mesa/drivers/dri/intel/intel_tex_copy.c

index 08437aa0e2b5b520af74c2f7f3e902b4073114fb..90bbb8c6bbf7998055e65f44f55ff6c40ae338a1 100644 (file)
@@ -231,6 +231,14 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
    if (border)
       goto fail;
 
+   /* Setup or redefine the texture object, mipmap tree and texture
+    * image.  Don't populate yet.
+    */
+   ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+                          width, height, border,
+                          GL_RGBA, CHAN_TYPE, NULL,
+                          &ctx->DefaultPacking, texObj, texImage);
+
    srcx = x;
    srcy = y;
    dstx = 0;
@@ -241,15 +249,6 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
                                   &width, &height))
       return;
 
-   /* Setup or redefine the texture object, mipmap tree and texture
-    * image.  Don't populate yet.  
-    */
-   ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
-                          width, height, border,
-                          GL_RGBA, CHAN_TYPE, NULL,
-                          &ctx->DefaultPacking, texObj, texImage);
-
-
    if (!do_copy_texsubimage(intel_context(ctx), target,
                             intel_texture_image(texImage),
                             internalFormat, 0, 0, x, y, width, height))