Merge pull request #1245: AMD FSR 4 as a fourth scene upscaler, scene_upscaler = fsr4 (codexx-dev)

The PR's FSR 4 path (runtime/vk_ffx.c over AMD's FSR SDK 2.4 signed libraries, ffx_api_min.h, the cooperative
matrix and float8 device extensions in vk_device.c), its setup step that downloads amd_fidelityfx_loader_vk.dll and
amd_fidelityfx_upscaler_vk.dll, its notices and the FXAA copy shader hash 0x9d065204aac9766b now serve dev's own
scene upscaler as UPSCALER_FSR4. FSR 4 goes through vk_dlaa.c fsr_evaluate beside FSR 3.1: the same frame point,
jitter, motion vectors with the per-object pass, camera from vk_fg_camera, mip bias, fsr_sharpness, FXAA skip and
dynamic resolution hold.

Dropped from the PR: the dlaa_backend setting, FSR 3 through the DLL and the separate Upscalers row. vk_ffx.c pins
FSR 4 only; a device the libraries offer no FSR 4 for runs with the upscaler off and the menu says so. It keeps one
context per output size with dynamic resolution, like vk_fsr3.cpp, waits on the SDK's ring depth and is released
before the device goes. The menu's scene upscaler row gets "AMD FSR 4" (Windows; marked when the libraries or the
GPU are missing). The setup's FSR box and its strings are in all eleven installer catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-23 14:13:20 +03:00
commit be98dbc336
37 files changed
+1183 -133

No files matched your search

