fix(vk): the Grass distance path calls ub_overlay with its allocator and alignment, so the renderer builds #2098

Merged
HumanBean merged 1 commit from d4nkn3ss/Longshot:fix/grass-ub-overlay into main 2026-11-21 18:36:01 +00:00
Contributor

Summary

main doesn't build since d2f0e8dc (#1382, Grass distance). Its new uniform-buffer path in gpu/vk/vk_draw.cpp calls ub_overlay with four arguments, a capturing lambda as the allocator. Since 6112edb6 (#391), vk_draw.h's ub_overlay takes a plain function pointer and the alignment as a fifth argument. This passes stream_alloc and align, the same call the next block in the function already makes.

On main: build the renderer: vk_draw.cpp:4017:31: error: no matching function for call to 'ub_overlay' (candidate function not viable: requires 5 arguments, but 4 were provided).

Read first: the one line in gpu/vk/vk_draw.cpp under // (the Grass distance row: grass_reach), and the ub_overlay call about 20 lines below it.

See #1382. Its renderer builds were still skipped, waiting on the Test Farm's approval, when it merged.

Testing

Tested:

  • Windows 11 Pro 26300, llvm-mingw from the Longshot Builder. On main @ 936d4e00 the standalone build stops at vk_draw.cpp (1 error). With this PR it compiles, and longshot.exe and longshot_vk.dll link.
  • In the game, Windows 11, RTX 3080 10 GB (NVIDIA 621.14), this PR's build, with Grass distance at 3x so the changed call runs. The adult save, a teleport to the Market, out on foot into Hyrule Field, then a 60 s run round the field (ls_ab_walk). The patch ran: 4 vk: Grass distance 3x: program ... word 46 0.00263486 -> 0.000878286 lines. Market 73 fps, field 55 fps, the run round 60.5 fps median (52.9 min), 0 draws skipped, and no CRASH, FATAL, VK_ERROR or device lost.
  • python -I -B tests/test_grass_distance.py: 2 passed. It cuts the grass functions out of vk_draw.cpp and doesn't reach the changed call, so it passed on main too.
  • No game-free test is added. The thing that broke is a call that doesn't match its declaration, and the compiler is the check for that, as CI's renderer builds (Linux longshot_vk.so, Windows) do.
  • python -I -B tests/run_all.py --changed origin/main (the 164 checks that read vk_draw.cpp), Windows: 147 passed, 17 failed, 4 skipped (Linux only). The same 17 fail with main's vk_draw.cpp: FAIL:, ['longshot_fsr4_pipelines.bin']), build, page, test_dev_packs.py, test_device_lost_exit.py, test_device_policy.py, test_draw_binds.py, test_draw_stream_visibility.py, test_frame_overlap.py, test_framegen_preset.py, test_fsr_uniform_ownership.py, test_linux_pressure.py, test_mesh_conv.py, test_pipeline_play_cache.py, test_prepare_cache_save.py, test_recorder_own_idle.py, test_rumble_menu.py, test_sampler_admission.py, test_upscaler_rows.py, test_vk_occlusion_queries.py. The rest of the suite reads no changed file (mise isn't installed here).
  • Not compiled on Linux here (no Vulkan headers under WSL on this PC). The call is the same on every platform, and CI's Linux renderer build compiles it.

Still to test: None

Measurements

Nothing to measure: a build fix, one call. The path it touches runs only with Grass distance above Game's, as #1382 made it.

Risks

None beyond #1382's own. Without the lambda, the allocator is the same function with the same alignment. Turning it off: a revert, which breaks the build again.

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 check under tests/ that reads changed source is updated, not weakened.
  • 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.

🤖 Generated with Claude Code

