Mesa (master): glsl/types: Add a real is_integer helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 19 20:40:16 UTC 2019


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

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Jun  6 11:40:13 2019 -0500

glsl/types: Add a real is_integer helper

Reviewed-by: Karol Herbst <kherbst at redhat.com>

---

 src/compiler/glsl_types.cpp | 2 +-
 src/compiler/glsl_types.h   | 8 ++++++++
 src/compiler/nir_types.cpp  | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 2e84d6ea72c..ded355ee308 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -246,7 +246,7 @@ glsl_type::contains_integer() const
       }
       return false;
    } else {
-      return glsl_base_type_is_integer(this->base_type);
+      return this->is_integer();
    }
 }
 
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index 693b0371151..e986b51d523 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -586,6 +586,14 @@ public:
    }
 
    /**
+    * Query whether or not a type is an integer.
+    */
+   bool is_integer() const
+   {
+      return glsl_base_type_is_integer(base_type);
+   }
+
+   /**
     * Query whether or not a type is an 32-bit integer.
     */
    bool is_integer_32() const
diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index 7fa1741515d..e2dfc40ff0b 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -355,7 +355,7 @@ glsl_type_is_boolean(const struct glsl_type *type)
 bool
 glsl_type_is_integer(const struct glsl_type *type)
 {
-   return glsl_base_type_is_integer(type->base_type);
+   return type->is_integer();
 }
 
 bool




More information about the mesa-commit mailing list