Add AMD FSR 4 upscaling as a second DLAA backend.

dlaa_backend = fsr hands the DLAA frame (scene light, depth, motion vectors, jitter and the characters' mask) to AMD's FSR through the FSR SDK 2.4 Vulkan loader, which picks FSR 4 where the GPU has it and FSR 3.1 elsewhere. The device enables cooperative matrix and 8-bit float support for it, the camera's near and far planes and field of view come from the scene camera block, and the setup gains an fsr step that downloads AMD's signed DLLs. DLAA also no longer arms on scenes narrower than a quarter of the output, which small loading renders did at ultrawide sizes.
This commit is contained in:
VictorSCosta committed 2026-11-06 18:35:09 -03:00
1 parent eda417fd1d
commit ba711b7f5a
25 files changed
+973 -39

No files matched your search

+8
View File
@@ -129,6 +129,14 @@ Every guest thread is a host thread. TotK assumes Horizon's scheduler: three app
that computes last frame's position from last frame's blocks (the game writes them into two copies that take turns;
the uniform snapshot keeps both) and writes the difference into the motion image. `TOTK_MV_CHECK` measures the
vectors against the picture, `TOTK_DLAA_TIMES` times the passes on the GPU. `fxaa` switches the game's own FXAA pass.
- FSR (`vk_ffx.c`, `dlaa_backend = fsr`, Windows). The same frame, jitter, motion vectors and masks go to AMD's FSR
instead of DLSS: `vk_dlaa.c` `evaluate` calls `vk_ffx_dispatch` where it would call NGX, and everything around it is
shared. `amd_fidelityfx_loader_vk.dll` (FSR SDK 2.4) is loaded at run time from the executable's folder and finds
`amd_fidelityfx_upscaler_vk.dll` next to it; only the descriptor layouts of `ffx_api_min.h` are compiled in. At
start the upscaler's versions for the device are listed and the newest FSR 4 is pinned where the DLL offers it (the
DLL decides which GPUs get it), else its default (FSR 3.1). `vk_device.c` enables `VK_KHR_cooperative_matrix` and
`VK_EXT_shader_float8` with their features when the device has them. FSR also asks for the camera's near and far
distances and field of view, which `cam_params` reads from the projection in the scene camera block.
- Occlusion queries never block the CPU; a result that is not ready counts as visible.
- ASTC textures are uploaded as they are where the device reports `textureCompressionASTC_LDR`, and decoded by a compute shader everywhere else (`vk_astc.c`, `TOTK_ASTC`). The CPU decoder (`tex_astc*.c`) is the fallback and the test oracle.
- Draw state. A draw whose program, bound state and textures repeat reuses the previous draw's shaders and skips rebuilding its descriptor sets; descriptor sets are written through update templates (`vk_exec_draw.c`, `vk_pipeline.c`).
+8 -1
View File
@@ -24,6 +24,7 @@ The install folder (`main.c` `portable_paths()` reads this layout; it stays port
<install folder>/
totk.exe, SDL3.dll, libopus-0.dll, totk_xlate.exe
nvngx_dlss.dll NVIDIA DLSS, downloaded by the setup's DLSS step when the player keeps it ticked
amd_fidelityfx_*_vk.dll AMD FSR (loader and upscaler), downloaded by the setup's FSR step likewise
totk.ini language; the other keys as commented defaults (totk.ini.example)
exefs/, romfs/ extracted from the player's files
shared-fonts/ the Switch system fonts, with Chinese, Korean or Traditional Chinese text
@@ -85,7 +86,13 @@ loads the saves 1.4.3 wrote.
the library; NGX loads it from the folder of totk.exe for `dlaa` and the DLSS modes. A DLSS library already in the
folder (a newer one the player put there) is kept. Without an RTX GPU the step only logs and does nothing; a failed
download warns, the game runs without DLSS, and the next run of the setup tries again.
8. **Clean up** the temp folder, except the generated C and the objects (about 1.3 GB), and write
8. **FSR** (the window's tick box, on by default, or `--fsr`; Windows with an AMD GPU): download
`amd_fidelityfx_loader_vk.dll` and `amd_fidelityfx_upscaler_vk.dll` from AMD's FSR SDK repository
(github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK, tag `v2.4.0`, `Kits/FidelityFX/signedbin/`, AMD FSR SDK
license) into the install folder and check their sizes and SHA-256 (`steps.py`, `Fsr`). Both go in only when both
downloaded and matched. `dlaa_backend = fsr` loads them from the folder of totk.exe. Libraries already in the folder
are kept; without an AMD GPU the step only logs; a failed download warns and the next run tries again.
9. **Clean up** the temp folder, except the generated C and the objects (about 1.3 GB), and write
`build-cache/rebuild.txt` in the install folder.
A cancelled or failed setup resumes from the last finished step (`totk-install.json`).
+2
View File
@@ -156,6 +156,8 @@ Many rows below are developer tools that only act together with another setting
| `dlaa_survey` (default `0`) | `1` logs what is drawn into the light target that DLSS reads. | Adds log output and per-draw work. | Caution |
| `dlaa_times` (default `0`) | `1` times the DLSS passes on the GPU. | Adds GPU timestamps and log lines. | Caution |
| `dlss_reactive` (default `0`) | `1` builds a reactive mask for DLSS where it ran. | Changes how DLSS blends moving areas; a test setting. | Caution |
| `fsr_debug` (default `0`) | `1` creates the FSR contexts (`dlaa_backend = fsr`) with AMD's API checks on, whose findings go to the log. | Adds log output and some CPU time per frame; a test setting. | Caution |
| `fsr_jitter_sign` (default `1`) | `-1` hands FSR the camera jitter with the opposite sign (`dlaa_backend = fsr`). | With the wrong sign FSR's picture wobbles and loses detail; a test setting for checking the convention. | Caution |
| `mv_check` | Frame interval; every that many DLSS frames copies the light target and motion images to host memory and logs how well the vectors explain the picture. | Costs a GPU-to-host copy and a comparison on the completion thread at each interval. | Caution |
| `mv_survey` (default `0`) | `1` notes the uniform blocks of each scene draw and compares them with those of earlier frames. | Adds per-draw work and log output. | Caution |
| `mvobj_all` (default `0`) | `1` also lists draws for object motion that read no object blocks (terrain and grass). | More draws are checked and listed, which costs time. | Caution |