From b44e93b3c652f81f321b8ff4431418368727f523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 10 Nov 2026 15:09:16 +0100 Subject: [PATCH] Android: Check for a crashing custom driver on Android 11+ too There the backend is never given up on, but a custom driver that crashed Vulkan last time is cleared, and Vulkan is tried again with the system's. Co-Authored-By: Claude Opus 5.5 --- UI/NativeApp.cpp | 17 ++++++++++++----- android/jni/app-android.cpp | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 444807d2d4..5f5e0f976b 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -507,12 +507,17 @@ static void CheckFailedGPUBackends() { return; #endif + // Only a custom driver is given up on, never the backend. + bool customDriverOnly = false; #if PPSSPP_PLATFORM(ANDROID) if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 30) { - // In Android 11 or later, Vulkan is as stable as OpenGL, so let's not even bother. - // Have also seen unexplained issues with random fallbacks to OpenGL for no good reason, - // especially when debugging. - return; + // In Android 11 or later, Vulkan is as stable as OpenGL, so the only thing to check for is a custom + // driver that crashes. Have also seen unexplained issues with random fallbacks to OpenGL for no good + // reason, especially when debugging. + if (g_Config.iGPUBackend != (int)GPUBackend::VULKAN || g_Config.sCustomDriver.empty()) { + return; + } + customDriverOnly = true; } #endif @@ -556,7 +561,9 @@ static void CheckFailedGPUBackends() { #endif // Okay, let's not try a backend in the failed list. - g_Config.iGPUBackend = g_Config.NextValidBackend(); + if (!customDriverOnly) { + g_Config.iGPUBackend = g_Config.NextValidBackend(); + } if (lastBackend != g_Config.iGPUBackend) { // This is the expected path. std::string param = GPUBackendToString((GPUBackend)lastBackend) + " -> " + GPUBackendToString((GPUBackend)g_Config.iGPUBackend); diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 4259f33e3f..cd646f9f1e 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -869,7 +869,7 @@ retry: const std::string failedDriver = VulkanTakeFailedCustomDriver(); if (!failedDriver.empty()) { auto gr = GetI18NCategory(I18NCat::GRAPHICS); - g_OSD.Show(OSDType::MESSAGE_ERROR, gr->T("The custom driver failed, so the default driver is used instead"), failedDriver, 10.0f); + g_OSD.Show(OSDType::MESSAGE_ERROR, gr->T("The custom Vulkan driver failed to load. Switching back to default."), failedDriver, 10.0f); g_Config.Save("CustomDriverFailed"); } }