this->fields.structure[i].location = fields[i].location;
this->fields.structure[i].interpolation = fields[i].interpolation;
this->fields.structure[i].centroid = fields[i].centroid;
+ this->fields.structure[i].sample = fields[i].sample;
this->fields.structure[i].row_major = fields[i].row_major;
}
}
this->fields.structure[i].location = fields[i].location;
this->fields.structure[i].interpolation = fields[i].interpolation;
this->fields.structure[i].centroid = fields[i].centroid;
+ this->fields.structure[i].sample = fields[i].sample;
this->fields.structure[i].row_major = fields[i].row_major;
}
}
}
}
+bool
+glsl_type::contains_opaque() const {
+ switch (base_type) {
+ case GLSL_TYPE_SAMPLER:
+ case GLSL_TYPE_ATOMIC_UINT:
+ return true;
+ case GLSL_TYPE_ARRAY:
+ return element_type()->contains_opaque();
+ case GLSL_TYPE_STRUCT:
+ for (unsigned int i = 0; i < length; i++) {
+ if (fields.structure[i].type->contains_opaque())
+ return true;
+ }
+ return false;
+ default:
+ return false;
+ }
+}
gl_texture_index
glsl_type::sampler_index() const
if (length == 0)
snprintf(n, name_length, "%s[]", array->name);
- else
- snprintf(n, name_length, "%s[%u]", array->name, length);
+ else {
+ /* insert outermost dimensions in the correct spot
+ * otherwise the dimension order will be backwards
+ */
+ const char *pos = strchr(array->name, '[');
+ if (pos) {
+ int idx = pos - array->name;
+ snprintf(n, idx+1, "%s", array->name);
+ snprintf(n + idx, name_length - idx, "[%u]%s",
+ length, array->name + idx);
+ } else {
+ snprintf(n, name_length, "%s[%u]", array->name, length);
+ }
+ }
this->name = n;
}
}
+bool
+glsl_type::record_compare(const glsl_type *b) const
+{
+ if (this->length != b->length)
+ return false;
+
+ if (this->interface_packing != b->interface_packing)
+ return false;
+
+ for (unsigned i = 0; i < this->length; i++) {
+ if (this->fields.structure[i].type != b->fields.structure[i].type)
+ return false;
+ if (strcmp(this->fields.structure[i].name,
+ b->fields.structure[i].name) != 0)
+ return false;
+ if (this->fields.structure[i].row_major
+ != b->fields.structure[i].row_major)
+ return false;
+ if (this->fields.structure[i].location
+ != b->fields.structure[i].location)
+ return false;
+ if (this->fields.structure[i].interpolation
+ != b->fields.structure[i].interpolation)
+ return false;
+ if (this->fields.structure[i].centroid
+ != b->fields.structure[i].centroid)
+ return false;
+ if (this->fields.structure[i].sample
+ != b->fields.structure[i].sample)
+ return false;
+ }
+
+ return true;
+}
+
+
int
glsl_type::record_key_compare(const void *a, const void *b)
{
if (strcmp(key1->name, key2->name) != 0)
return 1;
- if (key1->length != key2->length)
- return 1;
-
- if (key1->interface_packing != key2->interface_packing)
- return 1;
-
- for (unsigned i = 0; i < key1->length; i++) {
- if (key1->fields.structure[i].type != key2->fields.structure[i].type)
- return 1;
- if (strcmp(key1->fields.structure[i].name,
- key2->fields.structure[i].name) != 0)
- return 1;
- if (key1->fields.structure[i].row_major
- != key2->fields.structure[i].row_major)
- return 1;
- if (key1->fields.structure[i].location
- != key2->fields.structure[i].location)
- return 1;
- if (key1->fields.structure[i].interpolation
- != key2->fields.structure[i].interpolation)
- return 1;
- if (key1->fields.structure[i].centroid
- != key2->fields.structure[i].centroid)
- return 1;
- }
-
- return 0;
+ return !key1->record_compare(key2);
}
return this->length * this->fields.array->component_slots();
case GLSL_TYPE_SAMPLER:
+ case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
break;
return this->length * this->fields.array->count_attribute_slots();
case GLSL_TYPE_SAMPLER:
+ case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
break;