From: Timothy Arceri Date: Wed, 6 Feb 2019 01:27:39 +0000 (+1100) Subject: nir: add glsl_type_is_32bit() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e041123841385d308b1cdd91d8f83d1633cd31a8;p=mesa.git nir: add glsl_type_is_32bit() helper Reviewed-by: Jason Ekstrand --- diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index bdaeee7ddd7..bf9be0f48fb 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -584,6 +584,16 @@ public: return glsl_base_type_is_16bit(base_type); } + /** + * Query whether or not a type is 32-bit + */ + bool is_32bit() const + { + return base_type == GLSL_TYPE_UINT || + base_type == GLSL_TYPE_INT || + base_type == GLSL_TYPE_FLOAT; + } + /** * Query whether or not a type is a non-array boolean type */ diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index b4bde5470c0..b12aa297da3 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -204,6 +204,12 @@ glsl_type_is_16bit(const glsl_type *type) return type->is_16bit(); } +bool +glsl_type_is_32bit(const glsl_type *type) +{ + return type->is_32bit(); +} + bool glsl_type_is_64bit(const glsl_type *type) { diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h index 40cddf76374..34f4252a9e2 100644 --- a/src/compiler/nir_types.h +++ b/src/compiler/nir_types.h @@ -131,6 +131,7 @@ glsl_get_bit_size(const struct glsl_type *type) } bool glsl_type_is_16bit(const struct glsl_type *type); +bool glsl_type_is_32bit(const struct glsl_type *type); bool glsl_type_is_64bit(const struct glsl_type *type); bool glsl_type_is_void(const struct glsl_type *type); bool glsl_type_is_error(const struct glsl_type *type);