gpu: enable DXGI allow-tearing swap chain presentation (VICTORY_TEARING=0 opt-out) #23

Closed
Androtim wants to merge 0 commits from upstream-pr/23 into main
Androtim commented 2026-11-28 07:13:11 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T07:13:11Z.


Summary

Port DXGI allow-tearing swap-chain presentation from trustno1-coder/VIctory-NVIDIA (8fc2254) into crates/victory-gpu/src/host.rs:

  • Queries IDXGIFactory5::CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING) in Host::presenter unless VICTORY_TEARING=0.
  • Passes DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING at swap-chain creation and ResizeBuffers, and DXGI_PRESENT_ALLOW_TEARING on Present.
  • Falls back cleanly to presenting at the next refresh for the remainder of the run if an immediate tearing present is refused, logging once.
  • Adds unit test host::batch::tearing_flags_and_env_opt_out.

Rig Specs Tested On

  • CPU: 13th Gen Intel(R) Core(TM) i7-13700F
  • GPU & VRAM: NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM)
  • System RAM: 32 GiB
  • OS & GPU Driver: Windows 11 Home (Build 26300), NVIDIA Driver 32.0.16.2124

Run Settings & Profile

  • Build & Commit SHA: release / victory --features diagnostics @ 86065e3
  • Console Profile & Internal Resolution / Scale: series-s (default verify-world.ps1 baseline profile)
  • Ray Tracing: off
  • Upscaling: DLSS quality (-DlssMode quality)
  • Frame Generation: off
  • Launcher Command / Preset & Extra VICTORY_* Overrides: D:\victory-build\verify-tools\verify-world.ps1 -Exe 'D:\victory-build\verify-bins\pr23-diag.exe' -GoldenDataDir 'D:\victory-data\golden-data-minivi' -OutDir 'D:\victory-data\verify-runs\pr23-allow-tearing' -WorldSeconds 75 -AutoNudgeMenu (VICTORY_TEARING default on -> tearing=true)
  • Scene / Area & Session Length: Mission-1 autosave dock transition into balcony scene (draws >= 500, max 11320 draws/frame), 75s in-world after reaching world draws

