From 6a011d2adfd64a07821d7b4bbe222c4e1e931e05 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Wed, 11 Nov 2026 11:56:13 -0500 Subject: [PATCH] Blit the movie upscaler's stand-in into an image slot its program uses, so the Triforce movie after Gohma plays at 4K. The stand-in for the game's tensor-core upscalers wrote the largest image bound to the dispatch. Image slots keep their bindings from earlier dispatches, and with a 3840x2160 picture the scene upscaler leaves its 3840x2160 RGB9E5 target in slot 2, larger than the movie network's real 2560x1440 output in slot 1. The output kept stale bits for the whole movie, which showed as frozen coloured stripes (issue #520). The output is now looked for only among the image entries the program's NVN2 control section counts (at least slot 0). The binding log of NX2NAVI_LOG_CS_BINDS also prints those counts. Checked with Dm_Kokiri_0095 at game_res 2160 with DLAA (stripes before, the movie after), at 1440 with DLSS performance (unchanged), and in Goron City gameplay at 1440 (same picture, 164.9 against 159.8 fps). Co-Authored-By: Claude Opus 5.5 --- runtime/vk_exec_draw.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/runtime/vk_exec_draw.c b/runtime/vk_exec_draw.c index fa20d2c8..9322d8e8 100644 --- a/runtime/vk_exec_draw.c +++ b/runtime/vk_exec_draw.c @@ -5657,7 +5657,11 @@ static void log_cs_bindings_locked(const VkExec *ex) { if (ex->ubo[NVN_STAGE_CS][i].size) o += snprintf(line + o, sizeof line - o, " ubo%d=%#llx+%#x", i + 3, (unsigned long long)ex->ubo[NVN_STAGE_CS][i].addr, (unsigned)ex->ubo[NVN_STAGE_CS][i].size); - rt_log("vk_exec: its bindings:%s", line); + const uint8_t *ctl, *code; + uint32_t len; + int ntex = -1, nimg = -1; + if (ex->prog && find_stage(ex->prog, NVN_STAGE_CS, &ctl, &code, &len) && ctl_nvn2(ctl)) ntex = ctl[0xb3], nimg = ctl[0xb6]; + rt_log("vk_exec: its bindings (control: %d texture, %d image entries):%s", ntex, nimg, line); } // NX2NAVI_LOG_CS_BINDS: an untranslated program the fallback leaves alone, so its output keeps what it held (black when @@ -5704,8 +5708,19 @@ static void untranslated_dispatch_fallback(VkExec *ex) { } const VkTexImage *dst = NULL, *src = NULL, *out; int in_place = 0; + // The output is looked for among the image slots the program uses: the count of image entries of its NVN2 control + // section (byte +0xb6), at least slot 0 (the networks' in-place passes count none and write slot 0). An image slot + // keeps its binding from earlier dispatches, so past that count lie other programs' images: with a 3840x2160 + // picture the scene upscaler leaves its 3840x2160 RGB9E5 target in slot 2, the largest image bound to the movie + // network's last pass, and that pass's real output (2560x1440, slot 1, which the frame's last passes enlarge) kept + // stale bits for the whole movie: the Triforce movie after Gohma showed as frozen coloured stripes. + int nimg = 32; + const uint8_t *ctl, *code; + uint32_t len; + if (ex->prog && find_stage(ex->prog, NVN_STAGE_CS, &ctl, &code, &len) && ctl_nvn2(ctl)) nimg = ctl[0xb6] ? ctl[0xb6] : 1; + if (nimg > 32) nimg = 32; vk_texture_lock(); - for (int i = 0; i < 32; i++) { + for (int i = 0; i < nimg; i++) { uint64_t h = ex->img[NVN_STAGE_CS][i]; view_t v; int hv = 0; const VkTexImage *t = h ? vk_texture_by_id_locked(NVN_HANDLE_TEX(h), &v, &hv) : NULL;