summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-12-30 02:33:00 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2016-01-08 12:05:27 +0200
commitb2352d758591cac76ddc66f7640522da76dee5d1 (patch)
treec79a066a67d10fd3e0e1b38d2a375a1a5d5fca7e
parent6c69561068b92b8f6285645798a9b9769bc50cf4 (diff)
glsl: Fix varying struct locations when varying packing is disabled.
varying_matches::record tries to compute the number of components in each varying, which varying_matches::assign_locations uses to assign locations. With varying packing, it uses glsl_type::component_slots() to come up with a reasonable value. Without varying packing, it fell back to an open-coded computation that didn't bother to handle structs at all. I believe we can simply use 4 * glsl_type::count_attribute_slots(false), which already handles these cases correctly. Partially fixes rendering in GFXBench 4.0's tessellation benchmark. (NVE0 is almost right after this, but i965 is still mostly garbage.) Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 7cdc2b9ca0ab60b282416b975a2ac6d7abcd42ad) [Emil Velikov: resolve trivial conflicts] Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Conflicts: src/glsl/link_varyings.cpp
-rw-r--r--src/glsl/link_varyings.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 269cfd5d29..d65220626c 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -956,17 +956,8 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
type = type->fields.array;
}
- if (type->is_array()) {
- slots = 1;
- while (type->is_array()) {
- slots *= type->length;
- type = type->fields.array;
- }
- slots *= type->matrix_columns;
- } else {
- slots = type->matrix_columns;
- }
- this->matches[this->num_matches].num_components = 4 * slots;
+ slots = type->count_attribute_slots(false);
+ this->matches[this->num_matches].num_components = slots * 4;
} else {
this->matches[this->num_matches].num_components
= var->type->component_slots();