diff options
author | Brian Paul <[email protected]> | 2012-02-07 07:42:33 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-02-07 07:42:33 -0700 |
commit | 627b435dfe17698a1c69e9a259838fc6f2e6bd4e (patch) | |
tree | 07d6223879f8985139a87a9c271c34848d8c305f /src/mesa/main/readpix.c | |
parent | 699e3b98214b52579e186594c21b972ea4cb4037 (diff) |
mesa: new _mesa_error_check_format_and_type() function
This replaces the _mesa_is_legal_format_and_type() function.
According to the spec, some invalid format/type combinations to
glDrawPixels, ReadPixels and glTexImage should generate
GL_INVALID_ENUM but others should generate GL_INVALID_OPERATION.
With the old function we didn't make that distinction and generated
GL_INVALID_ENUM errors instead of GL_INVALID_OPERATION. The new
function returns one of those errors or GL_NO_ERROR.
This will also let us remove some redundant format/type checks in
follow-on commit.
v2: add more checks for ARB_texture_rgb10_a2ui at the top of
_mesa_error_check_format_and_type() per Ian.
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/readpix.c')
-rw-r--r-- | src/mesa/main/readpix.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index 908a55e702e..6c64cbeb8c4 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -588,6 +588,7 @@ _mesa_error_check_format_type(struct gl_context *ctx, GLenum format, { const char *readDraw = drawing ? "Draw" : "Read"; const GLboolean reading = !drawing; + GLenum err; /* state validation should have already been done */ ASSERT(ctx->NewState == 0x0); @@ -609,9 +610,9 @@ _mesa_error_check_format_type(struct gl_context *ctx, GLenum format, } /* basic combinations test */ - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_ENUM, - "gl%sPixels(format or type)", readDraw); + err = _mesa_error_check_format_and_type(ctx, format, type); + if (err != GL_NO_ERROR) { + _mesa_error(ctx, err, "gl%sPixels(format or type)", readDraw); return GL_TRUE; } @@ -715,7 +716,7 @@ _mesa_error_check_format_type(struct gl_context *ctx, GLenum format, } break; default: - /* this should have been caught in _mesa_is_legal_format_type() */ + /* this should have been caught in _mesa_error_check_format_type() */ _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw); return GL_TRUE; } |