Add the FSR 3.1 shader passes and the script that compiles them #1095

Closed
N3oTraX wants to merge 2 commits from fsr3/sdk into main
N3oTraX commented 2026-11-09 11:07:45 +00:00 (Migrated from github.com)

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 main includes 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, with PROVENANCE.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 with spirv-val and pins the build options. Wired into tests/run_all.py and source-regressions.yml.

Why the compiled headers are checked in

CONTRIBUTING asks not to include generated files. These follow what main already does for its 12 _spv.h shaders, 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

Check Result
python -I -B tests/test_fsr3_shaders.py, with glslang and spirv-val 11 modules match the headers and are valid
tests/run_all.py fsr 1 passed

Nothing 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

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 `main` includes 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, with `PROVENANCE.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 with `spirv-val` and pins the build options. Wired into `tests/run_all.py` and `source-regressions.yml`. ## Why the compiled headers are checked in CONTRIBUTING asks not to include generated files. These follow what `main` already does for its 12 `_spv.h` shaders, 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 | Check | Result | |---|---| | `python -I -B tests/test_fsr3_shaders.py`, with glslang and `spirv-val` | 11 modules match the headers and are valid | | `tests/run_all.py fsr` | 1 passed | Nothing 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](https://claude.com/claude-code)
hckrman101 (Migrated from github.com) reviewed 2026-11-09 23:24:04 +00:00
hckrman101 (Migrated from github.com) left a 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), so tests/test_fsr3_shaders.py hasn't been exercised on the runner yet. It needs a run before merge. On #1313 the same approach passes on ubuntu-24.04 with glslang-tools from 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 in PROVENANCE.md or 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 no encoding=. It's ASCII so it's harmless, but it would be consistent with check_options(), which passes it.
  • Nit: PROVENANCE.md doesn'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.

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`), so `tests/test_fsr3_shaders.py` hasn't been exercised on the runner yet. It needs a run before merge. On #1313 the same approach passes on ubuntu-24.04 with `glslang-tools` from 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 in `PROVENANCE.md` or 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 no `encoding=`. It's ASCII so it's harmless, but it would be consistent with `check_options()`, which passes it. - Nit: `PROVENANCE.md` doesn'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.
NotRexed commented 2026-11-10 02:07:43 +00:00 (Migrated from github.com)

Superseded by #1386 (FSR 3.1 upscaling and frame generation, with the same vendored FidelityFX SDK and shader script). Closing so FSR 3.1 is reviewed in one place. Thanks for the groundwork!

Superseded by #1386 (FSR 3.1 upscaling and frame generation, with the same vendored FidelityFX SDK and shader script). Closing so FSR 3.1 is reviewed in one place. Thanks for the groundwork!
Commenting is not possible because the repository is archived.
No description provided.