Compare commits

...
15 Commits
Author SHA1 Message Date
theme613 5d62b86f4a docs: update README benchmark stats and latest optimization changelog
CI / check (push) Canceled after 0s
2026-11-29 01:10:04 +08:00
theme613 ebd07c1dbb gpu/launcher: direct in-place CBVs, CBV dedup, coalesced fills, and cutscene texture-pass optimizations
CI / check (push) Canceled after 0s
2026-11-29 01:02:30 +08:00
theme613 b78c91f127 docs: add dedicated troubleshooting guide and link it from README
CI / check (push) Canceled after 0s
2026-11-28 23:11:13 +08:00
theme613 e4f94bc86f launcher: remove VICTORY_AMBIENT_ONCE to stop indoor flashing and use 0.65 ambient
CI / check (push) Canceled after 0s
2026-11-28 22:59:38 +08:00
theme613 9a97e0a537 launcher: enable VICTORY_AMBIENT_ONCE=1 (0.7) to prevent overexposed sunlight feedback
CI / check (push) Canceled after 0s
2026-11-28 22:42:01 +08:00
theme613 21f8d46d02 launcher/docs: enable FSR 3 2X Frame Generation by default on 6 GB preset
CI / check (push) Canceled after 0s
2026-11-28 22:37:07 +08:00
theme613 a7c7819db4 launcher/docs: restore sharp 1080p Half-texture preset with safe VRAM headroom
CI / check (push) Canceled after 0s
2026-11-28 22:32:11 +08:00
theme613 f0114565e0 docs: fix README git clone/pull URL and sync 6 GB preset defaults
CI / check (push) Canceled after 0s
2026-11-28 22:01:19 +08:00
theme613 6a9d4732e9 gpu/launcher: add VICTORY_WINDOWS_VRAM_PERCENT, F1 DLSS UltraPerf option, and enable ReBAR 768MB + COPY/STORE_BESIDE
CI / check (push) Canceled after 0s
2026-11-28 21:06:47 +08:00
theme613 604908e486 gpu: fix STAGING pool cap leak and tighten idle snapshot/send pool caps on <=20GB RAM hosts
CI / check (push) Canceled after 0s
2026-11-28 20:28:10 +08:00
theme613 e4dbd89cd3 docs: update README with Packet 27/28 verified 1080p benchmark gains
CI / check (push) Canceled after 0s
2026-11-28 20:08:29 +08:00
theme613 5d65b5d333 gpu: use AddressHash for Deferred::textures, fast-skip declared_writes, dedup card_before root bindings, and cache Batch::last_ahead 2026-11-28 20:03:01 +08:00
theme613 3f3e525d55 gpu: fuse ask_once, batch journal nothing_new, use AVX2 word_runs in Shadow::take, and cache non-watched view textures 2026-11-28 19:53:17 +08:00
theme613 3a4ce453cd docs: replace specific exe/scene references with generic game file (.exe) wording
CI / check (push) Canceled after 0s
2026-11-28 18:48:49 +08:00
theme613 084321f432 docs: add Antigravity setup prompt and verified 6GB/16GB benchmark stats
CI / check (push) Canceled after 0s
2026-11-28 18:14:43 +08:00
13 changed files with 1000 additions and 215 deletions

No files matched your search

