summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/SwapChain.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@users.noreply.github.com>2017-09-06 18:32:43 +1000
committerGitHub <noreply@github.com>2017-09-06 18:32:43 +1000
commit2e20cd0ffdfb909a52a70217474fa5b53bd12996 (patch)
tree559a4d64b6da3be1ee1565dfa8ea8f2da95af216 /Source/Core/VideoBackends/Vulkan/SwapChain.cpp
parent92e5f5c5684c0ef4fac55497e939e21336eb14cb (diff)
parenta5be5a3a765207b55b16661cc182e5c5bbbf55de (diff)
Merge pull request #6025 from spxtr/present_queue
Vulkan: Use a separate queue for presenting.
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/SwapChain.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/SwapChain.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp
index 21009510bb..c5b3791637 100644
--- a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp
+++ b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp
@@ -327,7 +327,6 @@ bool SwapChain::CreateSwapChain()
VkSwapchainKHR old_swap_chain = m_swap_chain;
// Now we can actually create the swap chain
- // TODO: Handle case where the present queue is not the graphics queue.
VkSwapchainCreateInfoKHR swap_chain_info = {VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
nullptr,
0,
@@ -346,6 +345,17 @@ bool SwapChain::CreateSwapChain()
m_present_mode,
VK_TRUE,
old_swap_chain};
+ std::array<uint32_t, 2> indices = {{
+ g_vulkan_context->GetGraphicsQueueFamilyIndex(),
+ g_vulkan_context->GetPresentQueueFamilyIndex(),
+ }};
+ if (g_vulkan_context->GetGraphicsQueueFamilyIndex() !=
+ g_vulkan_context->GetPresentQueueFamilyIndex())
+ {
+ swap_chain_info.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
+ swap_chain_info.queueFamilyIndexCount = 2;
+ swap_chain_info.pQueueFamilyIndices = indices.data();
+ }
res =
vkCreateSwapchainKHR(g_vulkan_context->GetDevice(), &swap_chain_info, nullptr, &m_swap_chain);