mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 21:50:11 +01:00
anv: move generation shader return instruction to last draw lane
If we dispatch exactly a multiple of 8192 items, there is additional
lane left to generate the jump instruction.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: c950fe97a0 ("anv: implement generated (indexed) indirect draws")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Tested-by: Felix DeGrood <felix.j.degrood@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25361>
This commit is contained in:
parent
6fc76eb280
commit
8aadd4745c
3 changed files with 19 additions and 10 deletions
|
|
@ -131,3 +131,18 @@ void write_MI_BATCH_BUFFER_START(uint write_offset,
|
|||
commands[write_offset + 1] = uint(addr & 0xffffffff);
|
||||
commands[write_offset + 2] = uint(addr >> 32);
|
||||
}
|
||||
|
||||
void end_generated_draws(uint cmd_idx, uint draw_id, uint draw_count)
|
||||
{
|
||||
uint _3dprim_dw_size = (flags >> 16) & 0xff;
|
||||
/* We can have an indirect draw count = 0. */
|
||||
uint last_draw_id = draw_count == 0 ? 0 : (min(draw_count, max_draw_count) - 1);
|
||||
uint jump_offset = draw_count == 0 ? 0 : _3dprim_dw_size;
|
||||
|
||||
if (draw_id == last_draw_id && draw_count < max_draw_count) {
|
||||
/* Only write a jump forward in the batch if we have fewer elements than
|
||||
* the max draw count.
|
||||
*/
|
||||
write_MI_BATCH_BUFFER_START(cmd_idx + jump_offset, end_addr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,10 +76,7 @@ void main()
|
|||
first_instance,
|
||||
draw_id);
|
||||
}
|
||||
} else if (draw_id == draw_count && draw_id < max_draw_count) {
|
||||
/* Only write a jump forward in the batch if we have fewer elements than
|
||||
* the max draw count.
|
||||
*/
|
||||
write_MI_BATCH_BUFFER_START(cmd_idx, end_addr);
|
||||
}
|
||||
|
||||
end_generated_draws(cmd_idx, draw_id, draw_count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,10 +135,7 @@ void main()
|
|||
first_instance,
|
||||
0 /* base_vertex_location */);
|
||||
}
|
||||
} else if (draw_id == draw_count && draw_id < max_draw_count) {
|
||||
/* Only write a jump forward in the batch if we have fewer elements than
|
||||
* the max draw count.
|
||||
*/
|
||||
write_MI_BATCH_BUFFER_START(cmd_idx, end_addr);
|
||||
}
|
||||
|
||||
end_generated_draws(cmd_idx, draw_id, draw_count);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue