aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/teximage.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/teximage.c')
-rw-r--r--mesalib/src/mesa/main/teximage.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 018aca063..25da75369 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1511,6 +1511,7 @@ texture_error_check( struct gl_context *ctx,
const GLboolean isProxy = target == proxyTarget;
GLboolean sizeOK = GL_TRUE;
GLboolean colorFormat;
+ GLenum err;
/* Even though there are no color-index textures, we still have to support
* uploading color-index data and remapping it to RGB via the
@@ -1579,16 +1580,10 @@ texture_error_check( struct gl_context *ctx,
}
/* Check incoming image format and type */
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- /* Normally, GL_INVALID_OPERATION is generated by a format/type
- * mismatch (see the 1.2 spec page 94, sec 3.6.4.). But with the
- * GL_EXT_texture_integer extension, some combinations should generate
- * GL_INVALID_ENUM instead (grr!).
- */
+ err = _mesa_error_check_format_and_type(ctx, format, type);
+ if (err != GL_NO_ERROR) {
if (!isProxy) {
- GLenum error = _mesa_is_integer_format(format)
- ? GL_INVALID_ENUM : GL_INVALID_OPERATION;
- _mesa_error(ctx, error,
+ _mesa_error(ctx, err,
"glTexImage%dD(incompatible format 0x%x, type 0x%x)",
dimensions, format, type);
}
@@ -1737,6 +1732,8 @@ subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type )
{
+ GLenum err;
+
/* Basic level check */
if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level);
@@ -1760,13 +1757,9 @@ subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- /* As with the glTexImage2D check above, the error code here
- * depends on texture integer.
- */
- GLenum error = _mesa_is_integer_format(format)
- ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
- _mesa_error(ctx, error,
+ err = _mesa_error_check_format_and_type(ctx, format, type);
+ if (err != GL_NO_ERROR) {
+ _mesa_error(ctx, err,
"glTexSubImage%dD(incompatible format 0x%x, type 0x%x)",
dimensions, format, type);
return GL_TRUE;