- VkResult result = VK_SUCCESS;
-
- for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
- RADV_FROM_HANDLE(radv_swapchain, swapchain, pPresentInfo->pSwapchains[i]);
-
- assert(swapchain->device == queue->device);
- if (swapchain->fences[0] == VK_NULL_HANDLE) {
- result = radv_CreateFence(radv_device_to_handle(queue->device),
- &(VkFenceCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
- .flags = 0,
- }, &swapchain->alloc, &swapchain->fences[0]);
- if (result != VK_SUCCESS)
- return result;
- } else {
- radv_ResetFences(radv_device_to_handle(queue->device),
- 1, &swapchain->fences[0]);
- }
-
- radv_QueueSubmit(_queue, 0, NULL, swapchain->fences[0]);
-
- result = swapchain->queue_present(swapchain, queue,
- pPresentInfo->pImageIndices[i]);
- /* TODO: What if one of them returns OUT_OF_DATE? */
- if (result != VK_SUCCESS)
- return result;
-
- VkFence last = swapchain->fences[2];
- swapchain->fences[2] = swapchain->fences[1];
- swapchain->fences[1] = swapchain->fences[0];
- swapchain->fences[0] = last;
-
- if (last != VK_NULL_HANDLE) {
- radv_WaitForFences(radv_device_to_handle(queue->device),
- 1, &last, true, 1);
- }
-
- }
-
- return VK_SUCCESS;
+ return wsi_common_queue_present(&queue->device->physical_device->wsi_device,
+ radv_device_to_handle(queue->device),
+ _queue,
+ queue->queue_family_index,
+ pPresentInfo);