summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-06-06 11:40:13 -0500
committerJason Ekstrand <[email protected]>2019-06-19 20:28:52 +0000
commit93f4aa98894cbc57325b90ecb128b22e6448de23 (patch)
treef1e2cdbc948a5332afdb707bfbd6ce0fc7777ac6
parentf0920e266c152044cb05892f3aea5a17a163cc02 (diff)
glsl/types: Add a real is_integer helper
Reviewed-by: Karol Herbst <[email protected]>
-rw-r--r--src/compiler/glsl_types.cpp2
-rw-r--r--src/compiler/glsl_types.h8
-rw-r--r--src/compiler/nir_types.cpp2
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