[Mesa-stable] [PATCH v2] mesa: etc2 online compression is unsupported, don't attempt it

Ilia Mirkin imirkin at alum.mit.edu
Sat Jul 9 00:29:22 UTC 2016


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable at lists.freedesktop.org>
---

v1 -> v2: also include a mesa_is_etc2_format function which takes a GLenum.

 src/mesa/main/glformats.c | 23 +++++++++++++++++++++++
 src/mesa/main/glformats.h |  3 +++
 src/mesa/main/teximage.c  |  1 +
 3 files changed, 27 insertions(+)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 24ce7b0..90f525c 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -907,6 +907,29 @@ _mesa_is_astc_format(GLenum 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.
  */
 GLboolean
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index c73f464..474ede2 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -61,6 +61,9 @@ extern GLboolean
 _mesa_is_astc_format(GLenum internalFormat);
 
 extern GLboolean
+_mesa_is_etc2_format(GLenum internalFormat);
+
+extern GLboolean
 _mesa_is_type_unsigned(GLenum type);
 
 extern GLboolean
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 26a6c21..81e46a1 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -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);
 }
 
-- 
2.7.3



More information about the mesa-stable mailing list