}
unsigned
-glsl_type::count_attribute_slots(bool is_vertex_input) const
+glsl_type::count_attribute_slots(bool is_gl_vertex_input) const
{
/* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec:
*
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
- if (this->vector_elements > 2 && !is_vertex_input)
+ if (this->vector_elements > 2 && !is_gl_vertex_input)
return this->matrix_columns * 2;
else
return this->matrix_columns;
case GLSL_TYPE_INTERFACE: {
unsigned size = 0;
- for (unsigned i = 0; i < this->length; i++)
- size += this->fields.structure[i].type->count_attribute_slots(is_vertex_input);
+ for (unsigned i = 0; i < this->length; i++) {
+ const glsl_type *member_type = this->fields.structure[i].type;
+ size += member_type->count_attribute_slots(is_gl_vertex_input);
+ }
return size;
}
- case GLSL_TYPE_ARRAY:
- return this->length * this->fields.array->count_attribute_slots(is_vertex_input);
+ case GLSL_TYPE_ARRAY: {
+ const glsl_type *element = this->fields.array;
+ return this->length * element->count_attribute_slots(is_gl_vertex_input);
+ }
case GLSL_TYPE_SUBROUTINE:
return 1;
*
* For vertex shader attributes - doubles only take one slot.
* For inter-shader varyings - dvec3/dvec4 take two slots.
+ *
+ * Vulkan doesn’t make this distinction so the argument should always be
+ * false.
*/
- unsigned count_attribute_slots(bool is_vertex_input) const;
+ unsigned count_attribute_slots(bool is_gl_vertex_input) const;
/**
* Alignment in bytes of the start of this type in a std140 uniform
unsigned
glsl_count_attribute_slots(const struct glsl_type *type,
- bool is_vertex_input)
+ bool is_gl_vertex_input)
{
- return type->count_attribute_slots(is_vertex_input);
+ return type->count_attribute_slots(is_gl_vertex_input);
}
unsigned
unsigned glsl_get_aoa_size(const struct glsl_type *type);
unsigned glsl_count_attribute_slots(const struct glsl_type *type,
- bool is_vertex_input);
+ bool is_gl_vertex_input);
unsigned glsl_get_component_slots(const struct glsl_type *type);
const char *glsl_get_struct_elem_name(const struct glsl_type *type,