mesa: fix error set for glCompressedTexSubImage calls
Desktop and ES expect a different error code here when dealing with generic compressed format tokens. This fixes failures with upcoming new tests for compressed texture related API calls. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11009>
This commit is contained in:
parent
a4e1501770
commit
586f84ce01
|
@ -5404,9 +5404,26 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dims,
|
||||||
struct gl_texture_image *texImage;
|
struct gl_texture_image *texImage;
|
||||||
GLint expectedSize;
|
GLint expectedSize;
|
||||||
|
|
||||||
|
GLenum is_generic_compressed_token =
|
||||||
|
_mesa_generic_compressed_format_to_uncompressed_format(format) !=
|
||||||
|
format;
|
||||||
|
|
||||||
|
/* OpenGL 4.6 and OpenGL ES 3.2 spec:
|
||||||
|
*
|
||||||
|
* "An INVALID_OPERATION error is generated if format does not match the
|
||||||
|
* internal format of the texture image being modified, since these commands do
|
||||||
|
* not provide for image format conversion."
|
||||||
|
*
|
||||||
|
* Desktop spec has an additional rule for GL_INVALID_ENUM:
|
||||||
|
*
|
||||||
|
* "An INVALID_ENUM error is generated if format is one of the generic
|
||||||
|
* compressed internal formats."
|
||||||
|
*/
|
||||||
/* this will catch any invalid compressed format token */
|
/* this will catch any invalid compressed format token */
|
||||||
if (!_mesa_is_compressed_format(ctx, format)) {
|
if (!_mesa_is_compressed_format(ctx, format)) {
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM, "%s(format)", callerName);
|
GLenum error = _mesa_is_desktop_gl(ctx) && is_generic_compressed_token ?
|
||||||
|
GL_INVALID_ENUM : GL_INVALID_OPERATION;
|
||||||
|
_mesa_error(ctx, error, "%s(format)", callerName);
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue