Skip to content

build(vk): vendor AMD's FSR 3.1 passes and the script that compiles them - #1313

Open
notquiteog wants to merge 1 commit into
NotRexed:mainfrom
notquiteog:pr/fsr-sdk-passes
Open

notquiteog wants to merge 1 commit into
NotRexed:mainfrom
notquiteog:pr/fsr-sdk-passes

Conversation

@notquiteog

Copy link
Copy Markdown
Contributor

What

The first part of #822, split out as requested there: only the vendored FidelityFX SDK sources and the script that compiles them. Nothing in the renderer uses them yet; the backend that records these passes, and the camera and frame-pacing changes, come later as separate PRs.

third_party/fidelityfx-sdk/ 76 files of AMD's GPU sources from FidelityFX SDK v1.1.4 (c6efa6bf): the common core, fsr3upscaler, frameinterpolation, opticalflow, spd, fsr1. Unmodified, MIT, with LICENSE.txt and a PROVENANCE.md saying what each folder is and where it came from
scripts/fsr3_shaders.py compiles the passes into gpu/vk/shaders/fsr3_*_spv.h with the one option set the renderer will record them under; --check compares instead of writing
gpu/vk/shaders/fsr3_*_spv.h the 28 compiled headers, checked in like every other shader there, so a clone builds without glslang
tests/test_fsr3_shaders.py recompiles every pass and fails if a checked-in header no longer matches its source. In run_all.py with a {glslang} tool, skipped on Windows (as the spirv-val checks are); source-regressions.yml installs glslang-tools for it

No runtime library is involved: this is the SDK-source route, which runs on any GPU on Windows and Linux, not AMD's FidelityFX API.

Testing

  • Every vendored file compared byte for byte with AMD's repository at c6efa6bf7f2027b3ec94f28578bb5965eabb9e55: 76 of 76 identical.
  • python -I tests/run_all.py tests/test_fsr3_shaders.py with glslang 16.2.0 and spirv-val: 28 match.

Size

49,075 added lines, almost all of it the two mechanical parts: AMD's GLSL (unmodified, checked above) and the generated SPIR-V headers (checked by the test). The reviewable code is scripts/fsr3_shaders.py, the test, and four lines of run_all.py and the workflow.

🤖 Generated with Claude Code

The first part of NotRexed#822, split out as asked: AMD's FidelityFX SDK GPU
sources for the FSR 3.1 upscaler, frame interpolation and optical flow, and
scripts/fsr3_shaders.py, which compiles them into gpu/vk/shaders like every
other shader there. Nothing in the renderer uses them yet; the backend that
records these passes is a later, separate PR.

- third_party/fidelityfx-sdk: 76 files from FidelityFX SDK v1.1.4 (commit
  c6efa6bf), unmodified, MIT, with PROVENANCE.md saying what each folder is.
- gpu/vk/shaders/fsr3_*_spv.h: the 28 compiled headers, checked in so a
  clone builds without glslang.
- tests/test_fsr3_shaders.py (in run_all, Linux only): recompiles every pass
  and fails if a checked-in header no longer matches its source;
  source-regressions installs glslang-tools for it.

Tested: every vendored file compared byte for byte with AMD's repository at
c6efa6bf (76 of 76 identical); tests/test_fsr3_shaders.py with glslang
16 and spirv-val: 28 match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@hckrman101 hckrman101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for splitting this out. Provenance looks right: AMD's MIT notice in LICENSE.txt, and PROVENANCE.md with the upstream URL, v1.1.4 and the commit. A few things before it can go in:

CI red, caused by the workflow change. Adding glslang-tools to the apt install in source-regressions.yml puts glslangValidator on PATH. tests/test_dlss_actor.py only compares the SPIR-V words of the checked-in DLSS headers when glslang is present, so on main that check is skipped. With the apt glslang the words differ, and it fails with "dlss_actor_frag_spv.h is not made from dlss_actor.frag as it is now". Options: install the glslang that made the existing headers, scope the package to the FSR3 step only, or make that test tolerant of version differences. tests/test_fsr3_shaders.py itself passes.

Needs a rebase. It's 82 commits behind main and conflicts in tests/run_all.py.

Option set. This compiles with HDR_COLOR_INPUT=1 and INVERTED_DEPTH=1. #1095 compiles the same passes with LDR colour and standard depth, and says that matches the renderer's inputs from #1008. One of the two is wrong for what the renderer feeds in, and nothing here pins or checks the options. Worth reconciling against the backend that will record these passes.

Reproducibility. glslang isn't pinned, and the version that made the headers isn't recorded in the script or PROVENANCE.md. Recording it would help the next regeneration.

Overlap. #1095 vendors the same SDK commit into the same third_party path with the same fsr3_*_comp_spv.h names, and #1335 ships this same header set too, so only one of the three can land. This one is the superset (it adds frame interpolation and optical flow, which nothing uses yet). It would be good to settle with the other authors which one carries the shaders.

Nits: PROVENANCE says "eleven frame-interpolation passes", but FI_VARIANTS has 10. Comments mention gpu/vk/vk_fsr3.cpp and vk_fsr3fi.cpp, which don't exist on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants