CONGE-2 REMOVED PRESENTATION QUEUE ON MAC

This commit is contained in:
Jimmy Tremblay-Bernier 2024-11-22 15:03:04 -05:00
parent 11b558f836
commit d74d19fdf2
3 changed files with 23 additions and 18 deletions

View File

@ -21,11 +21,6 @@ find_package(glm REQUIRED)
find_package(SDL2 REQUIRED)
find_package(Vulkan REQUIRED)
IF (WIN32)
define_property(TARGET PROPERTY VK_PROTOTYPES )
define_property(TARGET PROPERTY VK_USE_PLATFORM_WIN32_KHR)
endif ()
add_library(${PROJECT_NAME} STATIC ${HEADER_FILES} ${SOURCES_FILES})
# Specify include directories

View File

@ -4,15 +4,13 @@
#include "VulkanContext.h"
#ifdef __WIN32__
// #include <vulkan/vulkan_win32.h>
#endif
#ifdef __APPLE__
#include "vulkan/vulkan_metal.h"
#endif
namespace ConjureEngine {
VulkanContext::VulkanContext(SDL_Window* window, const VkApplicationInfo& appInfo) {
VulkanContext::VulkanContext(SDL_Window* window, const VkApplicationInfo& appInfo)
{
// LOAD THE EXTENSIONS
SDL_Vulkan_GetInstanceExtensions(window, &m_extensionCount, nullptr);
m_extensionNames.reserve(m_extensionCount);
@ -92,10 +90,20 @@ namespace ConjureEngine {
// CREATE VIRTUAL DEVICE FOR RENDERING
vkCreateDevice(m_selectedPhysicalDevice, &m_deviceCreateInfo, nullptr, &m_device);
VkResult result = vkCreateDevice(m_selectedPhysicalDevice, &m_deviceCreateInfo, nullptr, &m_device);
if(result != VkResult::VK_SUCCESS) {
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Error while creating the device: %d", static_cast<int>(result));
}
else {
SDL_Log("DEVICE CREATED SUCCESSFULLY");
}
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
const std::string error = SDL_GetError();
if(!error.empty()) {

View File

@ -16,16 +16,18 @@ namespace ConjureEngine {
private:
uint32_t m_extensionCount{0};
std::vector<const char*> m_extensionNames;
VkInstance m_vkInst{};
VkInstance m_vkInst{nullptr};
uint32_t m_physicalDeviceCount{0};
std::vector<VkPhysicalDevice> m_physicalDevices;
VkPhysicalDevice m_selectedPhysicalDevice;
VkPhysicalDevice m_selectedPhysicalDevice{nullptr};
uint32_t m_queueFamilyCount{0};
VkSurfaceKHR m_surface;
VkDeviceQueueCreateInfo m_deviceQueueCreateInfo;
VkDeviceCreateInfo m_deviceCreateInfo;
VkDevice m_device;
VkQueue m_graphicQueue;
VkQueue m_presentQueue;
VkSurfaceKHR m_surface{nullptr};
VkDeviceQueueCreateInfo m_deviceQueueCreateInfo{};
VkDeviceCreateInfo m_deviceCreateInfo{};
VkDevice m_device{nullptr};
VkQueue m_graphicQueue{nullptr};
#ifndef __APPLE__
VkQueue m_presentQueue{nullptr};
#endif
};
} // ConjureEngine