mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 21:55:57 +00:00
dlaa_backend gains fsr3, which pins the newest FSR 3 the upscaler DLL offers (3.1.6 with the SDK 2.4 libraries) on any GPU it supports; fsr keeps taking the newest FSR 4, so existing totk.ini files keep their upscaler. The row now reads Off, NVIDIA DLSS, AMD FSR 4, AMD FSR 3 on Windows, with the texts in all four menu languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
2.3 KiB
C
37 lines
2.3 KiB
C
// AMD FSR upscaling (vk_ffx.c) for the DLAA path (vk_dlaa.c): with totk.ini dlaa = 1 and dlaa_backend = fsr, the
|
|
// scene that DLSS would get goes to AMD's FSR (FSR 4 where the GPU has it, FSR 3.1 elsewhere) through
|
|
// amd_fidelityfx_loader_vk.dll next to the executable. Windows only; elsewhere every call does nothing.
|
|
#pragma once
|
|
#include "vk.h"
|
|
|
|
int vk_ffx_wanted(void); // dlaa and dlaa_backend = fsr or fsr3 at start (the device may still lack FSR)
|
|
// vk_device.c, while it builds the device: the extensions FSR's shaders use (cooperative matrix, 8-bit floats) join
|
|
// the list when the device has them; their feature structures are chained there.
|
|
void vk_ffx_device_exts(const VkExtensionProperties *have, uint32_t nhave, const char **ext, uint32_t *n, uint32_t max);
|
|
void vk_ffx_init(void); // after the device exists: loads the loader and picks the upscaler version
|
|
int vk_ffx_available(void); // vk_ffx_init found an upscaler for this device
|
|
|
|
typedef struct { // one image FSR reads or writes, in VK_IMAGE_LAYOUT_GENERAL, level 0 and layer 0
|
|
VkImage image;
|
|
VkFormat format;
|
|
uint32_t width, height;
|
|
} VkFfxImage;
|
|
|
|
typedef struct {
|
|
VkFfxImage color, depth, mv, reactive, out; // reactive.image VK_NULL_HANDLE: none
|
|
float jx, jy; // this frame's jitter, render pixels (window x right, y down), as the scene was drawn
|
|
float dt_ms; // time since the previous dispatch
|
|
float cam_near, cam_far; // view-space distances of the depth range's ends
|
|
float fov_y; // vertical field of view, radians
|
|
float sharpness; // FSR's own sharpening pass (RCAS) on its output, 0..1; 0: none
|
|
int reset; // a new history
|
|
} VkFfxDispatch;
|
|
|
|
// A context for one render and output size (vk_dlaa.c keeps one per scene size like DLSS's features). depth_inverted:
|
|
// depth 1 is near; depth_infinite: the far plane is at infinity. NULL on failure (logged).
|
|
void *vk_ffx_create(uint32_t w, uint32_t h, uint32_t ow, uint32_t oh, int depth_inverted, int depth_infinite);
|
|
// Records the upscaling into cb. 0 on failure (logged). FSR binds pipelines and descriptors of its own.
|
|
int vk_ffx_dispatch(void *ctx, VkCommandBuffer cb, const VkFfxDispatch *d);
|
|
void vk_ffx_release(void *ctx);
|
|
const char *vk_ffx_version(void); // the upscaler version in use, for the log ("" before vk_ffx_init)
|