glsl_type::init_ralloc_type_ctx(void)
{
if (glsl_type::mem_ctx == NULL) {
- glsl_type::mem_ctx = ralloc_autofree_context();
+ glsl_type::mem_ctx = ralloc_context(NULL);
assert(glsl_type::mem_ctx != NULL);
}
}
memset(& fields, 0, sizeof(fields));
- if (base_type == GLSL_TYPE_SAMPLER) {
- /* Samplers take no storage whatsoever. */
- matrix_columns = vector_elements = 0;
- } else {
- matrix_columns = vector_elements = 1;
- }
+ matrix_columns = vector_elements = 1;
}
glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
}
}
+bool
+glsl_type::contains_array() const
+{
+ if (this->is_record() || this->is_interface()) {
+ for (unsigned int i = 0; i < this->length; i++) {
+ if (this->fields.structure[i].type->contains_array())
+ return true;
+ }
+ return false;
+ } else {
+ return this->is_array();
+ }
+}
bool
glsl_type::contains_integer() const
{
const glsl_type *const t = (this->is_array()) ? this->fields.array : this;
- assert(t->is_sampler());
+ assert(t->is_sampler() || t->is_image());
switch (t->sampler_dimensionality) {
case GLSL_SAMPLER_DIM_1D:
_mesa_hash_table_destroy(glsl_type::interface_types, NULL);
glsl_type::interface_types = NULL;
}
+
+ if (glsl_type::function_types != NULL) {
+ _mesa_hash_table_destroy(glsl_type::function_types, NULL);
+ glsl_type::function_types = NULL;
+ }
+
+ if (glsl_type::subroutine_types != NULL) {
+ _mesa_hash_table_destroy(glsl_type::subroutine_types, NULL);
+ glsl_type::subroutine_types = NULL;
+ }
+
+ ralloc_free(glsl_type::mem_ctx);
+ glsl_type::mem_ctx = NULL;
}
if (this->fields.structure[i].patch
!= b->fields.structure[i].patch)
return false;
- if (this->fields.structure[i].image_read_only
- != b->fields.structure[i].image_read_only)
+ if (this->fields.structure[i].memory_read_only
+ != b->fields.structure[i].memory_read_only)
+ return false;
+ if (this->fields.structure[i].memory_write_only
+ != b->fields.structure[i].memory_write_only)
return false;
- if (this->fields.structure[i].image_write_only
- != b->fields.structure[i].image_write_only)
+ if (this->fields.structure[i].memory_coherent
+ != b->fields.structure[i].memory_coherent)
return false;
- if (this->fields.structure[i].image_coherent
- != b->fields.structure[i].image_coherent)
+ if (this->fields.structure[i].memory_volatile
+ != b->fields.structure[i].memory_volatile)
return false;
- if (this->fields.structure[i].image_volatile
- != b->fields.structure[i].image_volatile)
+ if (this->fields.structure[i].memory_restrict
+ != b->fields.structure[i].memory_restrict)
return false;
- if (this->fields.structure[i].image_restrict
- != b->fields.structure[i].image_restrict)
+ if (this->fields.structure[i].image_format
+ != b->fields.structure[i].image_format)
return false;
if (this->fields.structure[i].precision
!= b->fields.structure[i].precision)
case GLSL_TYPE_ARRAY:
return this->length * this->fields.array->component_slots();
+ case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
- return 1;
+ return 2;
+
case GLSL_TYPE_SUBROUTINE:
- return 1;
+ return 1;
case GLSL_TYPE_FUNCTION:
- case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
case GLSL_TYPE_INT:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_BOOL:
+ case GLSL_TYPE_SAMPLER:
+ case GLSL_TYPE_IMAGE:
return this->matrix_columns;
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT64:
return this->length * this->fields.array->count_attribute_slots(is_vertex_input);
case GLSL_TYPE_FUNCTION:
- case GLSL_TYPE_SAMPLER:
- case GLSL_TYPE_IMAGE:
case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
case GLSL_TYPE_SUBROUTINE: