From 4d44d4179ef723ca68e4ca41cdf67d304806b9f5 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 7 May 2021 19:01:06 -0400 Subject: [PATCH] glsl: Fix packing of matrices for XFB The CAP for packed transform feedback concerns packing of unrelated variables into the same varying slot. (On Mali, transform feedback is implemented on a per-slot basis, so different variables need different slots to be written to different buffers.) However, this requirement is tangential to the packing of arrays, matrices, and structures inherent to GLSL. These array-like values need to be packed /within/ their slot, even though drivers using the CAP (just Panfrost) cannot pack independent values in the slot. Transform feedback of individual elements is not independent, after all. Acked-by: Erik Faye-Lund Signed-off-by: Alyssa Rosenzweig Part-of: --- src/compiler/glsl/link_varyings.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index 43570de47a1..51b1f432d4d 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -2097,7 +2097,8 @@ varying_matches::assign_locations(struct gl_shader_program *prog, } else { if ((this->disable_varying_packing && !is_varying_packing_safe(type, var)) || - (this->disable_xfb_packing && var->data.is_xfb) || + (this->disable_xfb_packing && var->data.is_xfb && + !(type->is_array() || type->is_struct() || type->is_matrix())) || var->data.must_be_shader_input) { num_components = type->count_attribute_slots(false) * 4; } else {