mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 12:55:57 +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>
67 lines
4.8 KiB
C
67 lines
4.8 KiB
C
// DLAA (vk_dlaa.c): the scene upscaler, NVIDIA DLSS or AMD FSR 3.1 (vk_fsr3.cpp), behind scene_upscaler (dlaa = 1 without
|
|
// it: DLSS).
|
|
#pragma once
|
|
#include "vk.h"
|
|
|
|
// The narrowest scene the DLSS pass and the motion passes recognise by its D32F depth: Ultra Performance at a 1080p
|
|
// output renders 640 wide, smaller windows less.
|
|
#define DLAA_SCENE_MIN_W 320u
|
|
|
|
int vk_dlaa_wanted(void); // DLSS is the scene upscaler picked at start (the device may still lack it)
|
|
// vk_device.c: NGX's instance and device extensions join the lists (room for max names); vk_dlaa_init after the
|
|
// device exists brings NGX up and checks that DLSS is available.
|
|
void vk_dlaa_instance_exts(const char **ext, uint32_t *n, uint32_t max);
|
|
void vk_dlaa_device_exts(const VkExtensionProperties *have, uint32_t nhave, const char **ext, uint32_t *n, uint32_t max);
|
|
void vk_dlaa_init(void);
|
|
// 1 when dlaa is on and NGX came up with DLSS (after vk_dlaa_init): a DLSS mode's smaller scene is scaled up by DLSS.
|
|
int vk_dlaa_available(void);
|
|
// 1 when the per-object motion runs (after vk_dlaa_init): vk_dlaa_available, or FSR 3.1 picked as the scene upscaler.
|
|
int vk_objmv_wanted(void);
|
|
// vk_exec.c vk_exec_pass_begin, once the pass's targets are resolved and before its barrier: arms the frame on the
|
|
// scene's light target or, at the first quarter-width pass after it, runs DLAA on that target. Each present ends the
|
|
// frame (vk_dlaa_frame).
|
|
typedef struct VkExec VkExec;
|
|
typedef struct VkExecJob VkExecJob;
|
|
void vk_dlaa_pass(VkExec *ex);
|
|
// The same decision for a chunked replay's scan, in replay order: 1 with the record due before this pass (j), which
|
|
// vk_dlaa_exec makes on the chunk that holds the op (vk_exec.c run_job).
|
|
int vk_dlaa_plan(const VkExec *ex, VkExecJob *j);
|
|
void vk_dlaa_exec(VkExec *ex, const VkExecJob *j);
|
|
void vk_dlaa_frame(void);
|
|
// Frame generation without DLSS (vk_dlaa.c, "frame generation"), sequential replay: vk_dlaa_hud before each draw once
|
|
// its pass has begun (vk_exec_draw.c prepare_draw, while vk_dlaa_fg_on), vk_dlaa_sub_end at the end of each
|
|
// submission's replay with no pass open (vk_exec.c vk_exec_record).
|
|
extern int vk_dlaa_fg_on;
|
|
void vk_dlaa_hud(VkExec *ex);
|
|
void vk_dlaa_sub_end(VkExec *ex);
|
|
// vk_exec_draw.c, each draw before its fixed state is recorded: notes the scene camera block (vk_dlaa_draw), and moves
|
|
// the viewport of the scene's draws by the frame's jitter (vk_dlaa_viewport, when the viewport is recorded).
|
|
void vk_dlaa_draw(VkExec *ex);
|
|
void vk_dlaa_scan_draw(const VkExec *ex); // a chunked replay's scan, at each draw: the camera note of vk_dlaa_draw
|
|
void vk_dlaa_viewport(VkExec *ex, VkViewport *v);
|
|
// vk_mvsurvey.c (TOTK_MV_SURVEY): notes the uniform blocks of each scene draw, beside vk_dlaa_draw; each present
|
|
// compares them with the previous frames' and logs a summary now and then.
|
|
void vk_mvsurvey_draw(VkExec *ex);
|
|
void vk_mvsurvey_frame(void);
|
|
void vk_mvprev_draw(VkExec *ex); // vk_mvprev.c: notes the scene draw's object and bone blocks
|
|
// Per-object motion (vk_exec_draw.c): the moving scene draws are listed again during the replay with
|
|
// their vertex shader's last-frame variant; vk_dlaa.c mv_pass records them over the camera motion into ex->cb (and
|
|
// leaves every binding of the replay to be set again; draws whose camera block is not cam are left out).
|
|
// vk_dlaa_prev_camera: last frame's camera block and this frame's jitter, 0 when there is no history.
|
|
int vk_mvobj_execute(VkExec *ex, uint64_t cam, VkImageView mv, VkImageView depth, VkFormat depth_fmt, uint32_t w,
|
|
uint32_t h);
|
|
int vk_dlaa_prev_camera(VkDescriptorBufferInfo *out, float jitter[2]);
|
|
// nvn_api_core.c ov_memcpy, after a 64-byte copy on the game's thread: the camera jitter of 1.4.3 (vk_dlaa.c).
|
|
void vk_dlaa_camera_copied(uint64_t lr, uint64_t dst, uint64_t off);
|
|
void vk_dlaa_game_present(void); // vk_backend.c, each of the game's presents, on its thread
|
|
// vk_mvcheck.c (TOTK_MV_CHECK, test): mv_pass hands it the motion image after the camera pass and, after the object
|
|
// pass, the motion image again and the scene light target it ran on; it measures how well the vectors fit the picture.
|
|
void vk_mvcheck_camera(VkCommandBuffer cb, VkImage mv, uint32_t w, uint32_t h, float jx, float jy);
|
|
void vk_mvcheck_final(VkCommandBuffer cb, uint64_t fence, VkImage mv, VkImage cimg, VkFormat cfmt, uint32_t level,
|
|
uint32_t layer, uint32_t w, uint32_t h, float jx, float jy);
|
|
const char *vk_mvobj_frame_masks(void); // vk_exec_draw.c: the last motion list, per position and changed banks
|
|
void vk_mvcheck_output(VkCommandBuffer cb, VkImage out, uint32_t ow, uint32_t oh); // after DLSS on a check frame
|
|
// vk_exec_draw.c, once a draw's fragment shader is known: 1 skips the draw (the game's FXAA while TOTK_FXAA is 0, its
|
|
// scaling draw when DLSS wrote the scaled picture).
|
|
int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs);
|