summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-01-21 07:17:06 -0500
committerEmil Velikov <[email protected]>2016-02-04 10:06:26 +0000
commite101a005b14ee36568a12e2cf08c734be167cf23 (patch)
tree56f9b2f2ccfa69dee402320d2cb047ce38306bcc /src/glsl
parent65dfe8ba5fda1bdf154a709f58342b80afb1be25 (diff)
glsl: always compute proper varying type, irrespective of varying packing
Normally there's a producer and consumer, and the producer var gets picked. In both the vertex->gs and tes->gs cases, that's the un-arrayed version. In the SSO case, however, there is no producer. So we picked the arrayed GS variable, and as a result, used more slots than we should. More critically, these slots would also no longer line up with the producer's calculation. To fix this, we need to fix up the type of the variable based on stage no matter what. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93650 Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Cc: "11.0 11.1" <[email protected]> (cherry picked from commit dac2964f3ebd96d5ac227984ab0cd79c2c3b2a1a)
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/link_varyings.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 4c66dcbca2c..5bd39f60caa 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -960,23 +960,20 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
const ir_variable *const var = (producer_var != NULL)
? producer_var : consumer_var;
+ const 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;