mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +02:00
remove source code support for SDL2
This commit is contained in:
@@ -29,13 +29,7 @@
|
||||
#include "Shader.h"
|
||||
#include "Vulkan.h"
|
||||
|
||||
#if __has_include(<SDL3/SDL_version.h>)
|
||||
#include <SDL3/SDL_version.h>
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
#else
|
||||
#include <SDL_version.h>
|
||||
#include <SDL_vulkan.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
@@ -102,11 +96,7 @@ static void checkOptionalInstanceExtensions(OptionalInstanceExtensions& ext)
|
||||
Graphics::Graphics()
|
||||
: love::graphics::Graphics("love.graphics.vulkan")
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
if (!SDL_Vulkan_LoadLibrary(nullptr))
|
||||
#else
|
||||
if (SDL_Vulkan_LoadLibrary(nullptr))
|
||||
#endif
|
||||
throw love::Exception("could not find vulkan");
|
||||
|
||||
volkInitializeCustom((PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr());
|
||||
@@ -129,19 +119,12 @@ Graphics::Graphics()
|
||||
|
||||
// GetInstanceExtensions works with a null window parameter as long as
|
||||
// SDL_Vulkan_LoadLibrary has been called (which we do earlier).
|
||||
unsigned int count;
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
unsigned int count = 0;
|
||||
char const* const* extensions_string = SDL_Vulkan_GetInstanceExtensions(&count);
|
||||
if (extensions_string == nullptr)
|
||||
throw love::Exception("couldn't retrieve sdl vulkan extensions");
|
||||
|
||||
std::vector<const char*> extensions(extensions_string, extensions_string + count);
|
||||
#else
|
||||
if (SDL_Vulkan_GetInstanceExtensions(nullptr, &count, nullptr) != SDL_TRUE)
|
||||
throw love::Exception("couldn't retrieve sdl vulkan extensions");
|
||||
|
||||
std::vector<const char*> extensions = {};
|
||||
#endif
|
||||
|
||||
checkOptionalInstanceExtensions(optionalInstanceExtensions);
|
||||
|
||||
@@ -150,14 +133,6 @@ Graphics::Graphics()
|
||||
if (optionalInstanceExtensions.debugInfo)
|
||||
extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
size_t additional_extension_count = extensions.size();
|
||||
extensions.resize(additional_extension_count + count);
|
||||
|
||||
if (SDL_Vulkan_GetInstanceExtensions(nullptr, &count, extensions.data() + additional_extension_count) != SDL_TRUE)
|
||||
throw love::Exception("couldn't retrieve sdl vulkan extensions");
|
||||
#endif
|
||||
|
||||
createInfo.enabledExtensionCount = static_cast<uint32_t>(extensions.size());
|
||||
createInfo.ppEnabledExtensionNames = extensions.data();
|
||||
|
||||
@@ -1878,13 +1853,8 @@ void Graphics::createSurface()
|
||||
{
|
||||
auto window = Module::getInstance<love::window::Window>(M_WINDOW);
|
||||
const void *handle = window->getHandle();
|
||||
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||
if (!SDL_Vulkan_CreateSurface((SDL_Window*)handle, instance, nullptr, &surface))
|
||||
throw love::Exception("failed to create window surface");
|
||||
#else
|
||||
if (SDL_Vulkan_CreateSurface((SDL_Window*)handle, instance, &surface) != SDL_TRUE)
|
||||
throw love::Exception("failed to create window surface");
|
||||
#endif
|
||||
}
|
||||
|
||||
SwapChainSupportDetails Graphics::querySwapChainSupport(VkPhysicalDevice device)
|
||||
|
||||
Reference in New Issue
Block a user