Measurements & Verification

  • Base FPS (without Frame Gen):
    • Raw 14-window verifier median: 3.15 fps (321.35 ms, min 1.0 fps) — early dock/transition windows compiled 885 -> 502 remaining PSOs (1.0–3.4 fps).
    • Steady balcony scene (5701–6076 draws/frame, last 5 windows): 8.7–9.9 fps (median 9.4 fps, 100.6–115.2 ms/frame, preparing 54.9–57.9 ms, GPU 0.5–1.2 ms, copyback 8.3–9.2 ms).
    • Swap chain: logged tearing=true, 0 refused presents.
    • Visuals: 24 PNGs sampled (luma 104.84, edge_energy 7.12, 0.0% magenta); inspected frame-9122.png and frame-9170.png (full lighting, sky/water/character detail, HUD intact).
  • Frame-Gen FPS (if enabled): N/A (off)
  • VRAM / RAM Usage: copystat peak 5970 MB VRAM in use / 6952 MB budget (5476 MB shared PC RAM), final_waiting=4352, passes that made none for lack of room: 0
  • Crashes / DRED Resets: 0 (crashes=0, no_host_texture_errors=0)
  • Automated Checks:
    • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy (asset policy: 294 files ok)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask (6 passed; 0 failed)
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings (0 warnings)
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features victory-gpu/diagnostics -- -D warnings (0 warnings)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib (449 passed; 0 failed; 36 ignored, including host::batch::tearing_flags_and_env_opt_out)
    • Plain release & diagnostics --release builds (objdump -p: 0 non-system MinGW DLLs)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5537765009 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/23). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T07:13:11Z. --- ## Summary Port DXGI allow-tearing swap-chain presentation from `trustno1-coder/VIctory-NVIDIA` (`8fc2254`) into `crates/victory-gpu/src/host.rs`: - Queries `IDXGIFactory5::CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING)` in `Host::presenter` unless `VICTORY_TEARING=0`. - Passes `DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING` at swap-chain creation and `ResizeBuffers`, and `DXGI_PRESENT_ALLOW_TEARING` on `Present`. - Falls back cleanly to presenting at the next refresh for the remainder of the run if an immediate tearing present is refused, logging once. - Adds unit test `host::batch::tearing_flags_and_env_opt_out`. ## Rig Specs Tested On - **CPU:** 13th Gen Intel(R) Core(TM) i7-13700F - **GPU & VRAM:** NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM) - **System RAM:** 32 GiB - **OS & GPU Driver:** Windows 11 Home (Build 26300), NVIDIA Driver 32.0.16.2124 ## Run Settings & Profile - **Build & Commit SHA:** `release` / `victory --features diagnostics` @ `86065e3` - **Console Profile & Internal Resolution / Scale:** `series-s` (default `verify-world.ps1` baseline profile) - **Ray Tracing:** `off` - **Upscaling:** `DLSS quality` (`-DlssMode quality`) - **Frame Generation:** `off` - **Launcher Command / Preset & Extra `VICTORY_*` Overrides:** `D:\victory-build\verify-tools\verify-world.ps1 -Exe 'D:\victory-build\verify-bins\pr23-diag.exe' -GoldenDataDir 'D:\victory-data\golden-data-minivi' -OutDir 'D:\victory-data\verify-runs\pr23-allow-tearing' -WorldSeconds 75 -AutoNudgeMenu` (`VICTORY_TEARING` default on -> `tearing=true`) - **Scene / Area & Session Length:** Mission-1 autosave dock transition into balcony scene (`draws >= 500`, max `11320` draws/frame), 75s in-world after reaching world draws ## Measurements & Verification - **Base FPS (without Frame Gen):** - Raw 14-window verifier median: `3.15 fps` (`321.35 ms`, min `1.0 fps`) — early dock/transition windows compiled `885 -> 502` remaining PSOs (`1.0–3.4 fps`). - Steady balcony scene (`5701–6076` draws/frame, last 5 windows): `8.7–9.9 fps` (median `9.4 fps`, `100.6–115.2 ms/frame`, `preparing 54.9–57.9 ms`, `GPU 0.5–1.2 ms`, `copyback 8.3–9.2 ms`). - Swap chain: logged `tearing=true`, `0` refused presents. - Visuals: `24` PNGs sampled (`luma 104.84`, `edge_energy 7.12`, `0.0%` magenta); inspected `frame-9122.png` and `frame-9170.png` (full lighting, sky/water/character detail, HUD intact). - **Frame-Gen FPS (if enabled):** N/A (`off`) - **VRAM / RAM Usage:** `copystat` peak `5970 MB` VRAM in use / `6952 MB` budget (`5476 MB` shared PC RAM), `final_waiting=4352`, `passes that made none for lack of room: 0` - **Crashes / DRED Resets:** `0` (`crashes=0`, `no_host_texture_errors=0`) - **Automated Checks:** - [x] `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy` (`asset policy: 294 files ok`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask` (`6 passed; 0 failed`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings` (`0` warnings) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features victory-gpu/diagnostics -- -D warnings` (`0` warnings) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib` (`449 passed; 0 failed; 36 ignored`, including `host::batch::tearing_flags_and_env_opt_out`) - [x] Plain release & diagnostics `--release` builds (`objdump -p`: `0` non-system MinGW DLLs)
Androtim commented 2026-11-28 08:03:01 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T08:03:01Z.


Automated triage for the maintainers (not an approval).

Verdict: needs-gpu-test · CI (check): passing

Review Summary

Clean, well-scoped port of DXGI ALLOW_TEARING swap-chain presentation in crates/victory-gpu/src/host.rs, with passing CI and unit coverage (host::batch::tearing_flags_and_env_opt_out).

