GPU: mesh pipelines load from the pipeline library (name their topology) #352

Closed
github-bot wants to merge 1 commit from gh-pr/352/head into gh-pr/352/base
Owner

@⁠rhuantac on GitHub · 2026-11-24 02:30 UTC · original
rhuantac:fix/mesh-pipelines-load-from-library → main · +101 −2 · 1 files · 1 commits · closed without merging

A mesh pipeline never loaded from the host pipeline library: LoadPipeline refused it with E_INVALIDARG (debug layer 972, "does not match the one used to create the PSO") even with the very stream it was made from, so every mesh pipeline was compiled again on every run and its store then refused (970, "already exists") — the 972/970 pair in #264 (item 3; #334 covers its items 1 and 2).

Measured with synthetic pipelines on an RTX 3060 Ti, Windows 11 26300, with and without the debug layer: compute, graphics (DXBC and DXIL) and VS/PS streams load; a mesh stream loads only with a PRIMITIVE_TOPOLOGY subobject that is not UNDEFINED. The debug layer wants it to match the mesh shader's output topology (1323), and our translation makes triangle mesh shaders only (mesh_prologue), so the stream now names TRIANGLE. Mesh pipelines get a new library name ("mesh triangles"), so entries stored without a topology are not looked up again.

Test: a_mesh_pipeline_loads_from_the_library makes a mesh pipeline twice through mesh_pipeline and requires the second to come from the library; it fails before this change and passes after (skipped without a PC dxc.exe). cargo test -p victory-gpu: 44 passed, 1 ignored. Not measured: the effect on the title's loading time.

AI use: Claude Code ran the experiments and wrote the change; I reviewed it.

🤖 Generated with Claude Code

**@⁠rhuantac** on GitHub · 2026-11-24 02:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/352) `rhuantac:fix/mesh-pipelines-load-from-library` → `main` · +101 −2 · 1 files · 1 commits · closed without merging A mesh pipeline never loaded from the host pipeline library: `LoadPipeline` refused it with `E_INVALIDARG` (debug layer 972, "does not match the one used to create the PSO") even with the very stream it was made from, so every mesh pipeline was compiled again on every run and its store then refused (970, "already exists") — the 972/970 pair in #264 (item 3; #334 covers its items 1 and 2). Measured with synthetic pipelines on an RTX 3060 Ti, Windows 11 26300, with and without the debug layer: compute, graphics (DXBC and DXIL) and VS/PS streams load; a mesh stream loads only with a `PRIMITIVE_TOPOLOGY` subobject that is not `UNDEFINED`. The debug layer wants it to match the mesh shader's output topology (1323), and our translation makes triangle mesh shaders only (`mesh_prologue`), so the stream now names `TRIANGLE`. Mesh pipelines get a new library name (`"mesh triangles"`), so entries stored without a topology are not looked up again. Test: `a_mesh_pipeline_loads_from_the_library` makes a mesh pipeline twice through `mesh_pipeline` and requires the second to come from the library; it fails before this change and passes after (skipped without a PC `dxc.exe`). `cargo test -p victory-gpu`: 44 passed, 1 ignored. Not measured: the effect on the title's loading time. AI use: Claude Code ran the experiments and wrote the change; I reviewed it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A mesh pipeline never loaded from the host pipeline library: LoadPipeline
refused it with E_INVALIDARG (debug layer 972, "does not match the one used
to create the PSO") even with the very stream it was made from, so every
mesh pipeline was compiled again on every run and its store then refused
(970, "already exists"), the 972/970 pair in #264.

Measured with synthetic pipelines on an RTX 3060 Ti, Windows 11 26300, with
and without the debug layer: compute, graphics (DXBC and DXIL) and VS/PS
streams load; a mesh stream loads only with a PRIMITIVE_TOPOLOGY subobject
that is not UNDEFINED. The debug layer wants it to match the mesh shader's
output topology (1323), and the translation makes triangle mesh shaders
only (mesh_prologue), so the stream now names TRIANGLE. Mesh pipelines get
a new library name ("mesh triangles"), so entries stored without a
topology are not looked up again.

a_mesh_pipeline_loads_from_the_library makes a mesh pipeline twice through
mesh_pipeline and requires the second to come from the library; it fails
before this change and passes after (skipped without a PC dxc.exe).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:00:16 +00:00
github-bot closed this pull request 2026-11-26 04:00:16 +00:00
Author
Owner

@⁠ifBars on GitHub · 2026-11-24 02:42 UTC · original

I reproduced the cache miss on Windows 10 with Agility SDK 620 and the WARP software adapter. I ran the same synthetic triangle mesh pipeline through Causeway's mesh-pipeline creation path 21 times, saved the library, then reopened it in a new process. Without the topology, the reopened library served 0/21 calls. With the triangle topology and the new cache key, it served all 21. On an empty cache the changed build compiled the first pipeline and loaded the next 20.

Our last story trace includes successful mesh pipeline creations, but it only reports aggregate library hits. These results establish the cache behavior. The effect on story loading time and FPS remains unmeasured.

**@⁠ifBars** on GitHub · 2026-11-24 02:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7120405272) I reproduced the cache miss on Windows 10 with Agility SDK 620 and the WARP software adapter. I ran the same synthetic triangle mesh pipeline through Causeway's mesh-pipeline creation path 21 times, saved the library, then reopened it in a new process. Without the topology, the reopened library served 0/21 calls. With the triangle topology and the new cache key, it served all 21. On an empty cache the changed build compiled the first pipeline and loaded the next 20. Our last story trace includes successful mesh pipeline creations, but it only reports aggregate library hits. These results establish the cache behavior. The effect on story loading time and FPS remains unmeasured.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 11:20 UTC · original

