Repository navigation
vk: use VK_EXT_vertex_input_dynamic_state to cut pipeline permutations - #483
Conversation
122ec0c to
3383e1e
Compare
…rebases, PR mamcjr#485 async slots, Mali perf ABBA & release rollout
|
Thanks, the change looks right (internal binds forget the state, prewarm records carry the flag). The risk is drivers: it turns on wherever the extension is reported, including Qualcomm's own driver and older Mali, which weren't tested, and emulators have blocklisted this extension on some vendor drivers. Please keep it on only where it was tested (Mali r49, Turnip) and off on Qualcomm's driver for now, with an env switch to try it elsewhere. I'll A/B it here on Turnip, looking at the 1% lows, not only fps. |
3383e1e to
8146cfa
Compare
|
Rebased onto
|
…d release branch
|
Thanks, the driver gate is exactly right. You didn't test Turnip, so I'll A/B it here (the 1% lows with |
|
Thanks! On the POCO (Turnip) it turns on by default and off with LARECOMP_DYN_VI=0, and renders right. The speed A/B was within noise there (the phone was warm), no regressions. Merging. |
Summary
PipeKeybaked all 32 vertex attributes (attr_fmt,attr_off,attr_bind,attr_mask) and 17 stream descriptors (stride,divisor,used_streams) into everyVkPipeline. Draws sharing the same shaders, render targets, and blend/raster state still compiled duplicateVkPipelineobjects whenever vertex stride or attribute layout differed—driving compile hitches and pushing Mali drivers towardLARECOMP_PIPE_KEEPLRU eviction:runtime/nvn/vulkan/vk.h,runtime/nvn/vulkan/device.c):VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAMEviaQUERY_OPTIONAL(wideningextto48), gatesg_vk.dyn_viong_vk.eds && have_dyn_vi && vids_have.vertexInputDynamicState && g_vk.props.limits.maxVertexInputBindings > 16(ZERO_BINDING = 16), logs[vk-cap] dynamic vertex input: on|off, and providesLARECOMP_DYN_VI=0/LARECOMP_NO_DYN_VI=1opt-out.runtime/nvn/vulkan/dyn_vi.h,runtime/nvn/vulkan/exec.c):g_vk.dyn_viis active,build_pipeline()addsVK_DYNAMIC_STATE_VERTEX_INPUT_EXTand sets.pVertexInputState = NULL(guarded under#ifdef __ANDROID__to matchdevice.c).CMD_BIND_VERTEX_ATTRIB/CMD_BIND_VERTEX_STREAMandst_defaults()bumpvi_geninstead of settingpipeline_dirty, leaving vertex layout fields zeroed inPipeKey(last_pipelinereuse andLARECOMP_VK_PIPE_VERIFYstay consistent).draw_()rebuildscur_viviavk_build_dyn_vi()only when(vi_gen, pr->vi->attr_mask)changes, emitsvkCmdSetVertexInputEXTthroughSS_VIredundant-state filtering (ss_on == 0emits every draw), and resolves stream copy bounds fromcur_vi.ss_forget()after internal static-VI passes (post_pass,vk_present_draw,renderer_save_texture_tex) soSS_VIis re-bound on subsequent game draws.tools/test_dyn_vertex_input.c):vk_build_dyn_vi()attribute/binding packing,ZERO_BINDINGfallback, zero-strideVERTEXrate handling,divisor >= 1invariant (including!have_divisorclamping), empty inputs, and 32-attribute / 17-binding max capacity.Verification
Standalone Branch Checks (this commit)
NDK 30.0.16248370):test_vulkan_compat.py(16),test_vulkan_startup.py(33),test_shader_cache.py(17) — all passed.cc -Wall -Wextra -Werror -O2 -pthread) & Android ARM64 Bionic (SM-X730):tools/test_dyn_vertex_input.c— passed.:app:assembleDebug(JDK 17):BUILD SUCCESSFULwith0warnings in modified/added files.git merge-treeexit0, zero conflicts) with sibling PRsfeat/urgent-shader-buildsandfeat/shader-meta-cache.Combined Physical-GPU Measurements (with toggle ablation on unified prototype before splitting)
Mali-G925 MC12r49p1,hateno-night,cap30,sgsr11080p, warm caches,0Vulkan errors): EnablingLARECOMP_DYN_VI=1vsLARECOMP_DYN_VI=0in steady state reduced liveVkPipelinecount1222 -> 802(-34.4%) at identical30.00 fps(gpu.p50 27.279vs27.323 ms,0frames>50 ms).Turnip_Gen8_V38_Patched,driver-id 18, 3-pass A/B ona1ef820): Livegpipesdropped1247 -> 799(-35.9%) with0Vulkan errors (30.17 fps,gpu.p50 24.602 -> 21.918 ms).Companion Focused PRs