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

Carl Worth cworth at kemper.freedesktop.org
Wed Apr 23 09:27:25 UTC 2014


Module: Mesa
Branch: 10.1
Commit: 66765bb6a656af5cbc39ed3d04d16ecfc39e7643
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=66765bb6a656af5cbc39ed3d04d16ecfc39e7643

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>
(cherry picked from commit 313566825405c33f26a0471a997ec4c79fae6b08)

---

 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 f6c399e..774790d 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -2012,6 +2012,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 8c8e95f..64784e4 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -682,6 +682,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