diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index dc5cb65612a..43570de47a1 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -2925,17 +2925,15 @@ assign_varying_locations(struct gl_context *ctx, /* There are two situations where a new output varying is needed: * * - If varying packing is disabled for xfb and the current declaration - * is not aligned within the top level varying (e.g. vec3_arr[1]). + * is subscripting an array, whether the subscript is aligned or not. + * to preserve the rest of the array for the consumer. * * - If a builtin variable needs to be copied to a new variable * before its content is modified by another lowering pass (e.g. * \c gl_Position is transformed by \c nir_lower_viewport_transform). */ - const unsigned dmul = - matched_candidate->type->without_array()->is_64bit() ? 2 : 1; const bool lowered = - (disable_xfb_packing && - !tfeedback_decls[i].is_aligned(dmul, matched_candidate->struct_offset_floats)) || + (disable_xfb_packing && tfeedback_decls[i].subscripted()) || (matched_candidate->toplevel_var->data.explicit_location && matched_candidate->toplevel_var->data.location < VARYING_SLOT_VAR0 && (!consumer || consumer->Stage == MESA_SHADER_FRAGMENT) && diff --git a/src/compiler/glsl/link_varyings.h b/src/compiler/glsl/link_varyings.h index 87d7f43998e..1147117f052 100644 --- a/src/compiler/glsl/link_varyings.h +++ b/src/compiler/glsl/link_varyings.h @@ -130,9 +130,9 @@ public: return !this->next_buffer_separator && !this->skip_components; } - bool is_aligned(unsigned dmul, unsigned offset) const + bool subscripted() const { - return (dmul * (this->array_subscript + offset)) % 4 == 0; + return this->is_subscripted; } const char *name() const