+ }
+
+ /* Matrix and vector types with explicit strides have to be looked up in a
+ * table so they're handled separately.
+ */
+ if (explicit_stride > 0) {
+ const glsl_type *bare_type = get_instance(base_type, rows, columns);
+
+ assert(columns > 1 || !row_major);
+
+ char name[128];
+ util_snprintf(name, sizeof(name), "%sx%uB%s", bare_type->name,
+ explicit_stride, row_major ? "RM" : "");
+
+ mtx_lock(&glsl_type::hash_mutex);
+
+ if (explicit_matrix_types == NULL) {
+ explicit_matrix_types =
+ _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ _mesa_key_string_equal);
+ }
+
+ const struct hash_entry *entry =
+ _mesa_hash_table_search(explicit_matrix_types, name);
+ if (entry == NULL) {
+ const glsl_type *t = new glsl_type(bare_type->gl_type,
+ (glsl_base_type)base_type,
+ rows, columns, name,
+ explicit_stride, row_major);
+
+ entry = _mesa_hash_table_insert(explicit_matrix_types,
+ t->name, (void *)t);
+ }
+
+ assert(((glsl_type *) entry->data)->base_type == base_type);
+ assert(((glsl_type *) entry->data)->vector_elements == rows);
+ assert(((glsl_type *) entry->data)->matrix_columns == columns);
+ assert(((glsl_type *) entry->data)->explicit_stride == explicit_stride);
+
+ mtx_unlock(&glsl_type::hash_mutex);
+
+ return (const glsl_type *) entry->data;
+ }
+
+ assert(!row_major);