summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-08-04 10:55:29 -0600
committerBrian Paul <[email protected]>2009-08-04 15:36:28 -0600
commit2465c4fa9cabe8c40e526b9e081de3b70c851455 (patch)
tree530c902dd800d47786b2aba15f1b495917f1ccc0 /src/mesa/main/teximage.c
parent191e028de20b2f954621b652aa77b06d0e93652a (diff)
mesa: more glGetTexImage() error checking consolidation, new assertion
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 825f5e26bff..3549b68829b 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -765,6 +765,9 @@ _mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage )
GLboolean
_mesa_is_proxy_texture(GLenum target)
{
+ /* NUM_TEXTURE_TARGETS should match number of terms below */
+ assert(NUM_TEXTURE_TARGETS == 7);
+
return (target == GL_PROXY_TEXTURE_1D ||
target == GL_PROXY_TEXTURE_2D ||
target == GL_PROXY_TEXTURE_3D ||
@@ -2261,9 +2264,14 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
return GL_TRUE;
}
-
texUnit = get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
+
+ if (!texObj || _mesa_is_proxy_texture(target)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)");
+ return GL_TRUE;
+ }
+
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (!texImage) {
/* out of memory */
@@ -2342,17 +2350,13 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- texUnit = get_current_tex_unit(ctx);
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- if (!texObj || _mesa_is_proxy_texture(target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)");
- return;
- }
-
if (getteximage_error_check(ctx, target, level, format, type, pixels)) {
return;
}
+ texUnit = get_current_tex_unit(ctx);
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+
_mesa_lock_texture(ctx, texObj);
{
struct gl_texture_image *texImage =