Merge task/pr1112: DLSS upscaling on 1.2.1 shows the whole picture, the game's own scaling draw is skipped after DLSS (#1112 by itaskaev2, #1106)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-11 14:42:34 +03:00
commit 0fef33ce30
3 files changed
+35

No files matched your search

+15
View File
@@ -1306,6 +1306,21 @@ int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs) {
}
if (fxaa && !D.up) return 0; // nothing to skip: no shader lookup per draw at the defaults
if (!fs) return 0;
// 1.2.1 scales the light target to the output with an upscaler of its own (12 texelFetch taps around the source
// pixel, fragment shader e6f7ae35b8479ef3 with this build's translator), not with the FXAA one, in a pass without
// depth. It addresses its source in the scene's pixels (constant bank 3), so DLSS's output-sized picture swapped in
// (tex_info) showed only its top-left part, the scene's share of the output (two thirds at DLSS quality), over
// the whole screen (#1106). DLSS already wrote its picture into that pass's target
// (evaluate), so on 1.2.1 a draw there that samples the light target is skipped instead; the HUD drawn later into
// the same target samples other textures and stays. On 1.4.3 a tonemap can be the draw that scales (the comment
// above struct D), and it keeps the swap.
if (D.up && !RT_V143 && !ex->depth.image && vk_dlaa_swap_img && ex->pass_w > vk_dlaa_swap_img->width + 1 &&
vk_exec_draw_samples(ex, fs, vk_dlaa_swap_img)) {
static int logged;
if (!logged) logged = 1, rt_log("dlaa: DLSS replaces the game's scaling draw (fragment shader %016llx)",
(unsigned long long)spirv_hash(fs));
return 1;
}
uint64_t h = spirv_hash(fs);
int known = 0;
for (size_t i = 0; i < sizeof FXAA_FS / sizeof FXAA_FS[0]; i++) known |= h == FXAA_FS[i];
+3
View File
@@ -195,6 +195,9 @@ void vk_exec_inline_end(int reopen);
// vk_exec_draw.c: forget what the command buffer being recorded has bound (pipeline, sets, dynamic state, vertex
// buffers): the replay continues in a new one (vk_sync_split).
void vk_exec_draw_new_cb(VkExec *ex);
// vk_exec_draw.c: the fragment stage of the draw being recorded samples img through one of its bound combined
// textures (OP_BIND_TEX, the handles tex_info swaps; vk_dlaa.c vk_dlaa_skip_draw). Takes the texture lock.
int vk_exec_draw_samples(VkExec *ex, const GfxShader *fs, const VkTexImage *img);
// The recording threads of the chunked replay as this run read TOTK_REPLAY_WORKERS (0 off), -1 before the first
// submission read it (the settings menu shows it).
int vk_exec_replay_workers(void);
+17
View File
@@ -1709,6 +1709,23 @@ static Twin *twin_update(VkExec *ex, const VkTexImage *img) {
return t;
}
int vk_exec_draw_samples(VkExec *ex, const GfxShader *fs, const VkTexImage *img) {
const GfxShaderRes *res;
int n = fs && img ? gfx_shader_resources(fs, GFX_RES_TEX, &res) : 0, hit = 0;
if (!n) return 0;
vk_texture_lock();
for (int i = 0; i < n && !hit; i++) {
if (res[i].separate || res[i].slot < 0) continue;
for (int k = 0; k < (res[i].count ? res[i].count : 1) && !hit; k++) {
int slot = res[i].slot + k;
uint64_t h = slot < 128 ? ex->tex[NVN_STAGE_FS][slot] : 0;
hit = h && vk_texture_by_id_locked((int)(h & 0xfffff), NULL, NULL) == img;
}
}
vk_texture_unlock();
return hit;
}
// The image descriptor of slot h; in a dispatch, a compare-sampled colour image the driver cannot compare is swapped
// for its depth twin; in a pass larger than it, the scene's light target, once DLSS scaled it this frame, for DLSS's
// output (vk_dlaa.c).