diff --git a/runtime/dlssg/nx2_sl.cpp b/runtime/dlssg/nx2_sl.cpp index 7a7ad8a2..12c11a31 100644 --- a/runtime/dlssg/nx2_sl.cpp +++ b/runtime/dlssg/nx2_sl.cpp @@ -232,6 +232,12 @@ extern "C" NX2SL_API int nx2sl_frame(VkCommandBuffer cb, const Nx2SlImage *depth sl::DLSSGOptions o{}; o.mode = n ? sl::DLSSGMode::eOn : sl::DLSSGMode::eOff; o.numFramesToGenerate = n ? (uint32_t)n : 1; + // Generation goes off for every menu, cutscene and frame without depth and motion, and on again after it. Off + // frees the generator's resources unless this flag is set, and on allocates them again inside the present, with + // the queue lock held: a frame of 100 to 150 ms each time, the submitting thread waiting for that lock. With + // the flag, off only suspends. Whether frame generation runs at all is fixed for the run (vk_dlssg.c), so + // nothing is held for long that would otherwise be given back; Streamline frees it at shutdown. + o.flags = sl::DLSSGFlags::eRetainResourcesWhenOff; sl::Result r = p_dlssg_options(vp, o); if (n) say("dlssg: frame generation on, %dx (%d generated per rendered frame) (%d), output %ux%u", n + 1, n, (int)r, out_w, out_h); else say("dlssg: frame generation off (%d), output %ux%u", (int)r, out_w, out_h); diff --git a/runtime/vk_sync.c b/runtime/vk_sync.c index 4283da8e..cae29b16 100644 --- a/runtime/vk_sync.c +++ b/runtime/vk_sync.c @@ -99,7 +99,12 @@ static void queue_submit(VkCtx *c, const VkSubmitInfo2 *si, uint64_t value) { hold_max = v < 1 ? 1 : v > HOLD_CAP ? HOLD_CAP : v; rt_log("vk: up to %d submissions handed to the queue together (NX2NAVI_SUBMIT_BATCH)", hold_max); } + // The present holds this lock for its whole flip. A slow flip (frame generation allocating, a swapchain remade) makes + // the submitting thread wait here; counted as a present wait, so the slow-frame line no longer shows such a frame + // with nothing blocked. + uint64_t p0 = perf_begin(); vk_queue_lock_raw(); + perf_end(PERF_FENCE, p0); if (H.n == HOLD_CAP) hold_flush_locked(c); int i = H.n++; H.si[i] = *si;