gpu_helper: dual-path Vulkan init with runtime API-level branch#1
Draft
gpu_helper: dual-path Vulkan init with runtime API-level branch#1
Conversation
-- still to be tested. currently being stuck at log in due to SQLite error from ( @query("SELECT * FROM epic_games WHERE is_dlc .... ) will come back to this once i can test
…r SQLite compatibility - changed DAO for EpicGame and GOGGame. This fixed crash in API 29 (Android 10) otherwise Skip steam login or steam log in triggers native crash.
Fix - ContainerConfigDialog.kt, gpuExtensions is computed inside remember { ... } and mutates gpuExtensionsErrorDialogState inside the catch. That is a side-effect during composition (inside remember init), which can lead to invalid bytecode / verifier failure on some devices (especially older runtimes like API 29) - created GpuCompatHelper to avoid the issue.
This commit refactors the handling of Vulkan extension retrieval for API 29 devices with Mali GPUs.
The logic, which previously existed directly within `ContainerConfigDialog.kt`, has been extracted into a new `GpuCompatHelper` class. This helper now safely attempts to get the device's Vulkan extensions and provides a default list if the native call fails, preventing a crash.
The `ContainerConfigDialog` now uses this helper to get the extensions and displays an informational dialog to the user if the fallback list was used. This improves code organization and isolates the compatibility workaround.
…or Android 10 fix Co-authored-by: Catpotatos <221862400+Catpotatos@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix dynamic loading for Vulkan on Android 10
gpu_helper: dual-path Vulkan init with runtime API-level branch
Mar 5, 2026
Catpotatos
pushed a commit
that referenced
this pull request
Mar 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Android 10 (API 29), static Vulkan linking crashes at
vkCreateInstance. The fix is dynamic loading viadlopen/dlsym, but applying it unconditionally diverges unnecessarily from upstream. This PR restores the upstream static path for API > 29 and gates the dynamic-load fix behind a runtime check.Changes
Runtime branch —
Java_com_winlator_core_GPUHelper_vkGetDeviceExtensionsnow callsandroid_get_device_api_level()and dispatches to one of two static helpers:vkGetDeviceExtensions_dynamic(API ≤ 29) — resolvesvkCreateInstance,vkEnumeratePhysicalDevices,vkEnumerateDeviceExtensionProperties,vkDestroyInstanceviadlsym; populates a fullVkApplicationInfo; cleans up (vkDestroyInstance+dlclose) on every exit path; releases JNI local refs in the loop; null-checks all allocations and JNI calls.vkGetDeviceExtensions_static(API > 29) — upstream code verbatim; only change is the return typejlong→jobjectArray.Return type fix — the JNI entry point and both helpers now return
jobjectArrayinstead ofjlong, matching the Java declarationpublic static native String[] vkGetDeviceExtensions().make_empty_arrayhelper — shared by both paths; includes a null guard onFindClass.New includes —
<dlfcn.h>,<string.h>,<android/api-level.h>.Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.