I verified the on-disk pipeline library on exact head f77bd28 with a physical RTX 5090 (driver 616.56) and Windows build 26200. Both processes used VIctory's production HostPipeline::new path with the same synthetic triangle mesh shader and a separate VS/PS control.

Process Mesh created / loaded VS/PS created / loaded
Empty library, then save 1 / 0 1 / 0
New process, reopen saved library 0 / 1 0 / 1

The processes used the same GPU LUID and the same 3,512-byte library. The cold run had two expected name-not-found messages (971). The reopen run had no D3D12 diagnostics. This measures reuse of the synthetic PSOs across process launches.

**@⁠fuzeofficlal** on GitHub · 2026-11-24 11:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7129969393) I verified the on-disk pipeline library on exact head `f77bd28` with a physical RTX 5090 (driver 616.56) and Windows build 26200. Both processes used VIctory's production `HostPipeline::new` path with the same synthetic triangle mesh shader and a separate VS/PS control. | Process | Mesh created / loaded | VS/PS created / loaded | | --- | ---: | ---: | | Empty library, then save | 1 / 0 | 1 / 0 | | New process, reopen saved library | 0 / 1 | 0 / 1 | The processes used the same GPU LUID and the same 3,512-byte library. The cold run had two expected name-not-found messages (971). The reopen run had no D3D12 diagnostics. This measures reuse of the synthetic PSOs across process launches.
Author
Owner

@⁠qntic on GitHub · 2026-11-24 13:26 UTC · original

another data point from amd, rx 6600 xt with driver 32.0.21045.5002.

a_mesh_pipeline_loads_from_the_library passes both with this pr and after removing the topology subobject entirely.

setting it to D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED instead causes E_INVALIDARG.

looks like the original issue may be driver-specific. the fix itself works fine on my card too.

**@⁠qntic** on GitHub · 2026-11-24 13:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7132837621) another data point from amd, rx 6600 xt with driver 32.0.21045.5002. a_mesh_pipeline_loads_from_the_library passes both with this pr and after removing the topology subobject entirely. setting it to D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED instead causes E_INVALIDARG. looks like the original issue may be driver-specific. the fix itself works fine on my card too.
Author
Owner

@⁠rhuantac on GitHub · 2026-11-24 15:22 UTC · original

In-title check of this PR, on an RTX 3060 Ti (driver 610.88, Windows 11) with retail 1.0.2.1. Details are in #732.

test/world-stack (e0c3385) with and without this PR (f77bd28, merges cleanly), diag with VICTORY_D3D12_DEBUG=1, two runs per tree from a new empty cache, about 2 min of the intro cutscene each:

run 1: 972 / 970 run 2: 972 / 970
without #352 16 / 17 82 / 82
with #352 0 / 0 0 / 0

No id=1323 with the PR. Not measured: the effect on loading time.

AI-assisted (Claude Code); the numbers are counted from the logs.

**@⁠rhuantac** on GitHub · 2026-11-24 15:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7135923255) In-title check of this PR, on an RTX 3060 Ti (driver 610.88, Windows 11) with retail 1.0.2.1. Details are in https://git.gtahub.st/github/Marvisak--VIctory/issues/732. `test/world-stack` (`e0c3385`) with and without this PR (`f77bd28`, merges cleanly), `diag` with `VICTORY_D3D12_DEBUG=1`, two runs per tree from a new empty cache, about 2 min of the intro cutscene each: | | run 1: 972 / 970 | run 2: 972 / 970 | |---|---|---| | without #352 | 16 / 17 | 82 / 82 | | with #352 | **0 / 0** | **0 / 0** | No id=1323 with the PR. Not measured: the effect on loading time. AI-assisted (Claude Code); the numbers are counted from the logs.
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-24 15:56 UTC · original

