Read the upscaler choice once in the DLAA evaluation, so a change from the present's thread cannot split it between FSR 3.1 and DLSS.

vk_dlaa_frame runs with the game's present and vk_dlaa_pass with the replay, which can be another thread. evaluate read
the choice three times; when the menu's change from FSR 3.1 to a DLSS mode landed between two of the reads, the rest of
the function took DLSS's path with NGX never brought up.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
tangerineturtle1
2026-11-09 20:59:48 -05:00
parent 47d9a2d502
commit 6dcb11f93c

View File

@@ -1399,8 +1399,11 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
struct Size *e = size_for(cb, w, h, ow, oh);
if (!e) return dl_fail("work image creation", 0);
if (e != D.last) D.reset = 1, D.why[0]++, e->chars_ok = 0; // another size's history is from another moment
if (!use_fsr() && !N.ngx_up) return; // neither runs this frame: vk_dlaa_frame turns DLAA off at the next present
if (!use_fsr() && !D.params && !NGX_OK(N.alloc_params(&D.params))) return dl_fail("parameter allocation", 0);
// Read once: vk_dlaa_frame runs on the present's thread and can clear fsr_frame while this replay is between the
// checks below, which would send the rest of this function to DLSS's path without NGX after all.
const int fsr = use_fsr();
if (!fsr && !N.ngx_up) return; // neither runs this frame: vk_dlaa_frame turns DLAA off at the next present
if (!fsr && !D.params && !NGX_OK(N.alloc_params(&D.params))) return dl_fail("parameter allocation", 0);
NgxParam *p = D.params;
VkImageView zv = vk_exec_target_view(z->img, z->format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_DEPTH_BIT, z->level,
z->base_layer, 1, 0);
@@ -1424,7 +1427,7 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
uint64_t c0 = timed ? kern_now_ns() : 0;
rec_drain(); // NGX records into the command buffer itself: the recorder thread must have made every call so far
if (timed) T.cpu_drain += kern_now_ns() - c0;
if (use_fsr()) { // FSR 3.1 (vk_ffx.cpp) in DLSS's place: the same images, then the same blit below
if (fsr) { // FSR 3.1 (vk_ffx.cpp) in DLSS's place: the same images, then the same blit below
if (t->level || t->base_layer || z->level || z->base_layer) return dl_fail("FSR 3.1 on a target that is not level 0, layer 0", 0);
if (D.last_color != t->image) target_changed(t);
uint64_t now = plat_now_ns();