From 194ea8eeef269c55ab7b3db7914c52a9e1c3a902 Mon Sep 17 00:00:00 2001 From: Jimmy Tremblay-Bernier Date: Fri, 22 Nov 2024 15:08:02 -0500 Subject: [PATCH] CONGE-2 Tweaked the logic to handle cases where presentation queue is not available instead of using #ifndef --- ConjureEngine/src/ConjureEngine/VulkanContext.cpp | 8 +++++--- ConjureEngine/src/ConjureEngine/VulkanContext.h | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ConjureEngine/src/ConjureEngine/VulkanContext.cpp b/ConjureEngine/src/ConjureEngine/VulkanContext.cpp index 2ce5c34..f27cce7 100644 --- a/ConjureEngine/src/ConjureEngine/VulkanContext.cpp +++ b/ConjureEngine/src/ConjureEngine/VulkanContext.cpp @@ -100,9 +100,11 @@ namespace ConjureEngine { vkGetDeviceQueue(m_device, graphicsQueueIndex, 0, &m_graphicQueue); - #ifndef __APPLE__ // MAC DOESNT SUPPORT 2 QUEUES LIKE ON WINDOWS/ - vkGetDeviceQueue(m_device, presentQueueIndex, 0, &m_presentQueue); - #endif + // WHEN POSSIBLE, WE WANT TO USE THE PRESENTATION QUEUE, BUT MAC DOESN'T SUPPORT IT + if(presentQueueIndex != UINT32_MAX) { + m_supportsPresentationQueue = true; + vkGetDeviceQueue(m_device, presentQueueIndex, 0, &m_presentQueue); + } const std::string error = SDL_GetError(); diff --git a/ConjureEngine/src/ConjureEngine/VulkanContext.h b/ConjureEngine/src/ConjureEngine/VulkanContext.h index 24e5c86..f667312 100644 --- a/ConjureEngine/src/ConjureEngine/VulkanContext.h +++ b/ConjureEngine/src/ConjureEngine/VulkanContext.h @@ -26,8 +26,7 @@ namespace ConjureEngine { VkDeviceCreateInfo m_deviceCreateInfo{}; VkDevice m_device{nullptr}; VkQueue m_graphicQueue{nullptr}; - #ifndef __APPLE__ VkQueue m_presentQueue{nullptr}; - #endif + bool m_supportsPresentationQueue = false; }; } // ConjureEngine