glsl: fix counting of vertex shader output slots used by explicit vars
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 27 Aug 2017 04:09:31 +0000 (00:09 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Mon, 28 Aug 2017 13:07:40 +0000 (09:07 -0400)
The argument to count_attribute_slots should only be set to true for
vertex inputs, not for all vertex shader varyings.

Fixes KHR-GL45.enhanced_layouts.varying_locations

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: mesa-stable@lists.freedesktop.org
src/compiler/glsl/link_varyings.cpp

index 6c9a3d12d1d3a7ef91bbf6ab5a3e8e6a1051434b..528506fd0eb09076e04c2d13c7ce9de38fe776a8 100644 (file)
@@ -2072,7 +2072,8 @@ reserved_varying_slot(struct gl_linked_shader *stage,
       var_slot = var->data.location - VARYING_SLOT_VAR0;
 
       unsigned num_elements = get_varying_type(var, stage->Stage)
-         ->count_attribute_slots(stage->Stage == MESA_SHADER_VERTEX);
+         ->count_attribute_slots(io_mode == ir_var_shader_in &&
+                                 stage->Stage == MESA_SHADER_VERTEX);
       for (unsigned i = 0; i < num_elements; i++) {
          if (var_slot >= 0 && var_slot < MAX_VARYINGS_INCL_PATCH)
             slots |= UINT64_C(1) << var_slot;