From 2540460bb787b67b3fdeea9ac2e45f3231855c82 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B3zef=20Kucia?= Date: Mon, 15 Jan 2018 19:05:10 +0100 Subject: [PATCH] core: Use new API for accessing Vulkan queues. --- Core/port.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Core/port.cpp b/Core/port.cpp index 4a78b8e..d5877f1 100644 --- a/Core/port.cpp +++ b/Core/port.cpp @@ -41,7 +41,7 @@ struct port_swapchain VkInstance vk_instance; VkDevice vk_device; - VkQueue vk_queue; + ID3D12CommandQueue *command_queue; uint32_t current_buffer; unsigned int buffer_count; @@ -648,7 +648,6 @@ struct port_swapchain *port_swapchain_create(ID3D12CommandQueue *command_queue, swapchain->vk_fence = vk_fence; swapchain->vk_instance = vk_instance; swapchain->vk_device = vk_device; - swapchain->vk_queue = vkd3d_get_vk_queue(command_queue); vkAcquireNextImageKHR(vk_device, vk_swapchain, UINT64_MAX, VK_NULL_HANDLE, vk_fence, &swapchain->current_buffer); @@ -685,6 +684,9 @@ struct port_swapchain *port_swapchain_create(ID3D12CommandQueue *command_queue, free(vk_images); d3d12_device->Release(); + swapchain->command_queue = command_queue; + swapchain->command_queue->AddRef(); + return swapchain; fail: @@ -710,6 +712,7 @@ ID3D12Resource *port_swapchain_get_back_buffer(struct port_swapchain *swapchain, void port_swapchain_present(struct port_swapchain *swapchain) { VkPresentInfoKHR present_desc; + VkQueue vk_queue; present_desc.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; present_desc.pNext = NULL; @@ -720,7 +723,9 @@ void port_swapchain_present(struct port_swapchain *swapchain) present_desc.pImageIndices = &swapchain->current_buffer; present_desc.pResults = NULL; - vkQueuePresentKHR(swapchain->vk_queue, &present_desc); + vk_queue = vkd3d_acquire_vk_queue(swapchain->command_queue); + vkQueuePresentKHR(vk_queue, &present_desc); + vkd3d_release_vk_queue(swapchain->command_queue); vkAcquireNextImageKHR(swapchain->vk_device, swapchain->vk_swapchain, UINT64_MAX, VK_NULL_HANDLE, swapchain->vk_fence, &swapchain->current_buffer); @@ -732,6 +737,7 @@ void port_swapchain_destroy(struct port_swapchain *swapchain) { unsigned int i; + swapchain->command_queue->Release(); for (i = 0; i < swapchain->buffer_count; ++i) { swapchain->buffers[i]->Release(); -- 2.11.4.GIT