What Was Verified

  • Feature query & opt-out (tearing, tearing_allowed_by_env): Checks VICTORY_TEARING (default enabled; trimmed "0" opts out), casts IDXGIFactory2 to IDXGIFactory5, and queries CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING) with a BOOL-sized output buffer. Falls back cleanly to false if the cast or query fails.
  • Swap-chain creation & resize (Host::presenter, Host::present_planes): Sets DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING on DXGI_SWAP_CHAIN_DESC1::Flags (already flip-discard with BUFFERS = 2) and preserves p.tearing via chain_flags(p.tearing) on ResizeBuffers, matching DXGI's requirement that ALLOW_TEARING cannot be toggled during resize.
  • Present & runtime fallback (Host::present_planes): Separates immutable Presenter::tearing from runtime Presenter::presents_tearing. On a failed Present(0, DXGI_PRESENT_ALLOW_TEARING) (shown.is_err(), which correctly ignores non-error status codes like DXGI_STATUS_OCCLUDED), logs once, disables presents_tearing for the rest of the run, and retries Present(0, DXGI_PRESENT(0)). Subsequent non-tearing present failures are also logged once via Presenter::present_refused.
  • Static & security checks: No policy violations, sensitive files, or suspicious patterns.

Notes for Maintainers

  • Overlap with PR #11: PR #11 also modifies DXGI ALLOW_TEARING (bundled with underwater shader 926c46bab3b86bd6 recovery, which is separately split into PR #24). Merging PR #23 will supersede the tearing portion of PR #11.
  • Real-GPU verification: Because this changes the D3D12/DXGI host swap-chain creation, ResizeBuffers, and Present path—and the reported RTX 4060 Ti run had frame generation off—a local GPU smoke test covering default tearing, VICTORY_TEARING=0, window resize, and Streamline/FSR3 frame-generation swap chains (if applicable) is recommended before merging.

Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7236328819 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/23#issuecomment-7236328819). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T08:03:01Z. --- <!-- minivi-triage v1 head=86065e3cf15ba2fe68edbb026e047b2d27dc0a39 verdict=needs-gpu-test ci=passing at=2026-11-28T08:03:28Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Review Summary Clean, well-scoped port of DXGI `ALLOW_TEARING` swap-chain presentation in `crates/victory-gpu/src/host.rs`, with passing CI and unit coverage (`host::batch::tearing_flags_and_env_opt_out`). ### What Was Verified - **Feature query & opt-out (`tearing`, `tearing_allowed_by_env`):** Checks `VICTORY_TEARING` (default enabled; trimmed `"0"` opts out), casts `IDXGIFactory2` to `IDXGIFactory5`, and queries `CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING)` with a `BOOL`-sized output buffer. Falls back cleanly to `false` if the cast or query fails. - **Swap-chain creation & resize (`Host::presenter`, `Host::present_planes`):** Sets `DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING` on `DXGI_SWAP_CHAIN_DESC1::Flags` (already flip-discard with `BUFFERS = 2`) and preserves `p.tearing` via `chain_flags(p.tearing)` on `ResizeBuffers`, matching DXGI's requirement that `ALLOW_TEARING` cannot be toggled during resize. - **Present & runtime fallback (`Host::present_planes`):** Separates immutable `Presenter::tearing` from runtime `Presenter::presents_tearing`. On a failed `Present(0, DXGI_PRESENT_ALLOW_TEARING)` (`shown.is_err()`, which correctly ignores non-error status codes like `DXGI_STATUS_OCCLUDED`), logs once, disables `presents_tearing` for the rest of the run, and retries `Present(0, DXGI_PRESENT(0))`. Subsequent non-tearing present failures are also logged once via `Presenter::present_refused`. - **Static & security checks:** No policy violations, sensitive files, or suspicious patterns. ### Notes for Maintainers - **Overlap with PR #11:** PR #11 also modifies DXGI `ALLOW_TEARING` (bundled with underwater shader `926c46bab3b86bd6` recovery, which is separately split into PR #24). Merging PR #23 will supersede the tearing portion of PR #11. - **Real-GPU verification:** Because this changes the D3D12/DXGI host swap-chain creation, `ResizeBuffers`, and `Present` path—and the reported RTX 4060 Ti run had frame generation `off`—a local GPU smoke test covering default tearing, `VICTORY_TEARING=0`, window resize, and Streamline/FSR3 frame-generation swap chains (if applicable) is recommended before merging. --- _Generated with Antigravity CLI (`agy`)._
Androtim commented 2026-11-28 21:18:24 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T21:18:24Z.


Closing as superseded duplicate of merged PR #11.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7245921816 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/23#issuecomment-7245921816). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T21:18:24Z. --- Closing as superseded duplicate of merged PR #11.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
Androtim/MiniVI!23
No description provided.