From 93f4aa98894cbc57325b90ecb128b22e6448de23 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 6 Jun 2019 11:40:13 -0500 Subject: glsl/types: Add a real is_integer helper Reviewed-by: Karol Herbst --- 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(-) (limited to 'src/compiler') 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 @@ -585,6 +585,14 @@ public: return (base_type >= GLSL_TYPE_UINT) && (base_type <= GLSL_TYPE_INT64); } + /** + * 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. */ 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 -- cgit v1.2.3