panvk: fix gl_VertexIndex

According to pandecode, r32 is global attribute offset and r36 is vertex
offset.  Follow panfrost to use r36 instead of r32 for both non-indexed
firstVertex and indexed vertexOffset.

With this, gl_VertexIndex stops being zero-based which is incorrect.

Fixes: 5544d39f44 ("panvk: Add a CSF backend for panvk_queue/cmd_buffer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31810>
This commit is contained in:
Chia-I Wu 2024-10-23 17:20:36 -07:00 committed by Marge Bot
parent b79950fc1f
commit 029b8b11a0

View file

@ -45,7 +45,6 @@ struct panvk_draw_info {
struct {
uint32_t size;
uint32_t offset;
int32_t vertex_offset;
} index;
struct {
@ -1469,11 +1468,11 @@ panvk_cmd_draw(struct panvk_cmd_buffer *cmdbuf, struct panvk_draw_info *draw)
return;
cs_update_vt_ctx(b) {
cs_move32_to(b, cs_sr_reg32(b, 32), draw->vertex.base);
cs_move32_to(b, cs_sr_reg32(b, 32), 0);
cs_move32_to(b, cs_sr_reg32(b, 33), draw->vertex.count);
cs_move32_to(b, cs_sr_reg32(b, 34), draw->instance.count);
cs_move32_to(b, cs_sr_reg32(b, 35), draw->index.offset);
cs_move32_to(b, cs_sr_reg32(b, 36), draw->index.vertex_offset);
cs_move32_to(b, cs_sr_reg32(b, 36), draw->vertex.base);
cs_move32_to(b, cs_sr_reg32(b, 37), draw->instance.base);
}
@ -1567,7 +1566,7 @@ panvk_per_arch(CmdDrawIndexed)(VkCommandBuffer commandBuffer,
struct panvk_draw_info draw = {
.index.size = cmdbuf->state.gfx.ib.index_size,
.index.offset = firstIndex,
.index.vertex_offset = vertexOffset,
.vertex.base = (uint32_t)vertexOffset,
.vertex.count = indexCount,
.instance.count = instanceCount,
.instance.base = firstInstance,