summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-05-08 17:21:45 -0400
committerIlia Mirkin <[email protected]>2016-05-23 22:34:37 -0400
commit37266dfb7c747536d254b32eefa9222c60a37508 (patch)
treef79f7eeb9a804f2b9c372da75d0000158fe51284 /src/mesa
parent979bcb9f4288564fb6c5807bcfbfd0a78176c3ef (diff)
mesa: add view classes for 3d astc formats
Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/textureview.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index ef4d7bbc6cb..9b584cdba68 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -210,7 +210,7 @@ static const struct internal_format_class_info gles_etc2_compatible_internal_for
static const struct internal_format_class_info gles_astc_compatible_internal_formats[] = {
#define ASTC_FMT(size) \
- {VIEW_CLASS_ASTC_##size## _RGBA, GL_COMPRESSED_RGBA_ASTC_##size##_KHR}, \
+ {VIEW_CLASS_ASTC_##size##_RGBA, GL_COMPRESSED_RGBA_ASTC_##size##_KHR}, \
{VIEW_CLASS_ASTC_##size##_RGBA, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_##size##_KHR}
ASTC_FMT(4x4),
@@ -230,6 +230,24 @@ static const struct internal_format_class_info gles_astc_compatible_internal_for
#undef ASTC_FMT
};
+static const struct internal_format_class_info gles_astc_3d_compatible_internal_formats[] = {
+#define ASTC_FMT(size) \
+ {VIEW_CLASS_ASTC_##size##_RGBA, GL_COMPRESSED_RGBA_ASTC_##size##_OES}, \
+ {VIEW_CLASS_ASTC_##size##_RGBA, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_##size##_OES}
+
+ ASTC_FMT(3x3x3),
+ ASTC_FMT(4x3x3),
+ ASTC_FMT(4x4x3),
+ ASTC_FMT(4x4x4),
+ ASTC_FMT(5x4x4),
+ ASTC_FMT(5x5x4),
+ ASTC_FMT(5x5x5),
+ ASTC_FMT(6x5x5),
+ ASTC_FMT(6x6x5),
+ ASTC_FMT(6x6x6),
+#undef ASTC_FMT
+};
+
GLenum
_mesa_texture_view_lookup_view_class(const struct gl_context *ctx, GLenum internalformat)
{
@@ -264,7 +282,13 @@ _mesa_texture_view_lookup_view_class(const struct gl_context *ctx, GLenum intern
}
}
- /* FINISHME: Add 3D OES formats when supported */
+ if (ctx->Extensions.OES_texture_compression_astc) {
+ for (i = 0; i < ARRAY_SIZE(gles_astc_3d_compatible_internal_formats); i++) {
+ if (gles_astc_3d_compatible_internal_formats[i].internal_format
+ == internalformat)
+ return gles_astc_3d_compatible_internal_formats[i].view_class;
+ }
+ }
}
return GL_FALSE;
}