dlss: shut Streamline down at process exit (VICTORY_DLSS_TEARDOWN) #139
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ReTerryDavis--ReVIctory!139
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-138"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@SovietBearz0r on GitHub · 2026-12-05 17:16 UTC · original
SovietBearz0r:dlss-shutdown-exit→main· +7258 −481 · 59 files · 49 commits · draftMain defines
dlss::shutdown()but the only caller is a test (dlss.rs:2319): on process exit Streamline (and DLSS frame generation, whose proxied swap chain and callbacks live in the plugin) is torn down by DLL detach after the title's callbacks are gone — the situation MiniVI's #413 fixes for crashes/0xc0000005at exit.Fix
dlss::shutdown()is now single-owner and idempotent (SHUTTING_DOWNCAS); repeat/concurrent calls are no-ops and the hardware test's call still works. Ready flags,evaluate_dlss, swap-chain upgrade/create return "off" once teardown begins.slShutdownis reachable even whenslInitsucceeded butinit_apithen found no supported feature (a separateTEARDOWNhandle is captured right afterslInit).dlss::shutdown_for_exit()(gated on having initialized,VICTORY_DLSS_TEARDOWNon unless0, and the device not removed): release the presenter first (DLSS-G off while its swap chain is alive, FSR FG retired, submitted work settled non-blockingly), null the device/queue/factory proxies, thenslShutdown— MiniVI's order.victory_loader::set_before_dll_teardown(fn()), invoked indetach_allafter the title images getDLL_PROCESS_DETACHand before the CRT ends the process (our tree has noending.rs; this is the closest safe analogue).run.rsregistersdlss::shutdown_for_exitthere. Window-close/restart (lifecycle::end) is deliberately not hooked: it usesTerminateProcess, which skips DLL detach.Verification
cargo test -p victory-gpu --lib: 715 passed, 0 failed, 21 ignored (new tests: teardown env parser, gating, no-op/idempotence without Streamline);cargo check -p victory,cargo xtask policy(439 files), clippy: no warnings in changed code.-Dlss quality -DlssFrameGen, clean quit → logsprocess exit: shutting NVIDIA Streamline down/NVIDIA Streamline shut down, no crash at exit; also DLSS-SR-only andVICTORY_DLSS_TEARDOWN=0as an escape hatch.ExitProcessdirectly / aborts still skips the hook (same as before).Source: MiniVI #413, adapted to this tree's loader atexit emulation and DLSS layering.
@ReTerryDavis on GitHub · 2026-12-05 17:38 UTC · original
Marking this as draft for now.
VICTORY_DLSS_TEARDOWNhasn't been tested on RTX 40/50 hardware yet, and there's a shutdown-ordering hazard to address first:BEFORE_DLL_TEARDOWNruns incrates/victory-loader/src/threads.rs::detach_allafterend_other_threadshas already killed other threads (including Streamline/NGX/D3D12 workers) viaTerminateThread. RunningDlssSwap::resizing()andslShutdown()afterward risks deadlocking internal Streamline/NGX mutexes until the 5s watchdog fires.dlss::teardown()(PROXIES.lock()) andDlssSwap::resizing()(RUNTIME.lock()) also use blocking.lock()rather thantry_lock().Happy to revisit once teardown runs before
end_other_threads(or safely handles terminated workers) and is tested on RTX hardware.@SovietBearz0r on GitHub · 2026-12-05 18:55 UTC · original
Shutdown ordering fixed:
BEFORE_DLL_TEARDOWNnow runs after the runner's final save and beforeend_other_threads, while Streamline/NGX/driver workers are still alive; title-imageDLL_PROCESS_DETACHdeliberately stays after thread termination (its contract is "no other thread may use the image") and the one-step deviation from ExitProcess order is documented.dlss::teardown()'sPROXIESlock andset_dlssg_off()'sRUNTIMElock are nowtry_lockwith clean skip+warn (the DLSS-G turn-off is still sent; only bookkeeping is skipped).VICTORY_DLSS_TEARDOWNgate and idempotency kept.victory-gpu719 tests, loader 138. Staying draft for the RTX 40/50 in-game teardown check.github-bot referenced this pull request2026-12-05 22:31:10 +00:00
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.