diff --git a/src/gpu.h b/src/gpu.h index afcd80c8..9fe2297a 100644 --- a/src/gpu.h +++ b/src/gpu.h @@ -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_submit_plan(struct gpu_handle gpu_plan); - /* ========================== * * Dispatch * ========================== */ diff --git a/src/gpu_dx11.c b/src/gpu_dx11.c index 4c81bcb3..c38ccfd0 100644 --- a/src/gpu_dx11.c +++ b/src/gpu_dx11.c @@ -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 * ========================== */ @@ -1624,9 +1593,39 @@ void gpu_dispatch(struct gpu_dispatch_params params) { __prof; __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; + { + __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; /* 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); } - /* Send plans to GPU */ - gpu_submit_plan(G.present_blit_plan); - /* Clear textures */ gpu_texture_clear(dst_texture_handle, RGBA32_F(0, 0, 0, 1)); diff --git a/src/gpu_dx12.c b/src/gpu_dx12.c index 779402b6..97a93475 100644 --- a/src/gpu_dx12.c +++ b/src/gpu_dx12.c @@ -1449,11 +1449,6 @@ void gpu_push_cmd(struct gpu_handle gpu_plan, struct gpu_cmd_params params) (UNUSED)params; } -void gpu_submit_plan(struct gpu_handle gpu_plan) -{ - (UNUSED)gpu_plan; -} - /* ========================== * * Resource * ========================== */ diff --git a/src/user.c b/src/user.c index 14e7a651..f9f9122e 100644 --- a/src/user.c +++ b/src/user.c @@ -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); } - /* Send plans to GPU */ - gpu_submit_plan(G.world_gpu_plan); - gpu_submit_plan(G.ui_gpu_plan); - /* Clear textures */ gpu_texture_clear(G.user_texture, 0);