working on vulkan loader

This commit is contained in:
Kbz-8
2024-09-16 05:07:02 +02:00
parent 83432cb356
commit e9a8a0cb84
9 changed files with 274 additions and 221 deletions

View File

@@ -139,16 +139,30 @@ namespace mlx
return surface;
}
std::vector<const char*> SDLManager::GetRequiredVulkanInstanceExtentions(Handle window) const noexcept
std::vector<const char*> SDLManager::GetRequiredVulkanInstanceExtentions() const noexcept
{
std::uint32_t count;
if(!SDL_Vulkan_GetInstanceExtensions(static_cast<SDL_Window*>(window), &count, nullptr))
FatalError("Vulkan : cannot get instance extentions from window : %", SDL_GetError());
std::vector<const char*> extensions;
extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
std::vector<const char*> extensions(count);
#ifdef VK_USE_PLATFORM_XCB_KHR
extensions.push_back(VK_KHR_XCB_SURFACE_EXTENSION_NAME);
#endif
if(!SDL_Vulkan_GetInstanceExtensions(static_cast<SDL_Window*>(window), &count, extensions.data()))
FatalError("Vulkan : cannot get instance extentions from window : %", SDL_GetError());
#ifdef VK_USE_PLATFORM_XLIB_KHR
extensions.push_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
extensions.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
extensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
#endif
#ifdef VK_USE_PLATFORM_METAL_EXT
extensions.push_back(VK_EXT_METAL_SURFACE_EXTENSION_NAME);
#endif
return extensions;
}