fix(vk): Grass distance reaches the short grass in Zora's Domain too, so its patches no longer pop in at 30 m #2929

Merged
HumanBean merged 2 commits from cuecuemoar/Longshot:fix/grass-distance-culling-radius into main 2026-12-01 01:48:24 +00:00
Contributor

Summary

Above Game's, Grass distance makes the short grass on Zora's Domain's terraces pop in: a terrace across the room
stays bare until Link is a few steps closer, then a whole patch appears at once. At Game's the same grass dithers in, as
the game intends.

Why: in Kokiri Forest and Hyrule Field the short blades' patches are picked around Link by 383a566958350efe, and
its scene buffer's word 75, the patch radius, is what #1382 scales. In Zora's Domain 383a doesn't run: the game's GPU
culling, b612216258832b9c, hands the blades their patches, within the same word 75 of the same scene buffer
(30 m there). The row left b612's copy alone and only moved the blades' fade (words 46 and 47 of 43ec86f35fd937b9
and 8a8304edb7bdf4bf) outward, so above Game's the fade ran past the 30 m radius and the radius's edge showed. This
scales word 75 for b612 as for 383a. Game's changes nothing.

To see it on main: adult Zora's Domain, Grass distance 4x, walk toward a grassy terrace that is more than about 30 m
from Link: it is bare, then covered all at once a few steps on. At Game's it fades in instead.

How the word was found: RX_VK_DRAW_STATS and RX_VK_SKIP_FILE at the entrance's stair top gave the blade
programs and the program writing their indirect arguments (b612). A local debug build (not part of this PR) then
scaled words of b612's c3 copy one at a time, with the blade programs' task groups as the measure: only word 75 moved
them (24,288 to 43,488 at x2); words 36, 67, 71, 77, 94, 96, 98, 100, 102, 124 and 127 to 133 did nothing to the
blades, and word 37 (#1784's pebble cut) moved only the pebbles (3,328 to 5,088), which shows the copy reaches b612.
Pulling word 75 to 15 m made the terrace across the pool go bare at a hard edge: the pop-in, on demand.

Read first: gpu/vk/grass_distance.h (grass_words), tests/grass_distance_test.cpp.

See #1382 (the row). See #1784 (the pebble kind's own cut, the same scene buffer's words 37 and 118). See #1877 (larger
grass lists, closed: the overflow this must not bring back, below).

Testing

Tested: Windows 10 (build 19045), RTX 4090, NVIDIA 617.42. A base of main @ 018dd2ef and this PR's pack over it
(the renderer alone, the head c3f66749), and before the rebase the same on main @ e6a71a1d (1a81d337, the same diff).
Adult Zora's Domain, the entrance's stair top (6.66, 102.24, -20.86), the save loaded headless, Grass distance changed
live; the blade programs' indirect arguments (43ec86f35fd937b9, patch groups) from RX_VK_DRAW_STATS:

Grass distance Game's 2x 4x
main @ 018dd2ef: blade patch groups 748 731 739
this PR @ c3f66749: blade patch groups 739 1,335 1,329
main @ e6a71a1d / this PR @ 1a81d337 742 / 739 725 / 1,328 730 / 1,329

