gpu: create the empty pipeline library, skip hung pipelines at creation, and trace the queue #3

Manually merged
github merged 1 commit from gh-pr/3/head into gh-pr/3/base 2026-11-27 01:24:41 +00:00
Owner

@⁠vilja22 on GitHub · 2026-11-26 23:50 UTC · original
vilja22:pipeline-fixes → main · +58 −3 · 3 files · 1 commits · merged 2026-11-27 00:40 UTC

Three small fixes that made it possible to test RT here, plus one finding about the
pipeline library. They are independent of the LaneMirror PR.

1. The empty pipeline library is never created (library.rs)

open() builds an empty library with device.CreatePipelineLibrary(bytes) where
bytes is empty. The generated binding passes bytes.as_ptr(), which for an empty slice
is a dangling non-null pointer; vkd3d-proton rejects a non-null zero-length blob
(E_INVALIDARG), open() returns None, and the library is never created or saved. In
our logs every save was bytes=0.

The fix calls the vtable directly with a null pointer and length 0 for the empty case.

before: host pipeline library saved bytes=0        (every save)
after:  host pipeline library saved bytes=162488 early=2977 made=850 loaded=45

2. Skipped pipelines are still created (pipeline.rs, make.rs)

VICTORY_SKIP_PIPELINES currently drops the draws, but start() still queues and builds
the pipeline. A few of these hang the driver's compiler, so several workers end up stuck
and the whole make queue stops (the game then holds the last frame).

creates_skipped(&shaders) is exposed from pipeline.rs and start() returns early for
those pipelines; their draws were already dropped.

3. VICTORY_PIPELINE_TRACE (make.rs)

Writes start <key> <shaders> before the build and end <key> after it, so a pipeline
that never finishes is named. A Mutex serializes the writes; without it parallel
workers interleave lines (our first version did).

With it we found the queue stopping after the six known RT passes on
53c898f8332f08bc, b3744522a4662623, 2da4beb386509b77 (also the only "refused"
one), c2d3fdeffa839418, 9ad3577822ed8af2, d50c03da6d935d87.

4. Finding: the PSO library is keyed by shader hashes only

After any translator change (VICTORY_FIRSTLANE_OWN, LaneMirror, a new build), the
pipeline library is still accepted: its entries match the same shader hashes, but hold
PSOs built from the old DXIL. The game then serves stale pipelines (or re-translates
while holding a frame). Deleting pipelines/host-pipelines.bin is required for a clean
test. Worth documenting, or including the translator hash in the library key.

Testing

  • cargo xwin build --profile release -p victory --features diagnostics --target x86_64-pc-windows-msvc — clean.
  • The library saves with a non-zero size; the skip stops the known hangs from being built;
    the trace names the pending pipelines (logs available on request).

Licence

GPL-3.0-or-later, same as the repository. The skip and trace are our own; the library fix
is the same one victory-perf carries (CreatePipelineLibrary(NULL, 0)).

**@⁠vilja22** on GitHub · 2026-11-26 23:50 UTC · [original](https://github.com/edsuuu/VI-BR-PORT/pull/3) `vilja22:pipeline-fixes` → `main` · +58 −3 · 3 files · 1 commits · merged 2026-11-27 00:40 UTC Three small fixes that made it possible to test RT here, plus one finding about the pipeline library. They are independent of the `LaneMirror` PR. ## 1. The empty pipeline library is never created (`library.rs`) `open()` builds an empty library with `device.CreatePipelineLibrary(bytes)` where `bytes` is empty. The generated binding passes `bytes.as_ptr()`, which for an empty slice is a dangling non-null pointer; vkd3d-proton rejects a non-null zero-length blob (`E_INVALIDARG`), `open()` returns `None`, and the library is never created or saved. In our logs every save was `bytes=0`. The fix calls the vtable directly with a null pointer and length 0 for the empty case. ``` before: host pipeline library saved bytes=0 (every save) after: host pipeline library saved bytes=162488 early=2977 made=850 loaded=45 ``` ## 2. Skipped pipelines are still created (`pipeline.rs`, `make.rs`) `VICTORY_SKIP_PIPELINES` currently drops the draws, but `start()` still queues and builds the pipeline. A few of these hang the driver's compiler, so several workers end up stuck and the whole make queue stops (the game then holds the last frame). `creates_skipped(&shaders)` is exposed from `pipeline.rs` and `start()` returns early for those pipelines; their draws were already dropped. ## 3. `VICTORY_PIPELINE_TRACE` (`make.rs`) Writes `start <key> <shaders>` before the build and `end <key>` after it, so a pipeline that never finishes is named. A `Mutex` serializes the writes; without it parallel workers interleave lines (our first version did). With it we found the queue stopping after the six known RT passes on `53c898f8332f08bc`, `b3744522a4662623`, `2da4beb386509b77` (also the only "refused" one), `c2d3fdeffa839418`, `9ad3577822ed8af2`, `d50c03da6d935d87`. ## 4. Finding: the PSO library is keyed by shader hashes only After any translator change (`VICTORY_FIRSTLANE_OWN`, `LaneMirror`, a new build), the pipeline library is still accepted: its entries match the same shader hashes, but hold PSOs built from the old DXIL. The game then serves stale pipelines (or re-translates while holding a frame). Deleting `pipelines/host-pipelines.bin` is required for a clean test. Worth documenting, or including the translator hash in the library key. ## Testing - `cargo xwin build --profile release -p victory --features diagnostics --target x86_64-pc-windows-msvc` — clean. - The library saves with a non-zero size; the skip stops the known hangs from being built; the trace names the pending pipelines (logs available on request). ## Licence GPL-3.0-or-later, same as the repository. The skip and trace are our own; the library fix is the same one victory-perf carries (`CreatePipelineLibrary(NULL, 0)`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:24:40 +00:00
github manually merged commit 6d3caee6e3 into gh-pr/3/base 2026-11-27 01:24:41 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.