From 712a010b079a8e044629ada862a2622c6ab112ce Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Thu, 21 Jan 2016 06:37:24 -0500 Subject: [PATCH] glsl: always compute proper varying type, irrespective of varying packing Normally there's a producer and consumer, and the producer var gets picked. If there's any tessellation involved, varying packing is disabled. However if there's just vertex->gs, then the (un-arrayed) vertex var would get picked. In the SSO case, however, there is no producer. So we picked the arrayed GS variable, and as a result, using more slots than we should. To fix this, we need to fix up the type of the variable no matter what. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93650 Signed-off-by: Ilia Mirkin --- src/glsl/link_varyings.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 09f80d0..2e13b30 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -1001,23 +1001,20 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var) const ir_variable *const var = (producer_var != NULL) ? producer_var : consumer_var; + gl_shader_stage stage = (producer_var != NULL) + ? producer_stage : consumer_stage; + const glsl_type *type = get_varying_type(var, stage); this->matches[this->num_matches].packing_class = this->compute_packing_class(var); this->matches[this->num_matches].packing_order = this->compute_packing_order(var); if (this->disable_varying_packing) { - unsigned slots; - gl_shader_stage stage = - (producer_var != NULL) ? producer_stage : consumer_stage; - - const glsl_type *type = get_varying_type(var, stage); - - slots = type->count_attribute_slots(false); + unsigned 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(); + = type->component_slots(); } this->matches[this->num_matches].producer_var = producer_var; this->matches[this->num_matches].consumer_var = consumer_var; -- 2.4.10