summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-03-30 21:12:15 +0000
committerBrian Paul <[email protected]>2001-03-30 21:12:15 +0000
commit347b3f0dafe8d0cc30e9d1e7595d12b0ac31bb4a (patch)
treece2616a58f49e9e97c17d6002c0f646a80948aa1 /src/mesa/main/teximage.c
parente116d3b3e55a70ceb4af270ecd1b614117f631a2 (diff)
add texture border width to x/y/zoffset in gl[Copy]TexSubImage*D() functions to accomodate negative offsets correctly
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 6f13cc5dafd..ae1ef018cea 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.90 2001/03/30 15:31:44 brianp Exp $ */
+/* $Id: teximage.c,v 1.91 2001/03/30 21:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1644,6 +1644,9 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
if (width == 0 || !pixels)
return; /* no-op, not an error */
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+
ASSERT(ctx->Driver.TexSubImage1D);
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
format, type, pixels, &ctx->Unpack,
@@ -1688,6 +1691,10 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
if (width == 0 || height == 0 || !pixels)
return; /* no-op, not an error */
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+ yoffset += texImage->Border;
+
ASSERT(ctx->Driver.TexSubImage2D);
(*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset,
width, height, format, type, pixels,
@@ -1726,6 +1733,11 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
if (width == 0 || height == 0 || height == 0 || !pixels)
return; /* no-op, not an error */
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+ yoffset += texImage->Border;
+ zoffset += texImage->Border;
+
ASSERT(ctx->Driver.TexSubImage3D);
(*ctx->Driver.TexSubImage3D)(ctx, target, level,
xoffset, yoffset, zoffset,
@@ -1862,6 +1874,9 @@ void
_mesa_CopyTexSubImage1D( GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width )
{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
GLsizei postConvWidth = width;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -1876,6 +1891,13 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
xoffset, 0, 0, postConvWidth, 1))
return;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, 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);
ctx->NewState |= _NEW_TEXTURE;
@@ -1888,6 +1910,9 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -1902,6 +1927,14 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
postConvWidth, postConvHeight))
return;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, 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,
xoffset, yoffset, x, y, width, height);
@@ -1915,6 +1948,9 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -1929,6 +1965,15 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
zoffset, postConvWidth, postConvHeight))
return;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
+
+ /* If we have a border, xoffset=-1 is legal. Bias by border width */
+ xoffset += texImage->Border;
+ yoffset += texImage->Border;
+ zoffset += texImage->Border;
+
ASSERT(ctx->Driver.CopyTexSubImage3D);
(*ctx->Driver.CopyTexSubImage3D)(ctx, target, level,
xoffset, yoffset, zoffset,