Direct R32_UINT/SINT <-> R9G9B9E5_SHAREDEXP alias copies by default #4814

Open
github-bot wants to merge 1 commit from github-bot/gh-4813 into main AGit
Owner

@⁠Andreww2009 on GitHub · 2026-12-01 09:46 UTC · original
Andreww2009:perf/alias-direct-r32-rgb9e5-default → main · +67 −11 · 1 files · 1 commits · open

What it changes

Enables VICTORY_ALIAS_DIRECT by default (toggled! instead of opt-in asked_for!) in crates/victory-gpu/src/texture.rs so R32_UINT/R32_SINT <-> R9G9B9E5_SHAREDEXP placed texture aliases (written_as=42 read_as=67) copy directly via CopyResource instead of routing each frame's 20+ render-target aliases through pooled UAV bounce buffers and three resource barriers each. Setting VICTORY_ALIAS_DIRECT=0 still restores the bounce path.

Adds a hardware D3D12 unit test (direct_r32_uint_and_r9g9b9e5_sharedexp_copy_closes_cleanly) validating direct CopyResource between R32_TYPELESS (R32_UINT) and R9G9B9E5_SHAREDEXP under VICTORY_D3D12_DEBUG=1.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): NVIDIA GeForce RTX 5080 Laptop GPU (driver 621.14, Windows 11 26200, D3D12 SM 6.8), Series X, 2560x1440, DLSS Quality, FG OFF, RT OFF, tested on a545dc12 / f5019671 (based on origin/main 5fabb46e).
  • Before: 20+ written_as=42 read_as=67 aliases (e.g. 853x480, 768x192, 2048x512) logged direct=false and ran UAV bounce copies + 3 barriers each.
  • After: All written_as=42 read_as=67 aliases log direct=true; live 90 s run (NS-C4-base) completed with 0 crashes, 0 0x80070057, and 0 D3D12 Debug Layer errors on alias_layout_tests.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (host texture copy path only).
  • cargo test passed for the crates it touches: yes (VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --lib alias_layout_tests: 2/2 passed; cargo test -p victory-gpu --lib: 1,103/1,103 passed; cargo xtask policy: passed). Note: untouched upstream origin/main 5fabb46e currently has 5 pre-existing Clippy warnings in crates/victory-gpu/src/host/{font,menu,panel}.rs; crates/victory-gpu/src/texture.rs has 0 warnings.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: none found
**@⁠Andreww2009** on GitHub · 2026-12-01 09:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4813) `Andreww2009:perf/alias-direct-r32-rgb9e5-default` → `main` · +67 −11 · 1 files · 1 commits · open ## What it changes Enables `VICTORY_ALIAS_DIRECT` by default (`toggled!` instead of opt-in `asked_for!`) in `crates/victory-gpu/src/texture.rs` so `R32_UINT`/`R32_SINT` <-> `R9G9B9E5_SHAREDEXP` placed texture aliases (`written_as=42 read_as=67`) copy directly via `CopyResource` instead of routing each frame's 20+ render-target aliases through pooled UAV bounce buffers and three resource barriers each. Setting `VICTORY_ALIAS_DIRECT=0` still restores the bounce path. Adds a hardware D3D12 unit test (`direct_r32_uint_and_r9g9b9e5_sharedexp_copy_closes_cleanly`) validating direct `CopyResource` between `R32_TYPELESS` (`R32_UINT`) and `R9G9B9E5_SHAREDEXP` under `VICTORY_D3D12_DEBUG=1`. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): NVIDIA GeForce RTX 5080 Laptop GPU (driver 621.14, Windows 11 26200, D3D12 SM 6.8), Series X, 2560x1440, DLSS Quality, FG OFF, RT OFF, tested on `a545dc12` / `f5019671` (based on `origin/main` `5fabb46e`). - Before: 20+ `written_as=42 read_as=67` aliases (e.g. `853x480`, `768x192`, `2048x512`) logged `direct=false` and ran UAV bounce copies + 3 barriers each. - After: All `written_as=42 read_as=67` aliases log `direct=true`; live 90 s run (`NS-C4-base`) completed with 0 crashes, 0 `0x80070057`, and 0 D3D12 Debug Layer errors on `alias_layout_tests`. - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (host texture copy path only). - `cargo test` passed for the crates it touches: yes (`VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --lib alias_layout_tests`: 2/2 passed; `cargo test -p victory-gpu --lib`: 1,103/1,103 passed; `cargo xtask policy`: passed). Note: untouched upstream `origin/main` `5fabb46e` currently has 5 pre-existing Clippy warnings in `crates/victory-gpu/src/host/{font,menu,panel}.rs`; `crates/victory-gpu/src/texture.rs` has 0 warnings. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: none found
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 09:51:23 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-12-01 13:21 UTC · original

Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.

