From 1564ff72a0149ca5e1f5603cacbdd13afb0cadb4 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Tue, 10 Aug 2021 18:07:51 +0200 Subject: [PATCH] tu: Fix xfb when there is a hole at the end We were handling the case where we had an unassigned output in the middle of the outputs array, but v->outputs can be smaller than the shader's info.num_outputs when an output at the end isn't assigned. This lead to us reading garbage after the end, and assuming that it corresponded to r0.x and overwriting the xfb entry for some other random output with the unassigned output's entry. Part-of: --- src/freedreno/ci/deqp-freedreno-a630-fails.txt | 3 --- src/freedreno/vulkan/tu_pipeline.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/freedreno/ci/deqp-freedreno-a630-fails.txt b/src/freedreno/ci/deqp-freedreno-a630-fails.txt index c8a171583d9..f9c930b777c 100644 --- a/src/freedreno/ci/deqp-freedreno-a630-fails.txt +++ b/src/freedreno/ci/deqp-freedreno-a630-fails.txt @@ -281,6 +281,3 @@ dEQP-VK.ssbo.layout.random.all_shared_buffer.5,Fail dEQP-VK.ssbo.layout.random.nested_structs_arrays.0,Fail dEQP-VK.ssbo.layout.random.nested_structs_arrays.17,Fail dEQP-VK.ssbo.layout.random.scalar.19,Fail - -# "Mismatch at offset 0 expected -89 received 0 (elemNdx=0 vecNdx=0 compNdx=0)" -dEQP-VK.transform_feedback.fuzz.various_buffers.buffers100_instance_array_vertex,Fail diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index 43e77e93b36..6c9ca2458ac 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -726,8 +726,8 @@ tu6_setup_streamout(struct tu_cs *cs, unsigned k = out->register_index; unsigned idx; - /* Skip it, if there's an unused reg in the middle of outputs. */ - if (v->outputs[k].regid == INVALID_REG) + /* Skip it, if it's an output that was never assigned a register. */ + if (k >= v->outputs_count || v->outputs[k].regid == INVALID_REG) continue; ncomp[out->output_buffer] += out->num_components;