vk: inline the global-load helper in task and mesh stages (the floating trees, #994) #1334
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1334
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/task-mesh-load-inline"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the wall of floating trees from #994 at the spots I could test (Kakariko's entrance, the Hyrule Castle cliff), on an RTX 3070 / Windows 11.
Cause. The tree task stage
3cb7682790143836computes each visible cell's tree count asmin(offs[e+1] - offs[e], 256)from the placement file. Traced per load (details in #994): theoffs[e+1]load went tofile + (cells[e] + 9 + e) * 4instead offile + (n + 9 + e) * 4, the result of the previous call to the global-load helper where the one before it belongs. The address is outside every buffer, the load returns 0, and every cell is drawn with 256 trees, the following cells' trees placed in it. The IR and the emitted SPIR-V are both right; the compiled shader is not, while the helper isDontInline.Change. The global-load helper is emitted
Inlinefor the task and mesh stages. The compute stages keepDontInline: their culling programs have hundreds of global loads, and inlining was what made NVIDIA's compiler take 41 s (the comment abovedefine_load).EDEN_NX2_GM_INLINE=0brings the old behaviour back; as anEDEN_switch it is part of the program cache's stamp.Tested (RTX 3070, Windows 11, NVIDIA driver 610.88 as Vulkan reports it):
Not tested: AMD, Intel, Linux; the open-field view toward Death Mountain; frame rate in a proper A/B (a first single run at Kakariko gave about 7 fps more, which I would not rely on). @Nitnek offered to run it at the castle cliff on another driver version.
No game data in this change.
Tested at the Hyrule Castle cliff view, as offered: RTX 3070 8 GB, Windows 11, main
7dbdcdc+ this PR. The setup:EDEN_NX2_GM_INLINE=0is the "before".3cb7682790143836mesh threadsEDEN_NX2_GM_INLINE=0The pair's task groups barely change (164 vs 208 from
b612216258832b9c's list); what each group emits drops ~6x. That matches the per-cell count no longer coming out at the 256 clamp.Edit: also checked by hand in Kakariko with this PR and #1338 on the same build (the latter for the foliage that went bare at mid distance, #1151). Looking from the village entrance toward Hyrule Field, the render is as expected: no floating trees, and the spruces keep their needles.
Thank you!
Tested on Linux: the wall of trees is gone, same numbers with and without the switch as on Windows
mainat7dbdcdcplus this PR's commit (f78c175) and #1338's (9928d74), built from source; the A/B below is this PR's switch alone on that one build. Headless runs from one save, same frame after the load,RX_VK_DRAW_STATS.The tree pair
3cb7682790143836/4f0c0b40ab3a32cd, canyon save:3cb76827)EDEN_NX2_GM_INLINE=0Not tested: AMD, a long play session, Kakariko and the castle cliff.
No game data attached.
Ryzen 7 9800x3d RTX 5070 32gb
Everything is perfect where there used to be issues; however, it gives the impression that it’s on the verge of freezing whenever VRAM usage hits a high percentage. The game feels like it’s running twice as fast, haha! I’ll play a bit more so I can provide some precise feedback!
@NotRexed