One correction first, because it bites anyone running this test: it lives in texture::alias_layout_tests, not texture::tests. -- texture::tests::alias_layouts_are_made_again_for_other_textures --exact prints running 0 tests ... 1162 filtered out, which reads like a pass and runs nothing. The working form is below.

Base 5fabb46eaf6ed8771321787f8871051abde69b9b, head a545dc12299e254289f77013da91984c4035c41f. git diff --numstat → crates/victory-gpu/src/texture.rs 67/11.

On the base the name is already there at texture.rs (same function, older body), so git grep -F alias_layouts_are_made_again_for_other_textures 5fabb46e -- . matches — this is a rewrite of an existing test, not a new one. Read that as you will for the "new test" criterion; the body is what the direct alias path changes.

git diff --check "5fabb46e..a545dc12" → no output, exit 0.

$env:CARGO_TARGET_DIR='D:\Victory-Contrib\NVIDIA-Contrib\target-4813'
cargo test --locked -p victory-gpu --lib -- texture::alias_layout_tests::alias_layouts_are_made_again_for_other_textures --exact --test-threads=1 --quiet

Result: running 1 test, test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out.

The test builds D3D12_RESOURCE_DESCs and the layouts by hand and never opens a device; no title files, GPU/driver N/A. No game data.

**@⁠cloph-dsp** on GitHub · 2026-12-01 13:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4813#issuecomment-7312493301) Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree. One correction first, because it bites anyone running this test: it lives in `texture::alias_layout_tests`, not `texture::tests`. `-- texture::tests::alias_layouts_are_made_again_for_other_textures --exact` prints `running 0 tests ... 1162 filtered out`, which reads like a pass and runs nothing. The working form is below. Base `5fabb46eaf6ed8771321787f8871051abde69b9b`, head `a545dc12299e254289f77013da91984c4035c41f`. `git diff --numstat` → crates/victory-gpu/src/texture.rs 67/11. On the base the name is already there at texture.rs (same function, older body), so `git grep -F alias_layouts_are_made_again_for_other_textures 5fabb46e -- .` matches — this is a rewrite of an existing test, not a new one. Read that as you will for the "new test" criterion; the body is what the direct alias path changes. `git diff --check "5fabb46e..a545dc12"` → no output, exit 0. ``` $env:CARGO_TARGET_DIR='D:\Victory-Contrib\NVIDIA-Contrib\target-4813' cargo test --locked -p victory-gpu --lib -- texture::alias_layout_tests::alias_layouts_are_made_again_for_other_textures --exact --test-threads=1 --quiet ``` Result: `running 1 test`, `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out`. The test builds `D3D12_RESOURCE_DESC`s and the layouts by hand and never opens a device; no title files, GPU/driver N/A. No game data.
Author
Owner

@⁠Andreww2009 on GitHub · 2026-12-01 14:29 UTC · original

Thanks for verifying the diff and running the layout test, @⁠cloph-dsp!

Note that in addition to updating texture::alias_layout_tests::alias_layouts_are_made_again_for_other_textures, this commit adds a new hardware D3D12 Debug Layer test in the same module:
cargo test --locked -p victory-gpu --lib -- texture::alias_layout_tests::direct_r32_uint_and_r9g9b9e5_sharedexp_copy_closes_cleanly --exact
(under VICTORY_D3D12_DEBUG=1, it creates real R32_TYPELESS / R32_UINT and R9G9B9E5_SHAREDEXP resources and validates that direct CopyResource closes cleanly with zero debug-layer errors).

