dlss: fix 2-arg NVSDK_NGX_D3D12_Shutdown1 core ABI and full teardown … #227
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/TaynanGT--Vice-Tay!227
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-227"
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?
@mint17 on GitHub · 2026-11-27 11:17 UTC · original
mint17:fix/dlss-shutdown1-abi-teardown→main· +750 −93 · 2 files · 1 commits · openFixes #176 and #183 (and resolves the root cause behind #217 / #219 so
Shutdown1does not need to be skipped).Root cause
dlss.rsloads_nvngx.dlldirectly viaGetProcAddresswithout linking NVIDIA's static wrappernvsdk_ngx_s.lib, and declaredNVSDK_NGX_D3D12_Shutdown1with 1 argument (fn(*mut c_void) -> u32, matchingnvsdk_ngx.h). However,_nvngx.dll's internal core export takes 2 arguments:Calling it with 1 argument left Win64
RDX(OutRemaining) uninitialized, causing_nvngx.dllto write*OutRemainingto0x0(0xC0000005) or corrupt 4 bytes of memory on bothdlss::shut_down()anddlss::start()'s failure cleanup path (explaining why both startup-failure and exit crashes hit the exact same offset in_nvngx.dll).Changes
Shutdownsignature tounsafe extern "C" fn(*mut c_void, *mut u32) -> u32and pass&mut remainingin bothdlss::start()failure cleanup anddlss::shut_down().NVSDK_NGX_D3D12_DestroyParametersand destroy capability parameters beforeShutdown1on both failure and exit paths.AtomicPtr+ leaf-lockedLIVE_HANDLES: Mutex<Vec<Weak<Handle>>>and lockPENDINGbefore atomictake()inHandle::enqueue_drop, ensuring all live andbury_lag-retained features are released exactly once beforeDestroyParametersandShutdown1.shut_down()calls viaOnce(preserving PR #214's exact shutdown stage trace logs) and guard duplicatedlss::start()calls cleanly.bury_laghandles, concurrent idempotency, and start-failure cleanup, plus repeatedshut_down()at the end oftests/dlss.rs.Verification
cargo test --locked -p victory-hle dlss -- --test-threads=1(21 unit tests passed)617.42,_nvngx.dll32.0.16.1742,nvngx_dlss.dll310.6.0):VICTORY_DLSS_TEST=1 cargo test --locked -p victory-hle --test dlss -- --nocapture --test-threads=1— PASS (1440p -> 4K Super Resolution, 0 D3D12 debug-layer errors, clean repeatedshut_down()includingShutdown1).cargo clippy -p victory-hle --all-targets --locked -- -D warnings(default +--all-features) andcargo test --locked -p xtaskpassed.@TaynanGT on GitHub · 2026-11-27 11:19 UTC · original
@mint17 The public NGX header describes the SDK wrapper, and this code resolves the core export directly. Which driver and NGX core version were used for the live RTX 4090 teardown check? That will let us tie the ABI evidence to the tested runtime. The mock tests cover release order and concurrent calls. The live run is what establishes the full teardown path for that core version.
62568895abto51220d96f3@mint17 on GitHub · 2026-11-27 11:26 UTC · original
The live RTX 4090 run (
VICTORY_DLSS_TEST=1 cargo test --locked -p victory-hle --test dlss -- --nocapture --test-threads=1) ran on:617.42_nvngx.dll):32.0.16.1742(from the driver store)nvngx_dlss.dll):310.6.0(Presets M / L)In addition, disassembling NVIDIA's official static wrapper
nvsdk_ngx_s.lib(NVSDK_NGX_D3D12_Shutdown1) shows the SDK wrapper itself always allocates a localunsigned int remaining = 0and passeslea rdx, [remaining]as the 2nd argument to_nvngx.dll!NVSDK_NGX_D3D12_Shutdown1(InDevice, &remaining).Rebasing this branch cleanly on top of
63e2c98now so there are no merge conflicts.@mint17 on GitHub · 2026-11-27 11:31 UTC · original
Rebased cleanly onto
63e2c98(51220d9) — removed theVICTORY_DLSS_SHUTDOWNskip gate while keeping thereleasing NGX capability parameterstrace log, and re-verified all 21 unit tests, Clippy,xtask, and the live RTX 4090VICTORY_DLSS_TEST=1teardown run (driver617.42,_nvngx.dll32.0.16.1742,nvngx_dlss.dll310.6.0.0— passed in 5.58s with 0 D3D12 errors).@TaynanGT on GitHub · 2026-11-27 11:42 UTC · original
@mint17 The exact driver and core versions help.
51220d9covers full teardown on_nvngx.dll32.0.16.1742with driver617.42. Our installed core is32.0.16.2140on621.40, so I’ll use that as the next compatibility check once the active run is done. I’m keeping the process-exit fallback available until that check covers the new default.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.