From 4d25b8c97a776e3213232fd1dfba291ffba8a331 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Tue, 31 Mar 2026 20:21:14 -0300 Subject: [PATCH] vulkan: fix initialization if love.graphics is loaded before love.window. --- src/modules/graphics/vulkan/Graphics.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/graphics/vulkan/Graphics.cpp b/src/modules/graphics/vulkan/Graphics.cpp index d175fca3e..3ecdee31a 100644 --- a/src/modules/graphics/vulkan/Graphics.cpp +++ b/src/modules/graphics/vulkan/Graphics.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -95,6 +96,10 @@ static void checkOptionalInstanceExtensions(OptionalInstanceExtensions& ext) Graphics::Graphics() : love::graphics::Graphics("love.graphics.vulkan") { + // Needed for SDL_Vulkan_LoadLibrary, if graphics is loaded before the window. + if (!SDL_InitSubSystem(SDL_INIT_VIDEO)) + throw love::Exception("Could not initialize SDL video subsystem (%s)", SDL_GetError()); + if (!SDL_Vulkan_LoadLibrary(nullptr)) throw love::Exception("could not find vulkan"); @@ -192,6 +197,7 @@ Graphics::~Graphics() vkDestroyInstance(instance, nullptr); SDL_Vulkan_UnloadLibrary(); + SDL_QuitSubSystem(SDL_INIT_VIDEO); } // START OVERRIDEN FUNCTIONS