WIP: fix(vk): the fixed shares' fallback upscale gets an edge pass and FSR 1 EASU #1552
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1552
Loading…
Reference in a new issue
No description provided.
Delete branch "zeldaootr/Longshot:vk-fallback-upscale-aa"
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: medium · Tested on: Linux, Steam Deck OLED (RADV VANGOGH) · Needs: Windows, an AMD or Intel GPU
TL;DR
At Render resolution 50% on a Steam Deck (what Minimum and Auto pick there) the game's picture had no anti-aliasing at all. The game's own upscaler for that size can't run on the Deck, so its stand-in just stretched the small picture: every edge became a 2-pixel staircase and every bright speck a square. This PR smooths the edges at the small size first, then enlarges the picture with AMD's edge-following FSR 1 upscaler. On a Deck the outlines are continuous and calm in motion, with no new artefact in three areas, at 0.52 ms of GPU a frame and no fps cost that could be measured.
Breakdown
main;main: outlines continuous, nothing new in Kokiri Forest, Hyrule Field or the Market;Why
At Render resolution 50% on a Steam Deck the edges look hard and stair-stepped, with bright specks along Link's hat and on the grass that crawl as the camera moves. 50% is what the Minimum preset sets and what Auto picks on a Deck, so that is every Deck player on defaults.
The game draws the 3D at a fixed share of the screen and enlarges it with a network of its own for each share: 67%, 58%, 50% and 33% each have one. These networks need cooperative matrices, and the renderer leaves them out (
vk_shader.cpp) in these cases:RX_VK_NO_F16.On an NVIDIA RTX card the movie networks' linear rule also takes them:
movie_networks_slowtrips (a frame over 40 ms of GPU in under 40 draws);RX_VK_MOVIE_UPSCALE=linear;RX_VK_FORCE_UPSCALE_STUB.There, with the game's own upscaler,
upscale_stub's generic fallback stretched the small picture linearly with no anti-aliasing. At 75% a different network is replaced by a stand-in that does run FXAA, which is why 75% looks better.Which shares a player can reach on this path: with the game's own upscaler the Render resolution row offers Auto, 100%, 75%, 67% and 50% (
upscaler_rows.hkGameSteps), on every output size and OS. 58% and 33% are not offered with it:resolution=5or=6is snapped to 50% at start (snap_render);no step reaches 5 on this PC(host/control.c);58% and 33% are steps of DLSS, FSR 3.1, FSR 4 and XeSS (and 33% of Off), whose own paths draw the picture. So this PR changes what players see at 67% and 50%. The 58% and 33% keys stay in the list for the one case that still reaches this fallback: a temporal upscaler at those shares that fails to draw a frame (
temporal_rejected_networkreturns false), which would otherwise get the plain stretch. That case was not run.This fixes edges, not resolution: Render 75% still shows more texture detail inside the hat and the plants, because it draws 2.25x the pixels.
See #275: an RX 570 on this same fallback at 50%, with bright dots on hair and foliage.
How to reproduce
Seen on: SteamOS 3.9.5, Steam Deck OLED, RADV VANGOGH, Mesa 26.2.0-devel
Settings and switches: Render resolution 50%, Upscaler the game's own (the Minimum preset, or Auto on a Deck); 1280x720
Steps: load a child save in Kokiri Forest and look at Link's hat and the ferns against the path, standing, then turning the camera
Expected: anti-aliased edges, as at Render 75%
Actual: on main, outlines are dashed lines of 2x2 blocks, with bright 2x2 specks. The log has
vk: program 72ba090c70fe2614 not translated: a network left out on this cardandvk: typed upscale helper generic RGB9E5 fallback, packed output;RX_VK_TAAU_FXAA=2marks no pixel at 50%.What changed
When a fixed share's network is left out, its output is now drawn in two compute passes: FXAA on the input's texel centres at the Render resolution, then AMD FSR 1 EASU up to the output's size.
EASU runs only up to 2x a side, the largest ratio AMD's FSR 1 integration guide has a mode for (Performance, 2.0x per dimension): 67% (1.5x), 58% (1.72x) and 50% (2x). 33% (3x) gets the FXAA pass and the linear stretch, and the log says so once.
Every other program that reaches the same fallback is drawn as before.
gpu/vk/vk_draw.cpp.fixed_share_network()names the four keys: 67%6676619641320ba7, 58%f10782f9e58b6a7c, 50%72ba090c70fe2614, 33%0775215f8da720e6. The 33% key at 1280x720 was confirmed on the Deck with Upscaler Off.upscale_stubcallsfixed_share_upscale()for them beforetyped_upscale.typed_upscaleas before:fd029a317a9a4b94) and full-size (9dc98871eb7fc101) networks;fixed_share_upscale():ffxFsrPopulateEasuConstants;RX_VK_PASS_TIMINGspan of its own name.gpu/vk/shaders/fixed_share_upscale.comp, withfixed_share_upscale_comp_spv.hgenerated by glslang 16.6.0.third_party/fidelityfx-sdk/include/FidelityFX/gpu/fsr1/ffx_fsr1.h(MIT), included unchanged, then squares the result back into the R11G11B10 output.gpu/vk/switches.def.killrowRX_VK_FIXED_SHARE_EASU.RX_VK_TAAU_FXAA's row now says it covers this pass too, so the 3/4 stand-in's FXAA and this one can't be turned off apart.tests/test_fixed_share_upscale.py: the passes with Vulkan spies and their spans, both switches, the 3x case, an image that cannot be made, and the four keys against the same keys a bit off.tests/test_fixed_share_upscale_shader.py: header against source,spirv-val, the shader's shape.tests/test_upscale_fallback.py: each of the four keys takes the new path; 50%'s key a bit off does not.docs/development.md, beside the TAAU replacement's paragraph;README.md's credits name FSR 1 beside FSR 3.1 and FSR 4;docs/tested/, one per measured run.Measurements
Verdict: the fix holds on a Steam Deck. At 50% and 67% the outlines are continuous, with no 2x2 blocks, and calm while the camera turns. Navi, the fairies, the fireflies and the HUD are unchanged, and the Market and Hyrule Field show no halo, ring or fringe. The new passes cost 0.52 ms of GPU a frame in Hyrule Field, and no fps cost is resolved in any of the three areas. Both switches off is main's path exactly.
Hardware: Steam Deck OLED, SteamOS 3.9.5 (20261023.100), RADV VANGOGH Mesa 26.2.0-devel, GPU clock manual 1600 MHz; AMD Custom APU 0932, 16 GB
Scene: Kokiri Forest (child save's spot), Hyrule Field (night arrival, camera turned), the Market entrance; 1280x720, Render 50% (and 67%), the game's own upscaler, Lanczos window filter, Sharpness 50, frame generation off, no cap; headless
Method: presents per second over a 90 s standing sample (the control bridge's
replayed), Kokiri interleaved A B B A B A A B, median; GPU time fromRX_VK_PASS_TIMING=1(four 600-present reports inside the sample); stills after the window pass and four consecutive presents of a camera turn;RX_VK_TAAU_FXAA=2marks counted on the bridge shotsHow to reproduce: this PR's two code commits on main
8e3dfde6e(00eaca4aa, branchaa-final-on-8e3dfde6; the same code as this PR's head) as a renderer pack (scripts/dev_packs.py), against that main's own renderer, with the settings above8e3dfde6eRX_VK_TAAU_FXAA=2marks, 50% / 67% / 75% (red+blue)RGBA16F image madelinestyped upscale helperfixed shares' upscale: FXAA ... then FSR 1 EASU, no helpertyped upscale helper(main's)The PR's base: the Deck build is these commits backported onto main
8e3dfde6e, because the Deck's base and caches are at that commit. Between8e3dfde6eand this PR's base, these commits touch the upscale path:upscale_stub's output picture: no change to what is drawn);switches.defrows).None changes how the fixed shares reach
upscale_stubor what it draws for them, so the numbers carry over.How this design was chosen (a prototype, not this build):
What it costs where it was not measured
Desktop AMD (Windows and Linux), Intel Arc and integrated, GTX 10, Polaris on RADV, at Render 50% or 67% with the game's own upscaler: the picture changes there too, from a plain stretch to this. Not run on any of them.
GPU time at larger outputs: EASU's cost grows with the output. It measured 0.47 ms at 1280x720 on the Deck at 1600 MHz:
It is unmeasured on any of them, and on a weak integrated GPU at 1080p least of all.
Memory: the intermediate RGBA16F image has the Render resolution's size; briefly two exist during a size change.
Flags and settings
One switch added, one row's text changed.
RX_VK_FIXED_SHARE_EASU(new, kill)=0: linear stretch after the edge passRX_VK_TAAU_FXAA=0leaves both out;=2marks moved pixelsBoth off gives main's plain stretch through
typed_upscale(measured on the Deck: the same path and picture). Documented indocs/development.md.Testing
Tested:
docs/tested/):RX_VK_PASS_TIMING=1in the Field (gtA-1, gtB-1).VK_ERRORline and no shader preparation.mainand pass here with g++ 13.3 and clang 23.1;spirv-valpasses;nx2/translator_files.py);scripts/check_third_party.pypasses.python -I -B tests/run_all.py --changed main(26 files, 167 checks) at this PR's head on main79d4a1436: 159 passed, 11 failed, 2 skipped. All 11 fail on plainmainthe same way (11 failed of 11 there):test_compute_warm_apart,test_dev_packs,test_draw_stream_visibility,test_fsr_uniform_ownership,test_hud_layout_row,test_linux_pressure,test_pipeline_play_cache,test_switch_table(rows for eight host andreplay switches, none of this PR's),
test_upscaler_rows,test_vk_occlusion_queries,test_walk_key.test_pipeline_cache_save,test_prepare_stallandtest_draw_side_effectsfailed once; they read nothing this PR changes and pass alone.Not testable by hand: Render 58% and 33% with the game's own upscaler, because that row doesn't offer them on any PC (see Why). The one way they reach this pass is a temporal upscaler at those shares failing to draw, which can't be caused on purpose.
tests/test_fixed_share_upscale.pystands in for the 3x case andtests/test_upscale_fallback.pyfor those keys.Not tested:
Must be tested:
vk: fixed shares' upscale: FXAA at the Render resolution, then FSR 1 EASU.RX_VK_FIXED_SHARE_EASU=0 RX_VK_TAAU_FXAA=0beyond the run-to-run spread.@Beanstalk windows amd and windows intel: this PR against main at Render resolution 50% and 67% with the game's own upscaler, Kokiri Forest and Hyrule Field, screenshots of Link's outline and fps.Risks
What could break:
Known, not fixed: the intermediate image (1800 KB at 640x360, up to about 8,300 KB at 67% of 2048x1152) stays allocated for the rest of the run once a fixed share has been used, even after the player moves to 75% or 100%. It is given back only when a new size replaces it.
Turning it off:
RX_VK_TAAU_FXAA=0andRX_VK_FIXED_SHARE_EASU=0give main's path; reverting is enough.Compatibility: nothing for saves or options. The shader cache stamp is unchanged, so nothing is translated again.
MKWVK_API_VERSIONis unchanged (vk_api.huntouched). The new built-in compute pipeline is built at the first 50% or 67% frame.Issues
See #275
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).*_spv.hheader is the project's checked-in generated kind, regenerated with glslang.)third_party/untouched (a new folder with aPROVENANCE.mdinstead).third_party/fidelityfx-sdkwith its notice, and included unchanged.)When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md).mainand passing here.tests/that reads changed source updated in this PR, not weakened.vk_draw.cpp, a shader header); a Windows llvm-mingw build has not been run: needed from someone with the Windows builder, or the Test Farm run in Must be tested.)Tested in game: Steam Deck OLED (SteamOS 3.9.5, RADV VANGOGH, Mesa 26.2.0-devel): this change backported onto main
8e3dfde6e, 21 runs on 2026-11-18 against main at 1280x720 and the game's own upscaler (Kokiri Forest A B B A B A A B at 50%, 67%, Hyrule Field, the Market, both passes off, and RX_VK_PASS_TIMING in the Field): the two passes ran at 50% and 67% with continuous outlines and no artefact, 0.52 ms of GPU a frame, no fps cost resolved.Screenshots from the measured Deck runs: Steam Deck OLED, 1280x720, Render resolution 50% (640x360), the game's own upscaler, Lanczos window filter, Sharpness 50. Before: main @
8e3dfde6e. After: this PR, backported onto main @8e3dfde6e(longshot_vk.so061e414e…6076). Pictures are after the window pass; Link's idle pose differs between runs.@Beanstalk windows amd and windows intel: this PR against main at Render resolution 50% and 67% with the game's own upscaler, Kokiri Forest and Hyrule Field, screenshots of Link's outline and fps
@zeldaootr only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.Beanstalk test farm
Commit
ff0eec7· tier reviewed · approved by futondestroyer (👍 on zeldaootr's request) · dashboardWhat will be tested · AI plan (
gpt-6.1-terra)Windows AMD and Intel PCs will compare the PR with main in Kokiri Forest and Hyrule Field, using the game's own upscaler at both 50% and 67% render resolution. The resolution matrix exercises both changed fallback paths; screenshots capture Link's outline and the surroundings, while FPS and frame times measure performance over roughly 13 minutes per tester. Crashes, large screenshot differences, a 10% FPS drop, or a 15% p99 frame-time increase fail the plan; the image threshold permits some intended edge smoothing but cannot prove that outlines improved. No Intel tester is currently listed online, so that target will wait for one. No tester online now matches windows+intel: that target waits for one.
4or3.Started at 13:09 UTC.
AMD Radeon RX 9070 XT, 2.0.416; 2: windows+amd+amd-proprietary+dgpuAMD Radeon RX 9070 XT, 2.0.416resolution=4resolution=4resolution=3resolution=3Measurements · windows+amd
Verdict: pass on windows+amd (2/1 report): no rule failed and no PR run crashed.
Hardware: 1: windows+amd+amd-proprietary+dgpu
AMD Radeon RX 9070 XT, 2.0.416AMD Ryzen 9 5900X 12-Core Processor, 32 GB RAM; 2: windows+amd+amd-proprietary+dgpuAMD Radeon RX 9070 XT, 2.0.416AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAMScene: outlines-and-fps, from a new save (dlss=0, frame_generation=0); 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); outlines-and-fps: 1 game start a side, forest 20 s after 5 s warm-up, field 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)79d4a14ff0eec7resolution=4· field · frame rateresolution=4· forest · frame rateresolution=4· field · frame time (p99) (ms)resolution=4· forest · frame time (p99) (ms)resolution=3· field · frame rateresolution=3· forest · frame rateresolution=3· field · frame time (p99) (ms)resolution=3· forest · frame time (p99) (ms)Flags and settings
resolution4,3Markdown for the PR description
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.