From eed28932c0f096ab67471d7c2d387c081adae37f Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Tue, 14 May 2024 17:57:43 +0200 Subject: [PATCH] vulkan/wsi: Make current_frame usable in all cases It would be useful for u_trace to separate frames. Signed-off-by: Danylo Piliaiev Reviewed-by: Lionel Landwerlin Part-of: --- src/vulkan/wsi/wsi_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 2b7d8717e19..864edeb390d 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -1316,7 +1316,7 @@ static VkResult wsi_signal_present_id_timeline(struct wsi_swapchain *swapchain, } static VkResult -handle_trace(VkQueue queue, struct vk_device *device) +handle_trace(VkQueue queue, struct vk_device *device, uint32_t current_frame) { struct vk_instance *instance = device->physical->instance; if (!instance->trace_mode) @@ -1325,8 +1325,6 @@ handle_trace(VkQueue queue, struct vk_device *device) simple_mtx_lock(&device->trace_mtx); bool frame_trigger = device->current_frame == instance->trace_frame; - if (device->current_frame <= instance->trace_frame) - device->current_frame++; bool file_trigger = false; #ifndef _WIN32 @@ -1359,7 +1357,9 @@ wsi_common_queue_present(const struct wsi_device *wsi, int queue_family_index, const VkPresentInfoKHR *pPresentInfo) { - VkResult final_result = handle_trace(queue, vk_device_from_handle(device)); + struct vk_device *dev = vk_device_from_handle(device); + uint32_t current_frame = p_atomic_fetch_add(&dev->current_frame, 1); + VkResult final_result = handle_trace(queue, dev, current_frame); STACK_ARRAY(VkPipelineStageFlags, stage_flags, MAX2(1, pPresentInfo->waitSemaphoreCount));