Real-title confirmation: made goes 512 → 72 → 1

Your fix does more than the synthetic case in #780. Measured on a 4070 SUPER, Windows 10, Series X,
try/wave64 (i.e. #189 + #940 + #729 + #737 + this) + VICTORY_WAVE64_EMULATE=emulate +
VICTORY_TEXTURE_MIP_DROP=1, diag build, 240 s per run:

run pipelines rebuilt (made) loaded from library early list
without #352 (4 runs, stable) 512–534 586 → 705 1229 → 1246
with #352, first run 72 743 1246
with #352, after warming the library 1 1272 1307

The first run alone confirms your diagnosis: mesh PSOs that never loaded before start loading, so the
rebuild count drops by 86 % on a cold library. What the later run shows is that the rest was only
cold-miss too — once the library holds the entries, exactly one pipeline still needs compiling, and
1272 load.

Knock-on effects that matter more than the counter:

  • Slowest host submission in the world stage fell from 13318 ms to 1031 ms (the 13 s submission was
    the title compiling a batch that your fix now loads).
  • building … (N being made) during the world dropped from 167–243 to 122–165, and the frame budget
    finally stopped being dominated by compilation.
  • The same 240 s run now reaches 3370 draws/frame and completes without a device removal, where
    before it died at 93 s on a 13.3 s submission.

Not measured: whether made=1 needs a second warm run on other hardware, and which single pipeline it
is (we did not enable VICTORY_D3D12_DEBUG=1 to get its name). If you want that name I can run once
with the debug layer on.

**@⁠bittertea0323** on GitHub · 2026-11-24 15:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7136875650) ## Real-title confirmation: `made` goes 512 → 72 → 1 Your fix does more than the synthetic case in #780. Measured on a 4070 SUPER, Windows 10, Series X, `try/wave64` (i.e. #189 + #940 + #729 + #737 + this) + `VICTORY_WAVE64_EMULATE=emulate` + `VICTORY_TEXTURE_MIP_DROP=1`, diag build, 240 s per run: | run | pipelines rebuilt (`made`) | loaded from library | early list | |---|---|---|---| | without #352 (4 runs, stable) | **512–534** | 586 → 705 | 1229 → 1246 | | with #352, first run | **72** | 743 | 1246 | | with #352, after warming the library | **1** | **1272** | 1307 | The first run alone confirms your diagnosis: mesh PSOs that never loaded before start loading, so the rebuild count drops by 86 % on a cold library. What the later run shows is that the rest was only cold-miss too — once the library holds the entries, **exactly one pipeline still needs compiling**, and 1272 load. Knock-on effects that matter more than the counter: - Slowest host submission in the world stage fell from **13318 ms to 1031 ms** (the 13 s submission was the title compiling a batch that your fix now loads). - `building … (N being made)` during the world dropped from 167–243 to 122–165, and the frame budget finally stopped being dominated by compilation. - The same 240 s run now reaches **3370 draws/frame** and completes without a device removal, where before it died at 93 s on a 13.3 s submission. Not measured: whether `made=1` needs a second warm run on other hardware, and which single pipeline it is (we did not enable `VICTORY_D3D12_DEBUG=1` to get its name). If you want that name I can run once with the debug layer on.
Author
Owner

@⁠Yaekai on GitHub · 2026-11-24 16:19 UTC · original

Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head f77bd28:

  • cargo test -p victory-gpu --lib: 44 passed, 0 failed (including a_mesh_pipeline_loads_from_the_library).
  • cargo clippy -p victory-gpu -- -D warnings: 0 warnings.
  • Live GTA VI (1.0.2.1, --console series-s): confirmed mesh pipelines save to and reload cleanly from the host pipeline library (loaded=2102 on warm restart). Ready to merge!
**@⁠Yaekai** on GitHub · 2026-11-24 16:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7137493631) Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head `f77bd28`: - `cargo test -p victory-gpu --lib`: 44 passed, 0 failed (including `a_mesh_pipeline_loads_from_the_library`). - `cargo clippy -p victory-gpu -- -D warnings`: 0 warnings. - Live GTA VI (`1.0.2.1`, `--console series-s`): confirmed mesh pipelines save to and reload cleanly from the host pipeline library (`loaded=2102` on warm restart). Ready to merge!
Author
Owner

