Repository navigation
vulkan: default to classic VkRenderPass on ARM Mali r49+ and hash get_rp - #534
Merged
Merged
Conversation
Propinbo
added a commit
to Propinbo/BOTWRecompAndroid
that referenced
this pull request
Nov 21, 2026
mamcjr#534, held 2B-2 & 40 FPS validation
mamcjr
reviewed
Nov 24, 2026
mamcjr
left a comment
Owner
There was a problem hiding this comment.
Thanks! On Turnip nothing changes by default: vk_dyn_render_want returns true unless the variable is set, and every rpcompat entry point returns early on g_vk.dyn_render. The hash table is a good change.
Before merging:
- This turns #518 off. #518 only enables local read with dynamic rendering (
g_vk.local_read = want_lr && g_vk.dyn_render && ...), and this PR turns dynamic rendering off by default on the same Mali r49+ drivers. With both merged, local read would never turn on. Which one do you want on those drivers? I'd like to settle that before merging either. - The first session after the update on Mali r49+.
prewarm_vk_flags()includesdyn_render, so every prewarm file is rejected once, and everyvk_pipelines.binentry misses (the pipelines are now built againstvk_rp_compatrender passes). The first session stutters like a fresh install. Fine, but it needs a line in the release notes. - One device measured (G925, r49p1), and the default flips for every r49+ Mali (G715/G720 phones and others). Since most players can't set variables, could the rollback be a Settings option instead of env-only?
- Could you do one Mali run with
inplace_reads=1(#507, now in main) on this PR? #507 was probably checked with dynamic rendering.
Minor:
get_rpreturnsmake_rp(k)without caching when the firstrp_grow()fails or the insertion is refused, so every call then makes and leaks a render pass (main has the same leak past RP_MAX, out of memory only).nrps == 512in the log is now arbitrary.LARECOMP_NO_DYNAMIC_RENDERING=abcnow forces dynamic rendering on for Mali (main'satoiread it as not off).
I'll run LARECOMP_NO_DYNAMIC_RENDERING=1 on the POCO with this PR (3-scene benchmark plus two reboots) to exercise the hash table.
Propinbo
force-pushed
the
feat/vk-mali-renderpass-default
branch
from
November 24, 2026 15:08
9d5e732 to
c1a29d9
Compare
Contributor
Author
|
Rebased onto Review Updates Implemented (
|
Owner
|
Merged, thanks! It conflicted with #531 only in |
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.
Problem
On ARM Mali proprietary Vulkan drivers
r49+(tested onMali-G925-Immortalis MC12,v1.r49p1, Android 16),VK_KHR_dynamic_renderingtriggers repeated secondary allocations /mmap+munmapchurn insidelibGLES_mali.soon the render thread, adding ~2–3 ms per frame in CPU render-thread overhead compared to classicVkRenderPass(rpcompat.c), even when dynamic rendering features are unused.Meanwhile,
rpcompat.c'sget_rp()cache previously performed a linear scan over a fixedRP_MAX = 512array, hashed/compared anRpKeywith implicit 2-byte tail padding, and callers did not guardVK_NULL_HANDLE/ OOM returns acrossvk_rp_compat/vk_begin_rendering/ ImGui init.Changes (Updated for Maintainer Review & Rebased onto
v0.4.12-beta79ba1909)runtime/nvn/vulkan/device_compat.h,runtime/nvn/vulkan/dyn_vi.h):vk_arm_driver_major()fromdyn_vi.hintodevice_compat.husing freestanding ASCII helpers (vk_compat_is_digit/vk_compat_is_alnum) sowasm32 -ffreestanding -O2 -nostdlibcompatibility tests stay dependency-free.vk_compat_skip_ws(),vk_compat_env_nonzero(), andvk_dyn_render_want(supported, driver_id, driver_info, have_driver_props, no_dr_env, setting_dyn_render, &reason):"the driver lacks it").LARECOMP_NO_DYNAMIC_RENDERING=1/0retains highest precedence (with leading/trailing whitespace & sign/zero tolerance and malformed-token fallthrough).g_settings.dyn_render(0= Off,1= On,-1= Auto) follows env override.Auto(-1), dynamic rendering defaults OFF only on Android whenhave_driver_props && driver_id == VK_DRIVER_ID_ARM_PROPRIETARY && major >= 49("Mali r49+ default").runtime/settings.h,runtime/settings.c,runtime/nvn/vulkan/device.c,runtime/ui/{launcher.mm,menu.mm},runtime/ui/i18n_*.inc):g_settings.dyn_render(dyn_render = auto | 1 | 0, default-1Auto) persisted inbase.ini(Video -> Dynamic rendering), exposed cleanly in both launcher and in-game menu across all 11i18n_*.inclocales (note under the setting: defaults off on ARM Malir49+drivers).bool dr_ext_ok = cg[OPT_DR];before gating ondevice.c, keepingQCHAIN(dr_ext_ok, q_dr)capability queries accurate and logging exact reason ([vk] no dynamic rendering (Mali r49+ default): classic render passesvs[vk] dynamic rendering enabled (settings)).O(1)growing hash table & fullVK_NULL_HANDLE/OOM propagation (runtime/nvn/vulkan/{rpcompat.c,vk.h,device.c,exec.c,imgui_glue.cpp},runtime/ui/{launcher.mm,menu.mm}):get_rp()with a dynamic power-of-two open-addressed hash table (RP_INIT_CAP = 1024,rp_grow()doubling at >50% load factor via overflow-safe uint64 comparison and OOM safety). Added explicitRpKey.pad[2]zeroed via_Static_assert+memcpy,_Atomic int nlateacquire/release ordering invk_rp_collect(), andcap_late > INT_MAX / 2overflow +reallocOOM safety indestroy_late().vk_begin_renderingandvk_imgui_backend_initto returnbooland addedvk_rendering_active(). CheckedVK_NULL_HANDLE/falsereturns across all callers (device.c,exec.c,imgui_glue.cpp,launcher.mm,menu.mmincludingg_init_failed/BackendRendererUserDataguards).tools/test_mali_rp_default.c,tools/test_rt_load_upload.c,tools/test_android_runtime.ps1):vk_dyn_render_want()across Malir48/r49/r54/NULL, Turnip, RADV, PanVK, Qualcomm, Samsung,g_settings.dyn_render(-1/0/1), env precedence & edge-case tokens, plustest_rpcompat_cache()(OOM before table init,1024 -> 2048 -> 4096 -> 8192growth,make_rp()/vkCreateFramebufferOOM safety,vk_begin_rendering/vk_rendering_active, anddrop_all()/vk_rp_collect()deferred-destroy sequence ordering).Upgrade & Rollback Notes
r49+: Existingvk_pipelines.binentries built withVK_KHR_dynamic_renderingundergo a one-time rebuild onto classicVkRenderPass(rpcompat.c) on first boot after the change; warm.smeta/ SPIR-V caches remain reusable and subsequent boots load warm with classic render passes.VK_DRIVER_ID_ARM_PROPRIETARY(driver-id 9) with major version>= 49anddyn_render = auto. Adreno/Turnip, Qualcomm proprietary, Mali< r49, Xclipse, PanVK, and desktop (#ifndef __ANDROID__) keep dynamic rendering ON by default.LARECOMP_NO_DYNAMIC_RENDERING=0.Verification (Exact Final Commit
c1a29d9381aeb63739ecfc9c14f1cb3f00e1ff36atopv0.4.12-beta)Environment
SM-X730), SoCMT6991, Android 16 (API 36)Mali-G925-Immortalis MC12 - v1.r49p1-03bet0.f8a98b506b89b21c80a508d70abfcb3f(driver-id 9, Vulkan1.3.278)1.9.0(native), rebased ontov0.4.12-beta(79ba1909f716d7761046a767651c62dbfa917ef1)681e4f13d27a5205feaec6515752185c56b188f851799c8bb7a86e8d9dd2a314(0new compiler warnings)Tested vs. Untested Matrix
r49p1,SM-X730)c1a29d93)5a_warmup/5a_measured(withinplace_reads=1+ pre-existingvk_pipelines.binupgrade + 2 reboots) +5bdyn_render=1INI + PNG visual check< r49, Turnip, Qualcomm, Xclipse, PanVKtest_mali_rp_defaultvk_dyn_render_want()verified unchanged (DR=on); not runtime-tested on hardware#ifndef __ANDROID__)-U__ANDROID__)settings.c,rpcompat.c,device.c,imgui_glue.cpp,i18n.mm,menu.mmcompile cleanly under NDK Clang-WerrorAutomated & Unit Checks (
c1a29d93)tools/test_vulkan_compat.py:16 Vulkan compatibility checks passedtools/test_vulkan_startup.py:33 Vulkan startup checks passedtools/test_pipeline_cache_save.py(executed onSM-X730):PASStools/test_android_runtime.ps1 -DeviceSerial R52YA06LXAT:9/9Bionic tests passed (including expandedtest_mali_rp_defaultand updatedtest_rt_load_upload)workspace_check.py pr:PASS(commits=1 files=25 mergeable=YES)Live
SM-X730Checks (c1a29d93)inplace_reads=1+ Pre-existingvk_pipelines.bin(67,078,586B) Upgrade (cap30,res_mode=10,upscaler=3SGSR1, 2 in-place reboots):[vk] no dynamic rendering (Mali r49+ default): classic render passes(1..8RPs created) and[vk] targets a draw writes, sampled by it: in place (settings).0 keptafter teardown in254/278 msand279/226 ms;shader-meta:435 hits / 3 missesthen402 hits / 0 misses).5a_measured(451/451/243frames):plateau30.0 fps(low_1% 29.57,gpu p50 28.074 ms,render p50 17.018 ms,skipped 0),zora-plaza30.0 fps(low_1% 29.41,gpu p50 30.598 ms,render p50 18.243 ms,skipped 0),kakariko-day16.19 fps(low_1% 12.74,gpu p50 59.510 ms,render p50 42.871 ms,skipped 2— GPU-bound atres_mode=10); visual captures clean across all 3 scenes.dyn_render = 1inbase.ini, zero feature env vars):[vk] dynamic rendering enabled (settings); title screen rendered cleanly.(Historical
9d5e732ccap-30/60p A/B benchmark &simpleperfdata comparing Dynamic Rendering ON vs Classic RP default onMali-G925showed-1.87to-2.40 msrender-thread p50 savings at cap-30 and+3.46 fpsinkakariko-day60p; archived onevidence/pr-mali-renderpass-default-20261121.)