summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-15 15:29:29 -0700
committerBrian Paul <[email protected]>2012-02-16 09:37:11 -0700
commit6f3d91840945fbd9221a247e4f95b32c4051f202 (patch)
tree5fd71790f49604f045fe984897b791ef6ab65b66
parentb0b81218132b6952de987dca21b9750d8d51b7f0 (diff)
mesa: add missing texture integer test in glTexSubImage()
If the texture format is integer, the incoming user data must also be integer (and similarly for non-integer textures). NOTE: This is a candidate for the stable branches. Reviewed-by: Yuanhan Liu <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/mesa/main/teximage.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index e4eb7f67d1f..6acff240e45 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1852,6 +1852,17 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
}
}
+ if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) {
+ /* both source and dest must be integer-valued, or neither */
+ if (_mesa_is_format_integer_color(destTex->TexFormat) !=
+ _mesa_is_integer_format(format)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexSubImage%dD(integer/non-integer format mismatch)",
+ dimensions);
+ return GL_TRUE;
+ }
+ }
+
return GL_FALSE;
}