From a6cfa3d1ff2d5e1f03e714b816e94f312bdf29c6 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sat, 12 Jul 2025 10:58:05 +0200 Subject: [PATCH] Cleanup --- base/sources/backends/direct3d12_gpu.c | 8 ++++---- base/sources/backends/metal_gpu.m | 4 ++-- base/sources/backends/vulkan_gpu.c | 4 ++-- base/sources/backends/webgpu_gpu.c | 2 +- base/sources/iron_gpu.c | 2 +- base/sources/iron_gpu.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/base/sources/backends/direct3d12_gpu.c b/base/sources/backends/direct3d12_gpu.c index 8ab77b22..e205d266 100644 --- a/base/sources/backends/direct3d12_gpu.c +++ b/base/sources/backends/direct3d12_gpu.c @@ -412,7 +412,7 @@ void gpu_wait() { wait_for_fence(fence, fence_value, fence_event); } -void gpu_flush() { +void gpu_execute_and_wait() { command_list->lpVtbl->Close(command_list); ID3D12CommandList *command_lists[] = {(ID3D12CommandList *)command_list}; queue->lpVtbl->ExecuteCommandLists(queue, 1, command_lists); @@ -659,7 +659,7 @@ void gpu_get_render_target_pixels(gpu_texture_t *render_target, uint8_t *data) { }; command_list->lpVtbl->ResourceBarrier(command_list, 1, &barrier); - gpu_flush(); + gpu_execute_and_wait(); // Read buffer void *p; @@ -922,7 +922,7 @@ void gpu_texture_init_from_bytes(gpu_texture_t *texture, void *data, int width, command_list->lpVtbl->ResourceBarrier(command_list, 1, &barrier); // TODO: - gpu_flush(); + gpu_execute_and_wait(); upload_image->lpVtbl->Release(upload_image); } @@ -1856,7 +1856,7 @@ void gpu_raytrace_acceleration_structure_build(gpu_raytrace_acceleration_structu command_list->lpVtbl->ResourceBarrier(command_list, 1, &barrier); dxrCommandList->lpVtbl->BuildRaytracingAccelerationStructure(dxrCommandList, &topLevelBuildDesc, 0, NULL); - gpu_flush(); + gpu_execute_and_wait(); scratchResource->lpVtbl->Release(scratchResource); instanceDescs->lpVtbl->Release(instanceDescs); diff --git a/base/sources/backends/metal_gpu.m b/base/sources/backends/metal_gpu.m index f8399677..02e277e1 100644 --- a/base/sources/backends/metal_gpu.m +++ b/base/sources/backends/metal_gpu.m @@ -226,7 +226,7 @@ void gpu_wait() { [command_buffer waitUntilCompleted]; } -void gpu_flush() { +void gpu_execute_and_wait() { [command_buffer commit]; gpu_wait(); id queue = getMetalQueue(); @@ -334,7 +334,7 @@ void gpu_set_index_buffer(gpu_buffer_t *buffer) { } void gpu_get_render_target_pixels(gpu_texture_t *render_target, uint8_t *data) { - gpu_flush(); + gpu_execute_and_wait(); // Create readback buffer if (render_target->impl._readback == NULL) { diff --git a/base/sources/backends/vulkan_gpu.c b/base/sources/backends/vulkan_gpu.c index 28e8d08a..6f448a1a 100644 --- a/base/sources/backends/vulkan_gpu.c +++ b/base/sources/backends/vulkan_gpu.c @@ -1156,7 +1156,7 @@ void gpu_wait() { vkWaitForFences(device, 1, &fence, VK_TRUE, UINT64_MAX); } -void gpu_flush() { +void gpu_execute_and_wait() { if (gpu_in_use) { vkCmdEndRendering(command_buffer); } @@ -1346,7 +1346,7 @@ void gpu_get_render_target_pixels(gpu_texture_t *render_target, uint8_t *data) { set_image_layout(render_target->impl.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); - gpu_flush(); + gpu_execute_and_wait(); // Read buffer void *p; diff --git a/base/sources/backends/webgpu_gpu.c b/base/sources/backends/webgpu_gpu.c index 278e62a5..ffcbe578 100644 --- a/base/sources/backends/webgpu_gpu.c +++ b/base/sources/backends/webgpu_gpu.c @@ -291,6 +291,6 @@ void gpu_set_index_buffer(struct gpu_buffer *buffer) { void gpu_get_render_target_pixels(gpu_texture_t *render_target, uint8_t *data) {} void gpu_wait() {} -void gpu_flush() {} +void gpu_execute_and_wait() {} void gpu_set_constant_buffer(struct gpu_buffer *buffer, int offset, size_t size) {} void gpu_set_texture(int unit, gpu_texture_t *texture) {} diff --git a/base/sources/iron_gpu.c b/base/sources/iron_gpu.c index a665f858..3a391bf6 100644 --- a/base/sources/iron_gpu.c +++ b/base/sources/iron_gpu.c @@ -75,7 +75,7 @@ void gpu_draw() { draw_calls++; if (draw_calls + draw_calls_last >= CONSTANT_BUFFER_MULTIPLE) { draw_calls = draw_calls_last = constant_buffer_index = 0; - gpu_flush(); + gpu_execute_and_wait(); } gpu_constant_buffer_lock(&constant_buffer, constant_buffer_index * CONSTANT_BUFFER_SIZE, CONSTANT_BUFFER_SIZE); diff --git a/base/sources/iron_gpu.h b/base/sources/iron_gpu.h index 72ac72e8..902e88ba 100644 --- a/base/sources/iron_gpu.h +++ b/base/sources/iron_gpu.h @@ -141,7 +141,7 @@ void gpu_begin_internal(gpu_texture_t **targets, int count, gpu_texture_t *depth void gpu_end(void); void gpu_end_internal(void); void gpu_wait(void); -void gpu_flush(void); +void gpu_execute_and_wait(void); void gpu_present(void); void gpu_present_internal(void); void gpu_barrier(gpu_texture_t *render_target, gpu_texture_state_t state_after);