From: Ilia Mirkin Date: Sun, 27 Aug 2017 04:09:31 +0000 (-0400) Subject: glsl: fix counting of vertex shader output slots used by explicit vars X-Git-Tag: android-x86-7.1-r1~1^2~70 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-mesa.git;a=commitdiff_plain;h=70f7f60f0cfe37fffb458aae09d3854eba0c5a27 glsl: fix counting of vertex shader output slots used by explicit vars 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 Reviewed-by: Timothy Arceri Reviewed-by: Nicolai Hähnle Cc: mesa-stable@lists.freedesktop.org (cherry picked from commit eefeff09a784eb139cbf682b98926c0eaa00eb21) --- diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index f0df3d60a5c..883918c3c69 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -2017,7 +2017,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;