mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 17:29:57 -04:00
Take Ocarina's DLSS camera from the bytes the scene draws read, and log why a frame has none.
In Kokiri Forest dialogue (Saria, dlss = performance) about 1 frame in 20 had no camera, and DLSS started a new history twice for each: 24 to 26 camera resets per 300 frames. The camera block was looked up in the uniform copy of the submission DLSS ran in, which on those frames had none: the frame's work had been held past its present by the event order and ran in the present thread's empty submission. vk_dlaa_draw now keeps the camera rows as the first scene draw read them (vk_usnap_read), and mv_pass uses those. A frame with no scene-context draw at all keeps DLSS's history with zero motion, for up to 6 frames in a row. Measured at the Saria spot: camera resets went from 24 to 26 per 300 frames to none in 3600 frames (the first frame only). The whole-picture flashes stayed: they come from the presents that go out with that work held, handled separately. The log now explains frames without a camera, frames without the DLAA point (with the held submissions at that present), light target changes and a second scene after DLSS ran, plus a line every 300 DLSS frames with resets. dlaa_cam_keep = 0 (NX2NAVI_DLAA_CAM_KEEP=0) restores the old camera handling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -335,6 +335,38 @@ void vk_usnap_drop(uint64_t addr, uint64_t n) {
|
||||
|
||||
uint64_t vk_usnap_gen(void) { return U.gen; }
|
||||
|
||||
// A GPU write of a submission not known to be complete touches [lo, hi). A linear scan: vk_usnap_drop appends after
|
||||
// wr_prune sorted the list, so wr_hits's binary search does not hold here; only called on rare paths.
|
||||
static int wr_overlaps(uint64_t lo, uint64_t hi) {
|
||||
for (int i = 0; i < U.nwr; i++)
|
||||
if (U.wr[i].lo < hi && lo < U.wr[i].hi) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpu_written(uint64_t addr, uint64_t n) { // the same test vk_usnap_begin keeps regions by
|
||||
VkMemSpan sp;
|
||||
return vk_mem_resolve(addr, n, &sp) && !sp.alloc && sp.pool && sp.avail >= n &&
|
||||
(sp.cls == VK_MCLS_HOST_CACHED || sp.cls == VK_MCLS_HOST_UNC);
|
||||
}
|
||||
|
||||
int vk_usnap_read(uint64_t addr, uint64_t n, void *dst) {
|
||||
const uint8_t *s = vk_usnap_bytes(addr, n);
|
||||
if (s) return memcpy(dst, s, n), 1;
|
||||
if (!n || !cpu_written(addr, n) || wr_overlaps(addr, addr + n)) return 0;
|
||||
memcpy(dst, (const void *)(uintptr_t)addr, n);
|
||||
return 2;
|
||||
}
|
||||
|
||||
int vk_usnap_why(uint64_t addr, uint64_t n) {
|
||||
if (!U.on) return VK_USNAP_NO_SNAPSHOT;
|
||||
int i = first_above(addr);
|
||||
if (i < U.nreg && addr >= U.reg[i].lo && addr + n <= U.reg[i].hi)
|
||||
return U.reg[i].dropped ? VK_USNAP_DROPPED : VK_USNAP_FOUND;
|
||||
if (wr_overlaps(addr, addr + n)) return VK_USNAP_IN_FLIGHT;
|
||||
if (!cpu_written(addr, n)) return VK_USNAP_NOT_CPU;
|
||||
return VK_USNAP_NOT_BOUND;
|
||||
}
|
||||
|
||||
// the host copy where there is one (DLSS), else the device copy
|
||||
static uint8_t *host_copy(void) { return U.arena->cpu ? U.arena->cpu : U.arena->map; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user