summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2014-06-06 12:35:55 -0700
committerAnuj Phogat <[email protected]>2014-08-04 17:12:14 -0700
commit938b3d003401538ceadac28ec5fe0e6ca583d2a6 (patch)
tree3da25baa664ab4971073bf082c1d715546025009 /src/mesa
parent6df48ff27ad14c341a7ba4f1f833c8dbfbd056c1 (diff)
mesa: Add utility function _mesa_is_enum_format_unorm()
V2: Add missing formats. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/glformats.c71
-rw-r--r--src/mesa/main/glformats.h3
2 files changed, 74 insertions, 0 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 77eee4f22ea..0fb25ba0ff3 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -410,6 +410,77 @@ _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_SLUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ case GL_SLUMINANCE_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_SRGB:
+ 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_SRGB_ALPHA:
+ 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 6c553aee821..7b032157076 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -60,6 +60,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