tu: Fix xfb when there is a hole at the end
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 10 Aug 2021 16:07:51 +0000 (18:07 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 16 Aug 2021 11:06:23 +0000 (11:06 +0000)
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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12310>

src/freedreno/ci/deqp-freedreno-a630-fails.txt
src/freedreno/vulkan/tu_pipeline.c

index c8a1715..f9c930b 100644 (file)
@@ -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
index 43e77e9..6c9ca24 100644 (file)
@@ -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;