tu: Pass firstIndex directly to CP_DRAW_INDX_OFFSET
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 25 Jun 2020 10:23:49 +0000 (12:23 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 26 Jun 2020 10:05:24 +0000 (10:05 +0000)
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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5644>

src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_private.h

index db251e0eb7b241ea9705d455571538a5e47df733..871a5b8d35d96d0863ec816fb36b78b8c44a7e4e 100644 (file)
@@ -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
index 2bfd5eb18f4d75fdaed1cdae34d9e4e18770ed31..b00e891a01a060712ccd4cee81dd2b0ac2847ca8 100644 (file)
@@ -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