## Summary `main` doesn't build since d2f0e8dc (#1382, Grass distance). Its new uniform-buffer path in `gpu/vk/vk_draw.cpp` calls `ub_overlay` with four arguments, a capturing lambda as the allocator. Since 6112edb6 (#391), `vk_draw.h`'s `ub_overlay` takes a plain function pointer and the alignment as a fifth argument. This passes `stream_alloc` and `align`, the same call the next block in the function already makes. **On main:** build the renderer: `vk_draw.cpp:4017:31: error: no matching function for call to 'ub_overlay'` (`candidate function not viable: requires 5 arguments, but 4 were provided`). Read first: the one line in `gpu/vk/vk_draw.cpp` under `// (the Grass distance row: grass_reach)`, and the `ub_overlay` call about 20 lines below it. See #1382. Its renderer builds were still skipped, waiting on the Test Farm's approval, when it merged. ## Testing **Tested:** - Windows 11 Pro 26300, llvm-mingw from the Longshot Builder. On main @ 936d4e00 the standalone build stops at `vk_draw.cpp` (1 error). With this PR it compiles, and `longshot.exe` and `longshot_vk.dll` link. - In the game, Windows 11, RTX 3080 10 GB (NVIDIA 621.14), this PR's build, with Grass distance at 3x so the changed call runs. The adult save, a teleport to the Market, out on foot into Hyrule Field, then a 60 s run round the field (`ls_ab_walk`). The patch ran: 4 `vk: Grass distance 3x: program ... word 46 0.00263486 -> 0.000878286` lines. Market 73 fps, field 55 fps, the run round 60.5 fps median (52.9 min), 0 draws skipped, and no `CRASH`, `FATAL`, `VK_ERROR` or device lost. - `python -I -B tests/test_grass_distance.py`: 2 passed. It cuts the grass functions out of `vk_draw.cpp` and doesn't reach the changed call, so it passed on main too. - No game-free test is added. The thing that broke is a call that doesn't match its declaration, and the compiler is the check for that, as CI's renderer builds (Linux `longshot_vk.so`, Windows) do. - `python -I -B tests/run_all.py --changed origin/main` (the 164 checks that read `vk_draw.cpp`), Windows: 147 passed, 17 failed, 4 skipped (Linux only). The same 17 fail with main's `vk_draw.cpp`: `FAIL:`, `['longshot_fsr4_pipelines.bin'])`, `build`, `page`, `test_dev_packs.py`, `test_device_lost_exit.py`, `test_device_policy.py`, `test_draw_binds.py`, `test_draw_stream_visibility.py`, `test_frame_overlap.py`, `test_framegen_preset.py`, `test_fsr_uniform_ownership.py`, `test_linux_pressure.py`, `test_mesh_conv.py`, `test_pipeline_play_cache.py`, `test_prepare_cache_save.py`, `test_recorder_own_idle.py`, `test_rumble_menu.py`, `test_sampler_admission.py`, `test_upscaler_rows.py`, `test_vk_occlusion_queries.py`. The rest of the suite reads no changed file (`mise` isn't installed here). - Not compiled on Linux here (no Vulkan headers under WSL on this PC). The call is the same on every platform, and CI's Linux renderer build compiles it. **Still to test:** None ## Measurements Nothing to measure: a build fix, one call. The path it touches runs only with Grass distance above Game's, as #1382 made it. ## Risks None beyond #1382's own. Without the lambda, the allocator is the same function with the same alignment. Turning it off: a revert, which breaks the build again. ## 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 check under `tests/` that reads changed source is updated, not weakened. - [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. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(vk): the Grass distance path calls ub_overlay with its allocator and alignment, so the renderer builds
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 13s
37f0469e5e
d2f0e8dc (#1382) passed a capturing lambda as ub_overlay's allocator and no
alignment; since 6112edb6 (#391) it takes a function pointer and the
alignment. clang: no matching function for call to 'ub_overlay'. The call
is now the one the overlay below it already makes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: RTX 3080 10 GB, NVIDIA 621.14, Windows 11 Pro 26300: this head's build with Grass distance 3x, the adult save through the Market, out into Hyrule Field and a 60 s run round. The patched path ran (4 'vk: Grass distance 3x' lines), 60.5 fps median in the run round, no crash, FATAL, VK_ERROR or device lost.

Tested in game: RTX 3080 10 GB, NVIDIA 621.14, Windows 11 Pro 26300: this head's build with Grass distance 3x, the adult save through the Market, out into Hyrule Field and a 60 s run round. The patched path ran (4 'vk: Grass distance 3x' lines), 60.5 fps median in the run round, no crash, FATAL, VK_ERROR or device lost.
d4nkn3ss changed title from WIP: fix(vk): the Grass distance path calls ub_overlay with its allocator and alignment, so the renderer builds to fix(vk): the Grass distance path calls ub_overlay with its allocator and alignment, so the renderer builds 2026-11-21 18:30:00 +00:00
HumanBean deleted branch fix/grass-ub-overlay 2026-11-21 18:36:02 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 13s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!2098
No description provided.