Repository navigation
vk: inline the global-load helper in task and mesh stages (the floating trees, #994) - #1334
Conversation
NVIDIA's compiler gave the tree task 3cb76827 a wrong address for its offs[e+1] load while the helper was DontInline: every visible cell drew 256 trees, the floating tree wall. Compute stages keep DontInline (compile time). EDEN_NX2_GM_INLINE=0: off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMVHfecF8UiqmMfKTDgxgH
|
Tested at the Hyrule Castle cliff view, as offered: RTX 3070 8 GB, Windows 11, main 7dbdcdc + this PR. The setup:
The pair's task groups barely change (164 vs 208 from
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
The tree pair
Not tested: AMD, a long play session, Kakariko and the castle cliff. No game data attached. |
On the tested NVIDIA driver, the compiled Deku Tree web vertex shader uses the grid origin where the SPIR-V calls for the grid dimensions. The resulting coarse cell index is out of range and the web is dark. Request inlining for the 128-bit load helper in that vertex shader. Use the existing EDEN_NX2_GM_INLINE switch and cover the helper's function controls in the game-free SPIR-V fixture. Refs #455 and #1002. Related workaround: #1334. Assisted-by: OpenAI Codex Co-authored-by: Codex <codex@openai.com>
…otRexed#1338): row removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…otRexed#1338): row removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Inline global loads in emulated task and mesh stages on Pascal GPUs. This fixes floating trees in Ocarina of Time on the tested GTX 1060. Based on NotRexed/Hookshot#1334.

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.