diff options
author | Neil Roberts <[email protected]> | 2018-03-28 11:00:28 +0200 |
---|---|---|
committer | Alejandro Piñeiro <[email protected]> | 2019-01-28 11:42:46 +0100 |
commit | 5c797f73548e44233c8c748e3bda46bbc294b277 (patch) | |
tree | 5a38e671258250b1747413d84e34706e7dd4778a /src | |
parent | dfc3a7cb3c06c2e0d57e96ad15f7126461540994 (diff) |
glsl_types: Rename parameter of glsl_count_attribute_slots
glsl_count_attribute_slots takes a parameter to specify whether the
type is being used as a vertex input because on GL double attributes
only take up one slot. Vulkan doesn’t make this distinction so this
patch renames the argument to is_gl_vertex_input in order to make it
more clear that it should always be false on Vulkan.
v2: minor variable renaming (s/member/member_type) (Tapani)
Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl_types.cpp | 16 | ||||
-rw-r--r-- | src/compiler/glsl_types.h | 5 | ||||
-rw-r--r-- | src/compiler/nir_types.cpp | 4 | ||||
-rw-r--r-- | src/compiler/nir_types.h | 2 |
4 files changed, 17 insertions, 10 deletions
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index 9d5451dbb7c..90f4548030f 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -2051,7 +2051,7 @@ glsl_type::std430_size(bool row_major) const } 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: * @@ -2094,7 +2094,7 @@ glsl_type::count_attribute_slots(bool is_vertex_input) const 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; @@ -2102,14 +2102,18 @@ glsl_type::count_attribute_slots(bool is_vertex_input) const 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; diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index 4d205fad141..bdaeee7ddd7 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -393,8 +393,11 @@ public: * * 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 diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index 7ea5ef9b831..b4bde5470c0 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -146,9 +146,9 @@ 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) { - return type->count_attribute_slots(is_vertex_input); + return type->count_attribute_slots(is_gl_vertex_input); } unsigned diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h index 15891ce43be..40cddf76374 100644 --- a/src/compiler/nir_types.h +++ b/src/compiler/nir_types.h @@ -78,7 +78,7 @@ unsigned glsl_get_length(const struct glsl_type *type); 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, |