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 <alyssa@rosenzweig.io>
Tested-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27428>
This commit is contained in:
Erik Faye-Lund 2024-02-02 10:31:07 +01:00 committed by Marge Bot
parent 5d293f01cc
commit 4f0c33196c

View file

@ -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;