Merge ../mesa into vulkan
[mesa.git] / src / glsl / nir / nir_types.cpp
index 3542150654567f6526bdd9179ed2493127fbcdd4..01f0e9b5abcc6a17bdd7fd47423a8349609f1175 100644 (file)
@@ -138,6 +138,13 @@ glsl_get_sampler_result_type(const struct glsl_type *type)
    return (glsl_base_type)type->sampler_type;
 }
 
+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)
 {
@@ -168,6 +175,18 @@ glsl_type_is_matrix(const struct glsl_type *type)
    return type->is_matrix();
 }
 
+bool
+glsl_type_is_array(const struct glsl_type *type)
+{
+   return type->is_array();
+}
+
+bool
+glsl_type_is_struct(const struct glsl_type *type)
+{
+   return type->is_record() || type->is_interface();
+}
+
 bool
 glsl_type_is_sampler(const struct glsl_type *type)
 {
@@ -240,7 +259,7 @@ glsl_vector_type(enum glsl_base_type base_type, unsigned components)
 const glsl_type *
 glsl_matrix_type(enum glsl_base_type base_type, unsigned rows, unsigned columns)
 {
-   assert(rows > 1 && rows <= 4 && columns > 1 && columns <= 4);
+   assert(rows > 1 && rows <= 4 && columns >= 1 && columns <= 4);
    return glsl_type::get_instance(base_type, rows, columns);
 }
 
@@ -270,3 +289,10 @@ glsl_function_type(const glsl_type *return_type,
 {
    return glsl_type::get_function_instance(return_type, params, num_params);
 }
+
+const glsl_type *
+glsl_transposed_type(const struct glsl_type *type)
+{
+   return glsl_type::get_instance(type->base_type, type->matrix_columns,
+                                  type->vector_elements);
+}