summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-09-26 17:03:11 -0600
committerKeith Whitwell <[email protected]>2008-09-23 16:59:56 -0700
commit03bafd1f9fa000abdb794b2ae344a68840c83201 (patch)
treebb590699fa0aedde46bdc22f7a891694b43c2561 /src/mesa/main/teximage.c
parenta97226352fb8063d4d0084523312b4880dae5ac7 (diff)
Added new _mesa_clip_copytexsubimage() function to do avoid clipping down in the drivers.
This should probably be pulled into main-line Mesa... (cherry picked from commit 324ecadbfdf9b944e059832f146451e4151dcb21)
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index c964d988c49..b0a2d6ddb3d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3040,6 +3040,9 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width;
+ GLint yoffset = 0;
+ GLsizei height = 1;
+
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -3071,8 +3074,13 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
/* If we have a border, xoffset=-1 is legal. Bias by border width */
xoffset += texImage->Border;
- ASSERT(ctx->Driver.CopyTexSubImage1D);
- (*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width);
+ if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
+ &width, &height)) {
+ ASSERT(ctx->Driver.CopyTexSubImage1D);
+ ctx->Driver.CopyTexSubImage1D(ctx, target, level,
+ xoffset, x, y, width);
+ }
+
ctx->NewState |= _NEW_TEXTURE;
}
out:
@@ -3119,10 +3127,14 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
/* If we have a border, xoffset=-1 is legal. Bias by border width */
xoffset += texImage->Border;
yoffset += texImage->Border;
-
- ASSERT(ctx->Driver.CopyTexSubImage2D);
- (*ctx->Driver.CopyTexSubImage2D)(ctx, target, level,
+
+ if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
+ &width, &height)) {
+ ASSERT(ctx->Driver.CopyTexSubImage2D);
+ ctx->Driver.CopyTexSubImage2D(ctx, target, level,
xoffset, yoffset, x, y, width, height);
+ }
+
ctx->NewState |= _NEW_TEXTURE;
}
out:
@@ -3172,10 +3184,14 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
yoffset += texImage->Border;
zoffset += texImage->Border;
- ASSERT(ctx->Driver.CopyTexSubImage3D);
- (*ctx->Driver.CopyTexSubImage3D)(ctx, target, level,
+ if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
+ &width, &height)) {
+ ASSERT(ctx->Driver.CopyTexSubImage3D);
+ ctx->Driver.CopyTexSubImage3D(ctx, target, level,
xoffset, yoffset, zoffset,
x, y, width, height);
+ }
+
ctx->NewState |= _NEW_TEXTURE;
}
out: