From 2f1b50d8bcb3cd6a1e2420494bf14e20fe2cd89e Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 18 Feb 2024 09:06:06 -0400 Subject: [PATCH] asahi: clarify how unroll index buffers are offsetted it's a little inconsistent Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 8b58cc02c04..e0718f3ccc5 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -4326,8 +4326,7 @@ agx_draw_without_restart(struct agx_batch *batch, agx_batch_init_state(batch); size_t ib_extent = 0; - uint64_t ib = - agx_index_buffer_ptr(batch, info, indirect ? NULL : draw, &ib_extent); + uint64_t ib; /* The rest of this function handles only the general case of indirect * multidraws, so synthesize an indexed indirect draw now if we need one for @@ -4336,6 +4335,9 @@ agx_draw_without_restart(struct agx_batch *batch, struct pipe_draw_indirect_info indirect_synthesized = {.draw_count = 1}; if (!indirect) { + /* Adds in the offset so set to 0 in the desc */ + ib = agx_index_buffer_direct_ptr(batch, draw, info, &ib_extent); + uint32_t desc[5] = {draw->count, info->instance_count, 0, draw->index_bias, info->start_instance}; @@ -4343,6 +4345,9 @@ agx_draw_without_restart(struct agx_batch *batch, &indirect_synthesized.offset, &indirect_synthesized.buffer); indirect = &indirect_synthesized; + } else { + /* Does not add in offset, the unroll kernel uses the desc's offset */ + ib = agx_index_buffer_rsrc_ptr(batch, info, &ib_extent); } /* Next, we unroll the index buffer used by the indirect draw */