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
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
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
ci: approved
No milestone
No project
No assignees
3 participants
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
b8959c5a4029ed5fb9b2@Beanstalk
Beanstalk test farm
Commit
e4609af· tier reviewed · approved by HumanBean · dashboardWhat will be tested · AI plan (
gpt-6.1-terra)On Tommy’s and futondestroyer’s Windows PCs, this plan compares Kokiri Forest, Hyrule Field and the Lake Hylia teleport area against main, taking about 13 minutes per PC. It tests both the game’s anisotropy and 16x because the fix changes how the filtering override is applied. Screenshots, frametimes and load times are compared; crashes, large visual differences or specified performance regressions fail the plan. The screenshot comparison cannot by itself establish that AMD’s bright-line artifact is fixed.
0or4.Started. Run 16: the farm's reports were cleared after its Windows and Linux fixes: started again.
NVIDIA GeForce RTX 4070, 621.1.0anisotropic_filtering=0anisotropic_filtering=0anisotropic_filtering=4anisotropic_filtering=4Measurements · windows+tester-futondestroyer
Verdict: fail on windows+tester-futondestroyer (1/1 report):
outdoor-filtering screenshot.max_difffailed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 4070, 621.1.013th Gen Intel(R) Core(TM) i7-13700F, 32 GB RAMScene: outdoor-filtering, from a new save; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); outdoor-filtering: 1 game start a side, kokiri 10 s after 5 s warm-up, field 10 s after 5 s warm-up, lake 10 s after 5 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)0260816e4609afanisotropic_filtering=0· longest load (s)anisotropic_filtering=0· lake · frame time (p99) (ms)anisotropic_filtering=0· field · frame time (p99) (ms)anisotropic_filtering=0· kokiri · frame time (p99) (ms)anisotropic_filtering=4· longest load (s)anisotropic_filtering=4· lake · frame time (p99) (ms)anisotropic_filtering=4· field · frame time (p99) (ms)anisotropic_filtering=4· kokiri · frame time (p99) (ms)Flags and settings
anisotropic_filtering0,4Markdown for the PR description
29ed5fb9b2e4609af92aRebased onto main @
02608169(nowe4609af9). One conflict, insampler_for(gpu/vk/vk_draw.cpp): main added a frame to each thread-table entry (the sampler book, near the device's sampler limit), so the entry is now{gen, s, frame}intable[compare][one_level][id], checked ase.gen == gen && e.frame == frame. The rest of the change is as you wrote it.Checks after the rebase (Linux):
tests/test_sampler_admission.py --headers /usr/include --cxx clang++passes all 153 cases, also with--sanitize. In the fullrun_all.py(Vulkan, SPIR-V and VMA headers given) 20 fail, the same 20 as on main without this change.In the game on an RTX 3090 (Linux), as a renderer pack on main @
a00c485c, Anisotropic filtering at 16x, headless: Lake Hylia's ridges, the Hyrule Field gorge and the Kokiri start look the same as main, at 60 fps, with no new errors in the log. This GPU doesn't show the lines on main either, so it says nothing about the fix itself: that still needs an AMD run, main then this PR, at Lon Lon Ranch or the Kokiri start.@Beanstalk
@Beanstalk
@HumanBean
e4609afis already running: see the dashboard.@Beanstalk cancel
@Beanstalk
@HumanBean
e4609afis already running: see the dashboard.@Beanstalk cancel
@HumanBean cancelled 1 queued job.
@Beanstalk
@Beanstalk cancel
@HumanBean cancelled 1 queued job.
@Beanstalk
@Beanstalk cancel
@HumanBean cancelled 1 queued job.
@Beanstalk
@Beanstalk cancel
@HumanBean cancelled 1 queued job.
@Beanstalk
@Beanstalk cancel
@HumanBean cancelled 1 queued job.
@Beanstalk
@Beanstalk plan One target only, Tommy's PC: tags = ["tester-tommy"] (Windows, NVIDIA; it has the Beanstalk agent with the new Windows sandbox probe). Keep the same scenes as the last plan.
@Beanstalk plan One target only, futondestroyer's PC: tags = ["tester-futondestroyer"] (Windows, RTX 4070; it has the Beanstalk agent with the new Windows sandbox probe, and gameplay on). The same scenes as the plan before: Kokiri Forest, Hyrule Field and Lake Hylia against main.
@Beanstalk plan One target only, zealotn's PC: tags = ["tester-zealotn"] (Windows; it has the Beanstalk agent with the new Windows sandbox probe). The same scenes as the plan before: Kokiri Forest, Hyrule Field and Lake Hylia against main.
@Beanstalk plan One target only, futondestroyer's PC: tags = ["tester-futondestroyer"] (Windows, RTX 4070; it has the Beanstalk agent with the new Windows work drive). The same scenes as the plan before: Kokiri Forest, Hyrule Field and Lake Hylia against main.
@Beanstalk plan One target only, Tommy's PC: tags = ["tester-tommy"] (Windows, NVIDIA; it has the Beanstalk agent with the Windows work drive and the clang fix). The same scenes as the plan before: Kokiri Forest, Hyrule Field and Lake Hylia against main.
@Beanstalk plan One target only, Tommy's PC: tags = ["tester-tommy"] (Windows, NVIDIA). The same scenes as the plan before: Kokiri Forest, Hyrule Field and Lake Hylia against main. (Again: the last try lost its lease.)
@Beanstalk plan One target only, Tommy's PC: tags = ["tester-tommy"] (Windows, NVIDIA; on the nightly with the clang fixes). The same scenes as the plan before: Kokiri Forest, Hyrule Field and Lake Hylia against main.
@Beanstalk plan Windows only, to check Windows builds end to end: two targets, one report each, Jiro113's PC (tags = ["tester-jiro113"]) and dyst's PC (tags = ["tester-dyst"]). Keep the scenarios as they were.
@Beanstalk plan Windows only again, now that the farm's Windows sandbox fix for the lift is out: two targets, one report each, Tommy's PC (tags = ["tester-tommy"]) and futondestroyer's PC (tags = ["tester-futondestroyer"]). Keep the scenarios as they were.
The AMD run asked for above, at Lon Lon Ranch. It is on v3.0.0-rc.4, not on
main: the renderer alone was built twice from the rc.4 tag (RX_VK_ONLY), once as it is and once with this PR's change togpu/vk/vk_draw.cpp, and each DLL was put into a copy of an rc.4 game folder, so the game, the caches and everything else are the same in both.Verdict: the dashed bright line along the ridge is there without the change and gone with it.
Hardware: Windows 11, AMD Radeon RX 7900 XTX, driver 26.10.1
Scene: Lon Lon Ranch's field, day, facing the mountain behind the fence; 2560x1440, FSR (upscaling 2), Anisotropic filtering 16x
Method: headless (
longshot_ctl.py launch --headless --ready play,RX_VK_SHOT_W=2560 RX_VK_SHOT_H=1440), the same save and camera each time, 2 runs each way interleaved, 2 screenshots a run; counted: pixels brighter than both neighbours across a line by more than 25 in luma, in the 600x110 region of the ridge (x 1300, y 230)The ridge behind the fence, the counted region enlarged 3x:
The ground's detail at 16x looks the same in both (same crop compared by eye).
Not covered by this run:
mainwith the change (the sampler's thread table differs there since the rebase), other AMD cards, Linux.On the farm's
screenshot.max_difffailure at 16x (kokiri 0.366, field 0.364, lake 0.025 against main, one game start a side): I checked how much two runs of the same build differ in a scene with things moving in it.Setup: Windows 11, RX 7900 XTX, v3.0.0-rc.4 with the renderer built twice (as it is, and with this change), Lon Lon Ranch's field from the same save, 16x, headless at 2560x1440, 2 runs each way interleaved, one picture 30 s after play. (The teleports to Kokiri and Hyrule Field were sent but did not move Link, so both pictures are of the ranch; the horses walk and the grass sways there.)
Share of pixels that differ by more than 16 in any channel:
Two runs of the same build already differ as much as the build with and without this change, so in a scene with moving horses, grass or Link's idle pose, one picture a side can't separate this change from the scene itself. The ridge count above (177/161/169/160 → 0/0/1/0) is in a region with nothing moving. At "Game's", where this change does nothing, the farm's pictures matched within 1.2%, which suggests the scenes it compares at 16x moved more between starts. A picture taken from a fixed camera with nothing animated, or several runs a side, would tell more; I can't say from here which of the two the farm's 36% is.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.