From 4f0c33196c0c4a9efb1210f2edc14096bdc7d9cf Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 2 Feb 2024 10:31:07 +0100 Subject: [PATCH] mesa: fix error-handling for ETC2/RGTC textures It seems we missed an error-case that got introduced in OpenGL 4.4. While this error doesn't *technically* exist as-is in OpenGL ES before version 3, neither does 3D textures. And while OES_texture_3D introduces it to OpenGL ES 2.0 without adding the same error for ETC2 textures, that is likely an omission in the spec; 3D ETC2 texture was never a thing. This fixes a regression in the confidential Khronos CTS, specifically GL46.gtf42.GL3Tests.texture_storage.texture_storage_compressed_texture_data Fixes: 652a898d316 ("mesa/main: add support for EXT_texture_storage") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10545 Reviewed-by: Alyssa Rosenzweig Tested-by: Alyssa Rosenzweig Part-of: --- src/mesa/main/teximage.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 9d4b386613b..462ab393c80 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1570,10 +1570,14 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target, case GL_TEXTURE_3D: switch (layout) { case MESA_FORMAT_LAYOUT_ETC2: - /* See ETC2/EAC comment in case GL_TEXTURE_CUBE_MAP_ARRAY. */ - if (_mesa_is_gles3(ctx)) - return write_error(error, GL_INVALID_OPERATION); - break; + case MESA_FORMAT_LAYOUT_RGTC: + /* From the OpenGL 4.4 compatibility spec: + * An INVALID_OPERATION error is generated by TexImage3D if + * internalformat is one of the EAC, ETC2, or RGTC compressed + * formats and either border is non-zero, or target is not + * TEXTURE_2D_ARRAY. + */ + return write_error(error, GL_INVALID_OPERATION); case MESA_FORMAT_LAYOUT_BPTC: target_can_be_compresed = ctx->Extensions.ARB_texture_compression_bptc; break;