This commit is contained in:
luboslenco
2025-07-12 10:58:05 +02:00
parent 3e87ac8ca5
commit a6cfa3d1ff
6 changed files with 11 additions and 11 deletions
+4 -4
View File
@@ -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);
+2 -2
View File
@@ -226,7 +226,7 @@ void gpu_wait() {
[command_buffer waitUntilCompleted];
}
void gpu_flush() {
void gpu_execute_and_wait() {
[command_buffer commit];
gpu_wait();
id<MTLCommandQueue> 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) {
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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) {}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);