mesa/main: allow S3TC for 3D textures

This is allowed by D3D, RADV, ANV and Nvidia GL drivers
at least, so it should work on any hardware with S3TC.

Confirmed to work in OpenXRay on radeonsi.

Signed-off-by: Pavel Asyutchenko <svenpavel@gmail.com>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26389>
This commit is contained in:
Pavel Asyutchenko 2023-11-28 21:44:53 +01:00 committed by Marge Bot
parent a9064837f8
commit a921a69010

View file

@ -1577,6 +1577,21 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
case MESA_FORMAT_LAYOUT_BPTC:
target_can_be_compresed = ctx->Extensions.ARB_texture_compression_bptc;
break;
case MESA_FORMAT_LAYOUT_S3TC:
/* From the EXT_texture_compression_s3tc spec:
*
* In extended OpenGL ES 3.0.2 these new tokens are also accepted by the
* <internalformat> parameter of TexImage3D, CompressedTexImage3D,
* TexStorage2D, TexStorage3D and the <format> parameter of
* CompressedTexSubImage3D.
*
* The spec does not clarify whether the same applies to newer desktop GL versions
* (where 3D textures were introduced), check compatibility ext to be safe.
*/
target_can_be_compresed =
ctx->Extensions.EXT_texture_compression_s3tc &&
(_mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility);
break;
case MESA_FORMAT_LAYOUT_ASTC:
target_can_be_compresed =
ctx->Extensions.KHR_texture_compression_astc_hdr ||
@ -5532,6 +5547,11 @@ compressed_subtexture_target_check(struct gl_context *ctx, GLenum target,
case MESA_FORMAT_LAYOUT_BPTC:
/* valid format */
break;
case MESA_FORMAT_LAYOUT_S3TC:
targetOK =
ctx->Extensions.EXT_texture_compression_s3tc &&
(_mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility);
break;
case MESA_FORMAT_LAYOUT_ASTC:
targetOK =
ctx->Extensions.KHR_texture_compression_astc_hdr ||