WIP: fix(vk): the Anisotropic filtering row leaves images of one level alone, so no bright lines along edges #910
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved @ 14e165a
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
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
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!910
Loading…
Reference in a new issue
No description provided.
Delete branch "bvtterbrot/Longshot:fix/aniso-one-level"
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?
Type: fix · Risk: low · Tested on: Windows 11, AMD Radeon RX 7900 XTX, driver 26.10.1 (in Slingshot, a fork with the same sampler code; game-free checks here) · Needs: Windows or Linux, an AMD card, Lon Lon Ranch or Hyrule Field on
mainwith this changeWhy
With Anisotropic filtering above "Game's" (the default is 16x), thin dashed bright lines run along edges: mountain
ridges against the sky, roofs, shelves, and across the ground at Lon Lon Ranch. Players work around it by setting the
row to "Game's", which also takes the ground's sharpness away. Fixes #834, fixes #293, see #308 (its first point).
How to reproduce
Seen on: Windows 11, AMD Radeon RX 7900 XTX, driver 26.10.1 (in Slingshot; reported here on an RX 9070 XT, an RX 7800 XT on CachyOS and an RX 6750 XT: #834, #308)
Settings and switches: Anisotropic filtering 16x (any value above "Game's")
Steps: Stand in Lon Lon Ranch's field, or in Hyrule Field facing the mountains, and look along the ridges and roof edges.
Expected: Clean edges, as with the row at "Game's".
Actual: Dashed bright lines along the edges, one or two pixels wide.
What changed
The row's anisotropy is no longer added to a sampler when the image bound with it has a single level. The game's own
anisotropy stays, and mipmapped textures keep the row's value, so the ground's sharpness is unchanged.
The cause: the row's value went to every sampler with mip filtering, also where the game reads back a picture it drew
itself. OoT composites its half-size fog and particle layer (program
1a7482c0ec9991ea) through such a sampler. Wherea 2x2 block of pixels crosses an object's edge, its texture coordinates lie far apart, and the anisotropic filter
takes texels along that whole span: from the sky behind a ridge into the ridge.
sampler_make()andsampler_for()ingpu/vk/vk_draw.cpptakeone_level; with it the row's value isleft out of the sampler and of its cache key.
sampler_for()'s thread table has a second index for it.build_descriptors()passestex && tex->levels <= 1.tests/sampler_admission_test.cppandtests/test_sampler_admission.pytake the new argument and add thecase
anisotropy-one-level.docs/worklist.mdmoves the row to Fixed.Measurements
Verdict: Not measured in Longshot yet. In Slingshot, with the same change to the same code, the lines went: 180
bright edge pixels on one ridge before, 0 to 3 after, and the ground's detail at 16x was kept.
Hardware: Windows 11, AMD Radeon RX 7900 XTX, driver 26.10.1
Scene: Lon Lon Ranch, day; a fixed camera from a save, headless, Anisotropic filtering 16x
Method: a frame saved before and after (
RX_VK_SHOTS), bright pixels counted along one ridge by a script;RX_VK_ANISO=0as the control (lines gone, ground blurred)How to reproduce: the steps above, with the row at 16x and at "Game's"
Flags and settings
None new. The Anisotropic filtering row and
RX_VK_ANISOno longer reach samplers bound with an image of one level.Testing
Tested: The game-free checks on Windows 11:
tests/test_sampler_admission.pypasses with the new case. The wholerun (
python -I -B tests/run_all.py --jobs 8, with the Vulkan headers): 561 passed, 20 failed, 42 skipped; the same20 fail on
main@f637b42on this PC (test_appimage_player_build, test_auto_handheld, test_cpp_preflight,test_crash_dialog, test_crt_options, test_env_on, test_fpx_sticky, test_lift_cleanup_error, test_linux_preflight,
test_make_game_cache, test_make_game_prepare, test_missing_nup, test_oot_state_tap, test_options_budget_once,
test_readback_late, test_spawn_emit, test_tested_configurations, test_vk_occlusion_queries, test_vk_pgo,
test_walk_key). In the game: in Slingshot only (see Measurements), where it has been played since.
Not tested: Longshot built with this change, in the game. NVIDIA and Intel cards. Linux.
Must be tested:
mainand on this branch, a screenshot each).main(by hand: a screenshot each).Risks
What could break: A single-level texture that is not a picture the game drew (a small texture without mipmaps)
no longer gets the row's anisotropy; it keeps the game's. With one level there is nothing sharper to pick, so the
difference should not show.
Turning it off: Revert the commit; "Game's" on the row behaves as before.
Compatibility: Nothing changes for saves,
longshot_options.ini, the shader and pipeline caches or the vk ABI.Issues
Fixes #834
Fixes #293
See #308
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
b8959c5a4029ed5fb9b2View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.