From ba5e1c5310f3954aae803fe82814b22a86beeef7 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Thu, 25 Jun 2020 12:23:49 +0200 Subject: [PATCH] tu: Pass firstIndex directly to CP_DRAW_INDX_OFFSET Saves some minor overhead, cleans things up a bit, and removes one more unknown. We now program the internal registers in the same way between direct/indirect draws. Part-of: --- src/freedreno/vulkan/tu_cmd_buffer.c | 7 +++---- src/freedreno/vulkan/tu_private.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c index db251e0eb7b..871a5b8d35d 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.c +++ b/src/freedreno/vulkan/tu_cmd_buffer.c @@ -1799,7 +1799,6 @@ tu_CmdBindIndexBuffer(VkCommandBuffer commandBuffer, cmd->state.index_va = buf->bo->iova + buf->bo_offset + offset; cmd->state.max_index_count = (buf->size - offset) >> index_shift; cmd->state.index_size = index_size; - cmd->state.index_shift = index_shift; tu_bo_list_add(&cmd->bo_list, buf->bo, MSM_SUBMIT_BO_READ); } @@ -3401,9 +3400,9 @@ tu_CmdDrawIndexed(VkCommandBuffer commandBuffer, tu_cs_emit(cs, tu_draw_initiator(cmd, DI_SRC_SEL_DMA)); tu_cs_emit(cs, instanceCount); tu_cs_emit(cs, indexCount); - tu_cs_emit(cs, 0x0); /* XXX */ - tu_cs_emit_qw(cs, cmd->state.index_va + (firstIndex << cmd->state.index_shift)); - tu_cs_emit(cs, indexCount << cmd->state.index_shift); + tu_cs_emit(cs, firstIndex); + tu_cs_emit_qw(cs, cmd->state.index_va); + tu_cs_emit(cs, cmd->state.max_index_count); } void diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index 2bfd5eb18f4..b00e891a01a 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -820,7 +820,7 @@ struct tu_cmd_state /* Index buffer */ uint64_t index_va; uint32_t max_index_count; - uint8_t index_size, index_shift; + uint8_t index_size; /* because streamout base has to be 32-byte aligned * there is an extra offset to deal with when it is -- 2.30.2