v3dv: fix incorrect index buffer size

When programming the size, we should take into account the
offset from the start of the index buffer address.

cc: mesa-stable

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29425>
(cherry picked from commit 70aa470bdb)
This commit is contained in:
Iago Toral Quiroga 2024-05-28 08:36:01 +02:00 committed by Eric Engestrom
parent 4319c1c6e8
commit a2716f97d8
2 changed files with 6 additions and 5 deletions

View file

@ -2014,7 +2014,7 @@
"description": "v3dv: fix incorrect index buffer size",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -2606,11 +2606,12 @@ v3dX(cmd_buffer_emit_index_buffer)(struct v3dv_cmd_buffer *cmd_buffer)
&job->bcl, cl_packet_length(INDEX_BUFFER_SETUP));
v3dv_return_if_oom(cmd_buffer, NULL);
const uint32_t offset = cmd_buffer->state.index_buffer.offset;
const uint32_t offset = ibuffer->mem_offset +
cmd_buffer->state.index_buffer.offset;
assert(ibuffer->mem->bo->size >= offset);
cl_emit(&job->bcl, INDEX_BUFFER_SETUP, ib) {
ib.address = v3dv_cl_address(ibuffer->mem->bo,
ibuffer->mem_offset + offset);
ib.size = ibuffer->mem->bo->size;
ib.address = v3dv_cl_address(ibuffer->mem->bo, offset);
ib.size = ibuffer->mem->bo->size - offset;
}
}