submit plan data implicitly

This commit is contained in:
jacob 2025-06-17 18:52:43 -05:00
parent 9aad25a699
commit 13f5348265
4 changed files with 31 additions and 46 deletions

View File

@ -113,8 +113,6 @@ struct gpu_handle gpu_plan_alloc(void);
void gpu_push_cmd(struct gpu_handle gpu_plan, struct gpu_cmd_params params); void gpu_push_cmd(struct gpu_handle gpu_plan, struct gpu_cmd_params params);
void gpu_submit_plan(struct gpu_handle gpu_plan);
/* ========================== * /* ========================== *
* Dispatch * Dispatch
* ========================== */ * ========================== */

View File

@ -1518,37 +1518,6 @@ void gpu_push_cmd(struct gpu_handle gpu_plan, struct gpu_cmd_params params)
} }
} }
void gpu_submit_plan(struct gpu_handle gpu_plan)
{
__prof;
struct dx11_plan *plan = (struct dx11_plan *)gpu_plan.v;
/* Swap cmd plans */
struct arena swp_arena = plan->gpu_cmds_arena;
plan->gpu_cmds_arena = plan->cpu_cmds_arena;
plan->gpu_first_cmd = plan->cpu_first_cmd;
plan->gpu_last_cmd = plan->cpu_last_cmd;
/* Reset cpu cmds */
plan->cpu_cmds_arena = swp_arena;
plan->cpu_first_cmd = NULL;
plan->cpu_last_cmd = NULL;
arena_reset(&plan->cpu_cmds_arena);
/* Submit mesh buffers */
dx11_buffer_submit(plan->cmd_buffers.mesh.vertex_buffer);
dx11_buffer_submit(plan->cmd_buffers.mesh.index_buffer);
/* Submit texture buffers */
dx11_buffer_submit(plan->cmd_buffers.texture.instance_buffer);
/* Submit grid buffers */
dx11_buffer_submit(plan->cmd_buffers.grid.instance_buffer);
/* Submit test buffers */
dx11_buffer_submit(plan->cmd_buffers.test.instance_buffer);
}
/* ========================== * /* ========================== *
* Dispatch * Dispatch
* ========================== */ * ========================== */
@ -1624,9 +1593,39 @@ void gpu_dispatch(struct gpu_dispatch_params params)
{ {
__prof; __prof;
__profscope_dx11(G.profiling_ctx, Dispatch, RGB32_F(0.5, 0.2, 0.2)); __profscope_dx11(G.profiling_ctx, Dispatch, RGB32_F(0.5, 0.2, 0.2));
struct sprite_scope *sprite_scope = sprite_scope_begin();
struct dx11_plan *plan = (struct dx11_plan *)params.plan.v; struct dx11_plan *plan = (struct dx11_plan *)params.plan.v;
{
__profscope(Submit buffers);
/* Swap cmd plans */
struct arena swp_arena = plan->gpu_cmds_arena;
plan->gpu_cmds_arena = plan->cpu_cmds_arena;
plan->gpu_first_cmd = plan->cpu_first_cmd;
plan->gpu_last_cmd = plan->cpu_last_cmd;
/* Reset cpu cmds */
plan->cpu_cmds_arena = swp_arena;
plan->cpu_first_cmd = NULL;
plan->cpu_last_cmd = NULL;
arena_reset(&plan->cpu_cmds_arena);
/* Submit mesh buffers */
dx11_buffer_submit(plan->cmd_buffers.mesh.vertex_buffer);
dx11_buffer_submit(plan->cmd_buffers.mesh.index_buffer);
/* Submit texture buffers */
dx11_buffer_submit(plan->cmd_buffers.texture.instance_buffer);
/* Submit grid buffers */
dx11_buffer_submit(plan->cmd_buffers.grid.instance_buffer);
/* Submit test buffers */
dx11_buffer_submit(plan->cmd_buffers.test.instance_buffer);
}
struct sprite_scope *sprite_scope = sprite_scope_begin();
struct rect viewport = params.draw_target_viewport; struct rect viewport = params.draw_target_viewport;
/* Set viewport */ /* Set viewport */
@ -1969,9 +1968,6 @@ INTERNAL void present_blit(struct dx11_texture *dst, struct dx11_texture *src, s
draw_texture(G.present_blit_plan, params); draw_texture(G.present_blit_plan, params);
} }
/* Send plans to GPU */
gpu_submit_plan(G.present_blit_plan);
/* Clear textures */ /* Clear textures */
gpu_texture_clear(dst_texture_handle, RGBA32_F(0, 0, 0, 1)); gpu_texture_clear(dst_texture_handle, RGBA32_F(0, 0, 0, 1));

View File

@ -1449,11 +1449,6 @@ void gpu_push_cmd(struct gpu_handle gpu_plan, struct gpu_cmd_params params)
(UNUSED)params; (UNUSED)params;
} }
void gpu_submit_plan(struct gpu_handle gpu_plan)
{
(UNUSED)gpu_plan;
}
/* ========================== * /* ========================== *
* Resource * Resource
* ========================== */ * ========================== */

View File

@ -2072,10 +2072,6 @@ INTERNAL void user_update(void)
G.user_texture = gpu_texture_alloc(GPU_TEXTURE_FORMAT_R8G8B8A8_UNORM, GPU_TEXTURE_FLAG_TARGETABLE, user_resolution, NULL); G.user_texture = gpu_texture_alloc(GPU_TEXTURE_FORMAT_R8G8B8A8_UNORM, GPU_TEXTURE_FLAG_TARGETABLE, user_resolution, NULL);
} }
/* Send plans to GPU */
gpu_submit_plan(G.world_gpu_plan);
gpu_submit_plan(G.ui_gpu_plan);
/* Clear textures */ /* Clear textures */
gpu_texture_clear(G.user_texture, 0); gpu_texture_clear(G.user_texture, 0);