mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +01:00
[dxvk] Remove SDL dummy window
SDL >= 2.0.9 permits passing a nullptr window to SDL_Vulkan_GetInstanceExtensions, so there's no point in going though the work of creating a window just to call this function.
This commit is contained in:
parent
196fefec4c
commit
3491895960
@ -13,30 +13,18 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxvkNameSet DxvkPlatformExts::getInstanceExtensions() {
|
DxvkNameSet DxvkPlatformExts::getInstanceExtensions() {
|
||||||
SDL_Window* window = SDL_CreateWindow(
|
|
||||||
"Dummy Window",
|
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
|
||||||
1, 1,
|
|
||||||
SDL_WINDOW_HIDDEN | SDL_WINDOW_VULKAN);
|
|
||||||
|
|
||||||
if (window == nullptr)
|
|
||||||
throw DxvkError(str::format("SDL2 WSI: Failed to create dummy window. ", SDL_GetError()));
|
|
||||||
|
|
||||||
uint32_t extensionCount = 0;
|
uint32_t extensionCount = 0;
|
||||||
if (!SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, nullptr))
|
if (!SDL_Vulkan_GetInstanceExtensions(nullptr, &extensionCount, nullptr))
|
||||||
throw DxvkError(str::format("SDL2 WSI: Failed to get instance extension count. ", SDL_GetError()));
|
throw DxvkError(str::format("SDL2 WSI: Failed to get instance extension count. ", SDL_GetError()));
|
||||||
|
|
||||||
auto extensionNames = std::vector<const char *>(extensionCount);
|
auto extensionNames = std::vector<const char *>(extensionCount);
|
||||||
if (!SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, extensionNames.data()))
|
if (!SDL_Vulkan_GetInstanceExtensions(nullptr, &extensionCount, extensionNames.data()))
|
||||||
throw DxvkError(str::format("SDL2 WSI: Failed to get instance extensions. ", SDL_GetError()));
|
throw DxvkError(str::format("SDL2 WSI: Failed to get instance extensions. ", SDL_GetError()));
|
||||||
|
|
||||||
DxvkNameSet names;
|
DxvkNameSet names;
|
||||||
for (const char* name : extensionNames)
|
for (const char* name : extensionNames)
|
||||||
names.add(name);
|
names.add(name);
|
||||||
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user