fix(vk): a fragment program that asks for early fragment tests runs after them, so the fence behind the Forest Temple's warp stays in the fog #2796
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2796
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/early-fragment-tests"
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?
Summary
In Phantom Ganon's room, after the fight, the fence behind the blue warp "pops": at some camera pitches the fence pieces behind the warp are drawn crisp and dark over the warp's light, and they're back in the fog a little higher or lower. On the Switch the fence stays dark in the fog at every angle (reported on an RX 9070 XT with FSR 4 in #1463, an RTX 5060 Ti in a later report on the issue; seen here on an RTX 5080). Adult Link shows it best; child Link is affected too.
The cause. The game fades whatever stands between the camera and Link (its camera fade,
game::activecameraalpha). It finds those objects on the GPU:The counting program asks for early fragment tests (GLSL's
layout(early_fragment_tests)): byte+0x5bof NVN2's control section. On the Switch the hardware then runs the depth test first, and the fragments behind Link are never counted. Longshot's translation never read that byte. In Vulkan a fragment program that stores runs before its depth test unless it hasEarlyFragmentTests, so every fragment of every candidate was counted, behind Link or not. At those pitches the fence pieces behind the warp counted as in front of Link: the game faded them (alpha 0.76) and drew them after the fog, crisp against the warp's light.How it was traced, in game:
d6dcafdb…,10d347d4…; their alpha isc4[24] * c5[107], andc5[107]= 0.76 in the broken frames).f_800cdbe0, fromf_82c43780), whose target comes fromf_8034f440.f_8034f440reads the GPU's per-object counters after invalidating the cache.bc3ae540…).+0x5bis set in 711, never in one that writes depth. The 114 stages that write depth set+0x58,+0x59and+0x5f, so+0x5bis the early-tests flag, as early tests can't go with depth writes.The fix.
parse_codereads+0x5bof a fragment stage's control section intoCode::early_fragment_tests.RuntimeInfo::force_early_zfrom it. The SPIR-V back end already turns that into theEarlyFragmentTestsexecution mode.RX_VK_EARLY_FRAGMENT_TESTS=0turns it off (a kill switch); off, the program cache keeps a stamp of its own.The camera fade still works where the game wants it: with a fence section near the camera, the same pieces fade with and without the fix.
To see it on
main: beat Phantom Ganon (or load a save from after the fight), stand as adult between the start and the warp, and tilt the camera up slowly with the warp ahead. The fence behind the warp turns crisp over the light from a few steps up, and stays crisp the higher you go.Read first:
fragment_tests_earlyandCode::early_fragment_testsingpu/vk/vk_shader.cpp, thentests/test_early_fragment_tests.py.Fixes #1463. See #956 (the fishing pond's log vanishing as the camera turns): a false camera fade looks just like that, so this likely fixes it too; not checked here.
Testing
Tested: Windows 11 (build 26300), RTX 5080 (NVIDIA 621.40). This branch's game was built as a pack over the shared base and run through the job queue. Settings: the run profile's defaults, 1280x720 windowless, the Quality preset Auto picks. The save is from after the fight; Link is made adult and placed in the boss room with a local teleport override that isn't in this branch. The camera was driven through the control bridge.
RX_VK_EARLY_FRAGMENT_TESTS=0(main's translation): 0, 0, then 6 at steps 2 to 8 and 14 at steps 9 to 11; the shots show the fence crisp over the light.main's translation with frame dumps: 6 faded fence draws in the broken frames, 0 in the good ones.RX_VK_OCC_QUERIES=0andRX_VK_OCC_FIXED=0leave the bug as it is; so do full buffer write-backs and every readback waiting.tests/test_early_fragment_tests.pyfails onmain("vk_shader.cpp never sets the fragment runtime's force_early_z…") and passes here (clang++ from llvm-mingw).force_early_zlines, makes it fail.test_program_stamp_knobs,test_compute_local_memoryandtest_live_shader_stagepass.test_switch_tablereports onlyLONGSHOT_LAUNCHER_STARTUP, which fails the same way onmain.mise run test(llvm-mingw on PATH,CC=clang,CXX=clang++): 626 passed, 224 failed, 46 skipped here; onmain@01d6878b3, 625 passed and the same 224 failed (tools this PC lacks: gcc, glslang, spirv-val and others). The one more pass is the new check; nothing fails here that passes onmain.main@01539efd2(the same two commits):mise run test -- --exact tests/test_early_fragment_tests.pypasses, and the pack builds (llvm-mingw).gpu/vk/vk_shader.cppcompiles for Linux (WSL Ubuntu 24.04, clang++,-std=c++20 -fsyntax-only -Wall -Wextra, the build's include paths withhost/posix) with no error or warning, on this branch and onmain; on Windows the pack built it (llvm-mingw).Still to test:
RX_VK_EARLY_FRAGMENT_TESTS=0, plus a walk through Hyrule Field. Expecting the fence to stay in the fog with it unset, and no change elsewhere. (@Beanstalk)Measurements
Verdict: no measurable difference. In the three scenes measured the two sides' runs overlap (
dev.py ab's rule: within the spread). The medians differ by -1.6% (Hyrule Field) to +2.7% (Market). The tails go both ways within their spreads: in the Market the 1% lows are steadier with the fix (100 to 103 fps against 89 to 104), and in Inside the Deku Tree the p99 median is higher with it (7.37 ms against 6.97 ms, the runs 6.73 to 7.71 against 6.88 to 7.17). Only the 748 programs that ask for early tests change, and early tests let the GPU skip fragments the depth test rejects.Setup:
mise run dev -- ab --env RX_VK_EARLY_FRAGMENT_TESTS=0 --scene <scene>: one build of this branch, the switch unset (this PR) against=0(main's translation: no program gets early fragment tests).dev.py abcan't measure on currentmain; the runs used the fixes in the tooling pull request (#2797), on top of this branch's two commits.abwrote no write-up of its own, because it read the menu before the area had loaded its simulated-turf rows (fixed there too). The numbers below are its per-run lines.01d6878b3(its translation: this build,RX_VK_EARLY_FRAGMENT_TESTS=0)d96bb1061The switch ships on (unset): it fixes the fence and costs nothing measurable. (The frame rates are from
d96bb1061on01d6878b3; the branch is now the same two commits onmain@01539efd2, and nothing between changes the renderer's frame.)First start after the update: the shader preparation and its caches
Verdict: the update costs one preparation of about 3.5 to 4.5 minutes on this PC instead of the usual 2, the same as any change to the translator. The early tests themselves add nothing to it, and nothing to a new installation's time or to the caches' size.
longshot-builder dev prepare <runtime> --compile-shaders most, what a build and an update run before the first start (a profile withprepare_shadersoff does the same at the game's first start). 16 runs, through the job queue intimingmode.main@01539efd2and this branch @6dd8c7f96.cache/, its own SPIR-V store (LONGSHOT_SHADER_STORE) and its own NVIDIA cache (__GL_SHADER_DISK_CACHE_PATH). Nothing was read from the PC's own caches.cache/held only the pipeline notes (the shipped list; a new installation's first preparation writes the same 1052.4 MB), with an empty store and an empty NVIDIA cache. Both sides prepared 268,075 entries, all built (0 failed, faulted or cold).main's caches after its cold and warm runs, as an installed game's first start after the update.RX_VK_EARLY_FRAGMENT_TESTS=0. Its stamp differs frommain's (the switch is part of it), but its SPIR-V ismain's, so it shows what a translator change costs without the early tests.mainmain's cachesmaincache/cache/stays 2.54 GB (the pipeline cache 1,337.4 and 1,339.5 MB). The store grows by 0.17 GB to 4.02 GB, as this stamp's programs are added besidemain's; with the switch off it grows by 0.15 GB, to 4.00 to 4.01 GB. NVIDIA's cache grows by 5 to 9 MB.main's caches in about 2 minutes: 39,564 noted pipelines and 5,087 compute pipelines in 71.5 s.main, 386.8 to 404.0 s here).Risks
+0x5bmeant something else for some program, that program's discards would no longer keep its depth out, or its stores would skip occluded fragments.RX_VK_EARLY_FRAGMENT_TESTS=0; a revert is enough too.vk_shader.cppdoes it:docs/dev/developing.md, The shader preparation). Measured above: one preparation of 220 to 264 s on this PC instead of about 110 s, the same as a translator change without the early tests (211 to 261 s), with the same cache sizes. Nothing in saves orlongshot_options.inichanges.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.gpu/vk/switches.def.tests/that reads changed source is updated, not weakened. (None needed a change: every check that readsvk_shader.cpporswitches.defpasses as onmain.)mainand here, for a change that shows on screen.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11 (build 26300), RTX 5080, NVIDIA 621.40, this branch as a pack over the shared base, through the job queue. Phantom Ganon's room after the fight, adult Link between the start and the warp, the camera tilted up in 12 steps through the range where the fence popped, a frame dump at each. With RX_VK_EARLY_FRAGMENT_TESTS=0 (main's translation) 6 to 14 of the fence's faded draws from step 2 up, the fence crisp over the warp's light in the shots; with this branch 0 at every step and the fence stays in the fog. The camera fade still fades a fence section near the camera the same way on both sides. Timing A/B in Inside the Deku Tree, the Market, Hyrule Field and Kokiri Forest: within the spread everywhere.
The same spot and camera, the same build: left
RX_VK_EARLY_FRAGMENT_TESTS=0(main's translation), right this branch. Top: the first shot at the broken pitch. Below: two pitches of the sweep, 6 and 14 of the fence's draws faded on the left; 0 on the right, the fence stays in the fog. (The heart container turns, so the frames differ there.)A correction to the pictures above: the top one is not from one build. Its left half is
main's translation in an earlier build of mine (main plus frame-dump logging), its right half the first version of this fix. The two sweep pictures below it are one build of this branch, the switch at 0 against unset.WIP: fix(vk): a fragment program that asks for early fragment tests runs after them, so the fence behind the Forest Temple's warp stays in the fogto fix(vk): a fragment program that asks for early fragment tests runs after them, so the fence behind the Forest Temple's warp stays in the fog@Beanstalk On an AMD Radeon RX 9070 XT (Windows, FSR 4 if it is there) and on AMD with RADV on Linux (a Steam Deck too, if one is free): load a save from after the Phantom Ganon fight in the Forest Temple, as adult Link, stand between the start and the blue warp with the warp ahead, and tilt the camera up slowly. Expected: the fence ring behind the warp stays dark in the fog at every angle, never drawn crisp over the warp's light. Then walk through Kokiri Forest and Hyrule Field: expected no visual change from main.
Beanstalk test farm · an earlier run: commit
d96bb10, run 2 (the newer results are in a comment below)Commit
d96bb10· approved by llun (reviewed) · dashboard⚠️ Note: The farm has no post-Phantom-Ganon save or boss-room teleport, so it cannot test the fence sweep or nearby camera fade; the Forest Temple teleport is not the fight aftermath.
⚠️ Note: FSR 4 is not enabled: its SDK build requires every target to be Windows with the FSR 4 license, which would exclude the requested Linux runs.
⚠️ Note: The still shots compare against main before movement; traversal after movement is timed but cannot be reliably image-diffed, and the brief walks do not cover either area exhaustively.
Started at 11:51 UTC. Run 2: re-planned by llun.
windows+amd+gpu-rx-9070-xt(GPU "rx 9070 xt")linux+radvsteamdeckCouldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.
linux+radv, report 2:the pr runtime failed (exit 1): File "<data>/longshot/scripts/dev.py", line 70, in <module>What was tested
What will be tested · AI plan (
gpt-6.1-terra)On Windows RX 9070 XT, Linux RADV and Steam Deck, this plan compares three runs per side through Kokiri Forest and Hyrule Field, including still images and traversal frame times. It takes roughly 35 minutes per tester and fails on a crash, a substantial still-image difference, or a frame-time regression over 15%. No Steam Deck is listed online, so that target will wait for a tester. The requested post-fight fence sweep cannot be reached with the farm’s saves and teleports, so these runs do not establish whether the reported artifact is fixed. No tester online now matches steamdeck: that target waits for one.
kokiri-start, then teleport to Kokiri Forest, take the picture kokiri-still to compare with main, move the stick, measure kokiri for 30 s (after 10 s warm-up), teleport to Hyrule Field, take the picture field-still to compare with main, measure field for 30 s (after 10 s warm-up); 3 runs on each side.Measurements on `linux+radv`, for the PR description
Verdict: pass on linux+radv (2 reports): no rule failed and no PR run crashed.
Hardware: 1: linux+amd+radv+dgpu
AMD Radeon RX 9070 (RADV GFX1201), 26.0.8AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAM; 2: linux+amd+radv+igpuAMD Radeon 760M Graphics (RADV PHOENIX), 26.0.8AMD Ryzen 5 230 w/ Radeon 760M Graphics, 16 GB RAMScene: outdoor-traversal, from the repository's save kokiri-start; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); outdoor-traversal: 3 game starts a side, kokiri 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)d96bb10Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `steamdeck`, for the PR description
Verdict: pass on steamdeck (1 report): no rule failed and no PR run crashed.
Hardware: 1: linux+amd+radv+igpu+handheld
AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 12 GB RAMScene: outdoor-traversal, from the repository's save kokiri-start; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); outdoor-traversal: 3 game starts a side, kokiri 30 s after 10 s warm-up, field 30 s after 10 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)d96bb10Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
The testers' hardware
linux+radvAMD Radeon RX 9070 (RADV GFX1201), 26.0.8AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAMlinux+radvAMD Radeon 760M Graphics (RADV PHOENIX), 26.0.8AMD Ryzen 5 230 w/ Radeon 760M Graphics, 16 GB RAMsteamdeckAMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 12 GB RAM@review
Recommendation: Request changes. The reported RTX 5080 run shows the fence staying in the fog while nearby camera fade still works. The change affects fragment programs throughout the game, and the required AMD, Linux and Steam Deck runs have not yet established its behavior there. (It stands on L5: The check
CI / Third-party parts and guide screenshots (pull_request)fails on this head and passes on the base branch: Failing after 14s.)Reads the fragment program's early-test flag and emits the Vulkan execution mode for both vertex and mesh pipelines, fixing the reported camera-fade artifact on the tested system. It adds a kill switch and a game-free check; the wider graphics impact remains to be tested.
Blocking (2): must change before merging.
CI / Third-party parts and guide screenshots (pull_request)fails on this head and passes on the base branch: Failing after 14s.CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)fails on this head and passes on the base branch: Failing after 3m57s.Nits (1): optional.
Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_shader.cpp:1789: The change enables early tests across affected fragment programs on Windows AMD, where the original issue was also reported, without a reported run. (more on the line) Do: Run the requested boss-room sweep and representative traversal on Windows AMD, comparing the default with the switch off.gpu/vk/vk_shader.cpp:2005: RADV and Steam Deck have not been tested with the changed fragment execution mode. (more on the line) Do: Run the boss-room sweep and representative traversal on RADV and Steam Deck, comparing with the switch off.gpu/vk/vk_shader.cpp:1789: Linux NVIDIA is also Tier 1 and has no reported game run for the changed shader execution mode. (more on the line) Do: Run the boss-room sweep and representative traversal on Linux NVIDIA, comparing with the switch off.@fixcan do L4, L5 and L6.Checks: Still running: 5 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes, on the reported Windows RTX 5080 run: faded fence draws fell from 6–14 at the broken pitches to zero across the 12-step sweep, while nearby fence fade matched on both sides. The timing runs overlap, although the reported Deku Tree median p99 rose from 6.97 to 7.37 ms; they do not establish a performance gain or loss.
Other systems: The execution mode changes vertex and mesh fragment pipelines, including mesh fallback, on every GPU and OS. Windows AMD, Linux NVIDIA, Linux RADV and Steam Deck have no reported runs; other areas can use the 748 affected programs. The program cache stamp includes the switch, and the translator source contributes to the cache version.
Switches: RX_VK_EARLY_FRAGMENT_TESTS is new and defaults on; 0 restores the previous translation and uses a separate cache stamp. The default fixes the tested NVIDIA case, but its behavior on the other affected Tier 1 systems remains unverified. It has a switches.def row.
Reviewed:
d96bb1061cagainst01d6878b3f: Read AGENTS.md, CONTRIBUTING.md, the pull request template, relevant standards, the complete diff, commit messages, and the new test in full. Read the changed shader code, its parsing, translation, cache and SPIR-V emission context; skimmed the rest of vk_shader.cpp and switches.def because their full output was truncated. docs/review-checklist.md was absent. Read the supplied description, comments and CI results; screenshots themselves were not accessible.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run, as required for this review. The author reports an in-game Windows NVIDIA comparison and game-free checks; CI has two head-only failures and several checks still running, which are not restated as review items.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -1760,6 +1786,7 @@ void translate_into(Program& p, const NvnState& s, const Code* vsc, const Code*p.stages.push_back(std::move(v));if (fs) {frt.previous_stage_stores = vs->program.info.stores;frt.force_early_z = fragment_tests_early(*fsc, fs->program.info.stores_frag_depth);L1 (should fix): The change enables early tests across affected fragment programs on Windows AMD, where the original issue was also reported, without a reported run.
When: On an RX 9070 XT, the boss-room occlusion pass and other flagged fragment programs now execute with different depth and stencil ordering; their visual behavior on that driver is unknown.
Do: Run the requested boss-room sweep and representative traversal on Windows AMD, comparing the default with the switch off.
L3 (should fix): Linux NVIDIA is also Tier 1 and has no reported game run for the changed shader execution mode.
When: A player using the NVIDIA Linux driver runs the affected shaders with early tests enabled, but the reported Windows driver run does not exercise that driver stack.
Do: Run the boss-room sweep and representative traversal on Linux NVIDIA, comparing with the switch off.
@ -1975,6 +2002,7 @@ void translate_mesh_into(Program& p, const NvnState& s, const Code* task, constShader::RuntimeInfo frt{};// (what the mesh program stores, and its per-primitive generics: Eden's MakeRuntimeInfo)frt.previous_stage_stores = mesh_t->program.info.stores;frt.force_early_z = fragment_tests_early(*fsc, fs->program.info.stores_frag_depth);L2 (should fix): RADV and Steam Deck have not been tested with the changed fragment execution mode.
When: Linux AMD and Deck players encounter flagged fragment programs in the boss room and elsewhere, including mesh pipelines; only Windows NVIDIA behavior is reported.
Do: Run the boss-room sweep and representative traversal on RADV and Steam Deck, comparing with the switch off.
Thanks. Where each point stands:
scripts/check_guide_screenshots.py --review-sourcesfails onmain@01d6878b3exactly as here (REVIEW REQUIRED: settings-graphics.png: game/oot_cheat_items.h changed since reviewed revision 3c74597e), since #2785; #2793 retains the picture. I'll rebase once it merges.check_third_party.py(whole and--base origin/main) passes here.mise run rust),cargo fmt --all --checkstops atbuilder/crates/build-compile/src/host_sources_tests.rs:110on this branch and onmainalike, a file this change doesn't touch; nothing here touches Rust. The Website job fails too, and it reads no file this change touches. Every other open PR's Rust and Website jobs are still queued, so I'll compare againstmain's own run when it has one.@Beanstalk test it anyway.On L5: #2797, which changes only Python scripts, fails the same
CI / Third-party parts and guide screenshotsjob on the samemainbase, so it comes frommain(#2785; fixed by #2793), not this change. #2797's Rust and Website jobs are still queued; their result will show the same for L6 and the Website job.@review
Recommendation: Request changes. The reported RTX 5080 run shows the fence fix working while preserving the nearby camera fade. The changed shader execution mode still needs the outstanding Windows AMD, RADV, Steam Deck and Linux NVIDIA game runs. (It stands on L5: The check
CI / Third-party parts and guide screenshots (pull_request)fails on this head and passes on the base branch: Failing after 14s.)Programs that request early fragment tests now receive them, preventing occluded fragments from incorrectly triggering camera fade. This corrects the reported fence rendering on the tested NVIDIA system, at the cost of changing fragment execution for other programs that request early tests.
Blocking (3): must change before merging.
CI / Third-party parts and guide screenshots (pull_request)fails on this head and passes on the base branch: Failing after 14s.CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)fails on this head and passes on the base branch: Failing after 3m57s.CI / Website build and checks (pull_request)fails on this head and passes on the base branch: Failing after 1m36s.Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_shader.cpp:1789: The change enables early tests across affected fragment programs on Windows AMD, where the original issue was also reported, without a reported run. When: On an RX 9070 XT, the boss-room occlusion pass and other flagged fragment programs now execute with different depth and stencil ordering; their visual behavior on that driver is unknown. Do: Run the requested boss-room sweep and representative traversal on Windows AMD, comparing the default with the switch off.gpu/vk/vk_shader.cpp:2005: RADV and Steam Deck have not been tested with the changed fragment execution mode. When: Linux AMD and Deck players encounter flagged fragment programs in the boss room and elsewhere, including mesh pipelines; only Windows NVIDIA behavior is reported. Do: Run the boss-room sweep and representative traversal on RADV and Steam Deck, comparing with the switch off.gpu/vk/vk_shader.cpp:1789: Linux NVIDIA is also Tier 1 and has no reported game run for the changed shader execution mode. When: A player using the NVIDIA Linux driver runs the affected shaders with early tests enabled, but the reported Windows driver run does not exercise that driver stack. Do: Run the boss-room sweep and representative traversal on Linux NVIDIA, comparing with the switch off.@fixcan do L5, L6 and L7.Since the last review (on
d96bb1061c)Resolved: L4 (The measurements say p99 is as good or better with the fix, but the displayed Deku Tree p9…)
Still open: L1 (The change enables early tests across affected fragment programs on Windows AMD, where the…); L2 (RADV and Steam Deck have not been tested with the changed fragment execution mode.); L3 (Linux NVIDIA is also Tier 1 and has no reported game run for the changed shader execution…); L5 (The check
CI / Third-party parts and guide screenshots (pull_request)fails on this head…); L6 (The checkCI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)fails on th…)New: L7 (The check
CI / Website build and checks (pull_request)fails on this head and passes on…)Checks: Still running:
CI / Game-free checks (run_all.py, part 1/2) (pull_request),CI / Game-free checks (run_all.py, part 2/2) (pull_request).Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported fence case on Windows RTX 5080: faded fence draws fell from 6–14 to zero through the broken pitch range, while the nearby fence fade matched with the switch on and off. Performance runs overlapped on that system; they do not establish results on other hardware.
Other systems: The execution mode affects qualifying fragment programs on all Vulkan vendors and operating systems, including mesh and vertex pipelines. Windows AMD, Linux RADV, Steam Deck and Linux NVIDIA game runs remain outstanding; Intel has no reported run either.
Switches: RX_VK_EARLY_FRAGMENT_TESTS is added, default on; 0 restores the prior translation and gets a separate cache stamp. The default fixes the tested case, but cross-platform validation remains outstanding.
Reviewed:
d96bb1061cagainst01d6878b3f: Read the full diff and new test, the relevant shader parsing, translation, cache-stamp and SPIR-V emission sections, AGENTS.md and CONTRIBUTING.md; the rest of vk_shader.cpp and switches.def were not read in full. Comments, reported runs and CI status were reviewed; the pull request template and developer standards were not read.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run code were executed. The author reports Windows NVIDIA game tests, a game-free test, Windows and Linux compilation, and timing runs; two game-free CI checks are still running and three checks are reported failing.
Overlaps and merge order: None identified from the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
On L6 (Rust):
mainfails it too.main'sbuilder/crates/build-compile/src/host_sources_tests.rs, as committed (LF), failsrustfmt --check --edition 2024with the repository'srustfmt.tomland the pinned toolchain (rustfmt 1.10.0) at line 110, so every pull request that changes code fails this job until it is formatted. #2794, #2748 and #2506 note the same line. Locally, clippy (-D warnings) passes on this branch and onmain, andcargo teststops at the same test on both (matches_llvm_mc, no llvm-mc on this PC). This change touches no Rust.On L7 (Website):
scripts/website_check.shbuilds the site fromwebsite/and public forge data, and this change touches neither.main's own CI run for01d6878b3is still queued; I'll compare once it has run.The three failing jobs are
main's, from the jobs' logs on this head (the same on #2796, #2797 and #2799):REVIEW REQUIRED: settings-graphics.png: game/oot_cheat_items.h changed since reviewed revision 3c74597e, since #2785; #2793 fixes it.rustfmt:Diff in …/builder/crates/build-compile/src/host_sources_tests.rs:110.the game folder has no image.bin(end_to_end.rs:396), a test that predates the organized game folder.cargo testalready pass./settings/: game branding remains in published text, from #2779's Debug-tab paragraph indocs/user/graphics-and-controls.md; #2799 rewords it, andscripts/website_check.shpasses with it locally.This pull request changes none of those files. Once #2793 and #2799 merge, I'll rebase it so its checks run on the fixed
main.Recommendation: Request changes. The fence fix has a direct visual result. Measure the shader rebuild and cache cost that this change introduces on first start.
The shader source stamp changes, so existing installations can have to translate and prepare shaders again. Risks calls that out, but the evidence covers warmed gameplay. Please report first-start time and cache size on main and this head, including the first launch of an existing installation with its main cache. If reporting warmed Kokiri performance, use a fixed turf state with enough runs on both sides to report spread.
Source review found the new early-test behavior in live and preparation paths, with the depth-writing safeguard and cache identity split. Outdoor Farm evidence is useful. Matching RADV Hyrule Field p99 was 18.4 to 18.5 ms and Deck was 32.6 to 31.9 ms. The Farm did not exercise the Forest Temple boss-room fence. The Windows AMD run and a manual route through the affected room remain open.
Reviewed
d96bb1061ccbde5d35b796701664fdbbf881843cagainst01d6878b. Both renderer compile jobs and the new fixture passed. All 31 named game-free failures also occur on disjoint same-base PRs #2793, #2797, and #2799. Guide, Rust and Website failures have shared causes. PR evidence · CI@ -1499,2 +1520,4 @@add(&no_sim_turf, sizeof no_sim_turf);}// (and early fragment tests left out, RX_VK_EARLY_FRAGMENT_TESTS=0: only then, so the default keeps one cache)if (!early_fragment_tests_on()) {[P2] This changes a source file that feeds the translator stamp. Please measure cold and warm preparation, the first upgrade launch with a warm main cache, and the resulting cache size. The warmed gameplay runs do not measure this first-start cost.
d96bb1061c6dd8c7f96fThanks @futondestroyer. Both points are measured or fixed now, and the branch is rebased onto
main@01539efd2(the same two commits).First-start cost, measured (the full tables are in the description, under Measurements, First start after the update):
longshot-builder dev prepare --compile-shaders most, which is what a build or an update runs before the first start, on two runtimes on the same base:main@01539efd2and this branch @6dd8c7f96. That's 16 runs through the queue intimingmode on the RTX 5080.cache/, its own SPIR-V store and its own NVIDIA cache, so nothing came from this PC's caches.mainmain's prepared cachesRX_VK_EARLY_FRAGMENT_TESTS=0(a new stamp,main's SPIR-V)main's, overlaps it at 211 to 261 s. Any code change tovk_shader.cppbrings the same (docs/dev/developing.md, The shader preparation). In the build's own path, with the shared store and NVIDIA cache a player's update uses, this branch's runtime prepared overmain's caches in about 2 minutes.cache/is 2.54 GB on both sides and stays 2.54 GB after the upgrade (the pipeline cache within 7 MB).main's.Kokiri: I took Kokiri Forest out of the frame-rate table instead of reporting it from one or two runs per turf state. The description says why and what measuring it again needs (a fixed turf state on both sides and more runs). The three scenes left are as they were.
The Windows AMD run and the manual route through the boss room are still open, as you noted. They're the Beanstalk requests in Still to test.
6dd8c7f96f043ba24332Rebased onto
main@6b0f7b151: the same two commits, no conflicts. The numbers in Measurements still hold.01d6878b3. Since thenmainhas changed the menu (a 45 FPS cap row, #1585), the keyboard policy (#152), the Deck's IMU (#2802), Linux window hints (#2803), the icons (#2782) and the profiler's stack walk (#2790); none of them is in the draw path. The runs were uncapped at the defaults, so none of these rows was in play.01539efd2. #2765 changes the preparation only for Native HDR with PsychoV35. These runs used the defaults, without HDR.@review
@review
Recommendation: Request changes. The fence fix is demonstrated on Windows NVIDIA, and outdoor RADV and Steam Deck runs show similar frame-time tails. Windows AMD and Linux NVIDIA game runs remain outstanding for a shader change that affects Tier 1 hardware. (It stands on L5: The check
CI / Third-party parts and guide screenshots (pull_request)fails on this head and passes on the base branch: Failing after 14s.)The change honors the game's early-fragment-test request, preventing occluded fence fragments from incorrectly triggering camera fade. It adds a diagnostic kill switch and causes a one-time shader preparation after update.
Blocking (1): must change before merging.
CI / Third-party parts and guide screenshots (pull_request)fails on this head and passes on the base branch: Failing after 14s.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_shader.cpp:1789: The change enables early tests across affected fragment programs on Windows AMD, where the original issue was also reported, without a reported run. When: On an RX 9070 XT, the boss-room occlusion pass and other flagged fragment programs now execute with different depth and stencil ordering; their visual behavior on that driver is unknown. Do: Run the requested boss-room sweep and representative traversal on Windows AMD, comparing the default with the switch off.gpu/vk/vk_shader.cpp:1789: Linux NVIDIA is also Tier 1 and has no reported game run for the changed shader execution mode. When: A player using the NVIDIA Linux driver runs the affected shaders with early tests enabled, but the reported Windows driver run does not exercise that driver stack. Do: Run the boss-room sweep and representative traversal on Linux NVIDIA, comparing with the switch off.@fixcan do L5.Since the last review (on
d96bb1061c)Resolved: L2 (RADV and Steam Deck have not been tested with the changed fragment execution mode.)
Still open: L1 (The change enables early tests across affected fragment programs on Windows AMD, where the…); L3 (Linux NVIDIA is also Tier 1 and has no reported game run for the changed shader execution…); L5 (The check
CI / Third-party parts and guide screenshots (pull_request)fails on this head…); L6 (The checkCI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)fails on th…); L7 (The checkCI / Website build and checks (pull_request)fails on this head and passes on…)Checks: Still running: 7 checks.
Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. On an RTX 5080, the reported pitch sweep had 6–14 faded fence draws at broken pitches with the switch off and zero with the fix; a nearby fence still faded on both sides. Gameplay timing runs overlapped, while upgrade preparation took 220–264 seconds versus approximately 110 seconds warm.
Other systems: The execution mode applies to requesting fragment programs in both vertex and mesh translation paths, including shader preparation. Reported outdoor RADV and Steam Deck runs had comparable Hyrule Field p99 frame times, but did not cover the boss room; Windows AMD and Linux NVIDIA runs remain outstanding. CI reports one head-only failure and several jobs still running.
Switches: RX_VK_EARLY_FRAGMENT_TESTS is added, default on; setting it to 0 restores the previous translation and uses a separate program-cache stamp. The default fixes the reported issue on Windows NVIDIA; its behavior on the remaining Tier 1 systems still needs testing.
Reviewed:
043ba24332against6b0f7b151c: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the full diff, commit messages and the new test. Reviewed the changed shader paths and their call sites; the full shader and switch-table output was truncated, so those files were only skimmed. No review checklist was present.; nothing run (a code review).Checked and fine:
Testing: No commands that execute project code or tests were run. Await Windows AMD and Linux NVIDIA game runs and the remaining CI results.
Overlaps and merge order: The comments identify #2793 and #2799 as fixes for shared CI failures; their current merge status is not established.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
Thanks for the reviews, @HumanBean and BeanBot.
main's again, not this change's. Onmain@6b0f7b151itself,python3 -I -B scripts/check_guide_screenshots.py --review-sourcesfails withGuide screenshot check failed: 8 issue(s):REVIEW REQUIRED: settings-graphics.png: <file> changed since reviewed revision 01d6878b3…forgpu/vk/menu/gameplay.cpp,menu_i18n.h,vk_api.h,vk_menu.cppandvk_menu.h.01d6878b3. #1585 (the 45 FPS cap row) and #152 (the keyboard policy) then changed those menu sources.mainhere (check_third_party.py,test_guide_screenshots.py,test_launcher_capture.py).docs/user/images/guide/manifest.jsonof its own, not part of this fix.043ba24332df203fe8d9New commits pushed, approval review dismissed automatically according to repository settings
Rebased onto
main@e4801d6a5(#2772, simulated turf around Link). There was one conflict, intranslator_stamp():RX_VK_SIM_TURF_POOLStag from the stamp, the block just above this pull request's.RX_VK_EARLY_FRAGMENT_TESTS=0tag, as before. No other line of the fix changed.Checks on the new head:
tests/test_early_fragment_tests.py,test_program_stamp_knobs.pyandtest_live_shader_stage.pypass.test_switch_table.pyreports onlyLONGSHOT_LAUNCHER_STARTUP, as onmain.About the frame rates in Measurements: #2772 changes what grassy areas draw on both sides alike. The comparison there was of the two translations in one build (the switch unset against
=0), and only the 748 programs that ask for early tests differ between them. The absolute fps on today'smainwill differ from those runs; the difference between the sides is what they measured.@review
Recommendation: Request changes. The fence fix works in the reported Windows NVIDIA sweep, but the changed shader execution mode still needs the Windows AMD and Linux NVIDIA game runs. (It stands on L5: The check
CI / Third-party parts and guide screenshots (pull_request)fails on this head and passes on the base branch: Failing after 14s.)The change honors fragment programs' requests for early depth and stencil tests, preventing the camera-fade counter from fading the fence behind the Forest Temple warp. It adds a kill switch and a one-time shader preparation cost after updating.
Blocking (1): must change before merging.
CI / Third-party parts and guide screenshots (pull_request)fails on this head and passes on the base branch: Failing after 14s.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_shader.cpp:1789: The change enables early tests across affected fragment programs on Windows AMD, where the original issue was also reported, without a reported run. When: On an RX 9070 XT, the boss-room occlusion pass and other flagged fragment programs now execute with different depth and stencil ordering; their visual behavior on that driver is unknown. Do: Run the requested boss-room sweep and representative traversal on Windows AMD, comparing the default with the switch off.gpu/vk/vk_shader.cpp:1789: Linux NVIDIA is also Tier 1 and has no reported game run for the changed shader execution mode. When: A player using the NVIDIA Linux driver runs the affected shaders with early tests enabled, but the reported Windows driver run does not exercise that driver stack. Do: Run the boss-room sweep and representative traversal on Linux NVIDIA, comparing with the switch off.@fixcan do L5.Since the last review (on
043ba24332)Still open: L1 (The change enables early tests across affected fragment programs on Windows AMD, where the…); L3 (Linux NVIDIA is also Tier 1 and has no reported game run for the changed shader execution…); L5 (The check
CI / Third-party parts and guide screenshots (pull_request)fails on this head…); L6 (The checkCI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)fails on th…); L7 (The checkCI / Website build and checks (pull_request)fails on this head and passes on…)Checks: Still running: 7 checks.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. On the reported RTX 5080 sweep, faded fence draws fell from 6–14 at affected pitches with the switch off to 0 with it on; a nearby fence still faded on both sides. Three gameplay benchmarks overlapped within their run spreads; upgrade preparation took 220–264 seconds versus roughly 110 seconds warm on that PC.
Other systems: Both vertex-to-fragment and mesh-to-fragment translations use the new mode, including prepared shaders; depth-writing programs are excluded. RADV and Steam Deck outdoor runs were reported, but Windows AMD and Linux NVIDIA game runs remain outstanding.
Switches: RX_VK_EARLY_FRAGMENT_TESTS defaults on; setting it to 0 restores the previous translation and uses a separate cache stamp. The default fixes the reported NVIDIA case, but the remaining Tier 1 runs are needed to assess it across affected systems.
Reviewed:
df203fe8d9againste4801d6a55: Read AGENTS.md, CONTRIBUTING.md, the full diff and the new test; inspected the shader parsing, translation, cache stamp and SPIR-V emission paths and the switch row. The large shader and switch files were only partly inspected, and the pull request template was not read.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run tests were executed. The author reports the new fixture and shader-related checks passing; several CI jobs are still running.
Overlaps and merge order: None identified.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@Beanstalk
Beanstalk test farm · 🔄 testing (0 of 6 reports so far)
Commit
df203fe· approved by llun (reviewed) · dashboard⚠️ Note: The post-Phantom-Ganon save and boss-room teleport used in the reported reproduction are not available, so neither the fence pitch sweep nor the nearby-fence fade check can be run.
⚠️ Note: FSR 4 and the fishing pond are not covered; shader preparation after an update is also not measured.
Done (started 19:16 UTC). Comment
@Beanstalkto run it again.windows+amdlinux+radvsteamdecklinux+nvidia-proprietarywindows+nvidiaintelforest-and-field· frame time p99 (ms)RX_VK_EARLY_FRAGMENT_TESTS=(reference)RX_VK_EARLY_FRAGMENT_TESTS=0windows+amdlinux+radvsteamdecklinux+nvidia-proprietarywindows+nvidiaintelWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)The plan compares the PR with main in Kokiri Forest and Hyrule Field on Windows AMD and NVIDIA, Linux RADV and NVIDIA, Steam Deck, and Intel hardware. It runs with early fragment tests enabled and disabled to check for visual and frame-time regressions, taking about 50 minutes per tester. Crashes, substantial screenshot differences, or frame-time regressions over 15% fail the plan. The available saves and teleports cannot reach the post-fight boss-room setup, so this does not establish whether the fence fix works.
0(PR only).kokiri-start, then teleport to Kokiri Forest, take the picture forest to compare with main, move the stick, measure forest for 25 s (after 5 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 25 s (after 5 s warm-up); 2 runs on each side for each of 2 cells (2 game starts a run).