mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 22:28:04 +02:00
lavapipe: update prim restart index on index buffer bind
this makes more sense functionally, as the restart index only changes when the index size changes (and is harmless to update even if restart isn't enabled) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40783>
This commit is contained in:
parent
0927de4631
commit
88fd02daae
1 changed files with 2 additions and 8 deletions
|
|
@ -2718,9 +2718,6 @@ static void handle_draw_indexed(struct vk_cmd_queue_entry *cmd,
|
|||
state->info.start_instance = cmd->u.draw_indexed.first_instance;
|
||||
state->info.instance_count = cmd->u.draw_indexed.instance_count;
|
||||
|
||||
if (state->info.primitive_restart)
|
||||
state->info.restart_index = util_prim_restart_index_from_size(state->info.index_size);
|
||||
|
||||
draw.count = MIN2(cmd->u.draw_indexed.index_count, state->index_buffer_size / state->index_size);
|
||||
draw.index_bias = cmd->u.draw_indexed.vertex_offset;
|
||||
/* TODO: avoid calculating multiple times if cmdbuf is submitted again */
|
||||
|
|
@ -2747,9 +2744,6 @@ static void handle_draw_multi_indexed(struct vk_cmd_queue_entry *cmd,
|
|||
if (cmd->u.draw_multi_indexed_ext.draw_count > 1)
|
||||
state->info.increment_draw_id = true;
|
||||
|
||||
if (state->info.primitive_restart)
|
||||
state->info.restart_index = util_prim_restart_index_from_size(state->info.index_size);
|
||||
|
||||
unsigned size = cmd->u.draw_multi_indexed_ext.draw_count * sizeof(struct pipe_draw_start_count_bias);
|
||||
memcpy(draws, cmd->u.draw_multi_indexed_ext.index_info, size);
|
||||
if (state->index_buffer_size != UINT32_MAX) {
|
||||
|
|
@ -2785,8 +2779,6 @@ static void handle_draw_indirect(struct vk_cmd_queue_entry *cmd,
|
|||
state->info.index_size = state->index_size;
|
||||
state->info.index.resource = state->index_buffer;
|
||||
state->info.max_index = ~0U;
|
||||
if (state->info.primitive_restart)
|
||||
state->info.restart_index = util_prim_restart_index_from_size(state->info.index_size);
|
||||
if (state->index_offset || state->index_buffer_size != UINT32_MAX) {
|
||||
struct pipe_transfer *xfer;
|
||||
uint8_t *mem = pipe_buffer_map(state->pctx, state->index_buffer, 0, &xfer);
|
||||
|
|
@ -2812,6 +2804,7 @@ static void handle_index_buffer(struct vk_cmd_queue_entry *cmd,
|
|||
struct vk_cmd_bind_index_buffer *ib = &cmd->u.bind_index_buffer;
|
||||
state->index_size = vk_index_type_to_bytes(ib->index_type);
|
||||
state->index_buffer_size = UINT32_MAX;
|
||||
state->info.restart_index = util_prim_restart_index_from_size(state->index_size);
|
||||
|
||||
if (ib->buffer) {
|
||||
state->index_offset = ib->offset;
|
||||
|
|
@ -2840,6 +2833,7 @@ static void handle_index_buffer2(struct vk_cmd_queue_entry *cmd,
|
|||
state->index_offset = 0;
|
||||
state->index_buffer = state->device->zero_buffer;
|
||||
}
|
||||
state->info.restart_index = util_prim_restart_index_from_size(state->index_size);
|
||||
|
||||
state->ib_dirty = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue