fix(sandbox): the game can load DLSS's runtime from its own ngx folder #3061

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/sandbox-dlss-runtime into main 2026-12-03 08:05:42 +00:00
Owner

Summary

With the sandbox on (the default since #2822), DLSS can't be used with the runtime the build places: it is in the game folder's ngx/, but the sandbox only lets libraries read the user-wide ngx folder (~/.local/share/longshot/ngx, %LOCALAPPDATA%\Longshot\ngx). NGX opens the runtime itself, so it is refused, and the log wrongly says DLSS needs an NVIDIA RTX GPU (0xbad00004).

Seen on an RTX 3090 (driver 620.70.06) with nightly-1007-d984fd70. The cause comes from reading the code; it is not yet confirmed by a run.

sandbox_linux::gather now adds the game folder's ngx/ to lib_read: read only, and only when it is a real folder, not a link. The game cannot write there: the game folder is served read-only and ngx/ is not among the written subfolders.

Windows has the same gap and gets the same fix (sandbox_windows/plan.rs, gather.rs), found by reading the code only: no Windows report or log confirms it. Please review this part closely: it is an exception to "no ACL at, above or under the game folder" beyond the program's own files. It is <game>\ngx alone, read only, added when the folder exists, and dropped by the existing recheck when it is a junction or link.

Testing

Tested: nothing yet. The change has not been compiled, tested or run in the game; only rustfmt ran. The new tests (one in sandbox_linux, one in sandbox_windows::plan) and a Windows-target compile check are waiting in the job queue.

Still to test:

  • Linux, NVIDIA RTX: the new test passes here and fails on main; mise run test-changed (by hand)
  • Linux, NVIDIA RTX: a build with DLSS, run with RX_VK_DLSS=1 RX_VK_DLSS_LOG=1 and the sandbox on, expecting NGX started, and 0xbad00004 on main (by hand)
  • Linux, NVIDIA RTX: DLSS Frame Generation, which loads from the same folder, expecting frames to be generated (by hand)
  • Windows, NVIDIA RTX: DLSS with the sandbox on and the runtime only in the game's ngx, expecting NGX started here and not on main. NGX also writes its own logs into that folder, which stays read only: check that it starts anyway (by hand)

Measurements

Nothing to measure yet: this restores a feature and changes no rendering code.

Risks

Libraries in the game process can now read and map files in the game folder's ngx/. Only the build writes there. On Windows the grant is inherited by the files in it, so a runtime hard-linked from the builder's store gets the read grant on that file too. Reverting is enough; nothing about saves, settings or caches changes.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (not run yet)
  • mise run test passes (any failure that also fails on main is named). (not run yet)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (written, not run yet)
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (not built yet)
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary With the sandbox on (the default since #2822), DLSS can't be used with the runtime the build places: it is in the game folder's `ngx/`, but the sandbox only lets libraries read the user-wide `ngx` folder (`~/.local/share/longshot/ngx`, `%LOCALAPPDATA%\Longshot\ngx`). NGX opens the runtime itself, so it is refused, and the log wrongly says `DLSS needs an NVIDIA RTX GPU` (`0xbad00004`). Seen on an RTX 3090 (driver 620.70.06) with `nightly-1007-d984fd70`. The cause comes from reading the code; **it is not yet confirmed by a run**. `sandbox_linux::gather` now adds the game folder's `ngx/` to `lib_read`: read only, and only when it is a real folder, not a link. The game cannot write there: the game folder is served read-only and `ngx/` is not among the written subfolders. **Windows** has the same gap and gets the same fix (`sandbox_windows/plan.rs`, `gather.rs`), found by reading the code only: no Windows report or log confirms it. **Please review this part closely:** it is an exception to "no ACL at, above or under the game folder" beyond the program's own files. It is `<game>\ngx` alone, read only, added when the folder exists, and dropped by the existing recheck when it is a junction or link. ## Testing **Tested:** nothing yet. The change has **not been compiled, tested or run in the game**; only `rustfmt` ran. The new tests (one in `sandbox_linux`, one in `sandbox_windows::plan`) and a Windows-target compile check are waiting in the job queue. **Still to test:** - Linux, NVIDIA RTX: the new test passes here and fails on `main`; `mise run test-changed` (by hand) - Linux, NVIDIA RTX: a build with DLSS, run with `RX_VK_DLSS=1 RX_VK_DLSS_LOG=1` and the sandbox on, expecting `NGX started`, and `0xbad00004` on `main` (by hand) - Linux, NVIDIA RTX: DLSS Frame Generation, which loads from the same folder, expecting frames to be generated (by hand) - Windows, NVIDIA RTX: DLSS with the sandbox on and the runtime only in the game's `ngx`, expecting `NGX started` here and not on `main`. NGX also writes its own logs into that folder, which stays read only: check that it starts anyway (by hand) ## Measurements Nothing to measure yet: this restores a feature and changes no rendering code. ## Risks Libraries in the game process can now read and map files in the game folder's `ngx/`. Only the build writes there. On Windows the grant is inherited by the files in it, so a runtime hard-linked from the builder's store gets the read grant on that file too. Reverting is enough; nothing about saves, settings or caches changes. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. (not run yet) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (not run yet) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [ ] A fix: a game-free test that fails on `main` and passes here. (written, not run yet) - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (not built yet) - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(sandbox): the game can load DLSS's runtime from its own ngx folder
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
3ae8f70347
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fix(sandbox): Windows too grants DLSS's runtime in the game folder's ngx
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
PR description / Title and description (pull_request_target) Failing after 6s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 17s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m31s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 11m39s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m19s
CI / Website build and checks (pull_request) Failing after 39s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 11m7s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 45m35s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
639bc0258d
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
HumanBean changed title from WIP: fix(sandbox): the game can load DLSS's runtime from its own ngx folder to fix(sandbox): the game can load DLSS's runtime from its own ngx folder 2026-12-03 08:05:38 +00:00
HumanBean deleted branch fix/sandbox-dlss-runtime 2026-12-03 08:05:42 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3061
No description provided.