mesa: _mesa_is_format_integer() function
authorBrian Paul <brianp@vmware.com>
Sat, 23 Oct 2010 15:27:12 +0000 (09:27 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 23 Oct 2010 16:19:29 +0000 (10:19 -0600)
src/mesa/main/formats.c
src/mesa/main/formats.h

index 654ea03..3e78693 100644 (file)
@@ -945,6 +945,7 @@ _mesa_get_format_bits(gl_format format, GLenum pname)
  *    GL_UNSIGNED_NORMALIZED = unsigned int representing [0,1]
  *    GL_SIGNED_NORMALIZED = signed int representing [-1, 1]
  *    GL_UNSIGNED_INT = an ordinary unsigned integer
+ *    GL_INT = an ordinary signed integer
  *    GL_FLOAT = an ordinary float
  */
 GLenum
@@ -1007,6 +1008,17 @@ _mesa_is_format_packed_depth_stencil(gl_format format)
 
 
 /**
+ * Is the given format a signed/unsigned integer format?
+ */
+GLboolean
+_mesa_is_format_integer(gl_format format)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   return info->DataType == GL_INT || info->DataType == GL_UNSIGNED_INT;
+}
+
+
+/**
  * Return color encoding for given format.
  * \return GL_LINEAR or GL_SRGB
  */
index 7674d8e..73d85f2 100644 (file)
@@ -199,6 +199,9 @@ _mesa_is_format_compressed(gl_format format);
 extern GLboolean
 _mesa_is_format_packed_depth_stencil(gl_format format);
 
+extern GLboolean
+_mesa_is_format_integer(gl_format format);
+
 extern GLenum
 _mesa_get_format_color_encoding(gl_format format);