diff options
author | Juan A. Suarez Romero <[email protected]> | 2018-02-05 17:00:11 +0100 |
---|---|---|
committer | Juan A. Suarez Romero <[email protected]> | 2018-02-05 17:00:19 +0100 |
commit | 3d14e720574ea933b172affdafd53c74a9381e9c (patch) | |
tree | 7ad808ed638b2c366abd3876410d44eee252b129 /src/mesa/main/teximage.c | |
parent | 02e2009b929a0f101540b9b55c5f0ed859d1b3be (diff) |
mesa: enable ASTC format for CompressedTexSubImage3D
If extensions GL_KHR_texture_compression_astc_hdr or
GL_KHR_texture_compression_astc_sliced_3d are implemented then ASTC
format are supported in CompressedTex*Îmage3D.
Fixes KHR-GLES2.texture_3d.* with this format.
CC: Eric Anholt <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Juan A. Suarez Romero <[email protected]>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r-- | src/mesa/main/teximage.c | 41 |
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; |