summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-08-02 20:24:34 +0200
committerMarek Olšák <[email protected]>2014-08-11 21:53:57 +0200
commitddc8003c61480aa5cbab72435243aa6f99677440 (patch)
treef4cb55d8d64d48596997db5641c7f8770ce71fb0 /src/mesa/main
parentf24be7340162c6a831b392d46d6637e9656e7a8a (diff)
mesa: add helper _mesa_is_format_etc2
v2: renamed GLboolean -> bool Reviewed-by: Glenn Kennard <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/formats.c25
-rw-r--r--src/mesa/main/formats.h3
2 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index f03425e4169..a4ddbd66963 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -377,6 +377,31 @@ _mesa_get_format_color_encoding(mesa_format format)
/**
+ * Return TRUE if format is an ETC2 compressed format specified
+ * by GL_ARB_ES3_compatibility.
+ */
+bool
+_mesa_is_format_etc2(mesa_format format)
+{
+ switch (format) {
+ case MESA_FORMAT_ETC2_RGB8:
+ case MESA_FORMAT_ETC2_SRGB8:
+ case MESA_FORMAT_ETC2_RGBA8_EAC:
+ case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
+ case MESA_FORMAT_ETC2_R11_EAC:
+ case MESA_FORMAT_ETC2_RG11_EAC:
+ case MESA_FORMAT_ETC2_SIGNED_R11_EAC:
+ case MESA_FORMAT_ETC2_SIGNED_RG11_EAC:
+ case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1:
+ case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
* For an sRGB format, return the corresponding linear color space format.
* For non-sRGB formats, return the format as-is.
*/
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 457c8abf822..8166b964c7f 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -476,6 +476,9 @@ _mesa_is_format_signed(mesa_format format);
extern GLboolean
_mesa_is_format_integer(mesa_format format);
+extern bool
+_mesa_is_format_etc2(mesa_format format);
+
extern GLenum
_mesa_get_format_color_encoding(mesa_format format);