and the log says vk: Grass distance 2x: program b612216258832b9c word 75 30 -> 60. At the reporter's own terrace, by
hand: still to come (see Still to test; an earlier hand run is not counted, its settings file had left Grass distance at
Game's).

  • The compute fallback (RX_VK_FORCE_MESH_FALLBACK=1, the RADV and Steam Deck path) at 4x, same spot: 1,335 patch
    groups, the blade program's 744,405 vertices (248,135 primitives), under half of the 1.52M records #2121's area holds
    for it; no white or missing blades (0.00 % near-white pixels in the lower half, as with mesh shaders).
  • Elsewhere, on main @ a2dc5385 with the same word scaled by the debug build at 4x, two frames each side: Kokiri
    Forest: no program changes. Hyrule Field (where b612 hands out some of the short blades too): only the four blade
    programs change (+25 % patch groups), simulated turf, pebbles and everything else stay inside frame-to-frame noise.
  • No flicker: at 4x, six shots 8 frames apart, the grass areas change as much from frame to frame with the radius
    scaled as without (median 386 against 377 pixels); the patch count is the same from one frame to the next. It stops
    growing where the area runs out of grass, at a different count in different places (1,360 at the stair top, ~1,670 at
    the entrance), not at a list's size.
  • Not this PR's: twice in 12 launches of this PR's runtime (0 in 11 of main's; longshot.exe is the same file in
    both, the PR changes longshot_vk.dll alone) the game crashed in adult Lost Woods while the save loaded, before any
    Grass distance change, where this PR's code changes nothing: one is #2442's (guest return 0x83331040, which #1709's
    runs also saw on main, 1 launch in 13), the other a null write in the game's code at guest return 0x833316e8, in the
    same place. Neither run was measured.
  • Checks: tests/test_grass_distance.py fails on main @ 018dd2ef (program b612216258832b9c word 75 at 4x: 12, expected 48) and passes here, with g++ 11 and clang 23.1.5; with the fix's case taken out it fails again. The whole
    suite on Linux (WSL, Ubuntu 22.04, --strict), main against this PR: 821 passed, 91 failed, 10 skipped on both main @ 018dd2ef and c3f66749, the same 91 files (this WSL environment's; list below; before the rebase, 86 on e6a71a1d and 1a81d337 alike). The renderer builds on Linux (and, in the
    pack, on Windows with llvm-mingw) at the head.

Still to test:

  • Windows 10, RTX 4090: the reporter's terrace in adult Zora's Domain, at Grass distance 4x on main and on this PR from
    the same spot, expecting bare on main and covered here (by hand, the reporter).
  • AMD (RADV, the Steam Deck) and Intel: adult Zora's Domain, Grass distance 4x, walk toward the terraces, expecting the
    short grass there from afar, no white or flickering blades, no patch coming and going (@Beanstalk).
  • Windows 11, another NVIDIA: the same walk, by hand, expecting the same (or the Test Farm).

Measurements

Verdict: costs 0.3 ms of GPU time a frame at 4x where it acts: 5.60 against 5.90 ms (+5 %), every run of this PR
above every run of main; fps 120.2 against 117.6 (-2 %; the frame waits on the render thread, 8.4 ms, not the GPU). That
is the short grass drawn out to 4x its radius here (blade patch groups 730 against 1,329). At Game's nothing changes.

Setup: Windows 10 (build 19045), RTX 4090, NVIDIA 617.42, i9-13900K (32 threads), 32 GB. A base of main @ e6a71a1d and
this PR's pack over it (built from 1a81d337, the same diff as the head). Adult Zora's Domain, the entrance's stair top
(within 0.3 m of (6.66, 102.24, -20.86), facing the room), headless, 2560x1440 output; the rows set through the control
bridge and read back before measuring: Grass distance 4x, Frame rate cap Uncapped, Render resolution 67 %, V-Sync Off,
Frame generation Off, the rest at their defaults (no upscaler SDK in these builds). Each run through the job queue in
timing mode, 20 s after arriving, then 60 s measured: the median of the vk: GPU time lines (one every 120 presents) and
of the fps lines. 4 interleaved pairs, main first.

Before: main @ e6a71a1d After: this PR @ 1a81d337 (same diff as c3f66749)
GPU time a frame, runs 1 / 2 / 3 / 4 (ms) 5.50 / 5.70 / 5.50 / 5.70 5.90 / 5.90 / 5.80 / 6.20
GPU time a frame, median (ms) 5.60 5.90
fps, runs 1 / 2 / 3 / 4 120.7 / 119.7 / 121.1 / 118.1 117.9 / 117.5 / 117.7 / 113.9
fps, median 120.2 117.6
blade patch groups at 4x (43ec86f35fd937b9's indirect arguments) 730 1,329
main, run 1:
vk: GPU time 5.6 ms a frame (the longest submission 2.9 ms); 0.0 textures made a frame: ...
vk: 23760 presents, 120.3 fps; a frame: 2061 draws (0 skipped), 94 dispatches, 215 passes, 138 barriers, 6 submits, ...
vk: the render thread (600 presents, 8.35 ms a frame): its jobs 5.99 ms a frame (submits 0.46, presents 0.08, others 5.45), idle 2.36; ...
this PR, run 1:
vk: GPU time 5.9 ms a frame (the longest submission 3.4 ms); 0.0 textures made a frame: ...
vk: 23640 presents, 116.7 fps; a frame: 1959 draws (0 skipped), 91 dispatches, 221 passes, 136 barriers, 6 submits, ...
vk: the render thread (600 presents, 8.55 ms a frame): its jobs 5.81 ms a frame (submits 0.46, presents 0.07, others 5.28), idle 2.73; ...

Measured before the rebase onto 018dd2ef. The numbers still hold: main's commits in between (#2899's and #2920's
descriptor reuse, #2903's occlusion rasterizer, #2876's process priority, #2926's DLSS FG row) change CPU work and
none of the blade programs' GPU work, and at the stair top the blade patch groups are the same on both mains (above).

Not measured: Hyrule Field at 4x (where b612 hands out some of the blades, +25 % of them here), memory (no buffer is
added: the game's own lists hold them), loading.

Risks

  • It acts only above Game's, and only on b612's copy of word 75 (the game's memory and every other program's copy are
    left as they are). Where b612 hands out the short blades (Zora's Domain, part of Hyrule Field), 2x to 4x now draw
    them out to 2x to 4x its radius: more blades, the GPU time above.
  • A fixed list overflowing (#1877's bug: patches coming and going) would show as flicker; none was seen, and the counts
    are steady and stop where the grass runs out. The compute fallback's records area holds the blades at 4x here with
    room to spare, but a denser area than this one is untested on it.
  • Turning it off: Game's. A revert is enough. Nothing changes in saves or longshot_options.ini.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Screenshots of the same spot on main and here, for a change that shows on screen. Not yet: the reporter's two shots of main (the terrace bare, then covered a few steps on) are in a comment; the same spot on this PR is still to come.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
The 91 files failing in this WSL environment, on main @ 018dd2ef and on this PR alike

tests/f2i_immediate, tests/global_load_16, tests/native_suatom, tests/test_blocks_at_start.py, tests/test_bug_report.py, tests/test_cloth_kernels.py, tests/test_cloth_loops.py, tests/test_cloth_sphere.py, tests/test_cloth_step12.py, tests/test_cloth_step8.py, tests/test_cloth_step9.py, tests/test_control_picture.py, tests/test_coop_spirv.py, tests/test_crash_record.py, tests/test_crt_options.py, tests/test_dead_targets_sweep.py, tests/test_default_point_size.py, tests/test_depth_sample_types.py, tests/test_dev_update.py, tests/test_dlss_actor.py, tests/test_dlssg_pace.py, tests/test_draw_parameters.py, tests/test_draw_stream_visibility.py, tests/test_framegen_hdr.py, tests/test_framegen_resources.py, tests/test_fsr3_math.py, tests/test_fsr3_shaders.py, tests/test_fsr3fi_hud_layer.py, tests/test_fsr3fi_hudless_colour.py, tests/test_fsr4_tune.py, tests/test_fsr_uniform_ownership.py, tests/test_game_boundary.py, tests/test_guest_holes.py, tests/test_image_arrays.py, tests/test_image_reaper_threads.py, tests/test_image_view_retry.py, tests/test_input_background.py, tests/test_keyboard_option.py, tests/test_late_fix_shaders.py, tests/test_lens_eye_pass.py, tests/test_lifter.py, tests/test_linux_pressure.py, tests/test_loaded_modules_drop.py, tests/test_log_levels.py, tests/test_lower_depbar.py, tests/test_lower_lds_after_sts.py, tests/test_lower_register_markers.py, tests/test_menu_keys.py, tests/test_menu_save_atomic.py, tests/test_mesh_fallback_capacity.py, tests/test_mesh_fallback_layout.py, tests/test_mesh_first_types.py, tests/test_mesh_unreachable_outputs.py, tests/test_native_suatom.py, tests/test_nonuniform_image_arrays.py, tests/test_oot_cloth.py, tests/test_oot_occ_raster.py, tests/test_oot_song_inventory.py, tests/test_option_ids.py, tests/test_perf_send.py, tests/test_pipeline_tour.py, tests/test_present_source_crop.py, tests/test_prof_clock.py, tests/test_program_answer_domains.py, tests/test_program_cache_cleanup.py, tests/test_program_cache_one_variant.py, tests/test_reactive_mask.py, tests/test_readback_timeout_reuse.py, tests/test_recording_admission.py, tests/test_reshade_fx.py, tests/test_scene_tonemap_pass.py, tests/test_screensaver.py, tests/test_sim_turf_pools.py, tests/test_spirv_struct_identity.py, tests/test_switch_table.py, tests/test_target_pool_cap.py, tests/test_target_retention.py, tests/test_temporal_present_bandwidth.py, tests/test_tex_desc_memo.py, tests/test_texture_phi_dominance.py, tests/test_thinlto_tls.py, tests/test_unsigned_image_types.py, tests/test_upscaler_round_trip.py, tests/test_vcore_video_acquire.py, tests/test_video_catchup.py, tests/test_video_hold_early.py, tests/test_video_input_limit.py, tests/test_vram_compact.py, tests/test_windows_display_startup.py, tests/test_windows_on_linux.py, tests/test_wmma16_spirv_val.py

🤖 Generated with Claude Code

https://claude.ai/code/session_01VxeaZjejwdGWMMg5Zt4p48

## Summary Above Game's, **Grass distance** makes the short grass on Zora's Domain's terraces pop in: a terrace across the room stays bare until Link is a few steps closer, then a whole patch appears at once. At Game's the same grass dithers in, as the game intends. **Why:** in Kokiri Forest and Hyrule Field the short blades' patches are picked around Link by `383a566958350efe`, and its scene buffer's word 75, the patch radius, is what #1382 scales. In Zora's Domain `383a` doesn't run: the game's GPU culling, `b612216258832b9c`, hands the blades their patches, within the **same word 75 of the same scene buffer** (30 m there). The row left `b612`'s copy alone and only moved the blades' fade (words 46 and 47 of `43ec86f35fd937b9` and `8a8304edb7bdf4bf`) outward, so above Game's the fade ran past the 30 m radius and the radius's edge showed. This scales word 75 for `b612` as for `383a`. Game's changes nothing. **To see it on main:** adult Zora's Domain, Grass distance 4x, walk toward a grassy terrace that is more than about 30 m from Link: it is bare, then covered all at once a few steps on. At Game's it fades in instead. **How the word was found:** `RX_VK_DRAW_STATS` and `RX_VK_SKIP_FILE` at the entrance's stair top gave the blade programs and the program writing their indirect arguments (`b612`). A local debug build (not part of this PR) then scaled words of `b612`'s c3 copy one at a time, with the blade programs' task groups as the measure: only word 75 moved them (24,288 to 43,488 at x2); words 36, 67, 71, 77, 94, 96, 98, 100, 102, 124 and 127 to 133 did nothing to the blades, and word 37 (#1784's pebble cut) moved only the pebbles (3,328 to 5,088), which shows the copy reaches `b612`. Pulling word 75 to 15 m made the terrace across the pool go bare at a hard edge: the pop-in, on demand. Read first: `gpu/vk/grass_distance.h` (`grass_words`), `tests/grass_distance_test.cpp`. See #1382 (the row). See #1784 (the pebble kind's own cut, the same scene buffer's words 37 and 118). See #1877 (larger grass lists, closed: the overflow this must not bring back, below). ## Testing **Tested:** Windows 10 (build 19045), RTX 4090, NVIDIA 617.42. A base of main @ 018dd2ef and this PR's pack over it (the renderer alone, the head c3f66749), and before the rebase the same on main @ e6a71a1d (1a81d337, the same diff). Adult Zora's Domain, the entrance's stair top (6.66, 102.24, -20.86), the save loaded headless, Grass distance changed live; the blade programs' indirect arguments (`43ec86f35fd937b9`, patch groups) from `RX_VK_DRAW_STATS`: | Grass distance | Game's | 2x | 4x | |---|---|---|---| | main @ 018dd2ef: blade patch groups | 748 | 731 | 739 | | this PR @ c3f66749: blade patch groups | 739 | 1,335 | 1,329 | | main @ e6a71a1d / this PR @ 1a81d337 | 742 / 739 | 725 / 1,328 | 730 / 1,329 | and the log says `vk: Grass distance 2x: program b612216258832b9c word 75 30 -> 60`. At the reporter's own terrace, by hand: still to come (see Still to test; an earlier hand run is not counted, its settings file had left Grass distance at Game's). - **The compute fallback** (`RX_VK_FORCE_MESH_FALLBACK=1`, the RADV and Steam Deck path) at 4x, same spot: 1,335 patch groups, the blade program's 744,405 vertices (248,135 primitives), under half of the 1.52M records #2121's area holds for it; no white or missing blades (0.00 % near-white pixels in the lower half, as with mesh shaders). - **Elsewhere**, on main @ a2dc5385 with the same word scaled by the debug build at 4x, two frames each side: Kokiri Forest: no program changes. Hyrule Field (where `b612` hands out some of the short blades too): only the four blade programs change (+25 % patch groups), simulated turf, pebbles and everything else stay inside frame-to-frame noise. - **No flicker:** at 4x, six shots 8 frames apart, the grass areas change as much from frame to frame with the radius scaled as without (median 386 against 377 pixels); the patch count is the same from one frame to the next. It stops growing where the area runs out of grass, at a different count in different places (1,360 at the stair top, ~1,670 at the entrance), not at a list's size. - **Not this PR's:** twice in 12 launches of this PR's runtime (0 in 11 of main's; `longshot.exe` is the same file in both, the PR changes `longshot_vk.dll` alone) the game crashed in adult Lost Woods while the save loaded, before any Grass distance change, where this PR's code changes nothing: one is #2442's (guest return `0x83331040`, which #1709's runs also saw on main, 1 launch in 13), the other a null write in the game's code at guest return `0x833316e8`, in the same place. Neither run was measured. - **Checks:** `tests/test_grass_distance.py` fails on main @ 018dd2ef (`program b612216258832b9c word 75 at 4x: 12, expected 48`) and passes here, with g++ 11 and clang 23.1.5; with the fix's case taken out it fails again. The whole suite on Linux (WSL, Ubuntu 22.04, `--strict`), main against this PR: 821 passed, 91 failed, 10 skipped on both main @ 018dd2ef and c3f66749, the same 91 files (this WSL environment's; list below; before the rebase, 86 on e6a71a1d and 1a81d337 alike). The renderer builds on Linux (and, in the pack, on Windows with llvm-mingw) at the head. **Still to test:** - Windows 10, RTX 4090: the reporter's terrace in adult Zora's Domain, at Grass distance 4x on main and on this PR from the same spot, expecting bare on main and covered here (by hand, the reporter). - AMD (RADV, the Steam Deck) and Intel: adult Zora's Domain, Grass distance 4x, walk toward the terraces, expecting the short grass there from afar, no white or flickering blades, no patch coming and going (@Beanstalk). - Windows 11, another NVIDIA: the same walk, by hand, expecting the same (or the Test Farm). ## Measurements **Verdict:** costs 0.3 ms of GPU time a frame at 4x where it acts: 5.60 against 5.90 ms (+5 %), every run of this PR above every run of main; fps 120.2 against 117.6 (-2 %; the frame waits on the render thread, 8.4 ms, not the GPU). That is the short grass drawn out to 4x its radius here (blade patch groups 730 against 1,329). At Game's nothing changes. Setup: Windows 10 (build 19045), RTX 4090, NVIDIA 617.42, i9-13900K (32 threads), 32 GB. A base of main @ e6a71a1d and this PR's pack over it (built from 1a81d337, the same diff as the head). Adult Zora's Domain, the entrance's stair top (within 0.3 m of (6.66, 102.24, -20.86), facing the room), headless, 2560x1440 output; the rows set through the control bridge and read back before measuring: Grass distance 4x, Frame rate cap Uncapped, Render resolution 67 %, V-Sync Off, Frame generation Off, the rest at their defaults (no upscaler SDK in these builds). Each run through the job queue in timing mode, 20 s after arriving, then 60 s measured: the median of the `vk: GPU time` lines (one every 120 presents) and of the fps lines. 4 interleaved pairs, main first. | | Before: main @ e6a71a1d | After: this PR @ 1a81d337 (same diff as c3f66749) | |---|---|---| | GPU time a frame, runs 1 / 2 / 3 / 4 (ms) | 5.50 / 5.70 / 5.50 / 5.70 | 5.90 / 5.90 / 5.80 / 6.20 | | GPU time a frame, median (ms) | **5.60** | **5.90** | | fps, runs 1 / 2 / 3 / 4 | 120.7 / 119.7 / 121.1 / 118.1 | 117.9 / 117.5 / 117.7 / 113.9 | | fps, median | **120.2** | **117.6** | | blade patch groups at 4x (`43ec86f35fd937b9`'s indirect arguments) | 730 | 1,329 | ``` main, run 1: vk: GPU time 5.6 ms a frame (the longest submission 2.9 ms); 0.0 textures made a frame: ... vk: 23760 presents, 120.3 fps; a frame: 2061 draws (0 skipped), 94 dispatches, 215 passes, 138 barriers, 6 submits, ... vk: the render thread (600 presents, 8.35 ms a frame): its jobs 5.99 ms a frame (submits 0.46, presents 0.08, others 5.45), idle 2.36; ... this PR, run 1: vk: GPU time 5.9 ms a frame (the longest submission 3.4 ms); 0.0 textures made a frame: ... vk: 23640 presents, 116.7 fps; a frame: 1959 draws (0 skipped), 91 dispatches, 221 passes, 136 barriers, 6 submits, ... vk: the render thread (600 presents, 8.55 ms a frame): its jobs 5.81 ms a frame (submits 0.46, presents 0.07, others 5.28), idle 2.73; ... ``` Measured before the rebase onto 018dd2ef. The numbers still hold: main's commits in between (#2899's and #2920's descriptor reuse, #2903's occlusion rasterizer, #2876's process priority, #2926's DLSS FG row) change CPU work and none of the blade programs' GPU work, and at the stair top the blade patch groups are the same on both mains (above). Not measured: Hyrule Field at 4x (where `b612` hands out some of the blades, +25 % of them here), memory (no buffer is added: the game's own lists hold them), loading. ## Risks - It acts only above Game's, and only on `b612`'s copy of word 75 (the game's memory and every other program's copy are left as they are). Where `b612` hands out the short blades (Zora's Domain, part of Hyrule Field), 2x to 4x now draw them out to 2x to 4x its radius: more blades, the GPU time above. - A fixed list overflowing (#1877's bug: patches coming and going) would show as flicker; none was seen, and the counts are steady and stop where the grass runs out. The compute fallback's records area holds the blades at 4x here with room to spare, but a denser area than this one is untested on it. - Turning it off: Game's. A revert is enough. Nothing changes in saves or `longshot_options.ini`. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [ ] Screenshots of the same spot on `main` and here, for a change that shows on screen. Not yet: the reporter's two shots of main (the terrace bare, then covered a few steps on) are in a comment; the same spot on this PR is still to come. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. <details><summary>The 91 files failing in this WSL environment, on main @ 018dd2ef and on this PR alike</summary> `tests/f2i_immediate`, `tests/global_load_16`, `tests/native_suatom`, `tests/test_blocks_at_start.py`, `tests/test_bug_report.py`, `tests/test_cloth_kernels.py`, `tests/test_cloth_loops.py`, `tests/test_cloth_sphere.py`, `tests/test_cloth_step12.py`, `tests/test_cloth_step8.py`, `tests/test_cloth_step9.py`, `tests/test_control_picture.py`, `tests/test_coop_spirv.py`, `tests/test_crash_record.py`, `tests/test_crt_options.py`, `tests/test_dead_targets_sweep.py`, `tests/test_default_point_size.py`, `tests/test_depth_sample_types.py`, `tests/test_dev_update.py`, `tests/test_dlss_actor.py`, `tests/test_dlssg_pace.py`, `tests/test_draw_parameters.py`, `tests/test_draw_stream_visibility.py`, `tests/test_framegen_hdr.py`, `tests/test_framegen_resources.py`, `tests/test_fsr3_math.py`, `tests/test_fsr3_shaders.py`, `tests/test_fsr3fi_hud_layer.py`, `tests/test_fsr3fi_hudless_colour.py`, `tests/test_fsr4_tune.py`, `tests/test_fsr_uniform_ownership.py`, `tests/test_game_boundary.py`, `tests/test_guest_holes.py`, `tests/test_image_arrays.py`, `tests/test_image_reaper_threads.py`, `tests/test_image_view_retry.py`, `tests/test_input_background.py`, `tests/test_keyboard_option.py`, `tests/test_late_fix_shaders.py`, `tests/test_lens_eye_pass.py`, `tests/test_lifter.py`, `tests/test_linux_pressure.py`, `tests/test_loaded_modules_drop.py`, `tests/test_log_levels.py`, `tests/test_lower_depbar.py`, `tests/test_lower_lds_after_sts.py`, `tests/test_lower_register_markers.py`, `tests/test_menu_keys.py`, `tests/test_menu_save_atomic.py`, `tests/test_mesh_fallback_capacity.py`, `tests/test_mesh_fallback_layout.py`, `tests/test_mesh_first_types.py`, `tests/test_mesh_unreachable_outputs.py`, `tests/test_native_suatom.py`, `tests/test_nonuniform_image_arrays.py`, `tests/test_oot_cloth.py`, `tests/test_oot_occ_raster.py`, `tests/test_oot_song_inventory.py`, `tests/test_option_ids.py`, `tests/test_perf_send.py`, `tests/test_pipeline_tour.py`, `tests/test_present_source_crop.py`, `tests/test_prof_clock.py`, `tests/test_program_answer_domains.py`, `tests/test_program_cache_cleanup.py`, `tests/test_program_cache_one_variant.py`, `tests/test_reactive_mask.py`, `tests/test_readback_timeout_reuse.py`, `tests/test_recording_admission.py`, `tests/test_reshade_fx.py`, `tests/test_scene_tonemap_pass.py`, `tests/test_screensaver.py`, `tests/test_sim_turf_pools.py`, `tests/test_spirv_struct_identity.py`, `tests/test_switch_table.py`, `tests/test_target_pool_cap.py`, `tests/test_target_retention.py`, `tests/test_temporal_present_bandwidth.py`, `tests/test_tex_desc_memo.py`, `tests/test_texture_phi_dominance.py`, `tests/test_thinlto_tls.py`, `tests/test_unsigned_image_types.py`, `tests/test_upscaler_round_trip.py`, `tests/test_vcore_video_acquire.py`, `tests/test_video_catchup.py`, `tests/test_video_hold_early.py`, `tests/test_video_input_limit.py`, `tests/test_vram_compact.py`, `tests/test_windows_display_startup.py`, `tests/test_windows_on_linux.py`, `tests/test_wmma16_spirv_val.py` </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VxeaZjejwdGWMMg5Zt4p48
Where 383a566958350efe doesn't run (Zora's Domain), the game's GPU culling, b612216258832b9c, hands the short blades
their patches within the same scene-buffer word 75 (30 m around Link). The check now expects that word at n times the
reach for b612 as for 383a, and nothing else of b612 changed. It fails on main: "program b612216258832b9c word 75 at 4x:
12, expected 48".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZjejwdGWMMg5Zt4p48
fix(vk): Grass distance reaches the short grass in Zora's Domain too, so its patches no longer pop in at 30 m
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 6s
c3f6674918
Above Game's, the short grass on Zora's Domain's terraces stayed bare until Link came within a few steps, then a whole
patch appeared at once. There Hyrule Field's patch picker (383a566958350efe) doesn't run: the game's GPU culling,
b612216258832b9c, hands the blades their patches within the scene buffer's word 75 (30 m around Link), the word Grass
distance scaled for 383a only. The row moved the blades' fade (words 46 and 47) past that radius, so its edge showed.
grass_words() now scales word 75 for b612 as for 383a. Game's changes nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZjejwdGWMMg5Zt4p48
Author
Contributor

Tested in game: Windows 10, RTX 4090, NVIDIA 617.42, main @ 018dd2ef + this PR: adult Zora's Domain at the entrance's stair top, Grass distance 2x and 4x now scale the culling program's patch radius (log: b612216258832b9c word 75 30 -> 60), blade patch groups 739 -> 1,329 at 4x (main stays at 739); no white blades on the compute fallback; GPU +0.3 ms a frame at 4x. By hand, the reporter at their own terrace (main a2dc5385 + this change): no more pop-in.

Tested in game: Windows 10, RTX 4090, NVIDIA 617.42, main @ 018dd2ef + this PR: adult Zora's Domain at the entrance's stair top, Grass distance 2x and 4x now scale the culling program's patch radius (log: b612216258832b9c word 75 30 -> 60), blade patch groups 739 -> 1,329 at 4x (main stays at 739); no white blades on the compute fallback; GPU +0.3 ms a frame at 4x. By hand, the reporter at their own terrace (main a2dc5385 + this change): no more pop-in.
Author
Contributor

Before, on main (the reporter's own shots, Grass distance 4x, adult Zora's Domain): from the top of the stairs the terrace across the room is bare (first), and a few steps on the same terrace is covered at once (second). The same spot on this PR is still to come.

user-before-1-bare.png

user-before-2-covered.png

Before, on main (the reporter's own shots, Grass distance 4x, adult Zora's Domain): from the top of the stairs the terrace across the room is bare (first), and a few steps on the same terrace is covered at once (second). The same spot on this PR is still to come. ![user-before-1-bare.png](https://git.magicbean.dev/attachments/8bca609d-c626-49d3-8166-695f8b80f559) ![user-before-2-covered.png](https://git.magicbean.dev/attachments/d71a0c3d-495e-4ea3-8a4a-5e64937e944b)
Author
Contributor

Correction to the tested-in-game note above: the reporter's hand run is withdrawn. Its log shows the settings file it read had Grass distance at Game's (no "Grass distance Nx" line), where this PR changes nothing, so it can't show the fix. The in-game evidence that stands is the stair-top run: blade patch groups 739 -> 1,329 at 4x on main @ 018dd2ef + this PR, against 739 on main. The reporter's terrace at 4x, main and this PR from the same spot, is now in Still to test.

Correction to the tested-in-game note above: the reporter's hand run is withdrawn. Its log shows the settings file it read had Grass distance at Game's (no "Grass distance Nx" line), where this PR changes nothing, so it can't show the fix. The in-game evidence that stands is the stair-top run: blade patch groups 739 -> 1,329 at 4x on main @ 018dd2ef + this PR, against 739 on main. The reporter's terrace at 4x, main and this PR from the same spot, is now in Still to test.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The patch increases the intended grass patch count, but the reported terrace pop-in has not yet been checked with the fix at the correct setting. The affected AMD and Steam Deck paths and the cost in Hyrule Field also need runs before merge. Recommend approval; not approved on the forge.

Grass distance above Game's also scales the culling radius used for short grass in Zora's Domain and part of Hyrule Field. That should prevent a hard patch boundary, at the cost of drawing more grass; the reported RTX 4090 run costs 0.3 ms of GPU time per frame at 4x.

Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 gpu/vk/grass_distance.h:15: The target terrace has not been checked with the corrected setting. (more on the line) Do: Compare the same terrace on base and head at 4x, including a walk toward it and matching screenshots.
  • L2 gpu/vk/grass_distance.h:15: The additional patches have not been exercised on the affected RADV and Steam Deck paths. (more on the line) Do: Run the terrace and a dense grass area at 4x on RADV and Steam Deck, checking for missing, white or flickering grass and list capacity.
  • L3 gpu/vk/grass_distance.h:15: The frame-time cost in Hyrule Field is unmeasured, although this change increases its blade patch count too. (more on the line) Do: Compare base and head in a representative heavy Hyrule Field scene at 4x with interleaved runs, including frame times and 1% lows.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven for the reported visual bug: at the stair top, patch groups increased from 739 to 1,329 at 4x on the head comparison, but the reporter's terrace comparison is still outstanding. The game-free test reportedly fails on base and passes on head.

Other systems: The same culling program also affects some Hyrule Field blades. Mesh shaders and the compute fallback can consume the additional patches; the fallback was exercised on NVIDIA, but RADV and Steam Deck remain untested. Game's leaves the radius unchanged.

Switches: No switch added or removed. The existing RX_VK_GRASS_DISTANCE override, unset by default, now also affects this culling program at values above 1; the Grass distance row remains at Game's by default. Documentation was updated.

Reviewed: c3f6674918 against 018dd2ef40: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the full diff and both commits, grass_distance.h, grass_distance_test.cpp, test_grass_distance.py and the relevant menu module in full. Read the changed portions and descriptor callers in vk_draw.cpp; the rest of that large file and the surrounding documentation were not read in full. The requested docs/review-checklist.md and ../Tooling/AGENTS.md are absent. Reviewed the supplied run reports and comments; screenshots were not available locally.; nothing run (a code review).

Checked and fine:

  • The patch changes a private uniform copy and bounds-checks word 75 against its copied size.
  • The test checks the new key's actual patched values and would fail with the new case removed.
  • Both commits record AI assistance; no generated files, game-derived files or renderer API changes appear in the diff.

Testing: No code or tests were run, as requested. The supplied CI checks are still running.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The patch increases the intended grass patch count, but the reported terrace pop-in has not yet been checked with the fix at the correct setting. The affected AMD and Steam Deck paths and the cost in Hyrule Field also need runs before merge. Recommend approval; not approved on the forge. Grass distance above Game's also scales the culling radius used for short grass in Zora's Domain and part of Hyrule Field. That should prevent a hard patch boundary, at the cost of drawing more grass; the reported RTX 4090 run costs 0.3 ms of GPU time per frame at 4x. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `gpu/vk/grass_distance.h:15`: The target terrace has not been checked with the corrected setting. (more on the line) **Do:** Compare the same terrace on base and head at 4x, including a walk toward it and matching screenshots. - **L2** `gpu/vk/grass_distance.h:15`: The additional patches have not been exercised on the affected RADV and Steam Deck paths. (more on the line) **Do:** Run the terrace and a dense grass area at 4x on RADV and Steam Deck, checking for missing, white or flickering grass and list capacity. - **L3** `gpu/vk/grass_distance.h:15`: The frame-time cost in Hyrule Field is unmeasured, although this change increases its blade patch count too. (more on the line) **Do:** Compare base and head in a representative heavy Hyrule Field scene at 4x with interleaved runs, including frame times and 1% lows. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven for the reported visual bug: at the stair top, patch groups increased from 739 to 1,329 at 4x on the head comparison, but the reporter's terrace comparison is still outstanding. The game-free test reportedly fails on base and passes on head. **Other systems:** The same culling program also affects some Hyrule Field blades. Mesh shaders and the compute fallback can consume the additional patches; the fallback was exercised on NVIDIA, but RADV and Steam Deck remain untested. Game's leaves the radius unchanged. **Switches:** No switch added or removed. The existing RX_VK_GRASS_DISTANCE override, unset by default, now also affects this culling program at values above 1; the Grass distance row remains at Game's by default. Documentation was updated. **Reviewed:** c3f667491879 against 018dd2ef405b: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the full diff and both commits, grass_distance.h, grass_distance_test.cpp, test_grass_distance.py and the relevant menu module in full. Read the changed portions and descriptor callers in vk_draw.cpp; the rest of that large file and the surrounding documentation were not read in full. The requested docs/review-checklist.md and ../Tooling/AGENTS.md are absent. Reviewed the supplied run reports and comments; screenshots were not available locally.; nothing run (a code review). **Checked and fine:** - The patch changes a private uniform copy and bounds-checks word 75 against its copied size. - The test checks the new key's actual patched values and would fail with the new case removed. - Both commits record AI assistance; no generated files, game-derived files or renderer API changes appear in the diff. **Testing:** No code or tests were run, as requested. The supplied CI checks are still running. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -12,0 +12,4 @@
// game's GPU culling, b612, which hands the blades their patches where 383a doesn't run, as in Zora's Domain, 30 m there.
// Left at the game's for b612, a reach above 1x moved the blades' fade past it and whole patches popped in at its edge)
case 0x383a566958350efeull:
case 0xb612216258832b9cull: words[0] = 75, power[0] = 1; return 1;
Member

L1 (should fix): The target terrace has not been checked with the corrected setting.

When: At 4x, the patch count rises at the stair top, but that count alone does not show whether the reporter's terrace stops popping in or whether its appearance is correct.

Do: Compare the same terrace on base and head at 4x, including a walk toward it and matching screenshots.

**L1** (should fix): The target terrace has not been checked with the corrected setting. *When:* At 4x, the patch count rises at the stair top, but that count alone does not show whether the reporter's terrace stops popping in or whether its appearance is correct. **Do:** Compare the same terrace on base and head at 4x, including a walk toward it and matching screenshots.
Member

L2 (should fix): The additional patches have not been exercised on the affected RADV and Steam Deck paths.

When: At 4x, denser grass can increase the game's patch lists and fallback output beyond the NVIDIA stair-top case; an overflow could make patches disappear or flicker.

Do: Run the terrace and a dense grass area at 4x on RADV and Steam Deck, checking for missing, white or flickering grass and list capacity.

**L2** (should fix): The additional patches have not been exercised on the affected RADV and Steam Deck paths. *When:* At 4x, denser grass can increase the game's patch lists and fallback output beyond the NVIDIA stair-top case; an overflow could make patches disappear or flicker. **Do:** Run the terrace and a dense grass area at 4x on RADV and Steam Deck, checking for missing, white or flickering grass and list capacity.
Member

L3 (should fix): The frame-time cost in Hyrule Field is unmeasured, although this change increases its blade patch count too.

When: The reported debug run found about 25% more blade patch groups there at 4x; the Zora's Domain GPU timing does not quantify the cost in that scene.

Do: Compare base and head in a representative heavy Hyrule Field scene at 4x with interleaved runs, including frame times and 1% lows.

**L3** (should fix): The frame-time cost in Hyrule Field is unmeasured, although this change increases its blade patch count too. *When:* The reported debug run found about 25% more blade patch groups there at 4x; the Zora's Domain GPU timing does not quantify the cost in that scene. **Do:** Compare base and head in a representative heavy Hyrule Field scene at 4x with interleaved runs, including frame times and 1% lows.
HumanBean changed title from WIP: fix(vk): Grass distance reaches the short grass in Zora's Domain too, so its patches no longer pop in at 30 m to fix(vk): Grass distance reaches the short grass in Zora's Domain too, so its patches no longer pop in at 30 m 2026-12-01 01:48:19 +00:00
HumanBean deleted branch fix/grass-distance-culling-radius 2026-12-01 01:48:24 +00:00
Author
Contributor

Same spot, by hand, the reporter's save, both on main @ 018dd2ef with Grass distance 4x (each run's log checked: the settings file was config/settings.ini, "Grass distance 4x" lines on both, and b612216258832b9c word 75 30 -> 120 on this PR only). First main, then this PR, then a zoom on the far ledges beside the mosaic pillar and the bridge stairs: bare on main, moss on this PR. The near tiers are covered on both.

user-v2-main.png

user-v2-pr.png

v2_far.png

Same spot, by hand, the reporter's save, both on main @ 018dd2ef with Grass distance 4x (each run's log checked: the settings file was config/settings.ini, "Grass distance 4x" lines on both, and `b612216258832b9c word 75 30 -> 120` on this PR only). First main, then this PR, then a zoom on the far ledges beside the mosaic pillar and the bridge stairs: bare on main, moss on this PR. The near tiers are covered on both. ![user-v2-main.png](https://git.magicbean.dev/attachments/7faf5e26-3980-4c2b-bd0e-0db6bda7c04b) ![user-v2-pr.png](https://git.magicbean.dev/attachments/cb0d7130-ebc9-4f86-8e5c-5ac14985fbb2) ![v2_far.png](https://git.magicbean.dev/attachments/b686a165-d11a-40ce-ae4e-87c2fddb7599)
Author
Contributor

Merged while I was finishing the last item, so the description stays as it was; for the record, on BeanBot's three:

  • L1 (the terrace at the right setting): done, by hand, comment above: the reporter's terrace from the same spot on main @ 018dd2ef and this PR, both at 4x with each log checked (b612216258832b9c word 75 30 -> 120 on this PR only). The far ledges beside the mosaic pillar and the bridge stairs are bare on main and covered here.
  • L2 (RADV, Steam Deck): still open. Only the forced compute fallback on NVIDIA ran (no white blades, the blade program's records under half of #2121's area). Wanted: Zora's Domain and Hyrule Field at 4x on RADV or a Deck.
  • L3 (Hyrule Field's cost): still open. Only Zora's Domain was timed (+0.3 ms of GPU a frame at 4x on an RTX 4090). In Hyrule Field the blade patches rise about 25 % at 4x; not timed.
Merged while I was finishing the last item, so the description stays as it was; for the record, on BeanBot's three: - **L1** (the terrace at the right setting): done, by hand, comment above: the reporter's terrace from the same spot on main @ 018dd2ef and this PR, both at 4x with each log checked (`b612216258832b9c word 75 30 -> 120` on this PR only). The far ledges beside the mosaic pillar and the bridge stairs are bare on main and covered here. - **L2** (RADV, Steam Deck): still open. Only the forced compute fallback on NVIDIA ran (no white blades, the blade program's records under half of #2121's area). Wanted: Zora's Domain and Hyrule Field at 4x on RADV or a Deck. - **L3** (Hyrule Field's cost): still open. Only Zora's Domain was timed (+0.3 ms of GPU a frame at 4x on an RTX 4090). In Hyrule Field the blade patches rise about 25 % at 4x; not timed.
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 6s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2929
No description provided.