Repository navigation
Conversation
The first half of an FSR backend: its shaders. Adds AMD's FidelityFX SDK v1.1.4 GPU sources under third_party/fidelityfx-sdk, unmodified and MIT, with a provenance note, and scripts/fsr3_shaders.py to compile the eleven variants into gpu/vk/shaders/fsr3_*_comp_spv.h. Eleven, not eight: the eight passes, plus wave-free variants of both pyramids for devices without the subgroup operations the single-pass downsampler prefers, and an accumulate compiled with sharpening on. The option set lives in one place in the script because each option is a promise about the inputs -- HDR colour, low-resolution motion that is not jittered, reversed depth -- and the host code has to hand the passes what they were compiled for. This is the SDK-source route rather than AMD's FidelityFX API, so no runtime library is needed, none is included, and one code path serves Windows and Linux. NotRexed#577 vendors AMD's API headers for the other route under third_party/fidelityfx; if both land, one should go. The headers are checked in, like every other shader in gpu/vk/shaders, so a clone builds with no glslang. tests/test_fsr3_shaders.py recompiles all eleven and compares, and validates each module with spirv-val, so the headers cannot drift from their sources and an invalid module is caught here rather than on a device. It is wired into run_all's tool table, and glslang-tools is added to the Linux CI step that had spirv-tools only. That costs about 1.3 MB of generated hex. Generating at build time would remove it at the price of a glslang dependency for every build. No renderer change: nothing includes these headers yet. The host side that records the passes is the next commit. Checked here: all eleven compile and pass spirv-val, the check passes, and it fails as it should on a changed word in a header, a changed compile option and a missing header. python -I -B tests/run_all.py: 90 passed, with the same 8 failures and 12 skips as upstream/main (a missing clang++ or SPIR-V headers). Assisted-by: Claude Opus 5 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The renderer hands FSR tonemapped, square-root encoded colour (LDR), a standard D32 depth and render-pixel motion, so build the passes that way (HDR input off, inverted depth off) instead of converting the inputs. Regenerate the eleven headers, make --check ignore glslang's version comment (same SPIR-V) and pin the options in tests/test_fsr3_shaders.py. The note in third_party/fidelityfx-sdk no longer points at docs/upscaling.md, which this series does not bring in. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hckrman101
left a comment
There was a problem hiding this comment.
Looked at this as the vendoring + tooling PR it is. Provenance is good: pinned to FidelityFX SDK v1.1.4 / c6efa6bf, AMD's MIT notice is in LICENSE.txt, and PROVENANCE.md says what is and isn't included. The compile script is only run by hand and by the test (--check), never at normal build time, and the headers follow what main already does for its _spv.h shaders, so a clone still builds without glslang. Nothing includes the new headers, so the game doesn't change. Repo size is fine (about 15k lines of AMD GLSL plus about 14k of generated headers, around 30k lines in all).
Nothing blocking. Notes:
- No CI has run on this head (the workflows are sitting in
action_required), sotests/test_fsr3_shaders.pyhasn't been exercised on the runner yet. It needs a run before merge. On #1313 the same approach passes on ubuntu-24.04 withglslang-toolsfrom apt. - glslang isn't pinned.
comparable()drops glslang's version comment, but the SPIR-V itself can still change between glslang releases, which would show up as a source mismatch. It works today with the apt version, but a note inPROVENANCE.mdor the script docstring saying which glslang the headers were generated with would help the next person to regenerate them. - Nit:
header.read_text()/made.read_text()have noencoding=. It's ASCII so it's harmless, but it would be consistent withcheck_options(), which passes it. - Nit:
PROVENANCE.mddoesn't say where in the upstream tree the GLSL passes come from (sdk/src/backends/vk/shaders/...). #1313 records that. - Nit:
check_options()in the test greps the script source for quoted-D...strings. It works, but it breaks if the option list is ever built differently.
Overlap with #1313: that PR vendors the same SDK commit into the same third_party/fidelityfx-sdk/ and the same gpu/vk/shaders/fsr3_*_comp_spv.h names, so the two can't both land. It is the larger one (+49k, 28 headers) because it adds frame interpolation and optical flow, which nothing uses yet. It also compiles with HDR colour and inverted depth, where this PR compiles for LDR colour and standard depth, so the two disagree on the contract with the renderer. Whichever one merges, the option set has to be checked against what #1008 actually feeds FSR. I'd go with this smaller PR, since it matches the split that was asked for and #1096 / #1097 build on it, and frame interpolation can come as its own PR once something uses it. #1335 (the combined version) also overlaps. That's the maintainers' call, but one of them should be closed so the history isn't duplicated.
Part 1 of 3 of the split asked for on #871 and #822: the vendored SDK and the shader compile script on their own.
Nothing in the game uses these files yet. No source on
mainincludes the new headers, so the built game does not change.What changed
third_party/fidelityfx-sdk/: AMD's FSR 3.1 GPU sources from FidelityFX SDK v1.1.4 (c6efa6b), unmodified, MIT, withPROVENANCE.md.scripts/fsr3_shaders.py: compiles the passes with glslang.gpu/vk/shaders/fsr3_*_comp_spv.h: the eleven compiled variants.tests/test_fsr3_shaders.py: recompiles them all, compares with the checked-in headers, validates each withspirv-valand pins the build options. Wired intotests/run_all.pyandsource-regressions.yml.Why the compiled headers are checked in
CONTRIBUTING asks not to include generated files. These follow what
mainalready does for its 12_spv.hshaders, so a clone still builds without glslang, and the test fails if they drift from their sources. Generating them at build time instead would add glslang as a build dependency: your call.Size
47 files, +29,388/-1. 184 lines are hand-written (script, test, wiring). The rest is AMD's sources with the provenance note (15,285) and the compiled headers (13,919).
Authorship
The first commit is notquiteog's, from #822, limited to these paths. The second builds the passes for the inputs the renderer gives FSR on #1008 (tonemapped LDR colour, standard depth), and pins those options in the test.
How it was tested
python -I -B tests/test_fsr3_shaders.py, with glslang andspirv-valtests/run_all.py fsrNothing here is reachable from the game, so there was no game run.
Parts 2 and 3 (the FSR 3.1 engine and its menu row) need #1008.
🤖 Generated with Claude Code