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