fix(vk): Arc discrete cards no longer lose Kokiri Forest to the sky: uniforms snapshotted on every Intel GPU #446
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
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
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!446
Loading…
Reference in a new issue
No description provided.
Delete branch "nyannoying/Longshot:fix/arc-discrete-ub-snapshot"
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?
Why
On Intel Arc discrete cards (tested: Arc B580), Kokiri Forest shows the sky where the ground and Link's treehouse should be, with white glowing blocks and objects that flicker in and out, from the moment you spawn.
What changed
ub_snapshot_wanted()ingpu/vk/vk_draw.cppdecides the uniform snapshot (RX_VK_UB_SNAPSHOT);uniform_range()asks it. The default is now on for every Intel GPU (vendor 0x8086), not only for Intel GPUs without VRAM mirrors (the iGPUs). The comment inuniform_range()says why: with mirrors on, the B580 still read uniforms the game had already rewritten for the next frame, so the depth prepass drew the ground with other objects' matrices and the fog pass painted sky over it.tests/test_ub_snapshot_default.pycompiles the decision alone against 27 cases (unset: on for Intel, off for AMD and NVIDIA; the switch's on/off spellings) and checks thatuniform_range()asks it. It fails onmain.RX_VK_UB_SNAPSHOTrow indocs/development.md(it had none).Flags and settings
RX_VK_UB_SNAPSHOT=0/1Measurements
main:
cf605c85(2026-11-14)this PR: fix/arc-discrete-ub-snapshot @
9305d117Hardware: Intel Arc B580 12 GB, driver 32.0.101.9154; Core i5-13600K; 64 GB; Windows 11 Pro (26100-series Insider, 10.0.29704)
Scene: Kokiri Forest (child), the spawn spot on Link's balcony after the opening; 2048x1152 output, game's own upscaler, frame generation off, uncapped (
HOS_FPS_MAX=1000), Real time game speedMethod: 6 runs, the switch alternated (on, off, on, off, on, off), each about 50 s in free play standing still; fps from the log's
vi: ... frames presented (... fps over the last 5.0 s)lines (last 8 windows of each run), GPU time fromvk: GPU time ... ms a frame(last 6 lines). Median of the windows, then median of the runs.How to reproduce: start a new game, skip the opening into Kokiri Forest, stand still;
RX_VK_UB_SNAPSHOT=0gives main's behaviour on this GPU.Baseline: this PR @
9305d117,RX_VK_UB_SNAPSHOT=0(main's path), which is main's code path on an Arc discrete card. main itself was not the comparison because on the B580 it loses the device entering Kokiri Forest (the float atomic add loop, fixed in #444); both sides here carry that fix, nothing else differs. The runs were made with 47ebdc75, this change on maincf605c85; the branch has since been rebased onto main5e072fc8(9305d117) with the same diff and was not run in the game again:gpu/vk/vk_draw.cppdid not change between the two mains, and a main-based build has another shader stamp than this card's prepared caches, which is not paid again for an unchanged diff. The change was in every build of the later work on this card (#443, whose walks start at this spawn spot): the frames looked at there show the ground and the treehouse drawn.9305d117,RX_VK_UB_SNAPSHOT=0(main's path)9305d117(default: 1 on Intel)Testing
Tested: Arc B580, 101.9154, Windows 11: Kokiri Forest from spawn, 8 runs with the snapshot on and 8 off (switch bisect, interleaved builds, and the measurement above). Off: ground and treehouse replaced by sky, glowing white blocks, a pot that appears and disappears between frames, in every run. On: the scene is right in every run. Other switches tried and ruled out:
RX_VK_SPLIT_UBFLUSH=0(fixes the walls, not the glow),RX_VK_EQ_BIAS=1024and=0(no change);RX_VK_MIRROR=0also fixes it, since it turns the snapshot on, at about half the frame rate.python -I -B tests/run_all.pyon the rebased head: 486 passed, 6 failed, 70 skipped; the 6 aretest_module_ids,test_pad_layout,test_tested_configurations,test_oot_state_tap,test_fpx_stickyandtest_spawn_emit, which fail the same way on main5e072fc8here.tests/test_ub_snapshot_default.pypasses here and fails on main5e072fc8.Not tested: other areas than Kokiri Forest; Arc A-series discrete; Arc on Linux; long sessions; the rebased head in the game (see Baseline); a Linux build (no Linux compiler on this PC: the change is one function deciding a default in
gpu/vk/vk_draw.cpp, so the template's two-platform box is left out, not ticked).Needs other testers:
Screenshots
Kokiri Forest spawn, Arc B580: posted in the first comment ("main's path" with
RX_VK_UB_SNAPSHOT=0, and this PR).Risk and rollback
Only Intel GPUs change. A uniform buffer copied each draw costs CPU time; on the B580 it measured faster overall.
RX_VK_UB_SNAPSHOT=0turns it off; reverting the commit is enough.Reviewer notes
Why the VRAM mirrors don't cover this on the B580 is not explained yet: the mirror is made at the submission, so it should not see the game's later rewrite. Pools still waiting for a mirror or refused one bind in guest memory (see #222); that is the likely gap, left for a follow-up.
RX_VK_SPLIT_UBFLUSHstays as it is on Arc discrete: the snapshot alone fixes the scene.Issues
See #320
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md; no appended row or assembled view).mainand passing here.🤖 Generated with Claude Code
Kokiri Forest, the spawn spot on Link's balcony, Arc B580 (101.9154), the same build and spot, only the switch differs.
The two test requests are open (T-RY6D: Arc A750/A770; T-4SPA: an Intel iGPU, expecting no change) and named in the description; both wait for a maintainer's testing wanted label. A B580 needs #444 as well to reach the forest.
WIP: fix(vk): Arc discrete cards no longer lose Kokiri Forest to the sky: uniforms snapshotted on every Intel GPUto fix(vk): Arc discrete cards no longer lose Kokiri Forest to the sky: uniforms snapshotted on every Intel GPUView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.