fix(vk): ASTC-to-BC runs of 8 layers only on RADV and NVIDIA's driver, one layer a run elsewhere (Hyrule Field's grid lines on AMD's Windows driver) #2148

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/bc-small-runs-amd-windows into main 2026-11-21 22:51:10 +00:00
Owner

Summary

Fixes #2107. See #2006, #2110.

On AMD's Windows driver, Hyrule Field's ground has had a grid of thin dark lines since #1843. Players of RX 6700 XT and RX 6750 XT cards on 26.10.1 and 26.11.2 have reported it. The stable release is clean, and RX_VK_BC_SMALL_LAYERS=1 removes the lines.

Why. On cards without ASTC, the terrain's material arrays (1365 x 1365 x 90) are re-encoded to BC3 in runs of layers. #1843 made the levels of 1024 or less go 8 layers a run, through a small scratch. On AMD's Windows driver, every layer after a run's first comes out wrong at those levels: the same bug ec89f92e worked around on an RX 6600 by going one layer a run. #2015 tried the copy's layer pitch as the cause. Nightly 680 contains it and still shows the lines (#2107, #2110), so the cause is still not found.

The change. device_policy.h gets a new field, bc_small_runs: runs of 8 only on the drivers they were seen clean on. Those are RADV (RX 9070 XT, RX 6750 XT) and NVIDIA's (RTX 3080 on Windows, #2006's comment). Every other driver goes one layer a run, as before #1843, and the 36 MB small scratch isn't made. That covers AMD's Windows driver, AMDVLK, Intel's, NVK and the rest, which nobody has checked. RX_VK_BC_SMALL_LAYERS still overrides it, and the start-up vk: policy: block now shows bc_small_runs.

To see it on main: Windows, an RX 6000 card on AMD's driver. Leave the Castle Town gate into Hyrule Field and look across the far ground: its tiles are outlined in dark lines.

Read first: gpu/vk/device_policy.h (bc_small_runs), then gpu/vk/vk_texture.cpp (bc_small_layers).

Testing

Tested: not run in the game: opened untested at the request of the person I work for. No GPU I can reach gets the new default: this PC and the lab's RX 580 are both on RADV, where runs stay 8, as on main. vk_texture.cpp compiles clean (-fsyntax-only) with the build's flags; vk_main.cpp too. No checks were run on this PC; tests/test_bc_small_scratch.py (the first commit, written to fail on main: "another driver (AMD's Windows driver: Hyrule Field's grid lines), RX_VK_BC_SMALL_LAYERS=None: 8 layers a run, wanted 1") and tests/test_device_policy.py are left to CI.

