lavapipe: add execution backends for mesh shader draw apis

This binds the mesh draw apis to the gallium backend ones.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>
This commit is contained in:
Dave Airlie 2023-05-17 12:11:33 +10:00
parent 5c6c226f5a
commit aa2c209260

View file

@ -4146,6 +4146,42 @@ handle_shaders(struct vk_cmd_queue_entry *cmd, struct rendering_state *state)
}
}
static void handle_draw_mesh_tasks(struct vk_cmd_queue_entry *cmd,
struct rendering_state *state)
{
state->dispatch_info.grid[0] = cmd->u.draw_mesh_tasks_ext.group_count_x;
state->dispatch_info.grid[1] = cmd->u.draw_mesh_tasks_ext.group_count_y;
state->dispatch_info.grid[2] = cmd->u.draw_mesh_tasks_ext.group_count_z;
state->dispatch_info.grid_base[0] = 0;
state->dispatch_info.grid_base[1] = 0;
state->dispatch_info.grid_base[2] = 0;
state->dispatch_info.draw_count = 1;
state->dispatch_info.indirect = NULL;
state->pctx->draw_mesh_tasks(state->pctx, &state->dispatch_info);
}
static void handle_draw_mesh_tasks_indirect(struct vk_cmd_queue_entry *cmd,
struct rendering_state *state)
{
state->dispatch_info.indirect = lvp_buffer_from_handle(cmd->u.draw_mesh_tasks_indirect_ext.buffer)->bo;
state->dispatch_info.indirect_offset = cmd->u.draw_mesh_tasks_indirect_ext.offset;
state->dispatch_info.indirect_stride = cmd->u.draw_mesh_tasks_indirect_ext.stride;
state->dispatch_info.draw_count = cmd->u.draw_mesh_tasks_indirect_ext.draw_count;
state->pctx->draw_mesh_tasks(state->pctx, &state->dispatch_info);
}
static void handle_draw_mesh_tasks_indirect_count(struct vk_cmd_queue_entry *cmd,
struct rendering_state *state)
{
state->dispatch_info.indirect = lvp_buffer_from_handle(cmd->u.draw_mesh_tasks_indirect_count_ext.buffer)->bo;
state->dispatch_info.indirect_offset = cmd->u.draw_mesh_tasks_indirect_count_ext.offset;
state->dispatch_info.indirect_stride = cmd->u.draw_mesh_tasks_indirect_count_ext.stride;
state->dispatch_info.draw_count = cmd->u.draw_mesh_tasks_indirect_count_ext.max_draw_count;
state->dispatch_info.indirect_draw_count_offset = cmd->u.draw_mesh_tasks_indirect_count_ext.count_buffer_offset;
state->dispatch_info.indirect_draw_count = lvp_buffer_from_handle(cmd->u.draw_mesh_tasks_indirect_count_ext.count_buffer)->bo;
state->pctx->draw_mesh_tasks(state->pctx, &state->dispatch_info);
}
void lvp_add_enqueue_cmd_entrypoints(struct vk_device_dispatch_table *disp)
{
struct vk_device_dispatch_table cmd_enqueue_dispatch;
@ -4266,7 +4302,9 @@ void lvp_add_enqueue_cmd_entrypoints(struct vk_device_dispatch_table *disp)
ENQUEUE_CMD(CmdSetViewportSwizzleNV)
ENQUEUE_CMD(CmdSetViewportWScalingEnableNV)
ENQUEUE_CMD(CmdSetAttachmentFeedbackLoopEnableEXT)
ENQUEUE_CMD(CmdDrawMeshTasksEXT)
ENQUEUE_CMD(CmdDrawMeshTasksIndirectEXT)
ENQUEUE_CMD(CmdDrawMeshTasksIndirectCountEXT)
#undef ENQUEUE_CMD
}
@ -4586,6 +4624,18 @@ static void lvp_execute_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer,
break;
case VK_CMD_SET_ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT:
break;
case VK_CMD_DRAW_MESH_TASKS_EXT:
emit_state(state);
handle_draw_mesh_tasks(cmd, state);
break;
case VK_CMD_DRAW_MESH_TASKS_INDIRECT_EXT:
emit_state(state);
handle_draw_mesh_tasks_indirect(cmd, state);
break;
case VK_CMD_DRAW_MESH_TASKS_INDIRECT_COUNT_EXT:
emit_state(state);
handle_draw_mesh_tasks_indirect_count(cmd, state);
break;
default:
fprintf(stderr, "Unsupported command %s\n", vk_cmd_queue_type_names[cmd->type]);
unreachable("Unsupported command");