[Mesa-dev] [PATCH 14/15] mesa: Add utility function _mesa_is_enum_format_unorm()
Anuj Phogat
anuj.phogat at gmail.com
Fri Jun 6 16:57:10 PDT 2014
Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
src/mesa/main/glformats.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++
src/mesa/main/glformats.h | 3 +++
2 files changed, 70 insertions(+)
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index b95ecea..8107757 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -374,6 +374,73 @@ _mesa_is_enum_format_unsized(GLenum format)
}
/**
+ * Test if the given format is a UNORM (unsigned-normalized) format.
+ */
+GLboolean
+_mesa_is_enum_format_unorm(GLenum format)
+{
+ switch(format) {
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ case 1:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY8:
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ case GL_R8:
+ case GL_R16:
+ case GL_RG:
+ case GL_RG8:
+ case GL_RG16:
+ case 3:
+ case GL_RGB:
+ case GL_BGR:
+ case GL_R3_G3_B2:
+ case GL_RGB4:
+ case GL_RGB5:
+ case GL_RGB565:
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ case 4:
+ case GL_ABGR_EXT:
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_RGBA2:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+/**
* Test if the given format is a SNORM (signed-normalized) format.
*/
GLboolean
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index b2ef77b..ce6e438 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -63,6 +63,9 @@ extern GLboolean
_mesa_is_enum_format_unsized(GLenum format);
extern GLboolean
+_mesa_is_enum_format_unorm(GLenum format);
+
+extern GLboolean
_mesa_is_enum_format_snorm(GLenum format);
extern GLboolean
--
1.8.3.1
More information about the mesa-dev
mailing list