zink: use ring buffer to preserve last element
authorantonino <antonino.maniscalco@collabora.com>
Tue, 4 Apr 2023 14:49:57 +0000 (16:49 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 24 Apr 2023 08:59:19 +0000 (08:59 +0000)
commit89077b866cabfe736dcd2d27994930c468138161
tree396030351763ca0b5852cfb90fd2f71b9f8b57fa
parent436dacf75410144589abb835c2906e1a149abffb
zink: use ring buffer to preserve last element

Previously, whenever a vertex was emitted immediately after emitting a
primitive, that vertex would not use the attributes that where assigned
last because the position variable got set.

Now the temporary attributes array is treated as a ring buffer and
whenever the position is set to 0 it's previous value is used as an
offset when accessing it. This way when a new primitive is created the
attributes at index 0 correspond to the last attributes written.

Fixes: 5a4083349f3 ("zink: add provoking vertex mode lowering")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22599>
src/gallium/drivers/zink/zink_compiler.c