[Mesa-dev] [PATCH v2 12/25] compiler/nir: add glsl_type_is_{float, integer}()

Juan A. Suarez Romero jasuarez at igalia.com
Fri Dec 16 14:48:58 UTC 2016


From: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
 src/compiler/nir_types.cpp | 15 +++++++++++++++
 src/compiler/nir_types.h   |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index cc90efd..ea3bcb8 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -235,6 +235,21 @@ glsl_type_is_numeric(const struct glsl_type *type)
 }
 
 bool
+glsl_type_is_integer(const struct glsl_type *type)
+{
+   return (type->base_type == GLSL_TYPE_INT ||
+           type->base_type == GLSL_TYPE_UINT);
+}
+
+bool
+glsl_type_is_float(const struct glsl_type *type)
+{
+   return (type->base_type == GLSL_TYPE_FLOAT ||
+           type->base_type == GLSL_TYPE_DOUBLE);
+}
+
+
+bool
 glsl_type_is_boolean(const struct glsl_type *type)
 {
    return type->is_boolean();
diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h
index 9088a06..cf15ffc 100644
--- a/src/compiler/nir_types.h
+++ b/src/compiler/nir_types.h
@@ -114,6 +114,8 @@ bool glsl_type_is_sampler(const struct glsl_type *type);
 bool glsl_type_is_image(const struct glsl_type *type);
 bool glsl_type_is_dual_slot(const struct glsl_type *type);
 bool glsl_type_is_numeric(const struct glsl_type *type);
+bool glsl_type_is_integer(const struct glsl_type *type);
+bool glsl_type_is_float(const struct glsl_type *type);
 bool glsl_type_is_boolean(const struct glsl_type *type);
 bool glsl_sampler_type_is_shadow(const struct glsl_type *type);
 bool glsl_sampler_type_is_array(const struct glsl_type *type);
-- 
2.9.3



More information about the mesa-dev mailing list