Mesa (master): mesa: Add helper function _mesa_is_format_integer()

Anuj Phogat aphogat at kemper.freedesktop.org
Thu Apr 17 01:45:48 UTC 2014


Module: Mesa
Branch: master
Commit: 313566825405c33f26a0471a997ec4c79fae6b08
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=313566825405c33f26a0471a997ec4c79fae6b08

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Tue Mar 25 13:00:12 2014 -0700

mesa: Add helper function _mesa_is_format_integer()

This function will be used in the following patch.

Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/formats.c |    9 +++++++++
 src/mesa/main/formats.h |    3 +++
 2 files changed, 12 insertions(+)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index fb2501c..5c67011 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -2035,6 +2035,15 @@ _mesa_is_format_signed(mesa_format format)
    }
 }
 
+/**
+ * Is the given format an integer format?
+ */
+GLboolean
+_mesa_is_format_integer(mesa_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.
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 89bd021..185010e 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -445,6 +445,9 @@ _mesa_is_format_unsigned(mesa_format format);
 extern GLboolean
 _mesa_is_format_signed(mesa_format format);
 
+extern GLboolean
+_mesa_is_format_integer(mesa_format format);
+
 extern GLenum
 _mesa_get_format_color_encoding(mesa_format format);
 




More information about the mesa-commit mailing list