Skip to content

Commit

Permalink
Merge pull request #19440 from hrydgard/sdl-gl-fallback-fix
Browse files Browse the repository at this point in the history
SDL: Fix the fallback path from Vulkan to OpenGL
  • Loading branch information
hrydgard authored Sep 9, 2024
2 parents 7f1b43b + f8843b1 commit d3fca5b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SDL/SDLMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d3fca5b

Please sign in to comment.