+24 -14
View File
@@ -616,22 +616,30 @@ static void row_hud_width(void) {
opt_choice_list("TOTK_HUD_WIDTH", UI_MENU_HUD_WIDTH, vals, names, n, UI_MENU_HUD_WIDTH_DESC);
}
// The 3D scene upscaler (vk_dlaa.c): off, NVIDIA DLSS or AMD FSR 3.1. An engine that cannot run here is left out of
// the steps, and the note under the value says why; a totk.ini that names it anyway shows it, with the same note.
// Returns the value the settings name ("off", "dlss", "fsr3"; without scene_upscaler, dlaa = 1 is "dlss").
// The 3D scene upscaler (vk_dlaa.c): off, NVIDIA DLSS, AMD FSR 3.1 or AMD FSR 4. An engine that cannot run here is
// left out of the steps, and the note under the value says why; a totk.ini that names it anyway shows it, with the
// same note. FSR 4 is Windows only (AMD ships no Linux libraries): elsewhere it is left out without a note.
// Returns the value the settings name ("off", "dlss", "fsr3", "fsr4"; without scene_upscaler, dlaa = 1 is "dlss").
static const char *row_scene_upscaler(void) {
static const char *const all[] = {"off", "dlss", "fsr3"};
static const int engines[] = {UPSCALER_OFF, UPSCALER_DLSS, UPSCALER_FSR3};
static const UiTextId ids[] = {UI_MENU_SCENE_UPSCALER_OFF, UI_MENU_SCENE_UPSCALER_DLSS, UI_MENU_SCENE_UPSCALER_FSR3};
enum { N = 4 };
static const char *const all[N] = {"off", "dlss", "fsr3", "fsr4"};
static const int engines[N] = {UPSCALER_OFF, UPSCALER_DLSS, UPSCALER_FSR3, UPSCALER_FSR4};
static const UiTextId ids[N] = {UI_MENU_SCENE_UPSCALER_OFF, UI_MENU_SCENE_UPSCALER_DLSS, UI_MENU_SCENE_UPSCALER_FSR3,
UI_MENU_SCENE_UPSCALER_FSR4};
const char *now = cfg_scene_upscaler();
const char *vals[3], *names[3];
const char *vals[N], *names[N];
static char note[256];
note[0] = 0;
int n = 0, cur = -1;
for (int i = 0; i < 3; i++) {
for (int i = 0; i < N; i++) {
int why = vk_upscaler_missing(engines[i]);
if (why) {
UiTextId t = why == UPSCALER_MISSING_DLL ? UI_MENU_SCENE_UPSCALER_NO_DLSS_DLL : UI_MENU_SCENE_UPSCALER_NO_DLSS_GPU;
if (why && (why != UPSCALER_MISSING_OS || !strcmp(now, all[i]))) {
UiTextId t = engines[i] == UPSCALER_FSR4
? (why == UPSCALER_MISSING_DLL ? UI_MENU_SCENE_UPSCALER_NO_FSR4_DLL
: why == UPSCALER_MISSING_OS ? UI_MENU_SCENE_UPSCALER_NO_FSR4_OS
: UI_MENU_SCENE_UPSCALER_NO_FSR4_GPU)
: why == UPSCALER_MISSING_DLL ? UI_MENU_SCENE_UPSCALER_NO_DLSS_DLL
: UI_MENU_SCENE_UPSCALER_NO_DLSS_GPU;
size_t k = strlen(note);
snprintf(note + k, sizeof note - k, "%s%s", k ? "; " : "", menu_text(t));
}
@@ -827,9 +835,9 @@ static void tab_screen(float scale) {
UI_MENU_DLSS_PERFORMANCE, UI_MENU_DLSS_ULTRA};
opt_choice("TOTK_DLSS", UI_MENU_DLSS, dlss, 5, UI_MENU_DLSS_DESC);
}
if (!strcmp(engine, "fsr3")) // FSR 3.1's own sharpening (vk_dlaa.c fsr_evaluate)
opt_slider("TOTK_FSR_SHARPNESS", UI_MENU_FSR3_SHARPNESS, 0, 100, UI_MENU_FSR3_SHARPNESS_DESC, 5, "%.0f %%");
if (!strcmp(engine, "dlss")) { // DLSS's model, its characters' mask and its other switches (FSR 3.1 has none)
if (!strcmp(engine, "fsr3") || !strcmp(engine, "fsr4")) // FSR's own sharpening (vk_dlaa.c fsr_evaluate)
opt_slider("TOTK_FSR_SHARPNESS", UI_MENU_FSR_SHARPNESS, 0, 100, UI_MENU_FSR_SHARPNESS_DESC, 5, "%.0f %%");
if (!strcmp(engine, "dlss")) { // DLSS's model, its characters' mask and its other switches (FSR has none)
static const UiTextId preset[] = {UI_MENU_DLSS_PRESET_DEFAULT, UI_MENU_DLSS_PRESET_K, UI_MENU_DLSS_PRESET_J};
opt_choice("TOTK_DLSS_PRESET", UI_MENU_DLSS_PRESET, preset, 3, UI_MENU_DLSS_PRESET_DESC);
static const UiTextId chars[] = {UI_MENU_DLSS_CHARS_OFF, UI_MENU_DLSS_CHARS_LIGHT, UI_MENU_DLSS_CHARS_MEDIUM,
@@ -1779,7 +1787,9 @@ static void perf_picture(const MenuTarget *t, const ImVec4 &c) {
: !strcmp(m, "ultra_performance") ? UI_MENU_DLSS_ULTRA
: UI_MENU_DLSS_DLAA;
snprintf(v[6], sizeof v[6], "%s, %s",
menu_text(up == UPSCALER_FSR3 ? UI_MENU_SCENE_UPSCALER_FSR3 : UI_MENU_SCENE_UPSCALER_DLSS),
menu_text(up == UPSCALER_FSR4 ? UI_MENU_SCENE_UPSCALER_FSR4
: up == UPSCALER_FSR3 ? UI_MENU_SCENE_UPSCALER_FSR3
: UI_MENU_SCENE_UPSCALER_DLSS),
menu_text(mt));
}
// with frame generation: the pictures shown a second, of which the FPS row above counts the ones the game drew