aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2012-12-27 13:24:57 -0800
committerJordan Justen <[email protected]>2013-01-12 01:40:47 -0800
commit6d63b6e50371afdcfe6dc7a4239380d07bc8e727 (patch)
tree94a86cece65ce522b1f2383fa69d186a90b99fc0
parent2ace406b1fa502219d353e5d259d1c4bcd5633a5 (diff)
glformats: add functions to detect signed/unsigned integer types
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/mesa/main/glformats.c54
-rw-r--r--src/mesa/main/glformats.h6
2 files changed, 46 insertions, 14 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index f33a0503da2..5683d4b0a1a 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -353,21 +353,9 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type)
* Test if the given format is an integer (non-normalized) format.
*/
GLboolean
-_mesa_is_enum_format_integer(GLenum format)
+_mesa_is_enum_format_unsigned_int(GLenum format)
{
switch (format) {
- /* generic integer formats */
- case GL_RED_INTEGER_EXT:
- case GL_GREEN_INTEGER_EXT:
- case GL_BLUE_INTEGER_EXT:
- case GL_ALPHA_INTEGER_EXT:
- case GL_RGB_INTEGER_EXT:
- case GL_RGBA_INTEGER_EXT:
- case GL_BGR_INTEGER_EXT:
- case GL_BGRA_INTEGER_EXT:
- case GL_LUMINANCE_INTEGER_EXT:
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- case GL_RG_INTEGER:
/* specific integer formats */
case GL_RGBA32UI_EXT:
case GL_RGB32UI_EXT:
@@ -393,6 +381,34 @@ _mesa_is_enum_format_integer(GLenum format)
case GL_INTENSITY8UI_EXT:
case GL_LUMINANCE8UI_EXT:
case GL_LUMINANCE_ALPHA8UI_EXT:
+ case GL_RGB10_A2UI:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test if the given format is an integer (non-normalized) format.
+ */
+GLboolean
+_mesa_is_enum_format_signed_int(GLenum format)
+{
+ switch (format) {
+ /* generic integer formats */
+ case GL_RED_INTEGER_EXT:
+ case GL_GREEN_INTEGER_EXT:
+ case GL_BLUE_INTEGER_EXT:
+ case GL_ALPHA_INTEGER_EXT:
+ case GL_RGB_INTEGER_EXT:
+ case GL_RGBA_INTEGER_EXT:
+ case GL_BGR_INTEGER_EXT:
+ case GL_BGRA_INTEGER_EXT:
+ case GL_LUMINANCE_INTEGER_EXT:
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ case GL_RG_INTEGER:
+ /* specific integer formats */
case GL_RGBA32I_EXT:
case GL_RGB32I_EXT:
case GL_RG32I:
@@ -417,7 +433,6 @@ _mesa_is_enum_format_integer(GLenum format)
case GL_INTENSITY8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_LUMINANCE_ALPHA8I_EXT:
- case GL_RGB10_A2UI:
return GL_TRUE;
default:
return GL_FALSE;
@@ -426,6 +441,17 @@ _mesa_is_enum_format_integer(GLenum format)
/**
+ * Test if the given format is an integer (non-normalized) format.
+ */
+GLboolean
+_mesa_is_enum_format_integer(GLenum format)
+{
+ return _mesa_is_enum_format_unsigned_int(format) ||
+ _mesa_is_enum_format_signed_int(format);
+}
+
+
+/**
* Test if the given type is an integer (non-normalized) format.
*/
GLboolean
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index ccfb5e13ca4..d1208ef4ffe 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -62,6 +62,12 @@ extern GLboolean
_mesa_is_enum_format_integer(GLenum format);
extern GLboolean
+_mesa_is_enum_format_unsigned_int(GLenum format);
+
+extern GLboolean
+_mesa_is_enum_format_signed_int(GLenum format);
+
+extern GLboolean
_mesa_is_enum_format_or_type_integer(GLenum format, GLenum type);
extern GLboolean