mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 21:05:56 +00:00
scene_upscaler (off | dlss | fsr3, read at start) replaces the dlaa toggle on the Screen tab; without the key dlaa = 1 still means DLSS, so nobody gets FSR 3.1 without picking it. The DLSS mode row is the upscaling mode of both engines, the DLSS model, characters' mask, fixed exposure and effects-after rows show only with DLSS, and the performance overlay names the upscaler that ran and its mode. resolution.c sizes the scene for the engine picked at start. runtime/vk_fsr3.cpp drives the SDK's upscaler context on its Vulkan backend directly, as Savage Wind's fsr3.cpp does: one context per output size with the output as its largest render size (the modes and the dynamic resolution need no new context), HDR input (the light target before the bloom, where DLSS reads it), render-size motion vectors with the per-object pass, the camera jitter, the camera's planes and field of view from the scene block (vk_fg_camera; a cut starts a new history), FSR's sharpening off. vk_dlaa.c calls it at the DLSS point after the recorder's drain; the NGX path is left as it was. The backend's per-frame rings hold four dispatches: a dispatch waits for the one three back should it still be in flight. Frame generation stays off while FSR 3.1 runs (logged once). The SDK subset gains the upscaler component, its shader headers, FSR 1's (its RCAS) and its GLSL, from Savage Wind's copy unchanged; tools/ffx_shaders.py --effects fu builds its blobs (HDR, 32- and 16-bit floats) into spirv/ffx_fsr3upscaler_vk.h, and vk_fg.cpp's blob lookup hands those out through vk_fsr3_blob. The luma history's storage image is declared rgba16f, its images' format (rgba8 in the SDK; the validation layer reported it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Revivedx <82332536+Revivedx@users.noreply.github.com>
84 lines
5.9 KiB
C
84 lines
5.9 KiB
C
// Settings: the TOTK_* environment variables, with totk.ini next to totk.exe behind them.
|
|
#pragma once
|
|
|
|
// getenv for a setting: the environment variable when set, else the totk.ini key (the name without "TOTK_", any
|
|
// case), else the device profile's default (cfg.c: the Steam Deck), else NULL. Same string semantics as getenv; the pointer stays valid for the process (a value cfg_set replaces
|
|
// is kept). A name without the TOTK_ prefix goes to getenv unchanged. Safe from any thread once cfg_init has returned.
|
|
const char *cfg_get(const char *name);
|
|
|
|
// Reads totk.ini once, from mem_init after the address space is claimed and before any setting is read. Logs the file, its key count, unknown keys and environment overrides.
|
|
void cfg_init(void);
|
|
|
|
// Replaces the loaded keys with those of the file at path (tests). 1 when the file was read, 0 when missing.
|
|
// Not thread-safe: nothing else may call cfg_get meanwhile.
|
|
int cfg_load(const char *path);
|
|
|
|
// Live settings (the in-game menu). cfg_set stores value as the totk.ini value of name (TOTK_ prefixed), marks it for
|
|
// cfg_save and bumps cfg_version. cfg_get returns it unless the environment sets name. Any thread.
|
|
void cfg_set(const char *name, const char *value);
|
|
// Bumped by every cfg_set. A consumer that keeps a parsed value compares this with the number it last saw (one atomic
|
|
// load) and parses again when it changed.
|
|
unsigned cfg_version(void);
|
|
// 1 when the environment sets name: cfg_set cannot change what cfg_get returns (the menu greys the setting out).
|
|
int cfg_from_env(const char *name);
|
|
// 1 when the player set name (the environment or totk.ini), 0 when cfg_get gives a device profile's default or NULL.
|
|
int cfg_is_set(const char *name);
|
|
// The folder size of w x h's shape (cfg.c SHAPED: the closest aspect ratio within 1%, the first of equal ones), the
|
|
// one romfs-patches-<w>x<h> the setup writes for it. 0 for 16:9 and for a shape without a UI layout.
|
|
int cfg_shape_size(unsigned w, unsigned h, unsigned out[2]);
|
|
// The size output_res defaults to on this display (its shape, cfg.c screen_default) while the player set no
|
|
// output_res, also when the default stays 1920x1080 because that shape lacks the prompts' folder. The generator the game
|
|
// starts for missing folders (romfs.c romfs_folders_prepare) makes them for this size, so after a prompts change the
|
|
// next start takes the display's shape again. 0 when the player set output_res, a device profile is in use or the
|
|
// display is 16:9.
|
|
int cfg_screen_size(unsigned out[2]);
|
|
// The device profile in use, "deck" or "desktop" (TOTK_DEVICE_PROFILE, else what the machine is).
|
|
const char *cfg_device_profile(void);
|
|
// Writes the keys cfg_set changed since the last save into totk.ini next to totk.exe (cfg_save_to: the file at path).
|
|
// Only those lines change: the last line of a changed key gets the new value, a missing key goes under its section
|
|
// (after the commented example line of the key when the section has one; the section is added at the end of the file
|
|
// when missing), comments and every other line stay byte for byte. 1 on success or with nothing to write.
|
|
int cfg_save(void);
|
|
int cfg_save_to(const char *path);
|
|
|
|
// Reset (the menu's "Reset all settings to defaults"). Removes the active line of each key (names without TOTK_, any
|
|
// case) from totk.ini at the next cfg_save and its value from memory, so the consumer's own default applies again; the
|
|
// commented example lines stay. Keys the environment sets are skipped. Bumps cfg_version. Returns how many it reset.
|
|
int cfg_reset(const char *const *keys, int n);
|
|
// 0 when the last cfg_save / cfg_save_to failed to write (the values stay set in memory, the next save tries again).
|
|
int cfg_last_save_ok(void);
|
|
// Every setting with a value, for a bug report ("Copy system info"): the totk.ini and cfg_set keys (name without
|
|
// TOTK_, upper case; from_env 0), then the known TOTK_ variables the environment sets (from_env 1).
|
|
void cfg_each_active(void (*cb)(const char *key, const char *value, int from_env, void *ctx), void *ctx);
|
|
|
|
// What the menu knows about a setting. key: without TOTK_, upper case. def: what the consumer uses when the key is
|
|
// unset ("" = no fixed default, the consumer picks per machine). values: "0|1", "mailbox|fifo|immediate", a range
|
|
// "0..300", or NULL for free text. live: applies at once; the others are read at start.
|
|
typedef struct { const char *key, *def, *values; int live; } CfgMeta;
|
|
// The row of key (prefix and case ignored); NULL for a key the menu does not show.
|
|
const CfgMeta *cfg_meta(const char *key);
|
|
// The i-th row (0-based, table order); NULL past the last.
|
|
const CfgMeta *cfg_meta_at(int i);
|
|
|
|
// The setting's value for consumers: the environment or totk.ini value, else the CfgMeta default. name has the TOTK_
|
|
// prefix, like cfg_get; a name without a row is a bug (rt_fatal). A row with an empty default has no fixed value: its
|
|
// consumer reads cfg_get and keeps its own "unset" branch. An empty value counts as unset.
|
|
const char *cfg_value(const char *name);
|
|
// cfg_value parsed. A set value that does not parse (int: whole string; double: strtod) gives the default's number.
|
|
// cfg_bool: "0" is false, anything else true.
|
|
int cfg_int(const char *name);
|
|
double cfg_double(const char *name);
|
|
int cfg_bool(const char *name);
|
|
// The 3D scene upscaler the settings name now: "off", "dlss" or "fsr3" (scene_upscaler; without it dlaa = 1 is "dlss").
|
|
// The engine in use is the one named at start (vk_dlaa.c vk_upscaler_engine).
|
|
const char *cfg_scene_upscaler(void);
|
|
// vk_dlaa.c, the 3D scene upscaler (scene_upscaler): the engine picked at start (UPSCALER_*),
|
|
// 1 while the settings still name it (the menu switches it off at once), the engine that is running (it
|
|
// ran and has not failed; 0 none), and why an engine cannot run here (UPSCALER_MISSING_*, 0 it can).
|
|
enum { UPSCALER_OFF, UPSCALER_DLSS, UPSCALER_FSR3 };
|
|
enum { UPSCALER_MISSING_GPU = 1, UPSCALER_MISSING_DLL };
|
|
int vk_upscaler_engine(void);
|
|
int vk_upscaler_on(void);
|
|
int vk_upscaler_running(void);
|
|
int vk_upscaler_missing(int engine);
|