From e041123841385d308b1cdd91d8f83d1633cd31a8 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 6 Feb 2019 12:27:39 +1100 Subject: nir: add glsl_type_is_32bit() helper Reviewed-by: Jason Ekstrand --- src/compiler/glsl_types.h | 10 ++++++++++ src/compiler/nir_types.cpp | 6 ++++++ src/compiler/nir_types.h | 1 + 3 files changed, 17 insertions(+) (limited to 'src/compiler') 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); -- cgit v1.2.3