Commit Graph
53 Commits
Author SHA1 Message Date
Valiantsin DzerakhandClaude Opus 5.5 22794ab332 Merge task/fg into task/fsr31: frame generation's per-object motion vectors and its contexts kept across dynamic resolution, on one motion gate with FSR 3.1
vk_objmv_wanted is FSR 3.1's latched upscaler half (DLSS with NGX up, or FSR 3.1 picked at start) or frame generation following the scene with its objects (vk_fg_objects_on), and vk_mvprev_frame turns the tables on for the running upscaler or for frame generation. vk_usnap.c keeps this branch's host regions: a region's host flag says whether this submission wrote its host copy, which covers frame generation going on and off live without fg's separate U.host pointer. The jitter fix in mv_pass stays a single copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:15:40 +03:00
Valiantsin DzerakhandClaude Opus 5.5 49e8e92fe9 Merge dev into task/fg: the jitter fix for the per-object motion vectors (#1126) and the setup window work
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:12:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9c0dc49dc5 On 1.4.3 the per-object motion vectors no longer carry the camera jitter: the motion draws run with the jittered scene camera again, so DLSS stops moving the history of characters by up to a pixel each frame (shaking, softness) (#1126)
Since the jitter went into the game's camera (#1284), cam_unjitter writes the scene camera's snapshot back without it from the scene's end, before the DLSS point where vk_mvobj_execute redraws the moving objects through that snapshot. The draws rasterised unjittered and their fragment shader took the jitter off a second time. TOTK_MV_CHECK on a still Link (FSR 3.1 path, task/fsr31) measured the object part equal to the frame's jitter in every check; with the jittered rows written back around the motion draws and taken off after them, object pixels on a still Link fell from 1.2-2.1 % to about 0, and the object vectors beat the camera's (median end-point error 0.68 px against 0.88, before 0.93 against 0.82).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 19:22:38 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8dc1fe1bf4 On 1.4.3 the per-object motion vectors no longer carry the camera jitter: the motion draws run with the jittered scene camera again, so DLSS stops moving the history of characters by up to a pixel each frame (shaking, softness) (#1126)
Since the jitter went into the game's camera (#1284), cam_unjitter writes the scene camera's snapshot back without it from the scene's end, before the DLSS point where vk_mvobj_execute redraws the moving objects through that snapshot. The draws rasterised unjittered and their fragment shader took the jitter off a second time. TOTK_MV_CHECK on a still Link (FSR 3.1 path, task/fsr31) measured the object part equal to the frame's jitter in every check; with the jittered rows written back around the motion draws and taken off after them, object pixels on a still Link fell from 1.2-2.1 % to about 0, and the object vectors beat the camera's (median end-point error 0.68 px against 0.88, before 0.93 against 0.82).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 19:22:11 +03:00
Valiantsin DzerakhandClaude Opus 5.5 28f3fcc8d5 With FSR 3.1 upscaling, the scene's material textures take AMD's mip bias, log2(scene / output) - 1 (-1.58 at quality, -1 in place), where DLSS keeps NVIDIA's log2(scene / output); the bias follows the mode and the upscaler going on or off. Field still view at quality, 1080p, mean absolute Laplacian of luma on the far cliff: 2.31 -> 2.82 against 4.09 with FSR off; grass near Link unchanged (5.53 -> 5.56, its blades are flat-coloured geometry). FSR's auto exposure was tried with it and left out: grass softer (5.53 -> 4.96) with no visible gain.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:21:02 +03:00
fef31d9f7c FSR 3.1 sharpens its own picture at a new setting, fsr_sharpness (default 80, 0 off, live, a slider under the upscaler on the menu), as the game's sharpening sits in the FXAA draw FSR replaces; while FSR 3.1 runs the game's dynamic resolution stays at 100 %, and in place it skips the game's FXAA and its copy of the scene onto itself. The fix follows codexx-dev's pull request #1245. Town still view, 1080p, mean absolute Laplacian of luma: quality 5.2 -> 7.9 against 9.4 with FSR off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: codexx-dev <221918751+codexx-dev@users.noreply.github.com>
2026-11-20 16:10:46 +03:00
14ccef9a80 AMD FSR 3.1 upscales the 3D scene on the FidelityFX SDK 1.1.4 sources behind scene_upscaler = fsr3, off by default
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>
2026-11-20 14:39:57 +03:00
Valiantsin DzerakhandClaude Opus 5.5 380e6ff30e Frame generation gets the per-object motion vectors DLSS uses, so Link running no longer shows a soft second outline and a trail in the generated pictures
The motion image FG read held the camera's motion alone (fg_motion called mv_pass without its object pass). The camera
follows Link, so his pixels carried the world's motion and the interpolation drew him twice, with a smeared strip where
he had been; NPCs and enemies did the same. fg_motion now runs mv_pass with the object pass (vk_mvobj_execute), and its
gates follow vk_objmv_wanted: DLSS once NGX came up (vk_dlaa_available, as before) or FG following the scene with its
objects (vk_fg_objects_on). vk_mvprev_frame keeps last frame's block tables for either, vk_usnap_begin makes the host
copy for either and vk_usnap_bytes reads the copy that submission wrote (FG turns on and off live), and
vk_dlaa_prev_camera answers whenever the scene is followed. FG is off with DLSS, so every DLSS gate evaluates as before.
fg_objects = 0 keeps the camera's motion alone for comparisons.

Measured on A (RX 9070, 7900X on 4 cores, 1080p, field, 60 s): 85.6 drawn with fg_objects = 0, 80.0 with 1 (about
0.8 ms a drawn frame on the replay thread, half of it the snapshot's host copy), object pass 0.035 ms GPU. Still grass
gets no false motion (SDK debug view: the game vector field stays within 0.2 px), and grass does not break up while the
camera turns. Validation: 0 errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:30:51 +03:00
1ea8838da9 Frame generation inputs and dispatch with DLSS off: the replay follows the scene for it, records the camera motion vectors and the SDK's prepare at the scene's end, copies the picture before the HUD sRGB-encoded as the window texture holds it, and runs the optical flow and the interpolation after the frame's window texture, nothing shown yet
vk_dlaa.c follows the scene while frame_gen is live and DLSS is off (track: the arming and end of the DLSS path, without jitter, reactive mask or per-object motion), fg_motion runs mv_pass on the camera alone and vk_fg_prepare, vk_dlaa_hud takes the picture before the HUD by PR #1089's rule once the bloom chain began, vk_dlaa_sub_end runs the interpolation at the end of the submission that drew the window texture. vk_fg.cpp reads the camera's planes and depth convention from the scene block's projection (standard depth, near 0.1 m, far 25 km in TotK 1.4.3), makes the contexts again when sizes or the convention change, resets the history on a cut (10 m or 35 degrees, as Savage Wind), a frame without camera motion and after any frame without a generated picture, and stays off with DLSS, replay workers, sync_ahead, HDR and while a menu background or a fade is open. fg_test, fg_debug, fg_shot and fg_times are the checks; GPU timestamps and the replay thread's recording time go to the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Revivedx <82332536+Revivedx@users.noreply.github.com>
Co-Authored-By: xellow78-lgtm <336264245+xellow78-lgtm@users.noreply.github.com>
2026-11-20 10:09:58 +03:00
itaskaev2andClaude Opus 5.5 715070e267 The DLSS scaling draw is found again after translator patch 0017 (#1291)
Patch 0017 adds two support buffer fields, which every translated shader declares, so the SPIR-V hash of the game's FXAA shader changed (0x5c43ae18948d52cb to 0xde20aef90fea4ce6, with zero_locals 0xaad42238801d31d8 to 0x755964e8dce7f34d). vk_dlaa_skip_draw then no longer skipped the scaling draw DLSS replaces, and on 1.4.3 that draw, sampling DLSS's output-sized picture in place of the scene, stretched the picture's top left over the whole screen in every DLSS mode but dlaa. FXAA_FS gets the two new hashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 13:42:45 +01:00
Valiantsin Dzerakh 792d5398ab Merge branch 'pr1276-head' into task/pr1276
# Conflicts:
#	docs/agents/symptoms.md
#	runtime/cfg.c
2026-11-18 18:46:16 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c145f2bd5d The camera jitter checks where each copy puts its matrix in the block: f_70000e31d4 takes the offsets from the shader's layout (x8), so only a projection at 0x70 and a view-projection at 0x30 take the offset, a projection whose view-projection lies elsewhere gets its centre terms back, and a block counts as given only once both matrices carry it (#1126)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:29:28 +03:00
ipavlin98 04146289ac The camera jitter's read-back takes a block's centre terms as an offset only when this code gave that block that offset: the inventory's camera has an off-centre projection of its own, which read as a jitter of 1152 pixels, so DLSS smeared the world behind the inventory into horizontal streaks 2026-11-18 10:42:23 +03:00
ipavlin98 d5d62ab406 The camera jitter is described as dlaa_cam_jitter, and the game's matrix copies skip it at once while DLSS is not running 2026-11-18 09:01:16 +03:00
ipavlin98 0eab458030 Symptoms: water at a low angle flickering with DLAA from the viewport jitter the game's camera did not share; cfg knows DLAA_CAM_JITTER 2026-11-18 08:50:22 +03:00
ipavlin98 b5936a6aa9 The camera jitter moves on with the game's presents instead of at a camera block written again: the game fills two sets of blocks in turn, so each phase went to two frames, and each view-projection takes the offset its own block's projection took 2026-11-18 08:36:50 +03:00
ipavlin98 121b4fdf33 On 1.4.3 DLAA's jitter goes into the game's camera instead of the viewport: the projection's centre terms and the view-projection of each perspective camera with the scene's aspect take the offset where the game copies them into their uniform blocks, so the game's full-screen passes rebuild positions with the camera the scene was drawn with, and screen-space reflections on water seen at a low angle no longer flip between hit and miss with the jitter's phase 2026-11-18 08:13:26 +03:00
ipavlin98 efb896235a DLSS without auto exposure is a setting, dlss_fixed_exposure, next to the other DLSS settings, off by default: 0 creates DLSS with AutoExposure as before, 1 without it, and a change recreates the features at once 2026-11-18 00:58:32 +03:00
ipavlin98 fd08b5cee3 DLSS is created without auto exposure, so large distant blocks behind the fog in the Depths no longer turn darker or lighter for a frame while the camera moves 2026-11-18 00:21:25 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c76a38852e The DLAA effects switch sits with the other DLSS settings and is read only while DLSS runs
dlaa_effects_after moves to the Screen tab under the DLSS rows, to [display] in totk.ini and totk.ini.example next
to dlss_char_mask, and vk_dlaa_frame reads it after the dl_active check, so a game without DLSS does no new work
per frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:05:44 +03:00
ipavlin98 40c0071dd2 With DLAA, DLSS runs before the fog and the particles, which are drawn over its picture without jitter, so the dust in shrine fog no longer vanishes
DLSS ran at the bloom, after the volumetric fog composite and the particle pass. Neither has motion vectors or jitter
of its own, and DLSS wiped out the smallest motes. In DLAA mode DLSS now runs right after the deferred lighting: the
light target is the G-buffer's scene colour target, the lighting is the first pass into it after the G-buffer, with
a D16 depth, and the first pass into it with any other depth (the scene's, none, or the D16 of an ability's highlight)
is an effect. The order of the effects changes from frame to frame (the yard's half-size effects pass is in some
frames only; with Ultrahand or Ascend open the highlight comes before or after the fog layer), and rules that waited
for one of them, or took any D16 pass for the lighting, flickered. As a safety net the point is used only after it
held for 60 frames with nothing of the scene drawn after it; otherwise DLSS stays at the bloom.

dlaa_effects_after (Advanced tab, Render fixes, default 1, live) turns it off. The upscaling DLSS modes are unchanged.
2026-11-17 09:41:08 +03:00
Valiantsin DzerakhandClaude Opus 5.5 06088863bc Merge pull request #1163 into task/prfix: DLSS arms only on a light target more than half the scene size, so the frame no longer goes dark when the quick weapon menu closes (ipavlin98)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 08:34:52 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b8800bac86 Merge pull request #1162 into task/prfix: DLSS arms only on a light target of the scene's shape, so the inventory icon no longer stretches over the menu (ipavlin98)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 08:34:51 +03:00
ipavlin98 c18f3d6c5c End the DLAA scene only at a bloom pass of the scene's shape without depth, so the sky lookups and the quarter-size particles that follow transparents drawn early no longer end it before the mist, which DLSS then missed on runs of frames and the distant mist flashed between them 2026-11-14 05:37:10 +03:00
ipavlin98 a02413d2f6 Keep DLSS on frames where the game draws a half-size mip chain of the scene before the light target: the bloom chain's start now needs level 0, as the chain's level 1 ended the scene before anything was armed, DLAA skipped those frames and the picture flickered between anti-aliased and plain ones 2026-11-14 05:37:10 +03:00
ipavlin98 1a3b2936d6 Arm DLSS only on a light target more than half the scene's size, so the half-size effects target that armed on frames around the quick weapon menu, where the half-size G-buffer came first, is no longer scaled to the output in place of the scene 2026-11-13 08:46:42 +03:00
ipavlin98 6ef1eafca7 Arm DLSS only on a light target of the scene's shape, so the square targets the inventory renders item icons into are no longer scaled to the output and drawn over the menu 2026-11-13 08:46:41 +03:00
Valiantsin Dzerakh 346f22bbd4 Merge pull request #1112 into task/pr1112 2026-11-11 14:41:21 +03:00
itaskaev2andClaude Opus 5.5 be5f4db3bf Skip 1.2.1's own scaling draw after DLSS instead of feeding it DLSS's picture (#1106)
On 1.2.1 the light target is scaled to the output by an upscaler of the game's own (twelve texelFetch taps,
fragment shader e6f7ae35b8479ef3), not by the FXAA draw vk_dlaa_skip_draw knows. It addresses its source in the
scene's pixels, so DLSS's output-sized picture swapped in for the light target (tex_info) showed only its top-left
part, two thirds at DLSS quality, stretched over the screen: the "floating camera" of #1106. #660 (169d057) made the
swap reach that draw: before it, DLSS ran on another target and its picture never reached the screen on 1.2.1.

DLSS already writes its picture into the scaling pass's target, so on 1.2.1 a draw in a pass larger than the light
target, without depth, that samples the light target is now skipped (vk_exec_draw_samples). The HUD drawn later into
the same target samples other textures and stays. 1.4.3 keeps the swap, where a tonemap can be the scaling draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 11:53:25 +01:00
toadjiangandClaude Opus 5.5 5e6ebd8bbc Free all DLSS size slots when the preset changes
evaluate's preset_dirty loop stopped at slot 3 of the five D.sizes entries, so a preset change left the features in
slots 3 and 4 created with the old model: they kept running until the slot was evicted. The loop now covers the whole
array through DLSS_SIZES instead of a literal.

Taken from pull request #1057 (t04dJ14n9) alone; the PR's dlss_prewarm commits are not in this change.

(cherry picked from commit a76bdf5e08)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 23:02:05 +03:00
Valiantsin DzerakhandClaude Opus 5.5 169d057add Merge pull request #660: keep DLSS off the inventory screen (mictony6)
Ported onto vk_dlaa_plan (#794): the scene end in the inventory also records its submission and op (end_fence,
end_pos) so chunked replays see it at the same point. DLSS-only: everything sits behind dl_active().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:50:18 +03:00
ipavlin98 fd4427cb17 Run DLSS on the chunked replay
DLSS kept the replay on one thread: its decisions follow the passes in replay order, its jitter and camera are noted
draw by draw, and its evaluation reads the per-object motion list the scene's draws build. Now the scan takes DLSS's
decisions on its own state (vk_dlaa_plan, split out of vk_dlaa_pass) and notes the scene camera in replay order
(vk_dlaa_scan_draw), and the copy of the lit scene and the evaluation are records of the chunk that holds the op
(vk_dlaa_exec). A chunk's draws are jittered while they come before the op the scan ended the scene at. The
evaluation waits until the chunks before it are recorded, and the chunks after it wait for it (a hold), since they
sample its output. Chunks note their draws for the per-object motion one at a time (mo_lock in vk_exec_draw.c); the
uniform overrides of a motion draw and shader_for's last-frame variant flag are per thread, as the other chunks' draws
go on meanwhile; the FXAA shader table takes concurrent lookups. fxaa = 0 runs in chunks too.

With dlaa = 1 at 4K (DLSS Quality) on 1.2.1 and an RTX 5070, replay_workers = 4 takes the frame rate from 70 to 78
fps where the CPU is the limit, with no one-frame glitch in 241 consecutive frames.

(cherry picked from commit 04f8bb1b57)
2026-11-08 19:39:18 +03:00
ipavlin98 6b4d84ec50 Record large submissions in chunks on several threads
replay_workers = N (0, the default, keeps the sequential replay) records a submission of enough draws in chunks that start between passes, on N threads and in twice as many chunks, and submits them in order. In the town at 4K on an RTX 5070, 4 threads take the replay from 8.2 to 4.5 ms a frame and the frame rate from 71 to 79.

A sequential scan on the submitting thread applies only what is queue state (fixed-function and bind ops, render targets, render enable and conditions, samples-passed counting) and keeps a copy of it where each chunk starts, with how far its lists got: inline uniform updates, RENDER_COND results, contact shadow marches and the ops that drop uniform copies. A chunk takes those from the lists instead of from the chunks before it, starts with every image in GENERAL and ends with a full barrier, so its recording depends only on the copy and the lists.

Each thread records with a context of its own: the replay's memos, descriptor state, occlusion query segments and per-command-buffer state moved from file statics into VkExec and VkExecDraw, and the tables the contexts share (stand-ins, depth twins, views, mirrors, timestamps, completion callbacks, crumbs) take locks or atomics. The scan makes render targets live in replay order and notes the op (vk_texture_revive), since a chunk can sample a storage before the chunk that renders it got there or after the scan went past a later target there: a chunk's texture slots resolve as of its own op, and the chunks after a texture with no entry yet wait for the chunk that makes it. Uniform copies are dropped at the op that writes them (vk_usnap_drop_at).

Contact shadows plan their march in replay order (vk_contact_plan) and the chunk that holds its op records it; the HDR source keeps the copy that comes last in replay order. DLSS and fxaa = 0 act on the frame draw by draw and keep the replay sequential. TOTK_REPLAY_STATE_CHECK=1 compares the state after the last chunk with the scan's.

A draw or dispatch whose shaders write storage buffers drops the uniform copies they cover from its own op on, as the other GPU writes do (scan_writes). The scan still translates no shader: it reads the shaders the recording contexts translated from a table shared with them (vk_exec_draw_writes), and an op whose shader no context translated yet holds the chunks after it until it is recorded. Before, the chunk that recorded such a write dropped the copies for every position at that moment, so a later chunk recorded first bound the copy taken at the submit call: on an RX 7800 XT on RADV the grass near the camera came out dark or unshaded in some runs with 4 threads.

TOTK_TRACE=perf counts the chunks held per submission by reason and logs when each chunk of the last submission began. The settings menu has the thread count under Advanced, Scheduling, with the count this run uses under it.

The recorder thread begins, ends and submits the submission's open part (vk_rec.c rec_end_cb), so a chunk's mirror prologue stays off it: vk_sync_part waits until the recorder is idle, as the part pool allows one thread at a time, then records, ends and submits the prologue itself. Through the recorder the prologue could reach the queue before it was ended, and the GPU lost the device at the title screen.

(cherry picked from commit b94e2e9642)
2026-11-08 19:39:17 +03:00
itaskaev2andClaude Opus 5.5 cc4df7d140 Load the NGX core through the platform layer, so vk_dlaa.c has no Win32 calls
tools/check_platform.py failed on vk_dlaa.c: it read the NGX core's folder from the registry, loaded it with LoadLibraryA and GetProcAddress and named the executable's folder with GetModuleFileNameW. platform.h gets plat_ngx_core_path (the registry folder plus _nvngx.dll on Windows, libnvidia-ngx.so.1 on Linux), plat_exe_dir_wide (the folder as NGX's wchar_t string; the UTF-8 to UTF-32 conversion moves from vk_dlaa.c to linux.c) and plat_lib_error, and the core loads through plat_lib_open and plat_lib_sym on both hosts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 19:18:21 +01:00
Valiantsin DzerakhandClaude Opus 5.5 9dd50131ca Start function-local variables at 0 on Mesa drivers only
SPIR-V leaves a register read before any write undefined and Mesa folds undefined values freely. The unconditional patch 0014 guarded against that and was taken out in #701 because the whole picture shook with DLSS on NVIDIA. Patch 0016 brings the zero start back behind a zero_locals job flag, which vk_caps_driver turns on for RADV, ANV and NVK. TOTK_ZERO_LOCALS overrides it, and gfx_shader_set_host mixes it into the translator identity so the variant has its own cache keys.

FXAA_FS gains the flag-on hash of the game's FXAA shader, so vk_dlaa_skip_draw knows it on Mesa too. A game run with TOTK_ZERO_LOCALS=1 on an RX 9070 produced that hash; a TOTK_FXAA=0 run logged no skip with either hash, so the switch itself is not confirmed.

All 29736 stored 1.4.3 inputs translate with the flag off and on, 0 spirv-val failures. FXAA hashes to 5c43ae18948d52cb with the flag off and aad42238801d31d8 with it on. Flag-on output matches the old translator byte for byte on a sample of 312 shaders. Not run on a Mesa driver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:05:21 +03:00
Michael Anthony Bitoon cd32de5ff9 Keep DLSS off the inventory screen and on at every camera angle, with the scope or the camera rune open
The inventory's preview light target is drawn without depth before the bloom chain; a pass like that with nothing armed ends the scene once the bloom follows, so DLSS no longer runs on the finished menu picture. Arming on that target stays allowed, because at some camera angles the field's effects composite comes before the first pass with the scene depth. The G-buffer width is the widest of the frame, a small pass ends the scene only into a scene colour target, and no pair narrower than the widest G-buffer arms: with the scope open the half-size effects pass armed and DLSS scaled the effects into the light target.
2026-11-04 20:01:27 +08:00
Valiantsin DzerakhandClaude Opus 5.5 5024daf40d Merge pull request #534: DLSS / DLAA on Linux, a DLSS model choice, the real frame time and a character-trail mask (SchulzCode)
Merged on top of #566 and #594, by hand in vk_dlaa.c:
- One dlss_preset key: default keeps #594's model per mode (K for DLAA, Quality and Balanced, M for Performance, L
  for Ultra Performance); k, j or any other letter a..m takes that model in every mode, live, recreating the features
  as #534 does. The menu texts say so, with pt-BR and zh-Hans added.
- The mask pass stays on #594's camera motion (the identity and the CPU-made reprojection in dlaa_mv.comp's two
  blocks) and adds #534's outputs; it runs before the per-object pass. Where the reactive mask test
  (TOTK_DLSS_REACTIVE) ran, DLSS gets that mask instead of the characters'.
- #566 dropped the scaler_skipped/scaler_missed report, so #534's reset of it goes too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 19:46:27 +03:00
Valiantsin DzerakhandClaude Opus 5.5 80349df1a6 Merge pull request #594: per-object motion vectors for DLSS, Ultra Performance, live DLSS modes and per-mode presets (DizzyMan1337)
Merged on top of #566. The camera motion is #594's: its blocks in camb also feed the per-object pass, and
dlaa_mv.comp stays as on main, fed the identity and the reprojection made on the CPU in double. #566's
vk_usnap_host goes, vk_usnap_bytes serves the same. #566's scaling-draw swap, camera rune guard and output-size
scaling pass stay in vk_dlaa.c. Translator patch 0012 becomes 0015 after dev's 0012-0014.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 19:27:04 +03:00
DizzyMan1337andClaude Opus 5.5 ad3ecd8f3c Per-object motion vectors for DLSS, camera motion in double precision, Ultra Performance and DLSS presets.
Solid scene draws whose position reads an object's own uniform blocks (bones c5, place c7, c6) are drawn a second time
with a vertex shader variant (translator patch 0012) that computes last frame's position from last frame's blocks; the
game writes those into two copies that take turns, and the uniform snapshot keeps both (vk_mvprev.c). The draws are
listed during the replay and recorded through the recorder thread with repeated state skipped. Blocks whose last-frame
copies measured wrong (c9 and c11 of walls and cliffs) keep this frame's; positions without an object block (terrain,
grass) keep the camera's motion, which measured as good.

The camera motion is reprojected in double precision on the CPU: the float inverse made noise on far surfaces and a
still camera that DLSS followed into a wobble. DLSS gets Ultra Performance (a third of the output, also in the F1 menu)
and NVIDIA's recommended preset per mode (K, M for Performance, L for Ultra Performance; TOTK_DLSS_PRESET overrides).

Test switches: TOTK_MV_CHECK measures the motion vectors and DLSS's output against the picture, TOTK_DLAA_TIMES times
DLSS and the motion passes on the GPU. A reactive mask pass for transparents is included but off (TOTK_DLSS_REACTIVE):
its mask covers sky and fog too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:31:58 +08:00
DizzyMan1337andClaude Opus 5.5 2950132ad8 DLAA: a jitter sequence as long as the upscaling ratio asks for
NVIDIA's DLSS guide asks for 8 x (output / scene)^2 jitter phases: 18 in Quality, 24 in Balanced, 32 in
Performance. The sequence was 16 phases in every mode; it keeps 16 as the least (DLAA).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:31:49 +08:00
DizzyMan1337andClaude Opus 5.5 f071264d61 DLSS modes switch while the game runs
1.4.3 sets its render size once, at start (main+0x7000e67028 calls
main+0x585bd0(renderer, force)). The function-entry hook catches that call's
renderer, and a TOTK_DLSS change writes the new scene size to the patch page and
has the next nvnQueuePresentTexture call the setup again with force set, on the
game's thread between frames, with the guest registers kept. The heap is sized
for the largest scene a mode asks for. The DLSS texture bias is part of the
sampler cache key and follows the mode and the dlaa switch. The game's scaling
pass is told from the in-place FXAA by its missing depth attachment, not by the
sizes, which change a frame ahead of the drawing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:31:49 +08:00
Michael Anthony BitoonandClaude Opus 5.5 27df2d85d9 Keep DLSS on the scene's light target when the camera rune draws a half-size pass after the lighting
The camera view draws a half-size RGBA16F target with a half-size D32F depth after the lighting (852x480 under a
1704x960 scene). It matched the light target pattern, so the DLAA point re-armed on it and DLSS scaled it into the
scene's own light target, which left every object black. An armed pair is no longer replaced by a smaller one, and
the scaling pass DLSS writes into must have the output size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 08:40:13 +08:00
Michael Anthony Bitoon 5b23d6671b Make DLSS's picture reach the screen and stop the whole image wobbling with DLSS and DLAA
With a DLSS mode the game's own scaling draw covered DLSS's picture with the jittered scene. At a 1280x720 scene and
1920x1080 output the scaling is done by the game's tonemap, not by the FXAA shader vk_dlaa_skip_draw looks for, so no
hash list could catch it. From DLSS's evaluation to the frame's end, passes larger than the light target now sample
DLSS's output in its place (vk_dlaa_swap_img, applied in vk_exec_draw.c tex_info), whichever shader scales.

The motion-vector shader inverted the view-projection in 32-bit floats. With a still camera (identical matrices each
frame) the rounding still gave a few hundredths of a pixel of motion that changed with every jitter step; DLSS
followed it and the whole picture wobbled. mv_pass now makes last frame's view-projection times the inverse of this
frame's in double precision from the uniform snapshot (vk_usnap_host), and the shader only applies it.

Measured on 1.4.3 indoors, still camera, mean per-pixel change between consecutive frames on static areas:
DLSS quality 0.18 -> 0.06, DLAA 0.14 -> 0.05. A camera pan at 10 px per frame shows no ghosting.
2026-11-03 08:40:13 +08:00
SchulzCode 1d49f64f34 Reduce DLSS trails behind moving characters with a bias mask
The motion vectors follow the camera only, so a character, animal or held item that moves on its own drags a faint
copy of itself through DLSS's history. TotK's G-buffer target 0 carries an object class in green: above 64/255 for
characters, creatures and held items (Link 253, others 125, held items 160), 0 for terrain and 32 for foliage, checked
in the field, in Goron City and on horseback. The motion-vector pass now also writes DLSS's bias mask
(DLSS.Input.Bias.Current.Color.Mask) where such an object is now or was the frame before, read through the motion
vector from the previous frame's class mask, so the history that holds the moving object is weighed down there.
dlss_char_mask (0, 35, 65 or 100 percent, default 65; F1 > Screen > "DLSS character trails", live) sets the strength.
A 640x360 pass of the G-buffer's shape, seen while loading, no longer replaces the scene's class buffer in a frame.
The status line also prints after 300 frames, with the frames that had the mask.
2026-11-02 19:21:56 +01:00
SchulzCode bd54e701a8 Choose the DLSS model and pass DLSS the real frame time
dlss_preset (default, k or j; F1 > Screen > "DLSS model", live) sets the render preset hints when a DLSS feature is
created. default leaves the choice to NGX (preset K for DLAA, Quality and Balanced in the 310 releases); j is the
transformer model NVIDIA describes as slightly less ghosting at the cost of more flicker. A change recreates the
features at the next DLAA run. FrameTimeDeltaInMsec now carries the time since the previous evaluation instead of a
fixed 16.67 ms. The menu and totk.ini.example name the DLSS model file of the platform in use.
2026-11-02 19:21:56 +01:00
SchulzCode 1e908362ea Load NGX on Linux for DLSS / DLAA
vk_dlaa.c reached the NGX core only through Windows: the registry, LoadLibraryA and GetModuleFileNameW. On Linux the
NVIDIA driver installs the core as libnvidia-ngx.so.1 with the same Vulkan entry points; it is opened with plat_lib_open.
The parameter object's vtable follows the Itanium C++ ABI there, each overload group in declaration order rather than
MSVC's reverse order, so the slot enum has a Linux variant; vtable_ok confirms it at start. NGX gets the executable's
folder as a 32-bit wchar_t string, converted from UTF-8 without the C locale, and loads libnvidia-ngx-dlss.so.<version>
from there. The Windows path is unchanged.

resolution.c sized the scene for a DLSS mode only on Windows, where it looks for nvngx_dlss.dll; on Linux it now looks
for libnvidia-ngx-dlss.so.<version> next to totk, so quality, balanced and performance work there too. The no-op
stubs vk_dlaa.c had for other platforms go, as Linux now builds the real code.
2026-11-02 19:21:56 +01:00
Valiantsin DzerakhandClaude Opus 5.5 3ee347b248 Size the scene by a DLSS mode only where DLSS can run, and log whether fxaa = 0 found the game's FXAA
The DLSS modes already apply only with dlaa on (3de0839), so the DLL check no longer looks at dlaa, and off Windows,
where vk_dlaa.c is no-op stubs, a DLSS mode no longer shrinks the scene. fxaa = 0 names the FXAA shader it skipped,
or reports a minute of frames without it, so a translator change that moves FXAA_FS shows on any GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:11:14 +03:00
itaskaev2andClaude Opus 5.5 9263989625 Skip the game's scaling draw over DLSS's picture again
With a DLSS mode (a scene smaller than the output) DLSS writes the scaled picture into the scaling pass's target and
vk_dlaa_skip_draw skips the game's own scaling draw, known by its fragment shader's SPIR-V hash. Translator patch
0011 (the shadow filter spread) changed that hash, so the draw ran again and covered DLSS's picture with the scaled
jittered scene: the whole picture shook by a fraction of a pixel each frame, most visible on lit flat surfaces in
shrines. The FXAA switch (fxaa = 0) stopped working for the same reason.

Add the hash of the current translator, and log once when DLSS scaled a frame whose scaling draw was not found, so
the next translator change that moves the hash shows in the log.

Measured on 1.4.3, Ukouh Shrine, output 3200x1800, dlss = quality, mean absolute change between consecutive frames
with a still camera: 1.40 before, 0.07 after (0.054 with dlaa = 0). Outdoors on stone: 4.29 before, 1.08 after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:04:07 +03:00
itaskaev2andClaude Opus 5.5 438aa41747 Keep the scene at render_scale when DLSS cannot run
A DLSS mode (quality, balanced, performance) shrank the scene to 67, 58 or 50 % of the output and sharpened the
material textures' mip bias to match, even when nvngx_dlss.dll was missing and NGX reported DLSS as not available.
The game's plain scaling then stretched the smaller scene, and the negative bias made textures shimmer in motion.

With dlaa = 1 the scene size now waits on nvngx_dlss.dll next to totk.exe (checked before the device exists, as
the size is decided then) and follows render_scale without it. The mip bias applies only when NGX came up with
DLSS. dlaa = 0 keeps the documented size with the game's scaling, without the bias.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:04:07 +03:00
Valiantsin DzerakhandClaude Opus 5.5 0b84f48df2 Build vk_dlaa.c off Windows as no-op stubs
It includes windows.h and loads NGX as a Windows DLL, and build_game.py leaves only *_win.* files out of the Linux
build, which then stopped at it. Elsewhere DLAA, the DLSS scaling and the FXAA switch now do nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 11:42:15 +03:00