nir: Add helpers for getting input/output intrinsic sources.
[mesa.git] / src / glsl / nir / nir_types.cpp
index a13c3e12a86e169470ff130b7543c39ecd311e33..135591ab97d2d4d17984b1b1ff0a26b81f3063c5 100644 (file)
@@ -103,7 +103,13 @@ glsl_get_matrix_columns(const struct glsl_type *type)
 unsigned
 glsl_get_length(const struct glsl_type *type)
 {
-   return type->length;
+   return type->is_matrix() ? type->matrix_columns : type->length;
+}
+
+unsigned
+glsl_get_aoa_size(const struct glsl_type *type)
+{
+   return type->arrays_of_arrays_size();
 }
 
 const char *
@@ -112,6 +118,13 @@ glsl_get_struct_elem_name(const struct glsl_type *type, unsigned index)
    return type->fields.structure[index].name;
 }
 
+unsigned
+glsl_get_record_location_offset(const struct glsl_type *type,
+                                unsigned length)
+{
+   return type->record_location_offset(length);
+}
+
 bool
 glsl_type_is_void(const glsl_type *type)
 {
@@ -130,6 +143,12 @@ glsl_type_is_scalar(const struct glsl_type *type)
    return type->is_scalar();
 }
 
+bool
+glsl_type_is_vector_or_scalar(const struct glsl_type *type)
+{
+   return type->is_vector() || type->is_scalar();
+}
+
 bool
 glsl_type_is_matrix(const struct glsl_type *type)
 {
@@ -142,12 +161,24 @@ glsl_void_type(void)
    return glsl_type::void_type;
 }
 
+const glsl_type *
+glsl_float_type(void)
+{
+   return glsl_type::float_type;
+}
+
 const glsl_type *
 glsl_vec4_type(void)
 {
    return glsl_type::vec4_type;
 }
 
+const glsl_type *
+glsl_uint_type(void)
+{
+   return glsl_type::uint_type;
+}
+
 const glsl_type *
 glsl_array_type(const glsl_type *base, unsigned elements)
 {