Mesa (master): mesa: Make TexImage error cases about internalFormat more informative.
Eric Anholt
anholt at kemper.freedesktop.org
Thu Feb 13 00:20:42 UTC 2014
Module: Mesa
Branch: master
Commit: a4f3e2ca0e6cb4b794109c869e7b872e4ce267af
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4f3e2ca0e6cb4b794109c869e7b872e4ce267af
Author: Eric Anholt <eric at anholt.net>
Date: Tue Feb 4 14:04:14 2014 -0800
mesa: Make TexImage error cases about internalFormat more informative.
I tripped over one of these when debugging meta, and it's a lot nicer to
just see the internalFormat being complained about.
v2: Drop a note in the other errors path that there is one early return.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/main/teximage.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 5938f50..0519d22 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2244,9 +2244,10 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
/* This will detect any invalid internalFormat value */
if (!_mesa_is_compressed_format(ctx, internalFormat)) {
- reason = "internalFormat";
- error = GL_INVALID_ENUM;
- goto error;
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glCompressedTexImage%dD(internalFormat=%s)",
+ dimensions, _mesa_lookup_enum_by_nr(internalFormat));
+ return GL_TRUE;
}
switch (internalFormat) {
@@ -2338,6 +2339,7 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
return GL_FALSE;
error:
+ /* Note: not all error paths exit through here. */
_mesa_error(ctx, error, "glCompressedTexImage%dD(%s)", dimensions, reason);
return GL_TRUE;
}
@@ -2553,7 +2555,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
break;
default:
_mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexImage%dD(internalFormat)", dimensions);
+ "glCopyTexImage%dD(internalFormat=%s)", dimensions,
+ _mesa_lookup_enum_by_nr(internalFormat));
return GL_TRUE;
}
}
@@ -2561,7 +2564,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
baseFormat = _mesa_base_tex_format(ctx, internalFormat);
if (baseFormat < 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexImage%dD(internalFormat)", dimensions);
+ "glCopyTexImage%dD(internalFormat=%s)", dimensions,
+ _mesa_lookup_enum_by_nr(internalFormat));
return GL_TRUE;
}
@@ -2570,7 +2574,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
if (_mesa_is_color_format(internalFormat)) {
if (rb_base_format < 0) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyTexImage%dD(internalFormat)", dimensions);
+ "glCopyTexImage%dD(internalFormat=%s)", dimensions,
+ _mesa_lookup_enum_by_nr(internalFormat));
return GL_TRUE;
}
}
@@ -2596,7 +2601,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
}
if (!valid) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyTexImage%dD(internalFormat)", dimensions);
+ "glCopyTexImage%dD(internalFormat=%s)", dimensions,
+ _mesa_lookup_enum_by_nr(internalFormat));
return GL_TRUE;
}
}
More information about the mesa-commit
mailing list