fix(vk): FSR 4's shader preparation warms the model the player picked, and LONGSHOT_FSR builds again #2140
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!2140
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:fix/fsr4-warm-model"
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?
Summary
Since #1989, no build with AMD FSR 4 (
LONGSHOT_FSR=1:make_game.py --fsr, CI's FSR jobs) compiles. It stops atgpu/vk/vk_fsr4.cpp:1536: error: no matching function for call to 'make_context'. #1886 added the shader preparation'swarm-up call,
make_context(width, height, mode != 0). #1989 then gavemake_contextthe model as a fourth parameterwith no default. It updated the per-frame call in
preparebut not the warm-up's, and each PR built on its own.Builds without FSR 4 never compile that code, so only the FSR builds broke.
The warm-up now asks for
fsr4_model(), aspreparedoes each frame. That is the Model row as saved (menu_initreads it in
pick_device, before the preparation runs), orRX_VK_FSR4_MODEL. The pipelines it warms are then thoseof the model the game will use: with Lite picked, Lite's.
To see the bug on main, compile
vk_fsr4.cppwith-DLONGSHOT_FSR, or runRX_VK_ONLY=1 LONGSHOT_FSR=1 nx2/build.py --standalone.Read first:
fsr4_prepare_shadersingpu/vk/vk_fsr4.cpp, thentests/test_fsr4_prepare_model.py.Fixes #2122
Testing
Tested: Windows 11, llvm-mingw clang 23.1.5 (the Builder's) and TDM gcc 10.3.
tests/test_fsr4_prepare_model.py(new) cutsfsr4_prepare_shadersout ofvk_fsr4.cpp. It builds it againststand-ins whose
make_contexttakes the file's own parameters and records each call. It checks the contexts thepreparation makes: the shown output, LDR, and HDR after it with Native HDR (none with
RX_VK_FSR4_HDR=0), each ofthe model
fsr4_modelgives, Auto and Lite. On main @8aa74983it fails with both compilers, with the build's ownerror (
no matching function for call to 'make_context', 4 arguments wanted, 3 given). Here it passes with both. Italso fails when the call passes
FSR4_MODEL_AUTOwhatever was picked: "warmed for the Auto model, but the playerpicked Lite".
vk_fsr4.cppwhole,-fsyntax-onlywith-DLONGSHOT_FSRand the renderer's flags and include folders (clang): onmain the one error at 1536:21, here none.
RX_VK_ONLY=1 LONGSHOT_FSR=1 RX_RELEASE=1 nx2/build.py --standalone(the renderer, as CI's FSR jobs build it):"the Vulkan back end: with AMD FSR 4", every file compiled (
0 failed,vk_fsr4.cppin 29 s) andlongshot_vk.dlllinked. On main this build stops atvk_fsr4.cpp.test_fsr4_own_cache.py, which readsfsr4_prepare_shaders's text, still passes (clang; with TDM gcc 10.3 it failson main and here alike, on
FILE_DISPOSITION_INFOmissing from that toolchain's Windows headers).tests/run_all.py: 719 passed, 88 failed, 132 skipped on Windows (llvm-mingw first on PATH, the compile cache off). The 87 failing checks run again on main @8aa74983fail there too, all 87: none fails only here. The 88th,tests/test_vbytes.py(the translator's), timed out at 600 s while it ran beside the renderer build; it reads no file this changes. They are this PC's (Windows toolchain and missing tools), not this change's.Not run in the game: this PC has an NVIDIA RTX 3080, where AMD's FSR 4 library doesn't load and
fsr4_prepare_shadersreturns before the changed line.Still to test:
LONGSHOT_FSR=1renderer build (.forgejo/workflows/build-linux.yml) on this head, expecting it to pass where it fails on main (CI)(the launcher's last phase, or
--prepare-shaders). Expectingvk: AMD FSR 4: SDR pipeline preparation finishedfor each model in
longshot_log.txt, with noLite was asked for but no Lite provider is hookedunless the GPU hasno Lite. In play, expecting the first FSR 4 frames not to stall on building the model's pipelines (@Beanstalk).
Measurements
Nothing to measure: a build fix, and the warm-up makes the same contexts as before for the model now named.
Risks
Small. The warm-up makes one context per HDR mode, as before, now of the picked model. With Lite picked on a GPU
without a Lite provider,
make_contextfalls back to Auto and logs it once, as in play. A revert is enough. Nothingchanges for a player after updating, beyond FSR 4 builds compiling again.
Checklist
Ready for review
main; the title is a Conventional Commit.AMD's FSR 4 library loaded; this PC is NVIDIA: the AMD run in Still to test)
mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.build-linux.yml, on this PR's head)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
WIP: fix(vk): FSR 4's shader preparation warms the model the player picked, and LONGSHOT_FSR builds againto fix(vk): FSR 4's shader preparation warms the model the player picked, and LONGSHOT_FSR builds again@Beanstalk On Windows with an AMD RDNA 4 card and AMD's FSR 4 library: set Upscaler to FSR 4 and Model to Lite, run the shader preparation (the launcher's last phase), then start the game and play a minute in Kokiri Forest. Then the same with Model set to Auto. Expecting, for each model,
vk: AMD FSR 4: SDR pipeline preparation finishedin longshot_log.txt, noLite was asked for but no Lite provider is hooked(unless the card has no Lite), and the first FSR 4 frames in play without a stall while the model's pipelines build.@dyst this PR is closed or unknown to the farm.