From: Jason Ekstrand Date: Thu, 6 Jun 2019 16:40:13 +0000 (-0500) Subject: glsl/types: Add a real is_integer helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=93f4aa98894cbc57325b90ecb128b22e6448de23;p=mesa.git glsl/types: Add a real is_integer helper Reviewed-by: Karol Herbst --- 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