Merge pull request #19440 from hrydgard/sdl-gl-fallback-fix

SDL: Fix the fallback path from Vulkan to OpenGL
This commit is contained in:
Henrik Rydgård 2024-09-09 21:28:18 +02:00 committed by GitHub
commit d3fca5b8eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1134,8 +1134,10 @@ int main(int argc, char *argv[]) {
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
#endif
bool vulkanMayBeAvailable = false;
if (VulkanMayBeAvailable()) {
printf("DEBUG: Vulkan might be available.\n");
vulkanMayBeAvailable = true;
} else {
printf("DEBUG: Vulkan is not available, not using Vulkan.\n");
}
@ -1327,6 +1329,11 @@ int main(int argc, char *argv[]) {
GraphicsContext *graphicsContext = nullptr;
SDL_Window *window = nullptr;
// Switch away from Vulkan if not available.
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN && !vulkanMayBeAvailable) {
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
}
std::string error_message;
if (g_Config.iGPUBackend == (int)GPUBackend::OPENGL) {
SDLGLGraphicsContext *ctx = new SDLGLGraphicsContext();