Still to test:

  • Windows, AMD RDNA 2 (RX 6700 XT / RX 6750 XT / RX 6600), AMD's driver, defaults: leave the Castle Town gate into Hyrule Field and look across the field, expecting no grid lines on the far ground and bc_small_runs=0 in the log's vk: policy: can and measured: line (@Beanstalk test Windows AMD dGPU on Hyrule Field; or #2107's reporter, by hand)
  • Linux RADV and Windows NVIDIA: the same, expecting bc_small_runs=1 and the ground as on main (@Beanstalk test Linux RADV and Windows NVIDIA on Hyrule Field)

Measurements

Nothing new to measure. On RADV and NVIDIA's driver, the work is the same as on main. Every other driver goes back to what main did before #1843: one layer a run, which #1843 measured at ~50 ms of GPU time per never-put-off terrain array at Hyrule Field's entry, against ~16 ms at 8 layers (RX 9070 XT). That entry cost is the price of correct terrain on those drivers until the cause is found.

Risks

On drivers other than RADV and NVIDIA's, entering Hyrule Field holds the GPU for longer again (about 260 ms more GPU work at entry, the same as before #1843), and the 36 MB scratch isn't made. RX_VK_BC_SMALL_LAYERS=8 brings back runs of 8 on any driver; reverting the PR is enough to undo it. Nothing changes in saves, longshot_options.ini or the caches. #1987 (WIP) extends multi-layer re-encoding and should follow this policy field.

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. (not run: opened untested at the request of the person I work for; the changed default reaches no GPU I have)
  • mise run test passes (any failure that also fails on main is named). (not run on this PC; left to CI)
  • 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. (tests/test_bc_small_scratch.py, the first commit; not yet run both ways)
  • A check under tests/ that reads changed source is updated, not weakened. (test_device_policy.py: the new field on every PC, its site)
  • Docs updated. (the comments at bc_small_runs and bc_small_layers, the switch's row)
  • 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 Fixes [#2107](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2107). See [#2006](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2006), [#2110](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2110). On AMD's Windows driver, Hyrule Field's ground has had a grid of thin dark lines since [#1843](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1843). Players of RX 6700 XT and RX 6750 XT cards on 26.10.1 and 26.11.2 have reported it. The stable release is clean, and `RX_VK_BC_SMALL_LAYERS=1` removes the lines. **Why.** On cards without ASTC, the terrain's material arrays (1365 x 1365 x 90) are re-encoded to BC3 in runs of layers. #1843 made the levels of 1024 or less go 8 layers a run, through a small scratch. On AMD's Windows driver, every layer after a run's first comes out wrong at those levels: the same bug ec89f92e worked around on an RX 6600 by going one layer a run. [#2015](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2015) tried the copy's layer pitch as the cause. Nightly 680 contains it and still shows the lines (#2107, #2110), so the cause is still not found. **The change.** `device_policy.h` gets a new field, `bc_small_runs`: runs of 8 only on the drivers they were seen clean on. Those are RADV (RX 9070 XT, RX 6750 XT) and NVIDIA's (RTX 3080 on Windows, [#2006's comment](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2006)). Every other driver goes one layer a run, as before #1843, and the 36 MB small scratch isn't made. That covers AMD's Windows driver, AMDVLK, Intel's, NVK and the rest, which nobody has checked. `RX_VK_BC_SMALL_LAYERS` still overrides it, and the start-up `vk: policy:` block now shows `bc_small_runs`. To see it on `main`: Windows, an RX 6000 card on AMD's driver. Leave the Castle Town gate into Hyrule Field and look across the far ground: its tiles are outlined in dark lines. Read first: `gpu/vk/device_policy.h` (`bc_small_runs`), then `gpu/vk/vk_texture.cpp` (`bc_small_layers`). ## Testing **Tested:** not run in the game: opened untested at the request of the person I work for. No GPU I can reach gets the new default: this PC and the lab's RX 580 are both on RADV, where runs stay 8, as on `main`. `vk_texture.cpp` compiles clean (`-fsyntax-only`) with the build's flags; `vk_main.cpp` too. No checks were run on this PC; `tests/test_bc_small_scratch.py` (the first commit, written to fail on `main`: "another driver (AMD's Windows driver: Hyrule Field's grid lines), RX_VK_BC_SMALL_LAYERS=None: 8 layers a run, wanted 1") and `tests/test_device_policy.py` are left to CI. **Still to test:** - Windows, AMD RDNA 2 (RX 6700 XT / RX 6750 XT / RX 6600), AMD's driver, defaults: leave the Castle Town gate into Hyrule Field and look across the field, expecting no grid lines on the far ground and `bc_small_runs=0` in the log's `vk: policy: can and measured:` line (@Beanstalk test Windows AMD dGPU on Hyrule Field; or #2107's reporter, by hand) - Linux RADV and Windows NVIDIA: the same, expecting `bc_small_runs=1` and the ground as on `main` (@Beanstalk test Linux RADV and Windows NVIDIA on Hyrule Field) ## Measurements Nothing new to measure. On RADV and NVIDIA's driver, the work is the same as on `main`. Every other driver goes back to what `main` did before #1843: one layer a run, which #1843 measured at ~50 ms of GPU time per never-put-off terrain array at Hyrule Field's entry, against ~16 ms at 8 layers (RX 9070 XT). That entry cost is the price of correct terrain on those drivers until the cause is found. ## Risks On drivers other than RADV and NVIDIA's, entering Hyrule Field holds the GPU for longer again (about 260 ms more GPU work at entry, the same as before #1843), and the 36 MB scratch isn't made. `RX_VK_BC_SMALL_LAYERS=8` brings back runs of 8 on any driver; reverting the PR is enough to undo it. Nothing changes in saves, `longshot_options.ini` or the caches. [#1987](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1987) (WIP) extends multi-layer re-encoding and should follow this policy field. ## Checklist ### Ready for review - [x] 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. *(not run: opened untested at the request of the person I work for; the changed default reaches no GPU I have)* - [ ] `mise run test` passes (any failure that also fails on `main` is named). *(not run on this PC; left to CI)* - [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 - [ ] A fix: a game-free test that fails on `main` and passes here. *(`tests/test_bc_small_scratch.py`, the first commit; not yet run both ways)* - [x] A check under `tests/` that reads changed source is updated, not weakened. *(`test_device_policy.py`: the new field on every PC, its site)* - [x] Docs updated. *(the comments at `bc_small_runs` and `bc_small_layers`, the switch's row)* - [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)
tests/test_bc_small_scratch.py runs bc_small_layers() with device_policy.h's
bc_small_runs on and off. On main AMD's Windows driver still gets 8 layers a
run, and the grid lines with them (#2107, #2110, after #2015).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk): ASTC-to-BC runs of 8 layers only on RADV and NVIDIA's driver, one layer a run elsewhere (Hyrule Field's grid lines on AMD's Windows driver, #2107)
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 14s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Website build and checks (pull_request) Failing after 27s
bdc709fa80
#1843's small scratch re-encodes ASTC levels of 1024 or less 8 layers a run.
On AMD's Windows driver the layers after a run's first come out wrong there,
and Hyrule Field's ground shows a grid of dark lines (#2006). #2015 gave the
copy's layer pitch, but the lines are still there with it on an RX 6750 XT
(26.11.2, nightly 680: #2107, #2110).

device_policy.h's new bc_small_runs keeps runs of 8 on the drivers they were
seen clean on, RADV and NVIDIA's, and gives every other driver one layer a run,
as before #1843 (no small scratch, no 36 MB). RX_VK_BC_SMALL_LAYERS still
replaces it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean force-pushed fix/bc-small-runs-amd-windows from bdc709fa80
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 14s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Website build and checks (pull_request) Failing after 27s
to f63fec8767
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 15s
CI / Website build and checks (pull_request) Failing after 24s
PR description / Description follows the template (pull_request_target) Failing after 6s
2026-11-21 22:50:41 +00:00
Compare
HumanBean changed title from WIP: fix(vk): ASTC-to-BC runs of 8 layers only on RADV and NVIDIA's driver, one layer a run elsewhere (Hyrule Field's grid lines on AMD's Windows driver) to fix(vk): ASTC-to-BC runs of 8 layers only on RADV and NVIDIA's driver, one layer a run elsewhere (Hyrule Field's grid lines on AMD's Windows driver) 2026-11-21 22:51:03 +00:00
HumanBean deleted branch fix/bc-small-runs-amd-windows 2026-11-21 22:51:11 +00:00
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!2148
No description provided.