diff options
author | Eduardo Lima Mitev <[email protected]> | 2015-09-24 10:57:41 +0200 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-09-28 20:29:41 +0100 |
commit | 25e2a4136bc9b2cd503022eb39fc4ae9e219d1d4 (patch) | |
tree | 1360992a82b880fe71674c3b16530bbaab9adb31 /src/mesa | |
parent | ead4ce53f77f75936cd9044d6dc467d533e19bf0 (diff) |
mesa: Fix order of format+type and internal format checks for glTexImageXD ops
The more specific GLES constrains should be checked after the general
validation performed by _mesa_error_check_format_and_type(). This is also
for consistency with the error checks order of glTexSubImage ops.
v3: The change of order uncovered a bug that regresses a couple of piglit
tests written against OpenGL-ES 1.1 spec, which expects an INVALID_VALUE
instead of the INVALID_ENUM returned by _mesa_error_check_format_and_type()
when an invalid format is passed to glTexImage2D. This version of the patch
accounts for those cases.
Fixes 1 dEQP test:
* dEQP-GLES3.functional.negative_api.texture.teximage2d
Cc: "11.0" <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Tested-by: Mark Janes <[email protected]>
(cherry picked from commit 15ab968f62dd322ecda6d70b1069f52616fe39bb)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/teximage.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 3ee33fbc90e..0d475e7ada1 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2201,15 +2201,23 @@ texture_error_check( struct gl_context *ctx, return GL_TRUE; } - /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the - * combinations of format, internalFormat, and type that can be used. - * Formats and types that require additional extensions (e.g., GL_FLOAT - * requires GL_OES_texture_float) are filtered elsewhere. - */ - if (_mesa_is_gles(ctx) && - texture_format_error_check_gles(ctx, format, type, internalFormat, - dimensions, "glTexImage%dD")) { - return GL_TRUE; + /* Check incoming image format and type */ + err = _mesa_error_check_format_and_type(ctx, format, type); + if (err != GL_NO_ERROR) { + /* Prior to OpenGL-ES 2.0, an INVALID_VALUE is expected instead of + * INVALID_ENUM. From page 73 OpenGL ES 1.1 spec: + * + * "Specifying a value for internalformat that is not one of the + * above (acceptable) values generates the error INVALID VALUE." + */ + if (err == GL_INVALID_ENUM && _mesa_is_gles(ctx) && ctx->Version < 20) + err = GL_INVALID_VALUE; + + _mesa_error(ctx, err, + "glTexImage%dD(incompatible format = %s, type = %s)", + dimensions, _mesa_enum_to_string(format), + _mesa_enum_to_string(type)); + return GL_TRUE; } /* Check internalFormat */ @@ -2220,13 +2228,14 @@ texture_error_check( struct gl_context *ctx, return GL_TRUE; } - /* Check incoming image format and type */ - err = _mesa_error_check_format_and_type(ctx, format, type); - if (err != GL_NO_ERROR) { - _mesa_error(ctx, err, - "glTexImage%dD(incompatible format = %s, type = %s)", - dimensions, _mesa_enum_to_string(format), - _mesa_enum_to_string(type)); + /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the + * combinations of format, internalFormat, and type that can be used. + * Formats and types that require additional extensions (e.g., GL_FLOAT + * requires GL_OES_texture_float) are filtered elsewhere. + */ + if (_mesa_is_gles(ctx) && + texture_format_error_check_gles(ctx, format, type, internalFormat, + dimensions, "glTexImage%dD")) { return GL_TRUE; } |