summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/teximage.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index cc329e6410e..928e50d472d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4647,10 +4647,12 @@ out:
*/
static GLboolean
compressed_subtexture_target_check(struct gl_context *ctx, GLenum target,
- GLint dims, GLenum format, bool dsa,
+ GLint dims, GLenum intFormat, bool dsa,
const char *caller)
{
GLboolean targetOK;
+ mesa_format format;
+ enum mesa_format_layout layout;
if (dsa && target == GL_TEXTURE_RECTANGLE) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid target %s)", caller,
@@ -4711,21 +4713,44 @@ compressed_subtexture_target_check(struct gl_context *ctx, GLenum target,
* which is (at this time) only bptc. Otherwise we'd say s3tc (and
* more) are valid here, which they are not, but of course not
* mentioned by core spec.
+ *
+ * Also, from GL_KHR_texture_compression_astc_{hdr,ldr}:
+ *
+ * "Add a second new column "3D Tex." which is empty for all non-ASTC
+ * formats. If only the LDR profile is supported by the implementation,
+ * this column is also empty for all ASTC formats. If both the LDR and HDR
+ * profiles are supported, this column is checked for all ASTC formats."
+ *
+ * "An INVALID_OPERATION error is generated by CompressedTexSubImage3D if
+ * <format> is one of the formats in table 8.19 and <target> is not
+ * TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY, or TEXTURE_3D.
+ *
+ * An INVALID_OPERATION error is generated by CompressedTexSubImage3D if
+ * <format> is TEXTURE_CUBE_MAP_ARRAY and the "Cube Map Array" column of
+ * table 8.19 is *not* checked, or if <format> is TEXTURE_3D and the "3D
+ * Tex." column of table 8.19 is *not* checked"
+ *
+ * And from GL_KHR_texture_compression_astc_sliced_3d:
+ *
+ * "Modify the "3D Tex." column to be checked for all ASTC formats."
*/
- switch (format) {
- /* These are the only 3D compression formats supported at this time */
- case GL_COMPRESSED_RGBA_BPTC_UNORM:
- case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
- case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
- case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
+ format = _mesa_glenum_to_compressed_format(intFormat);
+ layout = _mesa_get_format_layout(format);
+ switch (layout) {
+ case MESA_FORMAT_LAYOUT_BPTC:
/* valid format */
break;
+ case MESA_FORMAT_LAYOUT_ASTC:
+ targetOK =
+ ctx->Extensions.KHR_texture_compression_astc_hdr ||
+ ctx->Extensions.KHR_texture_compression_astc_sliced_3d;
+ break;
default:
/* invalid format */
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(invalid target %s for format %s)", caller,
_mesa_enum_to_string(target),
- _mesa_enum_to_string(format));
+ _mesa_enum_to_string(intFormat));
return GL_TRUE;
}
break;