summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Schürmann <[email protected]>2018-02-06 18:53:33 +0100
committerBas Nieuwenhuizen <[email protected]>2018-07-23 23:16:25 +0200
commit87989339a0d350b19b23b916af7886d3dd689ad3 (patch)
tree56674af95bef7882505b3a59af0db4a88c26937c /src
parent7e7ee82698247d8f93fe37775b99f4838b0247dd (diff)
nir: add 16bit type information to glsl types
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl_types.h15
-rw-r--r--src/compiler/nir_types.cpp12
-rw-r--r--src/compiler/nir_types.h1
3 files changed, 28 insertions, 0 deletions
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index efc63248656..d32b580acc1 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -87,6 +87,13 @@ enum glsl_base_type {
GLSL_TYPE_ERROR
};
+static inline bool glsl_base_type_is_16bit(enum glsl_base_type type)
+{
+ return type == GLSL_TYPE_FLOAT16 ||
+ type == GLSL_TYPE_UINT16 ||
+ type == GLSL_TYPE_INT16;
+}
+
static inline bool glsl_base_type_is_64bit(enum glsl_base_type type)
{
return type == GLSL_TYPE_DOUBLE ||
@@ -552,6 +559,14 @@ public:
}
/**
+ * Query whether or not a type is 16-bit
+ */
+ bool is_16bit() const
+ {
+ return glsl_base_type_is_16bit(base_type);
+ }
+
+ /**
* 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 6f1182b742c..3a3864414f3 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -165,6 +165,12 @@ glsl_get_record_location_offset(const struct glsl_type *type,
}
bool
+glsl_type_is_16bit(const glsl_type *type)
+{
+ return type->is_16bit();
+}
+
+bool
glsl_type_is_64bit(const glsl_type *type)
{
return type->is_64bit();
@@ -473,6 +479,12 @@ glsl_channel_type(const glsl_type *t)
return glsl_uint64_t_type();
case GLSL_TYPE_INT64:
return glsl_int64_t_type();
+ case GLSL_TYPE_FLOAT16:
+ return glsl_float16_t_type();
+ case GLSL_TYPE_UINT16:
+ return glsl_uint16_t_type();
+ case GLSL_TYPE_INT16:
+ return glsl_int16_t_type();
default:
unreachable("Unhandled base type glsl_channel_type()");
}
diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h
index c128250c7d3..817b7a9b345 100644
--- a/src/compiler/nir_types.h
+++ b/src/compiler/nir_types.h
@@ -121,6 +121,7 @@ glsl_get_bit_size(const struct glsl_type *type)
return 0;
}
+bool glsl_type_is_16bit(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);