**@⁠Andreww2009** on GitHub · 2026-12-01 14:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4813#issuecomment-7314341513) Thanks for verifying the diff and running the layout test, @⁠cloph-dsp! Note that in addition to updating `texture::alias_layout_tests::alias_layouts_are_made_again_for_other_textures`, this commit adds a new hardware D3D12 Debug Layer test in the same module: `cargo test --locked -p victory-gpu --lib -- texture::alias_layout_tests::direct_r32_uint_and_r9g9b9e5_sharedexp_copy_closes_cleanly --exact` (under `VICTORY_D3D12_DEBUG=1`, it creates real `R32_TYPELESS` / `R32_UINT` and `R9G9B9E5_SHAREDEXP` resources and validates that direct `CopyResource` closes cleanly with zero debug-layer errors).
Author
Owner

@⁠Bazovsky on GitHub · 2026-12-01 18:17 UTC · original

Tested on origin/main (5fabb46e) + this PR (a545dc12) on Windows 11, Ryzen 9 9950X3D (64 GB DDR5), RTX 5090 (2560x1440, DLSS Quality + DLSS FG 2x, Series X build, VICTORY_SUBMISSION_TIMING=1).

  • cargo clippy --workspace --all-targets --all-features --locked (no new warnings) and texture::alias_layout_tests (2 passed, including direct_r32_uint_and_r9g9b9e5_sharedexp_copy_closes_cleanly on RTX 5090).
  • In-game (~60 s post-load window vs two bracketing origin/main control runs main_1 / main_2):
    • World-entry streaming ([0..10 s]): 24.67 / 30.22 (27.45 avg) -> 30.33 native FPS
    • Steady scene ([+10 s..end]): 33.14 / 33.76 (33.45 avg, 29.45 ms median) -> 33.70 native FPS (29.10 ms median)
    • Steady per-second max frame p95: 90.5 / 87.6 ms (89.1 ms avg) -> 80.9 ms (-9.2%)
    • 0 D3D12 / device-removed errors.
**@⁠Bazovsky** on GitHub · 2026-12-01 18:17 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4813#issuecomment-7320708457) Tested on `origin/main` (`5fabb46e`) + this PR (`a545dc12`) on Windows 11, Ryzen 9 9950X3D (64 GB DDR5), RTX 5090 (2560x1440, DLSS Quality + DLSS FG 2x, Series X build, `VICTORY_SUBMISSION_TIMING=1`). - `cargo clippy --workspace --all-targets --all-features --locked` (no new warnings) and `texture::alias_layout_tests` (`2 passed`, including `direct_r32_uint_and_r9g9b9e5_sharedexp_copy_closes_cleanly` on RTX 5090). - In-game (~60 s post-load window vs two bracketing `origin/main` control runs `main_1` / `main_2`): - World-entry streaming (`[0..10 s]`): `24.67 / 30.22` (`27.45` avg) -> **`30.33` native FPS** - Steady scene (`[+10 s..end]`): `33.14 / 33.76` (`33.45` avg, `29.45 ms` median) -> **`33.70` native FPS** (`29.10 ms` median) - Steady per-second max frame p95: `90.5 / 87.6 ms` (`89.1 ms` avg) -> **`80.9 ms`** (`-9.2%`) - `0` D3D12 / device-removed errors.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/4814/head:github-bot/gh-4813'
git switch 'github-bot/gh-4813'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4813'
git switch 'github-bot/gh-4813'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4813'
git switch 'github-bot/gh-4813'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4813'
git switch 'main'
git merge --squash 'github-bot/gh-4813'
git switch 'main'
git merge --ff-only 'github-bot/gh-4813'
git switch 'main'
git merge 'github-bot/gh-4813'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4814
No description provided.