@⁠Bullet18x on GitHub · 2026-11-24 19:48 UTC · original

RTX 5090 A/B of the pipeline-library messages: this PR vs #1041 vs plain main, same machine, same protocol.

Machine: RTX 5090 32 GB, driver 621.40 (32.0.16.2114), Ryzen 9 9950X3D, 64 GB, Windows 11 Pro 10.0.28000 (in-box D3D12 10.0.28000.3365, Graphics Tools installed).
Builds: each PR's single commit applied on main ffe310e (f77bd28 for this PR, 4111946 for #1041; each applies cleanly alone, the two conflict in pipeline/host.rs), cargo build --profile diag -p victory --features diagnostics.
Protocol per build: empty pipeline library (host-pipelines.bin and early-pipelines.txt removed, shader translations kept), run 1 to fill it, then run 2 with VICTORY_D3D12_DEBUG=1; debug-layer messages counted in run 2. Both runs: VICTORY_KEYS=8:Enter,20:Enter,35:Enter, VICTORY_D3D12_DRED=1, victory.exe run <dump>\game_scarlett_master.exe --execute.

Build 972 (desc does not match) 970 (already exists) 971 (not stored)
main ffe310e 350 358 256
+ #352 (this PR) 0 5 386
+ #1041 288 211 186
  • With this PR the mismatch / failed-store pairs are gone (972: 350 → 0, 970: 358 → 5), matching the RTX 3060 Laptop numbers in #780 (139 → 0).
  • 971 ("does not have a pipeline stored") is a plain miss for pipelines the first run never made; it depends on how far that run got (every run ended in DXGI_ERROR_DEVICE_HUNG in the world, the first runs after 153 / 84 / 88 s), so it is not comparable between rows.
  • #1041 lowers 970 / 972 by roughly 20–40 % but does not remove them, so zeroing padding is not the cause here; the missing mesh topology is.

Not tested: AMD / Intel, more than one run per build, the two PRs together (they conflict).

No game data, title-content log lines or screenshots attached. AI use: Claude Code (Claude Opus 5.5) built, ran and counted the messages; I checked the results.

**@⁠Bullet18x** on GitHub · 2026-11-24 19:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7142627096) RTX 5090 A/B of the pipeline-library messages: this PR vs #1041 vs plain `main`, same machine, same protocol. **Machine**: RTX 5090 32 GB, driver 621.40 (32.0.16.2114), Ryzen 9 9950X3D, 64 GB, Windows 11 Pro 10.0.28000 (in-box D3D12 10.0.28000.3365, Graphics Tools installed). **Builds**: each PR's single commit applied on `main` `ffe310e` (`f77bd28` for this PR, `4111946` for #1041; each applies cleanly alone, the two conflict in `pipeline/host.rs`), `cargo build --profile diag -p victory --features diagnostics`. **Protocol per build**: empty pipeline library (`host-pipelines.bin` and `early-pipelines.txt` removed, shader translations kept), run 1 to fill it, then run 2 with `VICTORY_D3D12_DEBUG=1`; debug-layer messages counted in run 2. Both runs: `VICTORY_KEYS=8:Enter,20:Enter,35:Enter`, `VICTORY_D3D12_DRED=1`, `victory.exe run <dump>\game_scarlett_master.exe --execute`. | Build | 972 (desc does not match) | 970 (already exists) | 971 (not stored) | |---|---|---|---| | `main` `ffe310e` | 350 | 358 | 256 | | + #352 (this PR) | **0** | **5** | 386 | | + #1041 | 288 | 211 | 186 | - With this PR the mismatch / failed-store pairs are gone (972: 350 → 0, 970: 358 → 5), matching the RTX 3060 Laptop numbers in #780 (139 → 0). - 971 ("does not have a pipeline stored") is a plain miss for pipelines the first run never made; it depends on how far that run got (every run ended in `DXGI_ERROR_DEVICE_HUNG` in the world, the first runs after 153 / 84 / 88 s), so it is not comparable between rows. - #1041 lowers 970 / 972 by roughly 20–40 % but does not remove them, so zeroing padding is not the cause here; the missing mesh topology is. **Not tested**: AMD / Intel, more than one run per build, the two PRs together (they conflict). No game data, title-content log lines or screenshots attached. AI use: Claude Code (Claude Opus 5.5) built, ran and counted the messages; I checked the results.

Pull request closed

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/Marvisak--VIctory!352
No description provided.