+105 -21
View File
@@ -6,20 +6,22 @@
> - **SOL:** `Cep7cZA8LPMUAWckR2JyUfvwhSpm9yzUqUWZxN3MY8LP`
> - **USDT (ERC-20 / EVM):** `0xf3feaf58c2f467508e4fd5d5abf2c1495a74b424`
A performance- and low-memory-tuned fork of [VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA) (built on [foxhound](https://github.com/readmet3xt-lab/foxhound) / [VIctory](https://github.com/Marvisak/VIctory)) that runs an Xbox Series title natively on Windows from files **you** supply.
A performance- and low-memory-tuned fork of [VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA) (built on [foxhound](https://github.com/readmet3xt-lab/foxhound) / [VIctory](https://github.com/Marvisak/VIctory)) that runs a game file natively on Windows from files **you** supply.
> **This repository contains no game files, code, or assets.** You must supply your own legally obtained copy of the title (build v1.0.2.1, `game_scarlett_master.exe`). Not affiliated with or endorsed by the title's developer/publisher, NVIDIA, or AMD. See [docs/asset-policy.md](docs/asset-policy.md).
> **This repository contains no game files, code, or assets.** You must supply your own legally obtained game file (`.exe`). Not affiliated with or endorsed by any developer, publisher, NVIDIA, or AMD. See [docs/asset-policy.md](docs/asset-policy.md).
>
> **Having issues? (crashes, pagefile, flashing/lighting, low FPS, DLSS/FSR, build errors)** → Open the full **[Troubleshooting Guide (`docs/troubleshooting.md`)](docs/troubleshooting.md)**.
---
## What This Fork Adds
- **6 GB / 4 GB VRAM support (`VICTORY_TEXTURE_DROP_MIPS`):** Drops top texture mip levels (`1` = Half for 6 GB GPUs, `2` = Quarter for 4 GB GPUs) to keep VRAM comfortably under budget. Toggleable in the **F1** menu (`TEXTURE SCALE (VRAM)`).
- **16 GB RAM stability & OOM recovery:** Caps idle upload/list pools automatically on `<= 32 GB` hosts, drains idle pools under critical commit pressure, and retries `E_OUTOFMEMORY` in command-list preludes instead of crashing.
- **Custom windowed output sizes (`VICTORY_OUTPUT`):** True `1280x720` and `1664x936` output patching that works cleanly alongside DLSS and FSR 3 Frame Generation. Toggleable in **F1** (`OUTPUT SIZE (WINDOW)`).
- **CPU submit-thread optimizations:** Lock-free `watch::AHEAD_KEPT` + binary-searched `ahead_contains`, `RwLock<Guards>` shared-read fast path, lock-free `Shadow::pending_len` & `Card::before`, merged `copied`/`ranged` lock, incremental `HeapRanges` spans, zero-alloc `HostList::prelude()` fast path, and reused `Batch` scratch buffers.
- **6 GB / 4 GB VRAM support (`VICTORY_TEXTURE_DROP_MIPS` + ReBAR GPU windows):** Drops top texture mip levels (`1` = Half default for sharp visuals + ~500 MiB VRAM headroom on 6 GB GPUs; `2` = Quarter for 4 GB GPUs or extra VRAM room with larger ReBAR windows via `VICTORY_WINDOWS_BAR_MB` / `VICTORY_WINDOWS_VRAM_PERCENT`). Toggleable in the **F1** menu (`TEXTURE SCALE (VRAM)`).
- **16 GB RAM stability & OOM recovery:** Automatically caps idle `STAGING`, upload `send::SPARE` (`128 MiB`), and CPU snapshot (`128 MiB`) pools on `<= 20 GB` / `<= 32 GB` RAM hosts, drains idle pools under critical commit pressure, and retries `E_OUTOFMEMORY` in command-list preludes instead of crashing.
- **Custom windowed output sizes (`VICTORY_OUTPUT`) & DLSS Ultra Performance:** True `1280x720` and `1664x936` windowed output patching plus `640X360 (ULTRA FAST)` (`ultraperformance`) in **F1** (`SERIES S PICTURE` / `OUTPUT SIZE (WINDOW)`), working cleanly alongside DLSS and FSR 3 Frame Generation.
- **CPU submit-thread, CBV & cutscene optimizations:** Direct 256-byte in-place CBV fast path (`VICTORY_DIRECT_CBV`, skips ~70% of CPU constant buffer fills when `VICTORY_PORT_CONSTANTS=1` is active), per-list `HostList::constant_scratch` CBV deduplication (`FillTo::Slots`), `Step::Host` premature `batch.fill()` flush fix + sorted/overlap-coalesced `Batch::fill()` (`VICTORY_FILL_BATCH`), short initial texture warm-up (`START_HOT_FRAMES=4`, killing the 12-second 265 MB/frame cutscene texture re-hashing storm while still promoting genuine alias-view updates to 64 frames), `heap_textures` early `VICTORY_TEXSPK_PASS_MS` budget exit (always running `texture_slots_flip()` first), fused single-pass write-watch `ask_once` with guarded-view skip, chunked `JOURNAL`-batched `nothing_new` filtering, AVX2 `word_runs` in `Shadow::take`, cached non-watched view-texture checks with zero-alloc `writes_since`, `AddressHash` on `Deferred::textures`, `has_gpu_write` fast-skip, deduplicated `card_before` root bindings, `Batch::last_ahead` 1-entry cache, lock-free `watch::AHEAD_KEPT` + binary-searched `ahead_contains`, `RwLock<Guards>` shared-read fast path, incremental `HeapRanges` spans, and zero-alloc `HostList::prelude()` fast path.
- **DLSS Super Resolution + AMD FSR 3 / DLSS Frame Generation:** Full F1 settings menu, F3 stats panel, HUD-less FSR 3 2X Frame Generation for RTX 20/30 and non-NVIDIA DX12 GPUs, and DLSS FG (2x–6x) for RTX 40/50.
- **Portable 6 GB / 16 GB launcher (`scripts/play-6gb.ps1`):** Pre-configured with verified settings (`VICTORY_FAST_CORES=0` for hybrid P+E CPUs, `VICTORY_PORT_CONSTANTS=1`, aligned `SLOT_EVICT` thresholds, `VICTORY_PIPELINE_WAIT_MS=50`, and ReBAR GPU windows).
- **Portable 6 GB / 16 GB launcher (`scripts/play-6gb.ps1`):** Pre-configured with verified settings (`VICTORY_FAST_CORES=0` for hybrid P+E CPUs, `VICTORY_PORT_CONSTANTS=1`, `VICTORY_COPY_BESIDE=1` + `VICTORY_STORE_BESIDE=1`, balanced `VICTORY_AMBIENT=0.8` + `VICTORY_AMBIENT_SHADE=0.5,0.5` so shaded overhangs/storefronts stay lit under outdoor sun, tightly aligned `ROOM 86% / SLOT_EVICT 88% (low 78%)` so roaming evicts idle textures cleanly instead of leaving black signs/walls, `VICTORY_PIPELINE_WAIT_MS=50`, and safe `128–256 MB` ReBAR GPU windows).
---
@@ -31,7 +33,7 @@ A performance- and low-memory-tuned fork of [VIctory-NVIDIA](https://github.com/
| **CPU** | x64 with AVX2 (4+ cores) | 6–8+ cores |
| **RAM** | **16 GB** *(set a 32–48 GB SSD pagefile)* | 32 GB or more |
| **GPU** | **6 GB VRAM** DX12 GPU (RTX 20/30/40/50 for DLSS; any DX12 GPU for FSR 3) | 12 GB+ NVIDIA RTX |
| **Storage** | SSD with 50+ GB free (for game + pagefile + shader cache) | NVMe SSD |
| **Storage** | SSD with 50+ GB free (for game file + pagefile + shader cache) | NVMe SSD |
| **Build Tools** | [Rust](https://rustup.rs) + [VS Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) ("Desktop development with C++") | — |
> **16 GB RAM users:** Windows needs virtual commit headroom while streaming open-world textures. Before playing on a 16 GB PC, set a **32–48 GB custom pagefile** on your SSD (*System Properties → Advanced → Performance Settings → Advanced → Virtual Memory*).
@@ -46,11 +48,11 @@ A performance- and low-memory-tuned fork of [VIctory-NVIDIA](https://github.com/
3. Make sure your GPU driver is up to date.
### Step 2 — Clone the Repository
Open **PowerShell** in a folder where you want the project (outside your game folder):
Open **PowerShell** in a folder where you want the project (outside your game file folder):
```powershell
git clone https://github.com/theme613/theme613crap.git
cd theme613crap
git clone https://theme613.ggff.net:8443/theme613/6gbvram---16gb-ram.git
cd 6gbvram---16gb-ram
```
### Step 3 — Download Upscaler / Frame-Gen DLLs (One-Time)
@@ -68,31 +70,43 @@ NVIDIA's and AMD's redistributables are not stored in this repo — run the incl
### Step 4 — Build & Launch
Replace `D:\Games\MyDump\game_scarlett_master.exe` with the path to **your own** dump of `game_scarlett_master.exe`. The first launch builds `target\release\victory.exe` automatically (takes a few minutes).
Replace `D:\path\to\your.exe` with the path to **your own game file (`.exe`)**. The first launch builds `target\release\victory.exe` automatically (takes a few minutes).
**Option A — 6–8 GB VRAM GPUs / 16 GB RAM Laptops (Recommended for RTX 3050 / 3060 / 4050 / 4060):**
```powershell
# Sharp 1080p windowed (960x540 DLSS Perf, Half textures, FG off):
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\Games\MyDump\game_scarlett_master.exe'
# Sharp 1080p windowed with FSR 3 2X Frame Generation ON (960x540 DLSS Performance, Half textures):
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe'
# Same with FSR 3 2X Frame Generation ON:
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\Games\MyDump\game_scarlett_master.exe' -FrameGen
# Same with Frame Generation OFF (raw real FPS / lowest input lag):
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe' -NoFrameGen
# Max FPS mode (640x360 DLSS Ultra Perf + Quarter textures, softer visuals):
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe' -Dlss ultraperformance -DropMips 2
# Extra GPU headroom (936p or 720p windowed):
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\Games\MyDump\game_scarlett_master.exe' -Output 936
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe' -Output 936
```
**Option B — 12 GB+ VRAM GPUs / 32 GB+ RAM Desktops:**
```powershell
powershell -ExecutionPolicy Bypass -File scripts\play-nvidia.ps1 -Exe 'D:\Games\MyDump\game_scarlett_master.exe'
powershell -ExecutionPolicy Bypass -File scripts\play-nvidia.ps1 -Exe 'D:\path\to\your.exe'
```
*(Optional: C: drive low on space? Run `setx VICTORY_HOME D:\victory` once and open a new PowerShell window — caches, saves, settings, and logs will go there instead of `%LOCALAPPDATA%\victory`.)*
### Step 5 — In-Game Controls & Tuning
### Step 5 — Updating Later (`git pull` & Rebuild)
Whenever new updates are pushed, pull `main` and rebuild `victory.exe` (since `play-6gb.ps1` only auto-builds when `target\release\victory.exe` does not exist yet):
```powershell
cd 6gbvram---16gb-ram
git pull origin main
cargo build --release --locked -j 4 -p victory
```
### Step 6 — In-Game Controls & Tuning
- Press **`F1`** anytime to open the **Settings Menu** (Arrow keys to navigate, Enter to select, `SAVE AND RESTART NOW` to apply):
- **`OUTPUT SIZE (WINDOW)`**: `1080P (DEFAULT)` / `936P` / `720P (FASTEST)`
- **`DLSS`** / **`SERIES S PICTURE`**: `960X540 (FASTEST)` / `1113X626` / `1280X720`
- **`DLSS`** / **`SERIES S PICTURE`**: `640X360 (ULTRA FAST)` / `960X540 (FASTEST)` / `1113X626` / `1280X720` / `1920X1080`
- **`TEXTURE SCALE (VRAM)`**: `FULL` / `HALF (6GB GPU)` / `QUARTER (4GB GPU)`
- **`FRAME GENERATION`**: `OFF` / `2X` (FSR 3 on RTX 20/30 or any DX12 card; DLSS FG 2x–6x on RTX 40/50)
- **`WATER LIGHT`**, **`LIGHT ESTIMATE`**, **`REFLECTION ESTIMATE`**, **`FOG CAP`**
@@ -101,6 +115,62 @@ powershell -ExecutionPolicy Bypass -File scripts\play-nvidia.ps1 -Exe 'D:\Games\
---
## Don't Know How to Set It Up? Use Antigravity + This AI Prompt
If you don't want to mess with Rust, PowerShell, pagefiles, or tuning flags by hand:
1. Download and open **Google Antigravity**.
2. Clone `https://theme613.ggff.net:8443/theme613/6gbvram---16gb-ram.git` (or open your cloned `6gbvram---16gb-ram` folder) in Antigravity.
3. Paste the prompt below (just replace the path with your own game file `.exe` path) and let Antigravity set up, build, and tune everything for your exact PC:
```text
Please set up and optimize this VIctory repository for my PC so I can play with a one-click launcher.
My game file (.exe) is at: D:\path\to\your.exe
Please do the following step by step:
1. Check my PC specs (Windows version, CPU core layout, RAM + pagefile commit limit, GPU model, VRAM budget, and current GPU power limit).
2. Check if Rust and Visual Studio C++ Build Tools are installed (tell me if anything is missing).
3. Fetch the right runtime DLLs for my GPU/OS using the repo's scripts:
- Run Get-NVIDIA-DLSS.cmd if I have an NVIDIA RTX card.
- Run Get-AMD-FSR.cmd if I want FSR 3 2X Frame Generation (especially on RTX 20/30 or non-NVIDIA GPUs).
- Run scripts\get-d3d12.ps1 if I am on Windows 10.
4. Build the release binary (`cargo build --release --locked -j 4 -p victory`).
5. Create a clean one-click windowed `.cmd` launcher tailored to my exact GPU VRAM, RAM, and CPU (using scripts\play-6gb.ps1 as a base for 6-8 GB VRAM / 16 GB RAM, or scripts\play-nvidia.ps1 for 12 GB+ VRAM / 32 GB+ RAM; use VICTORY_FAST_CORES=0 on hybrid P+E CPUs like Intel 12th-14th gen).
6. Tell me if my pagefile or laptop GPU power mode needs adjustment for best stability and FPS.
```
---
## Measured Performance Gains (6 GB VRAM / 16 GB RAM Laptop)
All numbers below were measured on the same Windows 11 gaming laptop (**Intel Core i5-12450HX [4 P-cores + 4 E-cores], 16 GB RAM, NVIDIA GeForce RTX 3050 6 GB Laptop GPU** — measured even while GPU power was capped at **26–31 W**) in an open-world test scene (`0` crashes, `0` OOMs, full lighting ON):
| Metric | Before (Stock `VIctory-NVIDIA` on 6 GB / 16 GB) | After (This Fork — Latest `main`) | Change |
| :--- | :---: | :---: | :---: |
| **Shader-warm frame stall** | `1.9 fps` (`520 ms` pipeline wait stalls) | `0` stalls (`VICTORY_PIPELINE_WAIT_MS=50`) | **Eliminated** |
| **CPU `preparing` (steady ~6k draws)** | `94.2 ms` | **`39.2 ms`** *(submit thread `52.4 ms`, ~19 fps CPU ceiling)* | **−58% (2.4× faster)** |
| **CPU `preparing` (heavy ~11.2k cutscene)** | `113.3 ms` *(with `25.6 ms / 265.9 MB` texture storm)* | **`46.2 ms`** *(`2.3 ms / 23.3 MB` textures)* | **−59% (−91% tex hash)** |
| **CPU constant buffer fills (`PORT_CONSTANTS=1`)** | `12,691` fills/frame (`4.9 MB`) | **`3,523–3,744`** fills/frame (`1.0–1.1 MB`) | **−71% fills / −78% KB** |
| **GPU idle bubbles (waiting on CPU)** | `30.0 ms` *(card 73% busy)* | **`14.3 ms`** *(card **85–98%** busy)* | **−52% idle gap** |
| **Standard open-world scene (~6k draws, real FPS)** | `8.5 fps` real (`117.8 ms`) | **`10.8 fps` med / `11.4–12.8 fps` peak real** | **+27% med / +50% peak** |
| **Heavy cutscene (~11.2k draws, real FPS)** | `4.8 fps` real (`208 ms`) | **`7.0 fps` med / `7.3 fps` peak real** (`142.9 / 136.6 ms`) | **+46% to +52% real** |
| **With FSR 3 2X Frame Gen (HUD-less)** | `17.0 fps` displayed (`8.5` base) | **`21.6–25.6 fps`** *(1080p, HUD-less)* | **+27% to +50% + smoother pacing** |
| **VRAM usage (6 GB card, 5.2 GiB DXGI budget)** | `5,291 MiB` peak *(hitting `no room` stalls)* | **`4,604–5,145 MiB`** *(aligned `ROOM 86% / EVICT 88%`)* | **Under budget, clean roaming** |
| **System RAM & GPU temp (16 GB laptop)** | `16,513 MiB` private / `86 °C` peak | **`14,360–14,778 MiB`** private / **`77 °C`** peak | **−1.7 to −2.1 GiB RAM, −9 °C** |
| **Texture eviction `sweep()` overhead** | `8.0 ms/frame` *(when `ROOM% > SLOT_EVICT%`)* | **`0.3 ms/frame`** *(aligned `ROOM 86% / EVICT 88%`)* | **26× faster** |
### Latest Changes (`ebd07c1` — Direct CBVs, Cutscene Texture Fix & Roaming Alignment)
- **Direct 256-byte in-place CBVs (`VICTORY_DIRECT_CBV`, on by default; `=0` disables):** When `VICTORY_PORT_CONSTANTS=1` already maps the 185 MB constant heap in place, 256-byte-aligned constant buffers bind directly on the card with zero scratch allocation, zero `Step::Fill`, and zero CPU copy (cutting CPU CBV fills from `12,691 → 3,523–3,744/frame`).
- **Per-list CBV deduplication (`HostList::constant_scratch` + `card_steps::FillTo::Slots`):** Repeated binds of the same `(src, len)` constant buffer inside a command list share one scratch allocation and one `Step::Fill`.
- **`Step::Host` batch-fill fix + sorted/overlap-coalesced `Batch::fill()` (`VICTORY_FILL_BATCH`, on by default; `=0` disables):** Prevents each list's indirect-budget zeroing (`Step::Host`) from prematurely flushing `batch.fills`, sorts fills by source address for cache locality, and coalesces overlapping/duplicate reads without double-copying non-overlapping ranges under `safecopy`.
- **Cutscene texture re-hashing storm fix (`START_HOT_FRAMES=4` in `texture.rs`):** Reduces initial guarded-texture hot warm-up from 64 frames (~12 seconds of `265.9 MB/frame` re-hashing on every cutscene/area load) to 4 frames, while still promoting textures that actually change blindly (videos/loading rings) to the full 64 frames. Cut heavy cutscene `prep` from `113.3 → 46.2 ms` (`5.6 → 7.0–7.3 real fps`).
- **Texture-pass budget & flip fix (`draw.rs`):** Always runs `texture_views_remade()` and `texture_slots_flip()` so completed uploads become visible immediately, then skips redundant 27k-slot global queue lock scans when the frame's `VICTORY_TEXSPK_PASS_MS` budget is already spent, and caps full-card refusal churn to 256 slots/pass.
- **Lighting & roaming VRAM alignment (`scripts/play-6gb.ps1`):** Restored `VICTORY_AMBIENT=0.8` with softened `VICTORY_AMBIENT_SHADE=0.5,0.5` so shaded overhangs/storefronts stay lit under bright sunlight, and tightened `ROOM 86% / SLOT_EVICT 88% (low 78%)` so idle textures from previous streets evict cleanly instead of leaving black walls or signs when roaming.
> **Hybrid CPU & stronger GPU note:** On Intel 12th–14th gen hybrid CPUs (`i5-12450HX` 4P + 4E), `VICTORY_FAST_CORES=0` adds `+13.5%` real FPS over `FAST_CORES=2`. With the submit thread now down to **`52.4 ms`** (~19 real FPS CPU ceiling), higher-wattage RTX 3060 / 4050 / 4060 6–8 GB GPUs can push toward **15–19 real FPS** (`30–38 FPS` with 2× FG), while 30–35 W RTX 3050 6 GB laptops are now primarily GPU-bound (`85%` card utilization at `10.8–12.8 real fps`).
---
## Frame Generation Compatibility
| Your GPU | Frame Generation | Notes |
@@ -113,13 +183,27 @@ powershell -ExecutionPolicy Bypass -File scripts\play-nvidia.ps1 -Exe 'D:\Games\
## Tips for Gaming Laptops (6 GB VRAM / 16 GB RAM)
1. **Use AC Power + Performance Mode (`Fn + Q` / OEM control panel):** Many gaming laptops cap the GPU to 30–35 W in Balanced mode even when capable of 65–115 W. Unlocking GPU TGP + raising fan speed gives a direct real-FPS boost.
1. **Use AC Power + Performance / Max Fan Mode (`Fn + Q` / OEM control panel):** Many gaming laptops cap the GPU to 30–35 W in Balanced mode or thermally throttle the CPU once the heatsink reaches 85–86 °C on long sessions. Keeping fans on Performance/Max and elevating the back of the laptop for airflow sustains peak FPS.
2. **Don't choke CPU wattage in Custom Mode:** This compatibility layer uses all CPU cores heavily. Keep CPU cross-loading power limit generous (45–55 W+) and keep Windows Power Plan on High Performance / 100% min processor state on AC.
3. **Close background apps before launching:** Browsers, Discord, and IDEs eat RAM and CPU cores on 16 GB systems.
4. **First-time shader warm-up:** New open-world areas compile pipelines on first visit (capped to 50 ms/frame in `play-6gb.ps1` to avoid long stalls) and run smoothly once cached.
---
## Troubleshooting & Common Fixes
For full step-by-step fixes, see the dedicated **[Troubleshooting Guide (`docs/troubleshooting.md`)](docs/troubleshooting.md)**:
- **[16 GB RAM crashes / `E_OUTOFMEMORY` — Step-by-step 32–48 GB SSD pagefile guide](docs/troubleshooting.md#1-out-of-memory--crashes-on-16-gb-ram-3248-gb-ssd-pagefile-setup)**
- **[Wrong F1 settings / pitch-black indoors — How to reset `victory-settings.txt`](docs/troubleshooting.md#2-wrong-or-broken-f1-settings-how-to-reset)**
- **[Blinding sun, indoor flashing, white dots, blurry graphics, or missing heads](docs/troubleshooting.md#3-graphics--lighting-issues)**
- **[Low FPS, roaming VRAM stutters, input lag, & laptop thermal throttling](docs/troubleshooting.md#4-low-fps-stuttering-input-lag--laptop-thermal-throttling)**
- **[DLSS / AMD FSR 3 Frame Generation not working](docs/troubleshooting.md#5-dlss-or-fsr-3-frame-generation-not-working)**
- **[Build errors, `git pull` rebuild, Windows 10 DX12, & low C: space](docs/troubleshooting.md#6-build-git-pull-windows-10--launch-errors)**
- **[Shader preloading (`-Preload`) & pop-in in new areas](docs/troubleshooting.md#7-shader-preloading--pop-in-in-new-areas)**
---
## Known Limitations
- **Hardware ray tracing is off by default** (`RAY TRACING` in F1 is slow/broken on current builds); indirect lighting and reflections use the emulator's `LIGHT ESTIMATE` + `REFLECTION ESTIMATE` + `WATER LIGHT` shaders instead.
+50 -11
View File
@@ -3187,6 +3187,25 @@ impl State {
if FRAME.swap(frame, Ordering::Relaxed) != frame {
SPENT.store(0, Ordering::Relaxed);
}
let baking = crate::texture::BAKING.get();
let required = PASS_BUDGET.get().is_some_and(|(_, _, bake)| bake);
let frame_pass = !required && !baking && sync.is_none();
// If an earlier pass in this same frame already exhausted the
// `VICTORY_TEXSPK_PASS_MS` budget, still flip any newly-completed
// texture uploads visible, then bail before taking the global
// texture-queue lock and scanning tens of thousands of slots for a
// loop that would immediately time out on iteration 0.
if frame_pass
&& let Some(cap) = texspk_pass_ms()
&& PASS_FRAME.load(Ordering::Relaxed) == frame
&& PASS_FRAME_NANOS.load(Ordering::Relaxed) >= cap.saturating_mul(1_000_000)
{
before(1, || {
host.texture_views_remade();
host.texture_slots_flip();
});
return false;
}
// No more of them are made while the card has no room
// (`resource::room`): by what is alive now, not by what was ever
// staged (4 GB in all, after which later textures stayed empty for
@@ -3205,7 +3224,6 @@ impl State {
once!("textures picked by index: the card has no room for more; they wait");
}
let mut refused = 0;
let baking = crate::texture::BAKING.get();
before(0, || {
// Room again: the slots held back while the card was full are
// due now (`full_card_pass`).
@@ -3233,10 +3251,15 @@ impl State {
if room {
before(0, || host.texture_slots_waiting(frame));
}
let required = PASS_BUDGET.get().is_some_and(|(_, _, bake)| bake);
// (And what the queue knew of each, `known`: see `Tells`.)
let (mut due, mut known, census) =
before(2, || host.texture_slots_due_known(frame, if baking { 1 << 16 } else { 4096 }));
let due_cap = if baking {
1 << 16
} else if !room && !required {
1024
} else {
4096
};
let (mut due, mut known, census) = before(2, || host.texture_slots_due_known(frame, due_cap));
// (Those that are due later after all that are due.)
let on_time = due.len();
if baking {
@@ -3322,7 +3345,6 @@ impl State {
// A frame's runs of the pass (its own and the early ones, not those
// before a bake) within `VICTORY_TEXSPK_PASS_MS` together
// ([`texspk_pass_ms`]).
let frame_pass = !required && !baking && sync.is_none();
let span = match texspk_pass_ms() {
Some(cap) if frame_pass => {
if PASS_FRAME.swap(frame, Ordering::Relaxed) != frame {
@@ -3489,10 +3511,11 @@ impl State {
outcome(slot_outcome::HELD);
if full_card_pass() {
// Held back for the frames of about four seconds
// (`most`), or until the card has room; the pass
// goes on, within a count that bounds one pass.
// (`most`), or until the card has room; cap refusals
// per pass at 256 so full-card cutscenes do not thrash
// thousands of held-slot tells under the queue lock.
tells.tell(index, write, Told::Held(frame + most));
if refused > 1024 {
if refused > 256 {
break;
}
} else if refused > 256 {
@@ -4820,12 +4843,28 @@ impl State {
let used = group.entry(k);
match crate::descriptor::view(table + u64::from(k) * 32) {
Some(View::Constant(address, size)) => {
let Some((buffer, gpu, to)) = list.scratch_held(u64::from(size)) else {
// Direct 256-byte-aligned in-place CBV fast path: when
// `VICTORY_PORT_CONSTANTS=1` already has the constant heap
// in place on the card and `gpu` is 256-byte aligned, bind
// directly with zero scratch alloc, zero `Step::Fill`, and
// zero CPU copy (`VICTORY_DIRECT_CBV=0` disables).
static DIRECT_CBV: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
if *DIRECT_CBV.get_or_init(|| std::env::var_os("VICTORY_DIRECT_CBV").is_none_or(|v| v != "0"))
&& crate::port::on()
&& let Some(shadow) = crate::shadow::find(address, u64::from(size)).filter(|s| s.in_place())
{
let gpu = shadow.gpu(address);
let aligned = u64::from(size).next_multiple_of(256);
if gpu.is_multiple_of(256) && shadow.left(address) >= aligned {
host.constant_at(index, &shadow.buffer, gpu, size);
continue;
}
}
let slot = (std::ptr::from_ref(heap) as usize, index);
let Some((buffer, gpu)) = list.constant_scratch(address as *const u8, size, slot) else {
host.make_null(index);
continue;
};
let slot = (std::ptr::from_ref(heap) as usize, index);
list.defer_constants(to, address as *const u8, size as usize, slot);
host.constant_at(index, &buffer, gpu, size);
}
Some(view) => {
+313 -49
View File
@@ -2715,8 +2715,14 @@ struct Deferred {
/// Scratch memory [`HostList::fill_scratch`] fills since the list last
/// wrote title memory (source, bytes): its host address.
filled: std::collections::HashMap<(usize, usize), u64, std::hash::BuildHasherDefault<AddressHash>>,
/// Constant-buffer upload copies [`HostList::constant_scratch`] made since
/// the list last wrote title memory (`(src, len)` -> `(buffer, gpu, step)`).
constants: std::collections::HashMap<(usize, usize), (ID3D12Resource, u64, usize), std::hash::BuildHasherDefault<AddressHash>>,
/// Textures whose contents the list brings up to date.
textures: std::collections::HashSet<usize>,
textures: std::collections::HashSet<usize, std::hash::BuildHasherDefault<AddressHash>>,
/// Whether `copies` contains at least one `Step::GpuWrite` (lets
/// `declared_writes` skip lists that only record refreshes/copies).
has_gpu_write: bool,
/// Bottom-of-pipe writes, done once the list has run: address, what,
/// bytes.
writes: Vec<(usize, crate::queue::Written, usize)>,
@@ -2756,6 +2762,7 @@ impl Deferred {
self.refreshed.clear();
self.gpu_written.clear();
self.filled.clear();
self.constants.clear();
}
}
@@ -4329,7 +4336,11 @@ fn declared_writes(runs: &[&HostList]) -> Vec<Declared> {
let mut places: ByCopy<usize> = ByCopy::default();
let mut seen = std::collections::HashSet::<(usize, usize, usize), std::hash::BuildHasherDefault<AddressHash>>::default();
for list in runs {
for step in &list.deferred().copies {
let deferred = list.deferred();
if !deferred.has_gpu_write {
continue;
}
for step in &deferred.copies {
if let Step::GpuWrite(shadow, address, len) = step {
let key = std::sync::Arc::as_ptr(shadow) as usize;
if !seen.insert((key, *address, *len)) {
@@ -5023,16 +5034,27 @@ impl Host {
list.SetComputeRootSignature(&work.root);
list.SetPipelineState(&work.pso);
list.SetComputeRootUnorderedAccessView(3, work.differs.0.GetGPUVirtualAddress());
let mut last_shadow = 0usize;
let mut last_size = 0u32;
let mut passes = 0u64;
for r in plan.ranges.iter().filter(|r| r.compared) {
let (Some((_, Some(before), _)), size) = (r.shadow.card_sides(), r.shadow.card_hash_size()) else {
continue;
};
list.SetComputeRootShaderResourceView(1, r.shadow.buffer.GetGPUVirtualAddress());
list.SetComputeRootUnorderedAccessView(2, before.GetGPUVirtualAddress());
let key = Arc::as_ptr(&r.shadow) as usize;
if key != last_shadow {
let (Some((_, Some(before), _)), size) = (r.shadow.card_sides(), r.shadow.card_hash_size()) else {
continue;
};
list.SetComputeRootShaderResourceView(1, r.shadow.buffer.GetGPUVirtualAddress());
list.SetComputeRootUnorderedAccessView(2, before.GetGPUVirtualAddress());
last_shadow = key;
last_size = size as u32;
}
// (What is only looked at keeps its hashes: what
// changed there is the next declared range's to land.)
card_pass(list, &r.span, size as u32, r.at, if flown && !r.picked { 2 } else { 1 });
CARD_PASSES[2].fetch_add(1, Ordering::Relaxed);
card_pass(list, &r.span, last_size, r.at, if flown && !r.picked { 2 } else { 1 });
passes += 1;
}
if passes != 0 {
CARD_PASSES[2].fetch_add(passes, Ordering::Relaxed);
}
list.Close()?;
list.cast()
@@ -7671,8 +7693,50 @@ impl HostList {
Some(gpu)
}
/// Upload memory for a table's constant buffer (`len` bytes at `src`,
/// viewed by `slot`), deduplicated within this list until the list next
/// writes title memory: repeated binds of the same `(src, len)` share one
/// upload copy and one `Step::Fill`, attaching every slot so `card_steps`
/// retargets all of them.
pub(crate) fn constant_scratch(
&self,
src: *const u8,
len: u32,
slot: (usize, u32),
) -> Option<(ID3D12Resource, u64)> {
let key = (src as usize, len as usize);
{
let mut deferred = self.deferred();
if let Some((buffer, gpu, step_idx)) = deferred.constants.get(&key).cloned() {
if let Some(Step::Fill(_, _, _, Some(to))) = deferred.copies.get_mut(step_idx) {
match to {
card_steps::FillTo::Slot(h0, i0) => {
let first = (*h0, *i0);
*to = card_steps::FillTo::Slots(vec![first, slot]);
}
card_steps::FillTo::Slots(slots) => slots.push(slot),
card_steps::FillTo::Buffer(_) => {}
}
}
return Some((buffer, gpu));
}
}
let (buffer, gpu, to) = self.scratch_held(u64::from(len))?;
let mut deferred = self.deferred();
let step_idx = deferred.copies.len();
deferred.copies.push(Step::Fill(
to as usize,
src as usize,
len as usize,
Some(card_steps::FillTo::Slot(slot.0, slot.1)),
));
deferred.constants.insert(key, (buffer.clone(), gpu, step_idx));
Some((buffer, gpu))
}
/// As [`HostList::defer_fill`], for upload memory that only `slot` (a
/// title heap's address, and the slot) shows.
#[allow(dead_code)]
pub(crate) fn defer_constants(&self, dst: *mut u8, src: *const u8, len: usize, slot: (usize, u32)) {
self.deferred()
.copies
@@ -7718,6 +7782,7 @@ impl HostList {
let mut deferred = self.deferred();
let key = (std::sync::Arc::as_ptr(shadow) as usize, address, len);
if deferred.gpu_written.insert(key) || !declare_once() {
deferred.has_gpu_write = true;
deferred.copies.push(Step::GpuWrite(shadow.clone(), address, len));
}
}
@@ -8229,21 +8294,22 @@ impl HostList {
continue;
}
Step::Run(work) | Step::Host(work, _) => {
batch.fill();
#[cfg(feature = "diagnostics")]
let started = std::time::Instant::now();
if matches!(step, Step::Run(_)) {
let is_run = matches!(step, Step::Run(_));
if is_run {
batch.fill();
batch.title_written();
// (It may write anywhere, a heap's records too.)
if crate::heap_marks::on() {
crate::heap_marks::prep_wrote();
}
}
#[cfg(feature = "diagnostics")]
let started = std::time::Instant::now();
let _step = crate::timeline::span("a step of ours");
work();
// It wrote title memory, where is not known here: the
// submission's one asking ends, later refreshes ask anew.
if matches!(step, Step::Run(_)) {
if is_run {
crate::watch::ask_once_end();
}
#[cfg(feature = "diagnostics")]
@@ -8584,6 +8650,9 @@ struct Batch {
/// Copies (by address) brought up to date ahead of the steps, and the
/// range (from, to) ([`Batch::refresh_ahead`]).
ahead: ByCopy<(usize, usize)>,
/// One-entry cache of the last hit in `ahead` (`(key, from, to)`), avoiding
/// repeated HashMap lookups for consecutive refreshes on the same buffer.
last_ahead: (usize, usize, usize),
/// `ahead` holds everything the submission refreshes
/// ([`Batch::refresh_front`]).
front: bool,
@@ -8853,6 +8922,7 @@ impl Batch {
self.placed.clear();
self.fills.clear();
self.ahead.clear();
self.last_ahead = (0, 0, 0);
self.front = false;
self.spans.clear();
self.spans_at.clear();
@@ -8917,8 +8987,15 @@ impl Batch {
}
let end = address + len;
let key = std::sync::Arc::as_ptr(shadow) as usize;
if self.ahead.get(&key).is_some_and(|&(from, to)| from <= address && end <= to) {
return;
if self.last_ahead.0 == key && key != 0 {
if self.last_ahead.1 <= address && end <= self.last_ahead.2 {
return;
}
} else if let Some(&(from, to)) = self.ahead.get(&key) {
self.last_ahead = (key, from, to);
if from <= address && end <= to {
return;
}
}
match self.index.get(&key) {
Some(&at) => {
@@ -8938,7 +9015,11 @@ impl Batch {
// From here on it is refreshed around what the shaders write. (What
// is in front of all the steps was, up to here.)
if !self.front {
self.ahead.remove(&(std::sync::Arc::as_ptr(shadow) as usize));
let key = std::sync::Arc::as_ptr(shadow) as usize;
self.ahead.remove(&key);
if self.last_ahead.0 == key {
self.last_ahead = (0, 0, 0);
}
}
let Some(at) = self.index.remove(&(std::sync::Arc::as_ptr(shadow) as usize)) else {
return;
@@ -8981,6 +9062,7 @@ impl Batch {
fn title_written(&mut self) {
self.flush();
self.ahead.clear();
self.last_ahead = (0, 0, 0);
self.textures.clear();
}
@@ -9039,32 +9121,71 @@ impl Batch {
// Those known to copy nothing are said so here, unless they are very
// many: then beside the others.
const FEW: usize = 256;
let mut spans = spans;
let many = spans.len() > FEW;
if !many {
let all = spans.len();
spans.retain(|(shadow, from, to)| !shadow.nothing_new(*from, *to - *from));
FLUSHES[2].fetch_add((all - spans.len()) as u64, Ordering::Relaxed);
}
let ahead = spans.len() > 1 && !crate::watch::kept_active();
const CHUNK: usize = 64;
let spans = std::sync::Arc::new(spans);
let dirty: Vec<usize> = if spans.len() <= FEW {
let j = crate::watch::read_journal();
let mut keep = Vec::with_capacity(spans.len());
for (i, (shadow, from, to)) in spans.iter().enumerate() {
if !shadow.nothing_new_in(&j, *from, *to - *from) {
keep.push(i);
}
}
FLUSHES[2].fetch_add((spans.len() - keep.len()) as u64, Ordering::Relaxed);
keep
} else {
let flags: std::sync::Arc<Vec<std::sync::atomic::AtomicBool>> = std::sync::Arc::new(
(0..spans.len()).map(|_| std::sync::atomic::AtomicBool::new(false)).collect(),
);
let chunks = spans.len().div_ceil(CHUNK);
let spans_ref = spans.clone();
let flags_ref = flags.clone();
crate::shadow::wide_each(chunks, move |c| {
let start = c * CHUNK;
let end = (start + CHUNK).min(spans_ref.len());
let j = crate::watch::read_journal();
let mut skipped = 0u64;
for i in start..end {
let (shadow, from, to) = &spans_ref[i];
if shadow.nothing_new_in(&j, *from, *to - *from) {
skipped += 1;
} else {
flags_ref[i].store(true, Ordering::Relaxed);
}
}
if skipped != 0 {
FLUSHES[2].fetch_add(skipped, Ordering::Relaxed);
}
});
flags
.iter()
.enumerate()
.filter_map(|(i, f)| f.load(Ordering::Relaxed).then_some(i))
.collect()
};
let ahead = dirty.len() > 1 && !crate::watch::kept_active();
if ahead {
let ranges: Vec<(usize, usize)> = spans.iter().filter(|r| r.0.asked_ahead()).map(|r| (r.1, r.2)).collect();
let ranges: Vec<(usize, usize)> = dirty
.iter()
.map(|&i| &spans[i])
.filter(|r| r.0.asked_ahead())
.map(|r| (r.1, r.2))
.collect();
crate::watch::ask_ahead(&ranges);
}
FLUSHES[3].fetch_add(spans.len() as u64, Ordering::Relaxed);
crate::shadow::wide_each(spans.len() + due.len(), move |i| {
// The textures first: they are the longer pieces.
let Some(i) = i.checked_sub(due.len()) else {
due[i].refresh();
return;
};
let (shadow, from, to) = &spans[i];
if many && shadow.nothing_new(*from, *to - *from) {
FLUSHES[2].fetch_add(1, Ordering::Relaxed);
return;
}
Self::update(shadow, *from, *to);
});
let work = dirty.len() + due.len();
if work > 0 {
crate::shadow::wide_each(work, move |i| {
// The textures first: they are the longer pieces.
let Some(i) = i.checked_sub(due.len()) else {
due[i].refresh();
return;
};
let (shadow, from, to) = &spans[dirty[i]];
Self::update(shadow, *from, *to);
});
}
if ahead {
crate::watch::ask_ahead_done();
}
@@ -9128,11 +9249,33 @@ impl Batch {
// Below this many the threads cost more than they save.
const FEW: usize = 96;
const PART: usize = 64;
const RUN_PART: usize = 16;
const MAX_RUN: usize = 256 << 10;
if self.fills.is_empty() {
return;
}
let started = std::time::Instant::now();
if self.fills.len() < FEW {
if fill_batch() && self.fills.len() >= 2 {
let mut fills = std::mem::take(&mut self.fills);
fills.sort_unstable_by(|a, b| a.1.cmp(&b.1).then(a.2.cmp(&b.2)));
// With userspace `safecopy`, only coalesce overlapping/duplicate `src`
// ranges (avoids double-copying non-overlapping adjacent fills through
// scratch while still keeping sorted-address cache locality). With
// kernel `ReadProcessMemory`, coalesce within a 4 KiB page to save syscalls.
let max_gap = if crate::safecopy::on() { None } else { Some(4096) };
let runs = coalesce_fill_runs(&fills, max_gap, MAX_RUN);
if fills.len() < FEW || runs.len() < RUN_PART || !wide_fills() {
for run in runs {
run_fill_chunk(&fills, run);
}
} else {
crate::shadow::wide_each(runs.len().div_ceil(RUN_PART), move |i| {
for &run in runs.iter().skip(i * RUN_PART).take(RUN_PART) {
run_fill_chunk(&fills, run);
}
});
}
} else if self.fills.len() < FEW || !wide_fills() {
for (dst, src, len) in self.fills.drain(..) {
copy_mapped(dst as *mut u8, src as *const u8, len, false);
}
@@ -9185,13 +9328,19 @@ impl Batch {
// and any thread woken. (Thousands of them, the heap's buffer views
// once a frame: on the threads, below.)
const FEW: usize = 256;
const CHUNK: usize = 64;
let light = crate::watch::light();
if light && self.refreshes.len() <= FEW {
let started = std::time::Instant::now();
let all = self.refreshes.len();
self.refreshes.retain(|(shadow, from, to)| !shadow.nothing_new(*from, *to - *from));
let j = crate::watch::read_journal();
self.refreshes.retain(|(shadow, from, to)| !shadow.nothing_new_in(&j, *from, *to - *from));
drop(j);
PREPARING[0].fetch_add(started.elapsed().as_micros() as u64, Ordering::Relaxed);
FLUSHES[2].fetch_add((all - self.refreshes.len()) as u64, Ordering::Relaxed);
if self.refreshes.is_empty() {
return;
}
}
// One write-watch asking for the copies that lie close together,
// not one per copy.
@@ -9215,16 +9364,49 @@ impl Batch {
let before = PREPARING[0].load(Ordering::Relaxed);
FLUSHES[3].fetch_add(self.refreshes.len() as u64, Ordering::Relaxed);
if light {
// A number to a free thread, not a job to each copy.
let refreshes = std::mem::take(&mut self.refreshes);
crate::shadow::wide_each(refreshes.len(), move |i| {
let (shadow, from, to) = &refreshes[i];
if refreshes.len() > FEW && shadow.nothing_new(*from, *to - *from) {
FLUSHES[2].fetch_add(1, Ordering::Relaxed);
return;
if refreshes.len() > FEW {
let refreshes = std::sync::Arc::new(refreshes);
let flags: std::sync::Arc<Vec<std::sync::atomic::AtomicBool>> = std::sync::Arc::new(
(0..refreshes.len()).map(|_| std::sync::atomic::AtomicBool::new(false)).collect(),
);
let chunks = refreshes.len().div_ceil(CHUNK);
let r_ref = refreshes.clone();
let f_ref = flags.clone();
crate::shadow::wide_each(chunks, move |c| {
let start = c * CHUNK;
let end = (start + CHUNK).min(r_ref.len());
let j = crate::watch::read_journal();
let mut skipped = 0u64;
for i in start..end {
let (shadow, from, to) = &r_ref[i];
if shadow.nothing_new_in(&j, *from, *to - *from) {
skipped += 1;
} else {
f_ref[i].store(true, Ordering::Relaxed);
}
}
if skipped != 0 {
FLUSHES[2].fetch_add(skipped, Ordering::Relaxed);
}
});
let dirty: Vec<usize> = flags
.iter()
.enumerate()
.filter_map(|(i, f)| f.load(Ordering::Relaxed).then_some(i))
.collect();
if !dirty.is_empty() {
crate::shadow::wide_each(dirty.len(), move |i| {
let (shadow, from, to) = &refreshes[dirty[i]];
Self::update(shadow, *from, *to);
});
}
Self::update(shadow, *from, *to);
});
} else {
crate::shadow::wide_each(refreshes.len(), move |i| {
let (shadow, from, to) = &refreshes[i];
Self::update(shadow, *from, *to);
});
}
} else {
let jobs: Vec<Box<dyn FnOnce() + Send>> = self
.refreshes
@@ -9246,6 +9428,88 @@ impl Batch {
}
}
/// Whether [`Batch::fill`] sorts fills by source address and coalesces
/// duplicate/adjacent source ranges into one staging read (`VICTORY_FILL_BATCH=0`
/// disables; on by default).
fn fill_batch() -> bool {
static ON: OnceLock<bool> = OnceLock::new();
*ON.get_or_init(|| std::env::var_os("VICTORY_FILL_BATCH").is_none_or(|v| v != "0"))
}
/// Groups `fills` (sorted by `(src, len)`) into coalesced runs
/// `(idx_start, idx_end, run_src_start, run_src_end)` with total span `<= max_run`.
/// When `max_gap` is `None`, only strictly overlapping/duplicate ranges (`src < last.3`)
/// are merged; when `Some(g)`, ranges separated by `<= g` bytes are also merged.
fn coalesce_fill_runs(
fills: &[(usize, usize, usize)],
max_gap: Option<usize>,
max_run: usize,
) -> Vec<(usize, usize, usize, usize)> {
let mut runs: Vec<(usize, usize, usize, usize)> = Vec::new();
for (idx, &(_, src, len)) in fills.iter().enumerate() {
if len == 0 {
continue;
}
let end = src.saturating_add(len);
if let Some(last) = runs.last_mut() {
let new_end = last.3.max(end);
let close = match max_gap {
None => src < last.3,
Some(g) => src <= last.3.saturating_add(g),
};
if len <= max_run
&& close
&& new_end.saturating_sub(last.2) <= max_run
&& idx == last.1
{
last.1 = idx + 1;
last.3 = new_end;
continue;
}
}
runs.push((idx, idx + 1, src, end));
}
runs
}
/// Executes one coalesced run of fills using a thread-local staging buffer
/// when multiple fills share or border the same source memory.
fn run_fill_chunk(fills: &[(usize, usize, usize)], run: (usize, usize, usize, usize)) {
thread_local! {
static SCRATCH: std::cell::RefCell<Vec<u8>> = const { std::cell::RefCell::new(Vec::new()) };
}
let slice = &fills[run.0..run.1];
if slice.len() == 1 {
let (dst, src, len) = slice[0];
copy_mapped(dst as *mut u8, src as *const u8, len, false);
return;
}
let (run_start, run_end) = (run.2, run.3);
let run_len = run_end - run_start;
let ok = SCRATCH.with_borrow_mut(|buf| {
if buf.len() < run_len {
buf.resize(run_len, 0);
}
if !read(run_start as *const u8, buf.as_mut_ptr(), run_len) {
return false;
}
for &(dst, src, len) in slice {
let off = src - run_start;
// SAFETY: `dst` is writable upload scratch of `len` bytes;
// `off + len <= run_len <= buf.len()`; non-overlapping.
unsafe {
std::ptr::copy_nonoverlapping(buf.as_ptr().add(off), dst as *mut u8, len);
}
}
true
});
if !ok {
for &(dst, src, len) in slice {
copy_mapped(dst as *mut u8, src as *const u8, len, false);
}
}
}
/// Copies title memory at submission. The ranges were checked against their
/// resources when recorded, but the title may since have unmapped pages of
/// them (tiled memory, page mappings), which read as zeros here; a title
+20 -7
View File
@@ -225,6 +225,8 @@ pub(super) enum FillTo {
/// A descriptor slot that shows the fill's memory, and nothing else does
/// (title heap, slot): it is made to show our buffer instead.
Slot(usize, u32),
/// Multiple deduplicated descriptor slots sharing the same fill.
Slots(Vec<(usize, u32)>),
/// A buffer the card can write, filled from its beginning.
Buffer(ID3D12Resource),
}
@@ -659,6 +661,8 @@ enum To {
Copy(Arc<Shadow>, usize),
/// A descriptor slot (title heap, slot).
Slot(usize, u32),
/// Multiple deduplicated descriptor slots sharing one fill.
Slots(Vec<(usize, u32)>),
/// A buffer's beginning.
Buffer(ID3D12Resource),
}
@@ -900,6 +904,7 @@ impl Host {
}
_ => match fill_to(runs, steps[i]) {
Some(FillTo::Slot(heap, index)) => To::Slot(heap, index),
Some(FillTo::Slots(slots)) => To::Slots(slots),
Some(FillTo::Buffer(buffer)) => To::Buffer(buffer),
None => continue,
},
@@ -957,7 +962,7 @@ impl Host {
match &op.to {
To::Copy(to, dst) => writes.push((&to.buffer, to.offset(*dst as u64), op.at, len)),
To::Buffer(buffer) => writes.push((buffer, 0, op.at, len)),
To::Slot(..) => {}
To::Slot(..) | To::Slots(..) => {}
}
}
record(level == 0, &own.list.list, &own.between, &reads, &writes);
@@ -972,11 +977,19 @@ impl Host {
let parts = if ops.len() < 256 { 1 } else { 8 };
crate::land::each_under(parts, &|part| {
for op in &ops {
if let To::Slot(heap, index) = &op.to
&& *index as usize / 4 % parts == part
{
// (A heap that is gone: nothing can read the slot.)
crate::descriptor::constant_slot(*heap, *index, &own.between, gpu + op.at, op.len as u32);
match &op.to {
To::Slot(heap, index) if *index as usize / 4 % parts == part => {
// (A heap that is gone: nothing can read the slot.)
crate::descriptor::constant_slot(*heap, *index, &own.between, gpu + op.at, op.len as u32);
}
To::Slots(slots) => {
for &(heap, index) in slots {
if index as usize / 4 % parts == part {
crate::descriptor::constant_slot(heap, index, &own.between, gpu + op.at, op.len as u32);
}
}
}
_ => {}
}
}
});
@@ -1023,7 +1036,7 @@ fn noted(ops: &[Op]) {
for op in ops {
let (to, dst) = match &op.to {
To::Copy(to, dst) => (to.span(), *dst),
To::Slot(..) | To::Buffer(_) => ((0, 0), 0),
To::Slot(..) | To::Slots(..) | To::Buffer(_) => ((0, 0), 0),
};
let e = noted.entry((op.len, op.from.0.span(), to)).or_default();
*e = (e.0 + 1, op.from.1, dst);
+9 -3
View File
@@ -118,7 +118,13 @@ const S_RES: &str = "VICTORY_MENU_S_RES";
/// The Series S scene sizes and the DLSS mode of each (the picture is 1920x1080). Only DLSS
/// changes it: the title's own FidelityFX path from 540 stopped it at the start (0xc0000094,
/// a division by zero in the title, 2026-11-28), so with DLSS off the scene stays at 720.
const S_MODES: [(&str, &str); 4] = [("1080", "dlaa"), ("720", "quality"), ("626", "balanced"), ("540", "performance")];
const S_MODES: [(&str, &str); 5] = [
("1080", "dlaa"),
("720", "quality"),
("626", "balanced"),
("540", "performance"),
("360", "ultraperformance"),
];
const ABOUT_S_RES: [&str; 3] = [
"THE SIZE THE GAME RENDERS AT. THE PICTURE IS 1920X1080.",
"OTHER THAN 720 NEEDS DLSS: THIS SETS ITS MODE (1080 IS",
@@ -148,7 +154,7 @@ const STAGES: &[(&str, &str)] = &[("2", "2"), ("1", "1"), ("0", "0 OFF")];
#[rustfmt::skip]
const ITEMS: &[Item] = &[
// The launcher's own choices.
Item { var: "VICTORY_MENU_DLSS", label: "DLSS", values: &[("quality", "QUALITY"), ("balanced", "BALANCED"), ("performance", "PERFORMANCE"), ("dlaa", "DLAA (NATIVE)"), ("off", "OFF")], live: false },
Item { var: "VICTORY_MENU_DLSS", label: "DLSS", values: &[("quality", "QUALITY"), ("balanced", "BALANCED"), ("performance", "PERFORMANCE"), ("ultraperformance", "ULTRA PERF"), ("dlaa", "DLAA (NATIVE)"), ("off", "OFF")], live: false },
Item { var: "VICTORY_MENU_FRAMEGEN", label: "FRAME GENERATION", values: &[("0", "OFF"), ("2", "2X"), ("3", "3X"), ("4", "4X"), ("5", "5X"), ("6", "6X (MOST)")], live: false },
// DLSS Frame Generation where it runs (RTX 40 and later), else AMD's FSR 3 (2X only).
Item { var: "VICTORY_MENU_FG_TYPE", label: "FRAME GEN TYPE", values: &[("auto", "AUTO"), ("dlss", "DLSS"), ("fsr", "FSR 3 (OLDER CARDS)")], live: false },
@@ -163,7 +169,7 @@ const ITEMS: &[Item] = &[
Item { var: "VICTORY_MENU_CONSOLE", label: "CONSOLE", values: &[("series-x", "SERIES X"), ("series-s", "SERIES S (FASTER)")], live: false },
Item { var: X_RES, label: "SERIES X PICTURE", values: &[("1440", "2560X1440"), ("1080to1440", "1080P TO 1440P"), ("4k", "3840X2160")], live: false },
// In place of SERIES X PICTURE when CONSOLE is Series S.
Item { var: S_RES, label: "SERIES S PICTURE", values: &[("1080", "1920X1080 (DLAA)"), ("720", "1280X720 (THE GAME)"), ("626", "1113X626"), ("540", "960X540 (FASTEST)")], live: false },
Item { var: S_RES, label: "SERIES S PICTURE", values: &[("1080", "1920X1080 (DLAA)"), ("720", "1280X720 (THE GAME)"), ("626", "1113X626"), ("540", "960X540 (FASTEST)"), ("360", "640X360 (ULTRA FAST)")], live: false },
// The layer's switches.
Item { var: "VICTORY_DLSS_PRESET", label: "DLSS MODEL", values: &[("", "DEFAULT"), ("k", "K"), ("j", "J"), ("m", "M"), ("l", "L")], live: false },
Item { var: "VICTORY_AMBIENT", label: "LIGHT ESTIMATE", values: &[("0.8", "0.8"), ("1", "1"), ("0.5", "0.5"), ("", "OFF")], live: false },
+3 -1
View File
@@ -122,7 +122,9 @@ static SPARE: Mutex<Vec<Memory>> = Mutex::new(Vec::new());
/// On hosts with <= 32 GiB RAM, cap the idle upload pool at 256 MiB (instead
/// of 768 MiB) so streaming bursts have more commit headroom.
fn kept() -> u64 {
if on_card() || crate::residency::limited_host_ram() {
if crate::residency::tight_host_ram() {
128 << 20
} else if on_card() || crate::residency::limited_host_ram() {
256 << 20
} else {
768 << 20
+4 -1
View File
@@ -52,12 +52,15 @@ pub(crate) fn room(memory: Option<[u64; 4]>) {
pool.reclaim(tick, limit, true);
}
if let Ok(mut pool) = STAGING.try_lock() {
let tight = crate::residency::tight_host_ram();
let staging_limit = if crate::residency::critical_commit() {
0
} else if pressure {
1
} else if tight {
2
} else {
limit
limit.min(STAGING_KEPT)
};
pool.reclaim(tick, staging_limit, true);
}
+8
View File
@@ -95,6 +95,14 @@ pub(crate) fn limited_host_ram() -> bool {
*LIMITED.get_or_init(|| memory_status().is_some_and(|s| s.ullTotalPhys <= 32 * GIB))
}
/// True on hosts with <= 20 GiB physical RAM (e.g. 16 GB laptops), where idle
/// pools (staging blocks, snapshot buffers, upload scratch, command allocators)
/// should stay lean to leave physical RAM free for Windows and avoid paging.
pub(crate) fn tight_host_ram() -> bool {
static TIGHT: OnceLock<bool> = OnceLock::new();
*TIGHT.get_or_init(|| memory_status().is_some_and(|s| s.ullTotalPhys <= 20 * GIB))
}
fn next_pressure(was: bool, physical: u64, commit: u64) -> bool {
if was {
physical < 5 * GIB || commit < 6 * GIB
+81 -18
View File
@@ -560,6 +560,19 @@ fn window_mapped_most() -> u64 {
})
}
/// Maximum VRAM budget percentage up to which windows may be placed in card
/// memory (`VICTORY_WINDOWS_VRAM_PERCENT`, 50..=95; default 80).
fn window_vram_percent() -> u64 {
static PCT: std::sync::OnceLock<u64> = std::sync::OnceLock::new();
*PCT.get_or_init(|| {
std::env::var("VICTORY_WINDOWS_VRAM_PERCENT")
.ok()
.and_then(|v| v.trim().parse().ok())
.unwrap_or(80)
.clamp(50, 95)
})
}
/// Bytes alive of windows in card memory the CPU maps.
static WINDOW_MAPPED_BYTES: AtomicU64 = AtomicU64::new(0);
@@ -572,7 +585,7 @@ fn window_mapped_for(size: u64) -> Option<(ID3D12Resource, *mut u8)> {
}
let host = host()?;
if let Some([budget, used, ..]) = host.video_memory()
&& used + size > budget / 10 * 8
&& used + size > budget * window_vram_percent() / 100
{
return None;
}
@@ -608,7 +621,7 @@ fn window_room_for(size: u64) -> Option<ID3D12Resource> {
return None;
}
if let Some([budget, used, ..]) = host.video_memory()
&& used + size > budget / 10 * 8
&& used + size > budget * window_vram_percent() / 100
{
return None;
}
@@ -1381,14 +1394,14 @@ fn snapshots_kept() -> usize {
/// the largest, and of those the largest one and the next ones up to `KEPT`
/// bytes in all.
fn give_back(v: Vec<u8>) {
const KEPT: usize = 512 << 20;
let cap: usize = if crate::residency::tight_host_ram() { 128 << 20 } else { 512 << 20 };
let mut pool = POOL.lock().unwrap_or_else(|e| e.into_inner());
pool.push(v);
pool.sort_by_key(|v| std::cmp::Reverse(v.capacity()));
let (mut kept, mut total) = (0, 0usize);
for v in pool.iter().take(snapshots_kept()) {
total = total.saturating_add(v.capacity());
if kept > 0 && total > KEPT {
if kept > 0 && total > cap {
break;
}
kept += 1;
@@ -2465,7 +2478,7 @@ fn wc_mapped_for(size: u64) -> Option<(ID3D12Resource, *mut u8)> {
}
let host = host()?;
if let Some([budget, used, ..]) = host.video_memory()
&& used + size > budget / 10 * 8
&& used + size > budget * window_vram_percent() / 100
{
return None;
}
@@ -3912,6 +3925,26 @@ impl Shadow {
}
}
/// [`Shadow::changed`] for multiple offset ranges under a single `kept` lock.
fn changed_runs(&self, runs: impl Iterator<Item = (usize, usize)>) {
if !keeps() {
return;
}
let mut runs = runs.filter(|r| r.0 < r.1).peekable();
if runs.peek().is_none() {
return;
}
let mut kept = self.kept.lock().unwrap_or_else(|e| e.into_inner());
if kept.0.is_empty() {
return;
}
for (from, to) in runs {
for piece in self.pieces(from, to) {
kept.0[piece] = false;
}
}
}
/// Whether shaders of a submission not yet copied back may be writing
/// the copy.
#[inline]
@@ -4216,6 +4249,12 @@ impl Shadow {
/// nothing, and knows it without asking anything
/// (`crate::watch::nothing_new`). `false` if it would have to ask.
pub(crate) fn nothing_new(&self, address: usize, len: usize) -> bool {
let j = crate::watch::read_journal();
self.nothing_new_in(&j, address, len)
}
/// [`Shadow::nothing_new`] using an already-held write-watch journal read guard.
pub(crate) fn nothing_new_in(&self, j: &crate::watch::JournalGuard, address: usize, len: usize) -> bool {
if self.place.is_some() {
return true;
}
@@ -4235,7 +4274,7 @@ impl Shadow {
}
let copied = self.copied.lock().unwrap_or_else(|e| e.into_inner());
let ranged = Self::ranged_in(&copied.1, from, to);
let same = crate::watch::nothing_new(from, to, start / PAGE, &copied.0, ranged);
let same = crate::watch::nothing_new_in(j, from, to, start / PAGE, &copied.0, ranged);
#[cfg(feature = "diagnostics")]
if same {
use crate::copystat::{C, add};
@@ -4255,11 +4294,15 @@ impl Shadow {
/// [`Shadow::update`] of `[from, to)` (inside the buffer) where no
/// shader writes.
fn update_free(&self, from: usize, to: usize) -> usize {
if self.watched.load(Ordering::Relaxed) != NOT_WATCHED {
let prev = self.watched.load(Ordering::Relaxed);
if prev != NOT_WATCHED {
if let Some((now, written)) = crate::watch::writes(from, to, true) {
// (A range whose blocks rest after a write has no guard now.)
let guarded = crate::watch::guarded(from, to) || self.watched.load(Ordering::Relaxed) == GUARDED;
self.watched.store(if guarded { GUARDED } else { 1 }, Ordering::Relaxed);
let guarded = prev == GUARDED || crate::watch::guarded(from, to);
let next = if guarded { GUARDED } else { 1 };
if next != prev {
self.watched.store(next, Ordering::Relaxed);
}
let copied = self.copy_stale(from, to, now, &written);
self.refresh_check(from, to);
#[cfg(feature = "diagnostics")]
@@ -4393,8 +4436,14 @@ impl Shadow {
if let Some((first, known)) = run {
runs.push(((first * PAGE).max(from), ((last + 1) * PAGE).min(to), known));
}
let runs = by_parts(runs, &again_at, &crate::watch::parts_written(&again_at));
let bytes = self.take_all(runs);
let bytes = if runs.is_empty() {
0
} else if again_at.is_empty() {
self.take_all(runs)
} else {
let runs = by_parts(runs, &again_at, &crate::watch::parts_written(&again_at));
self.take_all(runs)
};
if crate::watch::light() {
// All of the range is in the copy as of this asking.
let ranged = &mut copied.1;
@@ -4532,6 +4581,7 @@ impl Shadow {
};
let whole = !known && card.before.get().is_none();
let start = self.start as usize;
let (mut send0, mut send1, mut send2, mut send3) = (0u64, 0u64, 0u64, 0u64);
TITLE.with_borrow_mut(|title| {
title.resize(PAGE, 0);
let mut at = from;
@@ -4546,24 +4596,37 @@ impl Shadow {
// refresh lie apart.
let held = unsafe { std::slice::from_raw_parts_mut(self.data.add(at - start), n) };
let was = crate::host::upcheck::on().then(|| held.to_vec());
let runs = if whole { vec![(0, n)] } else { dword_runs(at, held, title, 0) };
let runs = if whole { vec![(0, n)] } else { word_runs(at, held, title) };
let mut page_bytes = 0u64;
for &(a, len) in &runs {
held[a..a + len].copy_from_slice(&title[a..a + len]);
self.changed(at - start + a, at - start + a + len);
page_bytes += len as u64;
}
if !runs.is_empty() {
self.changed_runs(runs.iter().map(|&(a, len)| (at - start + a, at - start + a + len)));
self.card_changed_runs(runs.iter().map(|&(a, len)| (at - start + a, at - start + a + len)));
}
self.card_changed_runs(runs.iter().map(|&(a, len)| (at - start + a, at - start + a + len)));
if let Some(was) = was {
crate::host::upcheck::note(self.id, at - start, &was, held);
}
SEND[0].fetch_add(n as u64, Ordering::Relaxed);
send0 += n as u64;
if runs.is_empty() {
SEND[1].fetch_add(n as u64, Ordering::Relaxed);
send1 += n as u64;
} else {
send2 += page_bytes;
send3 += runs.len() as u64;
}
SEND[2].fetch_add(runs.iter().map(|r| r.1 as u64).sum(), Ordering::Relaxed);
SEND[3].fetch_add(runs.len() as u64, Ordering::Relaxed);
at += n;
}
});
SEND[0].fetch_add(send0, Ordering::Relaxed);
if send1 != 0 {
SEND[1].fetch_add(send1, Ordering::Relaxed);
}
if send2 != 0 {
SEND[2].fetch_add(send2, Ordering::Relaxed);
SEND[3].fetch_add(send3, Ordering::Relaxed);
}
to - from
}
+37 -20
View File
@@ -110,12 +110,22 @@ struct Last {
/// first checks, and after the hash found a change the guard had not
/// seen ([`hot_textures`]). 0: not checked under the guard yet.
hot_until: u64,
/// Cached negative result from write-watch (`writes(..., false)` returned
/// `None` or the range is already guarded view memory), avoiding a
/// guaranteed-failing `GetWriteWatch` syscall on every refresh.
not_watched: bool,
}
/// Frames a guarded texture is hashed at every check from its first check,
/// and after the hash found a change the guard did not see.
/// Frames a guarded texture is hashed at every check after the hash found
/// a change the guard did not see.
const HOT_FRAMES: u64 = 64;
/// Initial hot frames on a guarded texture's very first check: long enough
/// to catch ring-of-3 animated/video textures (which then promote to full
/// [`HOT_FRAMES`] via `found_blind`), without forcing hundreds of megabytes
/// of static cutscene/world textures to be re-hashed every frame for 64 frames.
const START_HOT_FRAMES: u64 = 4;
/// Whether a guarded texture whose memory the hash found changed although
/// the guard saw no write is hashed at every check for a while
/// ([`HOT_FRAMES`]), not every eighth frame. A title that writes such a
@@ -1449,20 +1459,26 @@ impl Staging {
if alone && !exact && last.hash.is_some() {
return 0;
}
if !alone && let Some((now, written)) = waited(1, || crate::watch::writes(start, start + size, false)) {
if !exact && last.asked != 0 && written.iter().all(|&(_, w)| w <= last.asked) {
return 0;
if !alone && !last.not_watched {
if crate::watch::guarded(start, start + size) {
last.not_watched = true;
} else if let Some((now, changed)) = waited(1, || crate::watch::writes_since(start, start + size, false, last.asked)) {
if !exact && !changed {
return 0;
}
last.asked = now;
// Read through the copy, which stands unmapped pages: memory of
// big pools is too slow to ask page by page.
with_read(size, |read| {
crate::host::copy_mapped(read.as_mut_ptr(), self.memory, size, false);
self.detile(read);
});
#[cfg(feature = "diagnostics")]
crate::copystat::add(crate::copystat::C::TexWatched, size as u64);
return size;
} else {
last.not_watched = true;
}
last.asked = now;
// Read through the copy, which stands unmapped pages: memory of
// big pools is too slow to ask page by page.
with_read(size, |read| {
crate::host::copy_mapped(read.as_mut_ptr(), self.memory, size, false);
self.detile(read);
});
#[cfg(feature = "diagnostics")]
crate::copystat::add(crate::copystat::C::TexWatched, size as u64);
return size;
}
// View memory has no write-watch, and a texture there was hashed
// whole at every check: 229 MB and 51 ms a frame in a gameplay view
@@ -1479,19 +1495,20 @@ impl Staging {
let mut blind = false;
if !alone
&& *GUARD.get_or_init(|| std::env::var_os("VICTORY_TEXTURE_GUARD").is_none_or(|v| v != "0"))
&& let Some((now, written)) = waited(1, || crate::watch::writes(start, start + size, true))
&& let Some((now, changed)) = waited(1, || crate::watch::writes_since(start, start + size, true, last.asked))
{
const HASH_EVERY: u64 = 8;
let unwritten = last.asked != 0 && written.iter().all(|&(_, w)| w <= last.asked);
let unwritten = !changed;
last.asked = now;
let frame = crate::frame::current();
let turn = frame
.wrapping_add((start >> 16) as u64)
.is_multiple_of(HASH_EVERY);
// A texture starts hot: one written that way from its first
// frames on changes before the hash has ever caught it.
// A texture starts hot briefly: one written through an alias view
// from its first frames on changes within 1-3 frames and is then
// promoted to full `HOT_FRAMES` by `found_blind`.
if last.hot_until == 0 {
last.hot_until = frame + HOT_FRAMES;
last.hot_until = frame + START_HOT_FRAMES;
}
let hot = hot_textures() && frame < last.hot_until;
if !exact && unwritten && !turn && !hot {
+145 -61
View File
@@ -164,6 +164,14 @@ fn journal_mut() -> std::sync::RwLockWriteGuard<'static, Journal> {
waited(2, || JOURNAL.write().unwrap_or_else(|e| e.into_inner()))
}
/// Shared read guard over the write-watch journal so a batch of `nothing_new`
/// checks can acquire the lock once instead of per buffer.
pub(crate) struct JournalGuard(std::sync::RwLockReadGuard<'static, Journal>);
pub(crate) fn read_journal() -> JournalGuard {
JournalGuard(journal())
}
/// Since the last line: waits and nanoseconds of waiting, of all threads, for
/// the ranges held ([`ASKING`]), the journal to read it, the journal to note
/// in it, and the guards (faults of the title's among them).
@@ -367,17 +375,33 @@ pub(crate) fn ask_ahead(ranges: &[(usize, usize)]) {
if kept_active() {
return;
}
let skip_guarded = light();
let mut pieces: Vec<(usize, usize)> = ranges
.iter()
// Not view memory known by its bits: the kernel would refuse the
// asking (and, asked together with others, theirs).
// Not view memory known by its bits or guarded read-only: the kernel
// would refuse the asking (and, asked together with others, theirs).
.filter(|r| r.0 < r.1 && !published(r.0, r.1))
.map(|&(start, end)| (start / PAGE, end.div_ceil(PAGE)))
.filter(|&(first, last)| !(skip_guarded && PROTECTED.any(first, last)))
.collect();
if pieces.len() < 2 {
return;
}
pieces.sort_unstable();
// Collapse duplicate or fully-contained page spans before asking.
let mut write = 0usize;
for read in 1..pieces.len() {
let (a, b) = pieces[read];
if a >= pieces[write].0 && b <= pieces[write].1 {
continue;
}
write += 1;
pieces[write] = (a, b);
}
pieces.truncate(write + 1);
if pieces.len() < 2 {
return;
}
let _all = Asking::hold_all();
let (mut asked, mut written) = (Vec::new(), Vec::new());
let mut i = 0;
@@ -392,7 +416,7 @@ pub(crate) fn ask_ahead(ranges: &[(usize, usize)]) {
last = last.max(pieces[k].1);
k += 1;
}
ask_run(&pieces[i..k], &mut asked, &mut written);
ask_run(&pieces[i..k], &mut asked, &mut written, false);
i = k;
}
sort_merge_ahead(&mut asked);
@@ -578,63 +602,63 @@ pub(crate) fn once() -> bool {
}
/// With [`once`]: asks about `ranges` (everything a submission's lists
/// refresh) as [`ask_ahead`] does, and lets that asking stand until
/// [`ask_once_end`].
/// refresh) in a single pass (merged runs and isolated ranges together) and
/// lets that asking stand until [`ask_once_end`].
pub(crate) fn ask_once(ranges: &[(usize, usize)]) {
if !once() {
return;
}
ask_once_end();
ask_ahead(ranges);
ask_rest(ranges);
}
/// [`ask_once`] after its [`ask_ahead`]: what that left to `writes`, and the
/// asking stands.
fn ask_rest(ranges: &[(usize, usize)]) {
let _all = Asking::hold_all();
let mut ahead = {
let mut j = journal_mut();
std::mem::take(&mut j.ahead)
};
// `ask_ahead` leaves a range that lies alone to `writes`, which asks
// once per flush: with one asking for the submission that was every
// such range asked again at each of its 70 flushes (run 76: 2,300
// askings a frame with the switch on, as without it). They are asked
// here, once; what is not write-watched stays with `writes`.
let mut written = Vec::new();
let mut extra = Vec::new();
for &(start, end) in ranges {
if start >= end || published(start, end) {
let skip_guarded = light();
let mut pieces: Vec<(usize, usize)> = ranges
.iter()
.filter(|r| r.0 < r.1 && !published(r.0, r.1))
.map(|&(start, end)| (start / PAGE, end.div_ceil(PAGE)))
.filter(|&(first, last)| !(skip_guarded && PROTECTED.any(first, last)))
.collect();
if pieces.is_empty() {
return;
}
pieces.sort_unstable();
// Collapse exact duplicates and fully-contained page spans in O(N).
let mut write = 0usize;
for read in 1..pieces.len() {
let (a, b) = pieces[read];
if a >= pieces[write].0 && b <= pieces[write].1 {
continue;
}
let (first, last) = (start / PAGE, end.div_ceil(PAGE));
if !ahead_contains(&ahead, first, last)
&& !extra.iter().any(|&(a, b)| a <= first && last <= b)
&& let Some(pages) = kernel_written(first, last)
write += 1;
pieces[write] = (a, b);
}
pieces.truncate(write + 1);
let _all = Asking::hold_all();
let (mut asked, mut written) = (Vec::new(), Vec::new());
let mut i = 0;
while i < pieces.len() {
let first = pieces[i].0;
let mut last = pieces[i].1;
let mut k = i + 1;
while k < pieces.len()
&& pieces[k].0 <= last + AHEAD_GAP
&& last.max(pieces[k].1) - first <= AHEAD_MAX
{
written.extend(pages);
extra.push((first, last));
last = last.max(pieces[k].1);
k += 1;
}
ask_run(&pieces[i..k], &mut asked, &mut written, true);
i = k;
}
if !extra.is_empty() {
ahead.extend(extra);
sort_merge_ahead(&mut ahead);
}
sort_merge_ahead(&mut asked);
note_hot(&written);
let mut j = journal_mut();
// A number of its own, and the one this asking stands under: between
// the two parts another thread may have asked about a range of the
// second, copied it, and the title written it since. Under the first
// part's number that write was older than the copy, and never copied.
let now = next_asking();
j.ahead_asked = now;
for (page, parts) in written {
j.note(page, parts, now);
}
let kept = !ahead.is_empty();
let kept = !asked.is_empty();
j.kept = kept;
j.ahead = ahead;
j.ahead = asked;
AHEAD_KEPT.store(kept, std::sync::atomic::Ordering::Release);
}
@@ -686,10 +710,11 @@ fn elsewhere(at: usize, len: usize) -> Vec<(usize, Vec<usize>)> {
/// One kernel asking for `pieces` (page ranges in order); by halves if it
/// fails, as a run across two reservations or into memory that is not
/// write-watched does. A piece alone is left to [`writes`]. Adds what was
/// asked to `asked` and the pages found written to `written`.
fn ask_run(pieces: &[(usize, usize)], asked: &mut Vec<(usize, usize)>, written: &mut Vec<(usize, u16)>) {
if pieces.len() < 2 {
/// write-watched does. When `ask_single` is false, a piece alone is left to
/// [`writes`]. Adds what was asked to `asked` and the pages found written to
/// `written`.
fn ask_run(pieces: &[(usize, usize)], asked: &mut Vec<(usize, usize)>, written: &mut Vec<(usize, u16)>, ask_single: bool) {
if pieces.is_empty() || (!ask_single && pieces.len() < 2) {
return;
}
let first = pieces[0].0;
@@ -699,9 +724,12 @@ fn ask_run(pieces: &[(usize, usize)], asked: &mut Vec<(usize, usize)>, written:
asked.push((first, last));
return;
}
if pieces.len() < 2 {
return;
}
let (a, b) = pieces.split_at(pieces.len() / 2);
ask_run(a, asked, written);
ask_run(b, asked, written);
ask_run(a, asked, written, ask_single);
ask_run(b, asked, written, ask_single);
}
/// What [`writes`] would say of `[start, end)` from the journal alone, if
@@ -729,7 +757,13 @@ pub(crate) fn writes(start: usize, end: usize, guarded: bool) -> Option<(u64, Ve
materialize(start, end.saturating_sub(start));
}
let (first, last) = (start / PAGE, end.div_ceil(PAGE));
let of = |j: &Journal| -> Vec<(usize, u64)> { j.written.range(first..last).map(|(&p, &w)| (p, w)).collect() };
let of = |j: &Journal| -> Vec<(usize, u64)> {
if first + 1 == last {
j.written.get(&first).map(|&w| vec![(first, w)]).unwrap_or_default()
} else {
j.written.range(first..last).map(|(&p, &w)| (p, w)).collect()
}
};
// Asked ahead with the submission's other ranges: the journal has it.
let ahead = |j: &Journal| ahead_contains(&j.ahead, first, last).then(|| (j.ahead_asked, of(j)));
if let Some(known) = ahead(&journal()) {
@@ -800,29 +834,79 @@ pub(crate) fn writes(start: usize, end: usize, guarded: bool) -> Option<(u64, Ve
Some(answer)
}
/// Like [`writes`], but returns `(asking, changed_since)` without allocating a
/// per-page vector on the hot fast paths (`ahead` or `published`).
pub(crate) fn writes_since(start: usize, end: usize, guarded: bool, since: u64) -> Option<(u64, bool)> {
if guarded && soft().is_none() {
materialize(start, end.saturating_sub(start));
}
let (first, last) = (start / PAGE, end.div_ceil(PAGE));
let newer = |j: &Journal| -> bool {
if since == 0 {
return true;
}
if first + 1 == last {
j.written.get(&first).is_some_and(|&w| w > since)
} else {
j.written.range(first..last).any(|(_, &w)| w > since)
}
};
{
let j = journal();
if ahead_contains(&j.ahead, first, last) {
return Some((j.ahead_asked, newer(&j)));
}
}
if guarded && published(start, end) {
#[cfg(feature = "diagnostics")]
{
tally(2, 1);
crate::faultbook::note(crate::faultbook::What::Known, first, last, 0);
}
let j = journal();
return Some((next_asking(), newer(&j)));
}
let (now, written) = writes(start, end, guarded)?;
let changed = since == 0 || written.iter().any(|&(_, w)| w > since);
Some((now, changed))
}
/// Whether nothing of `[start, end)` was written that a copy with the notes
/// `copied` (the asking after which each page from page `base` on was taken)
/// and `ranged` (the asking after which a range that holds this one was
/// taken whole, or 0) does not hold, as [`writes`] would answer with nothing
/// asked: the submission's asking covers the range, or its blocks are known
/// by their bits. `false` if something would have to be asked.
pub(crate) fn nothing_new(start: usize, end: usize, base: usize, copied: &[u64], ranged: u64) -> bool {
pub(crate) fn nothing_new_in(j: &JournalGuard, start: usize, end: usize, base: usize, copied: &[u64], ranged: u64) -> bool {
let (first, last) = (start / PAGE, end.div_ceil(PAGE));
// The bits first, then the journal, as in `writes`.
let known = published(start, end);
#[cfg(feature = "diagnostics")]
if known {
crate::faultbook::note(crate::faultbook::What::Known, first, last, 1);
}
let j = journal();
if !known && !ahead_contains(&j.ahead, first, last) {
let covered = {
#[cfg(feature = "diagnostics")]
{
let known = published(start, end);
if known {
crate::faultbook::note(crate::faultbook::What::Known, first, last, 1);
}
known || ahead_contains(&j.0.ahead, first, last)
}
#[cfg(not(feature = "diagnostics"))]
{
ahead_contains(&j.0.ahead, first, last) || published(start, end)
}
};
if !covered {
return false;
}
let Some(taken) = first.checked_sub(base).and_then(|from| copied.get(from..last - base)) else {
return false;
};
(ranged != 0 || taken.iter().all(|&at| at != 0))
&& j.written.range(first..last).all(|(&page, &write)| write <= taken[page - first].max(ranged))
if ranged == 0 && taken.iter().any(|&at| at == 0) {
return false;
}
if first + 1 == last {
j.0.written.get(&first).is_none_or(|&write| write <= taken[0].max(ranged))
} else {
j.0.written.range(first..last).all(|(&page, &write)| write <= taken[page - first].max(ranged))
}
}
impl Tracked {
@@ -3750,7 +3834,7 @@ mod tests {
let (copied, _) = writes(p, p + 4 * PAGE, false).expect("watched");
// SAFETY: committed pages of ours.
unsafe { ((p + PAGE) as *mut u8).write_volatile(1) };
ask_rest(&ranges);
ask_once(&ranges);
let last = journal().written.get(&(p / PAGE + 1)).copied();
ask_once_end();
assert!(last.is_some_and(|last| last > copied), "{last:?} is not after {copied}");
+190
View File
@@ -0,0 +1,190 @@
# Troubleshooting Guide (6 GB VRAM / 16 GB RAM & Windows)
> Back to main setup guide: **[README.md](../README.md)** · Detailed memory notes: **[windows-memory.md](windows-memory.md)** · DLSS/FG details: **[dlss.md](dlss.md)**
## Quick Jump
- [1. Out of Memory / Crashes on 16 GB RAM (32–48 GB SSD Pagefile Setup)](#1-out-of-memory--crashes-on-16-gb-ram-3248-gb-ssd-pagefile-setup)
- [2. Wrong or Broken F1 Settings (How to Reset)](#2-wrong-or-broken-f1-settings-how-to-reset)
- [3. Graphics & Lighting Issues (Blinding Sun, Indoor Flashing, White Dots, Blurry Image, Missing Heads)](#3-graphics--lighting-issues)
- [4. Low FPS, Stuttering, Input Lag, & Laptop Thermal Throttling](#4-low-fps-stuttering-input-lag--laptop-thermal-throttling)
- [5. DLSS or FSR 3 Frame Generation Not Working](#5-dlss-or-fsr-3-frame-generation-not-working)
- [6. Build, Git Pull, Windows 10, & Launch Errors](#6-build-git-pull-windows-10--launch-errors)
- [7. Shader Preloading (`-Preload`) & Pop-In in New Areas](#7-shader-preloading--pop-in-in-new-areas)
- [8. Collecting Logs for Bug Reports](#8-collecting-logs-for-bug-reports)
---
## 1. Out of Memory / Crashes on 16 GB RAM (32–48 GB SSD Pagefile Setup)
Open-world texture and buffer streaming temporarily reserves more virtual commit than 16 GB of physical RAM. If Windows' pagefile is too small, the emulator will crash with `E_OUTOFMEMORY` or exit during loading.
### Step-by-Step: Set a 32–48 GB Custom SSD Pagefile
1. Press **`Win + R`**, type **`sysdm.cpl`**, and press **Enter**.
2. Open the **Advanced** tab → under **Performance**, click **Settings…**.
3. Open the **Advanced** tab → under **Virtual memory**, click **Change…**.
4. Uncheck **Automatically manage paging file size for all drives**.
5. Select your fastest **SSD** (C: or D: with at least 60 GB free).
6. Select **Custom size**:
- **Initial size (MB):** `32768` *(32 GB)*
- **Maximum size (MB):** `49152` *(48 GB)*
7. Click **Set** → **OK** → **OK** → **Restart your PC**.
### Verify It Worked
- Open **Task Manager** (`Ctrl + Shift + Esc`) → **Performance** → **Memory**.
- Check **Committed**: the right-hand limit should now show **48–64 GB** (16 GB RAM + 32–48 GB pagefile).
- Before launching, close heavy background apps (Chrome/Edge tabs, Discord, IDEs) to maximize free physical RAM.
---
## 2. Wrong or Broken F1 Settings (How to Reset)
Changes saved in the **F1** menu are written to `victory-settings.txt` and **override the launcher script on every future launch**. If you accidentally turned off lighting, broke resolution, or switched to blurry settings:
- **In-game (easiest):** Press **`F1`**, scroll to **`RESET ALL TO PLAY DEFAULTS`**, and press **Enter**. *(Do NOT press `SAVE AND RESTART NOW` if you want to discard bad changes.)*
- **Outside the game:** Delete the saved settings file and relaunch:
```powershell
Remove-Item "$env:LOCALAPPDATA\victory\victory-settings.txt" -ErrorAction SilentlyContinue
# If you set VICTORY_HOME (for example D:\victory):
Remove-Item "$env:VICTORY_HOME\victory-settings.txt" -ErrorAction SilentlyContinue
```
---
## 3. Graphics & Lighting Issues
### Pitch-black character / dark rooms indoors with glowing eyes
- **Cause:** `LIGHT ESTIMATE` (`VICTORY_AMBIENT`) and/or `REFLECTION ESTIMATE` (`VICTORY_AMBIENT_SPECULAR`) was saved as OFF in `victory-settings.txt`.
- **Fix:** Reset F1 settings to defaults (see [Section 2](#2-wrong-or-broken-f1-settings-how-to-reset)). `play-6gb.ps1` uses `VICTORY_AMBIENT=0.65` and `VICTORY_AMBIENT_SPECULAR=1`.
### Sunlight looks blinding / overexposed
- **Cause:** `VICTORY_AMBIENT` set too high (`0.8`–`1.0`).
- **Fix:** Lower **`LIGHT ESTIMATE`** in F1 (or set `VICTORY_AMBIENT=0.65` / `0.55`).
### Indoor rooms flashing / strobing bright and dark
- **Cause:** `VICTORY_AMBIENT_ONCE=1` can oscillate frame-to-frame indoors where there is little direct light.
- **Fix:** Do **not** set `VICTORY_AMBIENT_ONCE=1`. Use the default `play-6gb.ps1` settings (`VICTORY_AMBIENT=0.65`, `VICTORY_AMBIENT_ONCE` unset).
### White dots / specular fireflies / violet tint
- **Cause:** Skipping screen-probe or reflection shaders via extra hashes in `VICTORY_LEAVE_OUT`.
- **Fix:** Only leave out the 2 safe passes (`VICTORY_LEAVE_OUT=02384a60fda6f2d0,731a39171b568298`), which is already default in `play-6gb.ps1`. If shiny surfaces still show bright speckles, toggle **`REFLECTION ESTIMATE`** in F1.
### Image looks very blurry or textures look muddy
- **Cause:** Running `640x360` DLSS Ultra Performance (`-Dlss ultraperformance`) and/or Quarter textures (`-DropMips 2`).
- **Fix:** Use the sharp 1080p default (`960x540` DLSS Performance + Half textures):
```powershell
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe' -Dlss performance -DropMips 1
```
You can also change **`SERIES S PICTURE`** (`960X540` / `1113X626` / `1280X720`) and **`TEXTURE SCALE (VRAM)`** (`HALF (6GB GPU)`) in F1.
### Missing character heads or disappearing geometry
- **Cause:** `VICTORY_THIN=1` (`THIN LISTS = 1` in F1) can drop geometry/heads on some builds and increases RAM usage on 16 GB PCs.
- **Fix:** Keep **`THIN LISTS`** set to **`0`** (`VICTORY_THIN=0`, default in `play-6gb.ps1`).
### Dark/blocky patches on water
- **Cause:** `WATER LIGHT` turned off, or outdated shader cache from an older build.
- **Fix:** Keep **`WATER LIGHT: ON`** in F1 (`VICTORY_WATER_LIGHT=1`).
---
## 4. Low FPS, Stuttering, Input Lag, & Laptop Thermal Throttling
### Laptop FPS starts fine (~10–12 real / 20–24 FG) then drops after 15–20 minutes
- **Cause:** Thermal throttling — once a gaming laptop heatsink saturates at **85–86 °C**, CPU turbo clocks drop by 30–40%, directly lowering FPS.
- **Fix:**
- Always play plugged into **AC power**.
- Switch your OEM control app (Lenovo Vantage / Armoury Crate / NitroSense / OMEN) to **Performance Mode** (`Fn + Q`) with **Max / Performance fan curve**.
- Elevate the back of the laptop 1–2 cm (or use a cooling pad) so bottom intake vents breathe freely.
### Low FPS on Intel 12th–14th Gen hybrid CPUs (P-cores + E-cores)
- **Cause:** Pinning worker threads exclusively to P-cores (`VICTORY_FAST_CORES=2`) starves the submission and recording threads on 4P+4E / 6P+4E CPUs.
- **Fix:** Keep **`VICTORY_FAST_CORES=0`** (already default in `play-6gb.ps1` — typically +13% to +16% real FPS on hybrid CPUs).
### Stuttering while roaming on 6 GB VRAM GPUs
- **Cause:** VRAM exceeding your DXGI local budget (~5.0–5.2 GB on 6 GB cards), causing Windows (WDDM) to spill textures over PCIe into system RAM.
- **Fix:**
- Press **`F3`** to watch the `VRAM X.X / Y.Y GB` readout — keep usage comfortably below the budget (`4.2–4.8 GB`).
- Keep `DropMips=1` with `WINDOWS_BAR_MB=128–256` (default in `play-6gb.ps1`), or drop to `-DropMips 2` (`QUARTER` in F1) on 4 GB cards.
- Ensure `VICTORY_SLOT_EVICT_PERCENT` (`92`) stays strictly higher than `VICTORY_TEXTURE_ROOM_PERCENT` (`82–85`) so eviction doesn't thrash every second.
### Sluggish controls / input lag with Frame Generation ON
- **Cause:** Frame Generation adds ~1 frame of presentation latency (noticeable when base real FPS is ~10 fps).
- **Fix:** Launch with **`-NoFrameGen`** or set **`FRAME GENERATION: OFF`** in F1 for lowest input latency:
```powershell
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe' -NoFrameGen
```
---
## 5. DLSS or FSR 3 Frame Generation Not Working
- **Missing DLLs:** Make sure you ran the one-time download scripts from inside the repository folder:
```powershell
.\Get-NVIDIA-DLSS.cmd
.\Get-AMD-FSR.cmd
```
- **Window not focused:** Both DLSS FG and FSR 3 FG only generate interpolated frames while the game window is the active focused window.
- **RTX 20 / 30 or AMD / Intel GPU:** Use **AMD FSR 3 (`-FgType fsr`, default in `play-6gb.ps1`)** for 2X Frame Generation. Native DLSS Frame Generation (`-FgType dlss`) requires **RTX 40 / 50** plus **Hardware-Accelerated GPU Scheduling (HAGS)** enabled in *Windows Settings → System → Display → Graphics → Default graphics settings*.
- **Do not enable `MFG UNLOCKER` on RTX 20/30:** Multi-Frame Generation unlocker only applies to RTX 40/50 DLSS FG.
---
## 6. Build, Git Pull, Windows 10, & Launch Errors
### PowerShell says "running scripts is disabled on this system"
Always launch with `-ExecutionPolicy Bypass`:
```powershell
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe'
```
### `cargo build` fails with `linker 'link.exe' not found` or missing Windows SDK
1. Open **Visual Studio Installer** → **Modify** Visual Studio Build Tools.
2. Check **"Desktop development with C++"** (ensure **MSVC v143 build tools** and **Windows 10/11 SDK** are checked on the right).
3. Install, close PowerShell, open a **new** PowerShell window, and retry.
### Ran `git pull`, but nothing changed in-game
`scripts\play-6gb.ps1` only builds automatically when `target\release\victory.exe` does not exist yet. After pulling new code, always rebuild:
```powershell
git pull origin main
cargo build --release --locked -j 4 -p victory
```
### Windows 10 DX12 / Shader Model 6.6 error on startup
Run the Agility SDK helper script once and update your GPU driver:
```powershell
powershell -ExecutionPolicy Bypass -File scripts\get-d3d12.ps1
```
### C: drive running out of disk space (shader cache / saves)
Move caches, saves, settings, and logs to another drive (e.g. `D:\victory`) once, then open a new PowerShell window:
```powershell
setx VICTORY_HOME D:\victory
```
### "Game file (.exe) not found"
Wrap paths containing spaces in single quotes:
```powershell
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\My Folder\your.exe'
```
---
## 7. Shader Preloading (`-Preload`) & Pop-In in New Areas
- Every shader translated during gameplay is automatically cached on disk (`%LOCALAPPDATA%\victory\cache\shaders` or `$env:VICTORY_HOME\cache\shaders`), so areas you have already visited load cleanly on future runs.
- When entering **brand-new areas** for the first time, new shaders compile in the background (capped at 50 ms/frame by `VICTORY_PIPELINE_WAIT_MS=50` to avoid 500 ms freezes, which can briefly cause objects to pop in).
- To translate all shaders ahead of time once (~10–20 minutes on a laptop CPU, eliminates new-area pop-in; does not change steady FPS in already-cached areas):
```powershell
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe' -Preload
```
Or select **`PRELOAD SHADERS (RESTARTS THE GAME)`** in the F1 menu.
---
## 8. Collecting Logs for Bug Reports
If you hit a crash, freeze, or graphical bug, capture a log with `-LogFile` and share the last ~100 lines along with your CPU, GPU, RAM, Windows version, and a screenshot of the **`F3`** stats panel:
```powershell
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe' -LogFile D:\victory.log
```
+35 -23
View File
@@ -2,16 +2,17 @@
.SYNOPSIS
Portable launcher tuned for 6-8 GB VRAM GPUs and 16 GB RAM PCs (windowed by default).
.EXAMPLE
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\Games\MyDump\game_scarlett_master.exe'
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe'
.EXAMPLE
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\Games\MyDump\game_scarlett_master.exe' -FrameGen -Output '1664x936'
powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe' -NoFrameGen
#>
param(
[string]$Exe = '',
[ValidateSet('1080', '936', '720')][string]$Output = '1080',
[ValidateSet('performance', 'balanced', 'quality', 'dlaa', 'off')][string]$Dlss = 'performance',
[ValidateSet('ultraperformance', 'performance', 'balanced', 'quality', 'dlaa', 'off')][string]$Dlss = 'performance',
[ValidateRange(0, 2)][int]$DropMips = 1,
[switch]$FrameGen,
[switch]$NoFrameGen,
[ValidateSet('fsr', 'dlss', 'auto')][string]$FgType = 'fsr',
[ValidateRange(2, 6)][int]$FrameGenX = 2,
[switch]$Preload,
@@ -28,20 +29,24 @@ $menuFile = Join-Path $homeDir 'victory-settings.txt'
$slDir = if ($env:VICTORY_STREAMLINE_DIR) { $env:VICTORY_STREAMLINE_DIR } else { Join-Path $repo 'nvidia-sdk\Streamline\bin\x64' }
$fxDir = if ($env:VICTORY_FIDELITYFX_DIR) { $env:VICTORY_FIDELITYFX_DIR } else { Join-Path $repo 'amd-sdk\FidelityFX\bin' }
# Resolve title executable from -Exe, VICTORY_GAME_DIR, or victory.toml
if (-not $Exe -and $env:VICTORY_GAME_DIR) {
$Exe = Join-Path $env:VICTORY_GAME_DIR 'game_scarlett_master.exe'
# Resolve game file (.exe) from -Exe, VICTORY_GAME_DIR, or victory.toml
if (-not $Exe -and $env:VICTORY_GAME_DIR -and (Test-Path -LiteralPath $env:VICTORY_GAME_DIR)) {
$cand = Get-ChildItem -LiteralPath $env:VICTORY_GAME_DIR -Filter '*.exe' -File -ErrorAction SilentlyContinue | Sort-Object Length -Descending | Select-Object -First 1
if ($cand) { $Exe = $cand.FullName }
}
if (-not $Exe) {
$toml = Join-Path $repo 'victory.toml'
if (Test-Path -LiteralPath $toml) {
$m = Select-String -Path $toml -Pattern '^\s*game_dir\s*=\s*"([^"]+)"' | Select-Object -First 1
if ($m) { $Exe = Join-Path $m.Matches[0].Groups[1].Value 'game_scarlett_master.exe' }
if ($m -and (Test-Path -LiteralPath $m.Matches[0].Groups[1].Value)) {
$cand = Get-ChildItem -LiteralPath $m.Matches[0].Groups[1].Value -Filter '*.exe' -File -ErrorAction SilentlyContinue | Sort-Object Length -Descending | Select-Object -First 1
if ($cand) { $Exe = $cand.FullName }
}
}
}
if (-not $Exe -or -not (Test-Path -LiteralPath $Exe)) {
Write-Host 'Title executable not found. Pass it with -Exe:'
Write-Host " powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'C:\Path\To\game_scarlett_master.exe'"
Write-Host 'Game file (.exe) not found. Pass it with -Exe:'
Write-Host " powershell -ExecutionPolicy Bypass -File scripts\play-6gb.ps1 -Exe 'D:\path\to\your.exe'"
exit 1
}
@@ -72,19 +77,19 @@ if (Test-Path -LiteralPath $menuFile) {
$seriesS = $true
$res = '1080to1440'
$sRes = '540'
$sRes = if ($Dlss -eq 'ultraperformance') { '360' } elseif ($Dlss -eq 'balanced') { '626' } elseif ($Dlss -eq 'quality') { '720' } elseif ($Dlss -eq 'dlaa') { '1080' } else { '540' }
$dlssMode = $Dlss
$fgOn = [bool]$FrameGen
$fgOn = if ($NoFrameGen) { $false } else { $true }
$timesWanted = $FrameGenX
$fgKind = $FgType
$fpsWanted = 1000
if ($menu.Contains('VICTORY_MENU_CONSOLE')) { $seriesS = $menu['VICTORY_MENU_CONSOLE'] -eq 'series-s' }
if ($menu['VICTORY_MENU_RES'] -in '1440', '1080to1440', '4k') { $res = $menu['VICTORY_MENU_RES'] }
if ($menu['VICTORY_MENU_S_RES'] -in '1080', '720', '626', '540') { $sRes = $menu['VICTORY_MENU_S_RES'] }
if ($menu['VICTORY_MENU_DLSS'] -in 'off', 'dlaa', 'quality', 'balanced', 'performance') { $dlssMode = $menu['VICTORY_MENU_DLSS'] }
if ($menu['VICTORY_MENU_S_RES'] -in '1080', '720', '626', '540', '360') { $sRes = $menu['VICTORY_MENU_S_RES'] }
if ($menu['VICTORY_MENU_DLSS'] -in 'off', 'dlaa', 'quality', 'balanced', 'performance', 'ultraperformance') { $dlssMode = $menu['VICTORY_MENU_DLSS'] }
if ($seriesS -and $dlssMode -ne 'off' -and $menu.Contains('VICTORY_MENU_S_RES')) {
$sMap = @{ '1080' = 'dlaa'; '720' = 'quality'; '626' = 'balanced'; '540' = 'performance' }
$sMap = @{ '1080' = 'dlaa'; '720' = 'quality'; '626' = 'balanced'; '540' = 'performance'; '360' = 'ultraperformance' }
if ($sMap.ContainsKey($sRes)) { $dlssMode = $sMap[$sRes] }
}
if ($menu.Contains('VICTORY_MENU_FRAMEGEN')) {
@@ -131,6 +136,9 @@ $settings = [ordered]@{
VICTORY_WC_NO_BACK = '1'
VICTORY_WC_NO_BACK_MIN_KB = '1024'
VICTORY_SOFT_VIEWS = 'copies'
VICTORY_COPY_BESIDE = '1'
VICTORY_STORE_BESIDE = '1'
VICTORY_WINDOWS_VRAM_PERCENT = '80'
# Texture streaming + 6 GB VRAM mip scale
VICTORY_TEXTURE_POOL = '1'
@@ -156,6 +164,7 @@ $settings = [ordered]@{
# Visuals (windowed by default; toggleable in F1 menu)
VICTORY_AMBIENT = '0.8'
VICTORY_AMBIENT_AIR = '1.5'
VICTORY_AMBIENT_SHADE = '0.5,0.5'
VICTORY_AMBIENT_SPECULAR = '1'
VICTORY_WATER_LIGHT = '1'
VICTORY_EARLY_DEPTH = '1'
@@ -165,10 +174,10 @@ $settings = [ordered]@{
VICTORY_PIPELINE_BOOK = '1'
VICTORY_PIPELINE_WAIT_MS = '50'
# Memory stack (SLOT_EVICT aligned above ROOM% to prevent eviction thrashing)
# Memory stack (SLOT_EVICT sits just above ROOM% so idle textures evict cleanly when roaming)
VICTORY_SLOT_EVICT = '1'
VICTORY_SLOT_EVICT_PERCENT = '92'
VICTORY_SLOT_EVICT_LOW_PERCENT = '82'
VICTORY_SLOT_EVICT_PERCENT = '88'
VICTORY_SLOT_EVICT_LOW_PERCENT = '78'
VICTORY_ALLOCATOR_TRIM = '1'
VICTORY_BUDGET_PACK = '1'
VICTORY_TEARING = '1'
@@ -189,22 +198,25 @@ if ($dlssMode -ne 'off' -and (Test-Path (Join-Path $slDir 'sl.interposer.dll')))
$settings['VICTORY_STREAMLINE_DIR'] = $slDir
}
$barMb = if ($DropMips -ge 2) { '768' } elseif ($fgOn) { '128' } else { '256' }
$roomPct = if ($DropMips -ge 2) { if ($fgOn) { '75' } else { '78' } } else { '86' }
if ($dlssMode -ne 'off' -and $fgOn) {
if ($fgKind -ne 'dlss' -and (Test-Path (Join-Path $fxDir 'amd_fidelityfx_framegeneration_dx12.dll'))) {
$settings['VICTORY_FSR_FRAMEGEN'] = '1'
$settings['VICTORY_FIDELITYFX_DIR'] = $fxDir
$settings['VICTORY_FRAMEGEN_X'] = [string]$timesWanted
$settings['VICTORY_TEXTURE_ROOM_PERCENT'] = '82'
$settings['VICTORY_WINDOWS_BAR_MB'] = '128'
$settings['VICTORY_TEXTURE_ROOM_PERCENT'] = $roomPct
$settings['VICTORY_WINDOWS_BAR_MB'] = $barMb
} elseif ($fgKind -eq 'dlss') {
$settings['VICTORY_FRAMEGEN'] = '1'
$settings['VICTORY_FRAMEGEN_X'] = [string]$timesWanted
$settings['VICTORY_TEXTURE_ROOM_PERCENT'] = '82'
$settings['VICTORY_WINDOWS_BAR_MB'] = '128'
$settings['VICTORY_TEXTURE_ROOM_PERCENT'] = $roomPct
$settings['VICTORY_WINDOWS_BAR_MB'] = $barMb
}
} else {
$settings['VICTORY_TEXTURE_ROOM_PERCENT'] = '85'
$settings['VICTORY_WINDOWS_BAR_MB'] = '256'
$settings['VICTORY_TEXTURE_ROOM_PERCENT'] = $roomPct
$settings['VICTORY_WINDOWS_BAR_MB'] = $barMb
}
$settings['VICTORY_FRAME_INTERVAL_US'] = [string][int][math]::Round(1000000 / $fpsWanted)