mesa: etc2 online compression is unsupported, don't attempt it
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 8 Jul 2016 22:41:03 +0000 (18:41 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 12 Jul 2016 01:17:01 +0000 (21:17 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
src/mesa/main/glformats.c
src/mesa/main/glformats.h
src/mesa/main/teximage.c

index 448577e059fa922b1deb4faeb3731930edb1077a..0c2210a42d9f0bdf36df6a7d169312fa0a5b03e7 100644 (file)
@@ -906,6 +906,29 @@ _mesa_is_astc_format(GLenum internalFormat)
           is_astc_3d_format(internalFormat);
 }
 
+/**
+ * Test if the given format is an ETC2 format.
+ */
+GLboolean
+_mesa_is_etc2_format(GLenum internalFormat)
+{
+   switch (internalFormat) {
+   case GL_COMPRESSED_RGB8_ETC2:
+   case GL_COMPRESSED_SRGB8_ETC2:
+   case GL_COMPRESSED_RGBA8_ETC2_EAC:
+   case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+   case GL_COMPRESSED_R11_EAC:
+   case GL_COMPRESSED_RG11_EAC:
+   case GL_COMPRESSED_SIGNED_R11_EAC:
+   case GL_COMPRESSED_SIGNED_RG11_EAC:
+   case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+   case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+      return true;
+   default:
+      return false;
+   }
+}
+
 /**
  * Test if the given format is an integer (non-normalized) format.
  */
index 782e0f2edc85c4e050acbd2bb3c379e26642d42d..763307f259316201c7b0a0ae1f585f27a492e447 100644 (file)
@@ -60,6 +60,9 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type);
 extern GLboolean
 _mesa_is_astc_format(GLenum internalFormat);
 
+extern GLboolean
+_mesa_is_etc2_format(GLenum internalFormat);
+
 extern GLboolean
 _mesa_is_type_unsigned(GLenum type);
 
index 26a6c21cd0f6d31c68393a0f4aaf36a328f774b9..81e46a170ae1f2405c538a09eb2a4277f32fd545 100644 (file)
@@ -1307,6 +1307,7 @@ bool
 _mesa_format_no_online_compression(const struct gl_context *ctx, GLenum format)
 {
    return _mesa_is_astc_format(format) ||
+          _mesa_is_etc2_format(format) ||
           compressedteximage_only_format(ctx, format);
 }