summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2019-02-06 12:27:39 +1100
committerTimothy Arceri <[email protected]>2019-02-08 02:54:56 +0000
commite041123841385d308b1cdd91d8f83d1633cd31a8 (patch)
treead990522cc2b4c3e983de01ec1e9e318c369ded9
parent7b01d5c354c60058a7ab4312d6e08f1cd71e5449 (diff)
nir: add glsl_type_is_32bit() helper
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/compiler/glsl_types.h10
-rw-r--r--src/compiler/nir_types.cpp6
-rw-r--r--src/compiler/nir_types.h1
3 files changed, 17 insertions, 0 deletions
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
@@ -585,6 +585,16 @@ public:
}
/**
+ * 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
*/
bool is_boolean() const
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
@@ -205,6 +205,12 @@ glsl_type_is_16bit(const glsl_type *type)
}
bool
+glsl_type_is_32bit(const glsl_type *type)
+{
+ return type->is_32bit();
+}
+
+bool
glsl_type_is_64bit(const glsl_type *type)
{
return type->is_64bit();
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);