d3d12: give an empty pipeline library a null blob (D3D12-VKD3D-EMPTY-PIPELINE-LIBRARY) #2654

Open
kuzeyc wants to merge 4 commits from upstream-pr/2654 into main
kuzeyc commented 2026-11-29 22:40:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kuzeyc on 2026-11-29T22:40:13Z.


Item: D3D12-VKD3D-EMPTY-PIPELINE-LIBRARY (claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263775300)

What is wrong

pipeline/library.rs (open) makes the empty host pipeline library with CreatePipelineLibrary(&[]). The windows crate passes an empty slice's pointer, which is dangling, not null, with a length of 0. Microsoft's D3D12 takes that. VKD3D-Proton answers E_INVALIDARG (0x80070057), and make(&[]).ok()? dropped the error, so under Wine and Proton the run keeps no library:

INFO no host pipeline library yet; starting an empty one
WARN no host pipeline library: pipelines are not kept

Nothing is stored or saved (cache/pipelines/host-pipelines.bin never appears), and every start makes every pipeline again.

The change

  • The blob goes to CreatePipelineLibrary through blob_pointer(), which gives a null pointer for an empty blob.
  • A refused empty library is logged (the host refused an empty pipeline library, with the error) instead of dropped.
  • New unit test an_empty_blob_is_given_as_a_null_pointer.

One file, d3d12/crates/leonida-gpu/src/pipeline/library.rs.

Tested

  • cargo xwin test --target x86_64-pc-windows-msvc -p leonida-gpu --features diagnostics -- pipeline::library, run under Wine 11.23: 7 passed, 0 failed (the new test and the six that were there).
  • On hardware: RTX 3070 8 GB, NVIDIA 610.57.04, Arch Linux, Proton Hotfix (hotfix-20261110) and its VKD3D-Proton (vkd3d-1.1-5729-g00b6ef057), started with the play-linux.sh of #2577.
    • Before (#2577 at 919c0a9e2, with a log line added at that call): CreatePipelineLibrary refused error=Invalid parameter. (0x80070057), then pipelines are not kept.
    • After (this branch, from an empty cache/pipelines): host pipeline library saved bytes=248 ... made=1. With the same fix on #2577's tree, the next start logged host pipeline library loaded bytes=6584 and host pipelines all made made=0 loaded=34.
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline/library.rs: clean.

The new unit test checks the pointer, not the host: it passes on main too as far as the D3D12 call is concerned, since Microsoft's runtime accepts the dangling pointer. The failure only shows under VKD3D-Proton, which is what the hardware runs above are for.

  • #2569 edits the same function, and its fingerprint path starts empty libraries too, so it gains from this under VKD3D-Proton. The two may need a small merge.
  • #2577 is the Linux launcher these runs used; this change does not depend on it.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5555920092 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654). Originally posted by [kuzeyc](https://github.com/kuzeyc) on 2026-11-29T22:40:13Z. --- Item: `D3D12-VKD3D-EMPTY-PIPELINE-LIBRARY` (claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263775300) ## What is wrong `pipeline/library.rs` (`open`) makes the empty host pipeline library with `CreatePipelineLibrary(&[])`. The `windows` crate passes an empty slice's pointer, which is dangling, not null, with a length of 0. Microsoft's D3D12 takes that. VKD3D-Proton answers `E_INVALIDARG` (`0x80070057`), and `make(&[]).ok()?` dropped the error, so under Wine and Proton the run keeps no library: ``` INFO no host pipeline library yet; starting an empty one WARN no host pipeline library: pipelines are not kept ``` Nothing is stored or saved (`cache/pipelines/host-pipelines.bin` never appears), and every start makes every pipeline again. ## The change - The blob goes to `CreatePipelineLibrary` through `blob_pointer()`, which gives a null pointer for an empty blob. - A refused empty library is logged (`the host refused an empty pipeline library`, with the error) instead of dropped. - New unit test `an_empty_blob_is_given_as_a_null_pointer`. One file, `d3d12/crates/leonida-gpu/src/pipeline/library.rs`. ## Tested - `cargo xwin test --target x86_64-pc-windows-msvc -p leonida-gpu --features diagnostics -- pipeline::library`, run under Wine 11.23: 7 passed, 0 failed (the new test and the six that were there). - On hardware: RTX 3070 8 GB, NVIDIA 610.57.04, Arch Linux, Proton Hotfix (hotfix-20261110) and its VKD3D-Proton (vkd3d-1.1-5729-g00b6ef057), started with the `play-linux.sh` of #2577. - Before (#2577 at `919c0a9e2`, with a log line added at that call): `CreatePipelineLibrary refused error=Invalid parameter. (0x80070057)`, then `pipelines are not kept`. - After (this branch, from an empty `cache/pipelines`): `host pipeline library saved bytes=248 ... made=1`. With the same fix on #2577's tree, the next start logged `host pipeline library loaded bytes=6584` and `host pipelines all made made=0 loaded=34`. - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline/library.rs`: clean. The new unit test checks the pointer, not the host: it passes on `main` too as far as the D3D12 call is concerned, since Microsoft's runtime accepts the dangling pointer. The failure only shows under VKD3D-Proton, which is what the hardware runs above are for. ## Related - #2569 edits the same function, and its fingerprint path starts empty libraries too, so it gains from this under VKD3D-Proton. The two may need a small merge. - #2577 is the Linux launcher these runs used; this change does not depend on it. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
copilot-pull-request-reviewer[bot] commented 2026-11-29 22:40:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-29T22:40:21Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6105178796 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#pullrequestreview-6105178796). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-29T22:40:21Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level. An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. [Learn about Copilot code review billing](https://docs.github.com/en/copilot/concepts/agents/code-review#code-review-usage).
merzleckeier commented 2026-11-29 22:48:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T22:48:45Z.


Independent synthetic A/B of f1794125 (GitHub merge 71250d7b onto 452d1d1b). Win64 MSVC-target Rust 1.98.1, Wine 11.22, VKD3D-Proton 71cae091, DXC 1.8.2505.32, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1).

  • MEASURED, unchanged GPU fixtures. On both GPUs, main failed 3/3 at the library reload assertion in each of depth_bounds_pipeline_loads_and_filters_draws and a_mesh_pipeline_loads_from_the_library. With this PR each passed 3/3, including both depth readbacks. The library unit group went from 5 passed and the rejected-blob test failing to 7/7 on each GPU. An initial blank NVIDIA process timeout was outside the completed baseline sample.
  • MEASURED, save and reopen. A test-only probe gave the existing depth fixture a scratch library path and recorded the first PSO and save counters. The direct CreatePipelineLibrary(&[]) call returned 0x80070057. The PR path created one PSO and serialized the library, 15,664 bytes on NVIDIA and 3,136 bytes on RADV. A new process loaded the first PSO (loaded=1, made=0) and left the file size unchanged. It also rebuilt and saved successfully after I substituted a malformed blob. Each case passed 3/3 per GPU.
  • MEASURED, interaction with #2569. 8f5f02d80 combined cleanly with this PR (local tree 1b933a60). Cold and warm behavior matched the standalone PR. Replacing only host-pipelines.fingerprint with a stale value forced a rebuild and a fresh save, in 3/3 per GPU. All 36 instrumented invocations passed the depth fixture.

This resolves the local Wine library assertion I reported in #2648. The hosted native Windows pixel failure there remains open. Small build note: the !empty.as_ptr().is_null() assertion at library.rs:906 emits useless_ptr_null_checks. The test already checks the converted pointer immediately above.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7263968562 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7263968562). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T22:48:45Z. --- Independent synthetic A/B of `f1794125` (GitHub merge `71250d7b` onto `452d1d1b`). Win64 MSVC-target Rust 1.98.1, Wine 11.22, VKD3D-Proton `71cae091`, DXC `1.8.2505.32`, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). - **MEASURED, unchanged GPU fixtures.** On both GPUs, main failed 3/3 at the library reload assertion in each of `depth_bounds_pipeline_loads_and_filters_draws` and `a_mesh_pipeline_loads_from_the_library`. With this PR each passed 3/3, including both depth readbacks. The library unit group went from 5 passed and the rejected-blob test failing to 7/7 on each GPU. An initial blank NVIDIA process timeout was outside the completed baseline sample. - **MEASURED, save and reopen.** A test-only probe gave the existing depth fixture a scratch library path and recorded the first PSO and save counters. The direct `CreatePipelineLibrary(&[])` call returned `0x80070057`. The PR path created one PSO and serialized the library, 15,664 bytes on NVIDIA and 3,136 bytes on RADV. A new process loaded the first PSO (`loaded=1, made=0`) and left the file size unchanged. It also rebuilt and saved successfully after I substituted a malformed blob. Each case passed 3/3 per GPU. - **MEASURED, interaction with #2569.** `8f5f02d80` combined cleanly with this PR (local tree `1b933a60`). Cold and warm behavior matched the standalone PR. Replacing only `host-pipelines.fingerprint` with a stale value forced a rebuild and a fresh save, in 3/3 per GPU. All 36 instrumented invocations passed the depth fixture. This resolves the local Wine library assertion I reported in #2648. The hosted native Windows pixel failure there remains open. Small build note: the `!empty.as_ptr().is_null()` assertion at `library.rs:906` emits `useless_ptr_null_checks`. The test already checks the converted pointer immediately above. Synthetic fixtures only. AI-assisted with OpenAI Codex.
kuzeyc commented 2026-11-29 22:53:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kuzeyc on 2026-11-29T22:53:35Z.


Thanks for the A/B on both GPUs, and for checking it together with #2569.

  • Pushed 55ac5d337: drops the !empty.as_ptr().is_null() assertion that useless_ptr_null_checks flags. The converted pointer is still checked just above. pipeline::library is 7/7 under Wine 11.23, and clippy has no warnings in library.rs.
  • Your runs also answer the "a test that fails on main" question better than my new unit test does. Under VKD3D-Proton, a_rejected_blob_gives_an_empty_library, depth_bounds_pipeline_loads_and_filters_draws and a_mesh_pipeline_loads_from_the_library fail on main and pass with this PR, on both your RTX 4070 SUPER and RADV.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264031389 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7264031389). Originally posted by [kuzeyc](https://github.com/kuzeyc) on 2026-11-29T22:53:35Z. --- Thanks for the A/B on both GPUs, and for checking it together with #2569. - Pushed `55ac5d337`: drops the `!empty.as_ptr().is_null()` assertion that `useless_ptr_null_checks` flags. The converted pointer is still checked just above. `pipeline::library` is 7/7 under Wine 11.23, and clippy has no warnings in `library.rs`. - Your runs also answer the "a test that fails on `main`" question better than my new unit test does. Under VKD3D-Proton, `a_rejected_blob_gives_an_empty_library`, `depth_bounds_pipeline_loads_and_filters_draws` and `a_mesh_pipeline_loads_from_the_library` fail on `main` and pass with this PR, on both your RTX 4070 SUPER and RADV. AI-assisted (Claude Code).
z3r0rc commented 2026-12-01 10:45:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by z3r0rc on 2026-12-01T10:45:55Z.


We independently landed exactly this on our tree and can confirm it end-to-end under Wine. Before the null-pointer fix, with CreatePipelineLibrary receiving the dangling non-null + 0, the library was dead here under Wine + VKD3D-Proton master (RTX 4090, NVIDIA 620.73.04): every start logged "no host pipeline library: pipelines are not kept", nothing was written at clean exit, and the entry backlog peaked ~1038 every run. With this shape — vtable call, null for the empty blob — the loop closes: saved bytes=448760 made=2347 at a clean close, loaded mapped=true at the next start, compounding 605,624 → 641,336 bytes over the next three windows with the entry backlog shrinking each time. Your blob_pointer helper is the cleaner way to state the rule; we inlined the same thing. Happy to test this PR as-is on our machine if useful. AI-assisted; measured logs on the setup above.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7308683052 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7308683052). Originally posted by [z3r0rc](https://github.com/z3r0rc) on 2026-12-01T10:45:55Z. --- We independently landed exactly this on our tree and can confirm it end-to-end under Wine. Before the null-pointer fix, with `CreatePipelineLibrary` receiving the dangling non-null + 0, the library was dead here under Wine + VKD3D-Proton master (RTX 4090, NVIDIA 620.73.04): every start logged "no host pipeline library: pipelines are not kept", nothing was written at clean exit, and the entry backlog peaked ~1038 every run. With this shape — vtable call, null for the empty blob — the loop closes: `saved bytes=448760 made=2347` at a clean close, loaded `mapped=true` at the next start, compounding 605,624 → 641,336 bytes over the next three windows with the entry backlog shrinking each time. Your `blob_pointer` helper is the cleaner way to state the rule; we inlined the same thing. Happy to test this PR as-is on our machine if useful. AI-assisted; measured logs on the setup above.
KelboLive commented 2026-12-01 17:55:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T17:55:26Z.

Review: COMMENTED


Not superseded, and the fix is correct: main still has device.CreatePipelineLibrary::<ID3D12PipelineLibrary>(bytes)?.cast() (library.rs:522) with make(&[]).ok()? (:551), and windows-rs 0.62.2 does transmute(plibraryblob.as_ptr()) on an empty slice (Windows/Win32/Graphics/Direct3D12/mod.rs:9959) — a dangling non-null pointer. The manual vtable call with null + 0 is the right fix, and the rejected-blob test exercises that path against native D3D12 here (7/7 pass, clippy clean in library.rs).

One test gap: replacing blob_pointer(bytes) at the call site with bytes.as_ptr().cast() leaves all 7 tests green — only the helper is asserted, not that open uses it. A small seam (or the replay vtable) that checks the pointer open passes would close it, since the bug is only observable under VKD3D.

Also d3d12/crates/leonida-gpu/tests/replay.rs:193 still calls CreatePipelineLibrary(&[]) through windows-rs, so the replay test keeps the same dangling pointer under Wine — worth switching too.

Branch is 1068 commits behind main; merge-tree is clean (0b142434a), but the head predates #2648's d3d12 cargo-test CI, so no checks have run. A rebase is needed for CI; otherwise this is good to merge.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6136915026 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#pullrequestreview-6136915026). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T17:55:26Z. **Review:** COMMENTED --- Not superseded, and the fix is correct: main still has `device.CreatePipelineLibrary::<ID3D12PipelineLibrary>(bytes)?.cast()` (`library.rs:522`) with `make(&[]).ok()?` (`:551`), and windows-rs 0.62.2 does `transmute(plibraryblob.as_ptr())` on an empty slice (`Windows/Win32/Graphics/Direct3D12/mod.rs:9959`) — a dangling non-null pointer. The manual vtable call with `null` + 0 is the right fix, and the rejected-blob test exercises that path against native D3D12 here (7/7 pass, clippy clean in `library.rs`). One test gap: replacing `blob_pointer(bytes)` at the call site with `bytes.as_ptr().cast()` leaves all 7 tests green — only the helper is asserted, not that `open` uses it. A small seam (or the replay vtable) that checks the pointer `open` passes would close it, since the bug is only observable under VKD3D. Also `d3d12/crates/leonida-gpu/tests/replay.rs:193` still calls `CreatePipelineLibrary(&[])` through windows-rs, so the replay test keeps the same dangling pointer under Wine — worth switching too. Branch is **1068 commits behind** main; merge-tree is clean (`0b142434a`), but the head predates #2648's d3d12 cargo-test CI, so no checks have run. A rebase is needed for CI; otherwise this is good to merge.
merzleckeier commented 2026-12-01 20:42:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T20:42:36Z.


Current-head hardware check of the empty-library call on 55ac5d33, merged into 66c79286f, and combined on that same base with #2938 (69485a86). Win64 under Wine 11.22 / VKD3D-Proton 3.1.0, RTX 4070 SUPER (620.73.4) and Radeon RADV (26.3.1).

On each adapter, the unmodified a_mesh_pipeline_loads_from_the_library failed 3/3 on main and 3/3 with #2938 alone after both PSO requests returned. A diagnostic logged CreatePipelineLibrary returning E_INVALIDARG for the empty library, before load or store. The stock pipeline::library::tests also had exactly one failure under both trees, a_rejected_blob_gives_an_empty_library.

This PR alone and the combined tree each passed 3/3 mesh-library runs and 7/7 stock library tests on each adapter, with no skips. The existing GPU mesh test reaches the production open call and checks that the second request actually loads from the library, which complements the pointer helper’s unit test on Wine. This run covers an empty library and in-process reuse.

MEASURED with synthetic shader inputs, OpenAI Codex and a separate read-only review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7325144280 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7325144280). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T20:42:36Z. --- Current-head hardware check of the empty-library call on `55ac5d33`, merged into `66c79286f`, and combined on that same base with #2938 (`69485a86`). Win64 under Wine 11.22 / VKD3D-Proton 3.1.0, RTX 4070 SUPER (620.73.4) and Radeon RADV (26.3.1). On **each** adapter, the unmodified `a_mesh_pipeline_loads_from_the_library` failed 3/3 on main and 3/3 with #2938 alone after both PSO requests returned. A diagnostic logged `CreatePipelineLibrary` returning `E_INVALIDARG` for the empty library, before load or store. The stock `pipeline::library::tests` also had exactly one failure under both trees, `a_rejected_blob_gives_an_empty_library`. This PR alone and the combined tree each passed **3/3 mesh-library runs and 7/7 stock library tests on each adapter**, with no skips. The existing GPU mesh test reaches the production `open` call and checks that the second request actually loads from the library, which complements the pointer helper’s unit test on Wine. This run covers an empty library and in-process reuse. MEASURED with synthetic shader inputs, OpenAI Codex and a separate read-only review.
kuzeyc commented 2026-12-01 21:19:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kuzeyc on 2026-12-01T21:19:34Z.


Thanks @KelboLive, all three done in f4ae7b922:

  • Up to date: merged origin/main into the branch (c3ecaa558), no conflicts, so the d3d12 cargo-test CI from #2648 should now run. Merged rather than rebased, per the maintainer guide (no rebase, no force-push).
  • tests/replay.rs: the empty library there now goes through the vtable with null and 0, the same as pipeline::library (f4ae7b922). a_frame_is_recorded_and_replayed passes under Wine 11.23.
  • The test gap: agreed that an_empty_blob_is_given_as_a_null_pointer only pins the helper. The check that open uses it is the existing GPU test a_mesh_pipeline_loads_from_the_library, which goes through the real open: per merzleckeier's run above it fails 3/3 on main and passes 3/3 with this PR on both an RTX 4070 SUPER and RADV under VKD3D-Proton. Putting bytes.as_ptr().cast() back at the call site would fail it there, though not on native D3D12. If you'd still like a seam that checks the pointer open passes without a GPU, say so and I'll add it.

pipeline::library is 7/7 under Wine on the merged tree. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7326083020 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7326083020). Originally posted by [kuzeyc](https://github.com/kuzeyc) on 2026-12-01T21:19:34Z. --- Thanks @KelboLive, all three done in `f4ae7b922`: - **Up to date:** merged `origin/main` into the branch (`c3ecaa558`), no conflicts, so the d3d12 cargo-test CI from #2648 should now run. Merged rather than rebased, per the maintainer guide (no rebase, no force-push). - **`tests/replay.rs`:** the empty library there now goes through the vtable with `null` and 0, the same as `pipeline::library` (`f4ae7b922`). `a_frame_is_recorded_and_replayed` passes under Wine 11.23. - **The test gap:** agreed that `an_empty_blob_is_given_as_a_null_pointer` only pins the helper. The check that `open` uses it is the existing GPU test `a_mesh_pipeline_loads_from_the_library`, which goes through the real `open`: per merzleckeier's run above it fails 3/3 on main and passes 3/3 with this PR on both an RTX 4070 SUPER and RADV under VKD3D-Proton. Putting `bytes.as_ptr().cast()` back at the call site would fail it there, though not on native D3D12. If you'd still like a seam that checks the pointer `open` passes without a GPU, say so and I'll add it. `pipeline::library` is 7/7 under Wine on the merged tree. AI-assisted (Claude Code).
deynesdev commented 2026-12-02 07:10:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by deynesdev on 2026-12-02T07:10:50Z.


Tested on Linux/NVIDIA: f4ae7b922 merged (locally, nothing pushed) into main f37c4a87d, against plain f37c4a87d. Same save, same settings (scripts/play-linux.sh defaults, LEONIDA_SKIP_BINK=1), shader cache already translated for this build (leonida shaders).

Setup: RTX 4050 Laptop 6 GB, NVIDIA 580.196.07, Fedora 44, Wine 11.21 Staging, VKD3D-Proton 3.2.0 (71cae091b06571e+). Built with --target x86_64-pc-windows-gnullvm (not the msvc route).

main f37c4a87d with this PR
library at start no host pipeline library: pipelines are not kept host pipeline library saved, 331,640 bytes, made=1728
cache/pipelines/early-pipelines.txt never written 1,898 lines
leonida warm --used 83670 pipelines known ... 0 to make 1828 to make, 1828 made in 186 s, 0 bad
next start — loaded=1937, made=38
frame lines under 3 fps, first 4 min (5 s lines) 7 of 52 1 of 45
median fps, last 20 lines 12.4 12.4

So on Wine/VKD3D-Proton the empty-library refusal does not only lose the library: save returns before early-pipelines.txt is written, which leaves warm --used with nothing to make on every Linux setup. This PR fixes both here. One run per row; the main "next start" run had the driver's own cache warm from an earlier run, not a library.

AI-assisted: yes (Claude Code, Claude Opus 5.5): the runs, logs and this comment.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7337871042 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7337871042). Originally posted by [deynesdev](https://github.com/deynesdev) on 2026-12-02T07:10:50Z. --- Tested on Linux/NVIDIA: `f4ae7b922` merged (locally, nothing pushed) into `main` `f37c4a87d`, against plain `f37c4a87d`. Same save, same settings (`scripts/play-linux.sh` defaults, `LEONIDA_SKIP_BINK=1`), shader cache already translated for this build (`leonida shaders`). Setup: RTX 4050 Laptop 6 GB, NVIDIA 580.196.07, Fedora 44, Wine 11.21 Staging, VKD3D-Proton 3.2.0 (`71cae091b06571e+`). Built with `--target x86_64-pc-windows-gnullvm` (not the msvc route). | | `main` `f37c4a87d` | with this PR | |---|---|---| | library at start | `no host pipeline library: pipelines are not kept` | `host pipeline library saved`, 331,640 bytes, made=1728 | | `cache/pipelines/early-pipelines.txt` | never written | 1,898 lines | | `leonida warm --used` | `83670 pipelines known ... 0 to make` | `1828 to make`, `1828 made in 186 s`, 0 bad | | next start | — | loaded=1937, made=38 | | frame lines under 3 fps, first 4 min (5 s lines) | 7 of 52 | 1 of 45 | | median fps, last 20 lines | 12.4 | 12.4 | So on Wine/VKD3D-Proton the empty-library refusal does not only lose the library: `save` returns before `early-pipelines.txt` is written, which leaves `warm --used` with nothing to make on every Linux setup. This PR fixes both here. One run per row; the `main` "next start" run had the driver's own cache warm from an earlier run, not a library. AI-assisted: yes (Claude Code, Claude Opus 5.5): the runs, logs and this comment.
Kal0s-design commented 2026-12-02 14:24:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T14:24:45Z.


Ran natively on Windows 11, head f4ae7b922 merged into current main (2fc7383b9, no conflicts), toolchain 1.98.1, --locked. The 7/7 native run above covers the unit tests. This one adds the debug layer, WARP, the raw CreatePipelineLibrary results for each kind of blob, the serialised round trip of an empty library, and the empty-file paths.

Tests on the merge

card WARP card + debug layer WARP + debug layer
pipeline::library (7) + a_mesh_pipeline_loads_from_the_library + depth_bounds_pipeline_loads_and_filters_draws 9/9 9/9 9/9 9/9
tests/replay.rs a_frame_is_recorded_and_replayed pass pass not run not run

cargo test -p leonida-gpu --lib: 697 passed, 0 failed, 59 ignored. Clippy (--all-targets) reports nothing in library.rs or replay.rs.

Native CreatePipelineLibrary and the empty library (a throwaway test, not committed)

This calls the vtable directly with each blob, then serialises the result.

Blob given card WARP Debug layer message
null, 0 (this PR) S_OK, serialised size 900 S_OK, 872 none
empty slice's dangling pointer, 0 (main) S_OK, 900 S_OK, 872 none
windows-rs CreatePipelineLibrary(&[]) S_OK S_OK none
the empty library's own serialised bytes S_OK, same size, re-serialises to identical bytes same none
first half of those bytes E_INVALIDARG E_INVALIDARG "library blob which could not be understood"
352 bytes of junk E_INVALIDARG E_INVALIDARG same
Serialize into a buffer one byte short E_INVALIDARG E_INVALIDARG "insufficient amount of memory"

The production open gave a library in all three cases: Blob::None, a junk blob (it fell back to an empty one), and the serialised empty library (loaded as is, no fallback).

So on native D3D12 the change makes no difference: the runtime accepts null and dangling alike, and the debug layer is silent on both. The bug can only be seen under VKD3D-Proton, which matches the earlier runs above. An empty library still serialises to a few hundred bytes, not 0. save does not serialise at all while added == 0, and Blob::of treats a 0-byte file as no file. So I found no path that writes, or chokes on, an empty library file.

Not checked: Wine/VKD3D-Proton (covered above by others), AMD/Intel native drivers, a full save-and-reopen across two processes on native.

GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7348500030 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7348500030). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T14:24:45Z. --- Ran natively on Windows 11, head `f4ae7b922` merged into current `main` (`2fc7383b9`, no conflicts), toolchain 1.98.1, `--locked`. The 7/7 native run above covers the unit tests. This one adds the debug layer, WARP, the raw `CreatePipelineLibrary` results for each kind of blob, the serialised round trip of an empty library, and the empty-file paths. **Tests on the merge** | | card | WARP | card + debug layer | WARP + debug layer | |---|---|---|---|---| | `pipeline::library` (7) + `a_mesh_pipeline_loads_from_the_library` + `depth_bounds_pipeline_loads_and_filters_draws` | 9/9 | 9/9 | 9/9 | 9/9 | | `tests/replay.rs` `a_frame_is_recorded_and_replayed` | pass | pass | not run | not run | `cargo test -p leonida-gpu --lib`: 697 passed, 0 failed, 59 ignored. Clippy (`--all-targets`) reports nothing in `library.rs` or `replay.rs`. **Native `CreatePipelineLibrary` and the empty library (a throwaway test, not committed)** This calls the vtable directly with each blob, then serialises the result. | Blob given | card | WARP | Debug layer message | |---|---|---|---| | null, 0 (this PR) | `S_OK`, serialised size 900 | `S_OK`, 872 | none | | empty slice's dangling pointer, 0 (`main`) | `S_OK`, 900 | `S_OK`, 872 | none | | windows-rs `CreatePipelineLibrary(&[])` | `S_OK` | `S_OK` | none | | the empty library's own serialised bytes | `S_OK`, same size, re-serialises to identical bytes | same | none | | first half of those bytes | `E_INVALIDARG` | `E_INVALIDARG` | "library blob which could not be understood" | | 352 bytes of junk | `E_INVALIDARG` | `E_INVALIDARG` | same | | `Serialize` into a buffer one byte short | `E_INVALIDARG` | `E_INVALIDARG` | "insufficient amount of memory" | The production `open` gave a library in all three cases: `Blob::None`, a junk blob (it fell back to an empty one), and the serialised empty library (loaded as is, no fallback). So on native D3D12 the change makes no difference: the runtime accepts null and dangling alike, and the debug layer is silent on both. The bug can only be seen under VKD3D-Proton, which matches the earlier runs above. An empty library still serialises to a few hundred bytes, not 0. `save` does not serialise at all while `added == 0`, and `Blob::of` treats a 0-byte file as no file. So I found no path that writes, or chokes on, an empty library file. Not checked: Wine/VKD3D-Proton (covered above by others), AMD/Intel native drivers, a full save-and-reopen across two processes on native. GPUs tested: one NVIDIA desktop card + WARP. AI-assisted: yes (Claude Code).
merzleckeier commented 2026-12-02 14:31:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:31:11Z.

Review: COMMENTED


Follow-up for the replay change in f4ae7b92, merged locally onto main 69cd4106c. I ran the same MSVC-target tests under Wine 11.22 and VKD3D-Proton 0bb64c56 on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.4).

A local smoke test called the existing tests/replay.rs::mesh helper with synthetic HLSL and required the helper to store and reload its mesh PSO. On both GPUs it failed on main at CreatePipelineLibrary with 0x80070057 and passed with this PR. The stock pipeline::library suite passed 7/7 on each GPU. The existing rejected-blob and runtime mesh-reload tests also failed on main and passed with the PR.

The full replay test, with its SDK-dependent mesh path inactive, reached recorder on and scene made and then failed with the same Wine access fault on both revisions and GPUs. The isolated smoke test exercised the updated replay call with DXC available. git merge-tree also found no textual conflict with #3150 at 6a5e5bcd. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6152806636 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#pullrequestreview-6152806636). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T14:31:11Z. **Review:** COMMENTED --- Follow-up for the replay change in `f4ae7b92`, merged locally onto `main` `69cd4106c`. I ran the same MSVC-target tests under Wine 11.22 and VKD3D-Proton `0bb64c56` on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.4). A local smoke test called the existing `tests/replay.rs::mesh` helper with synthetic HLSL and required the helper to store and reload its mesh PSO. On both GPUs it failed on `main` at `CreatePipelineLibrary` with `0x80070057` and passed with this PR. The stock `pipeline::library` suite passed 7/7 on each GPU. The existing rejected-blob and runtime mesh-reload tests also failed on `main` and passed with the PR. The full replay test, with its SDK-dependent mesh path inactive, reached `recorder on` and `scene made` and then failed with the same Wine access fault on both revisions and GPUs. The isolated smoke test exercised the updated replay call with DXC available. `git merge-tree` also found no textual conflict with #3150 at `6a5e5bcd`. AI-assisted with OpenAI Codex.
MoonEyes commented 2026-12-02 18:01:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:01:29Z.


Triage of head f4ae7b922 (merge base 1fff69129, 334 commits behind; git merge-tree against current main 45dc41f95: no conflicts).

2 files: pipeline/library.rs (+37/-3), tests/replay.rs (+15/-7).

CI is at action_required on this head (fork workflow approval).

Existing verification: Verified by @merzleckeier (Wine/VKD3D-Proton, RTX and RADV), @z3r0rc (same fix landed independently), @deynesdev (Linux/NVIDIA in game on this head) and @Kal0s-design (native, debug layer, WARP, raw CreatePipelineLibrary per blob kind).

This check: Not re-reviewed in depth: the empty library is created from a null blob instead of an empty slice's dangling pointer, which VKD3D-Proton rejected. Root cause, small, verified on both Windows and Proton. It touches library::open, not library::pipeline, so it does not interact with #3185.

I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here.

Verdict: ready (root-cause fix verified natively and under Proton; needs CI approval).

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353870492 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7353870492). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:01:29Z. --- **Triage of head `f4ae7b922` (merge base `1fff69129`, 334 commits behind; `git merge-tree` against current `main` `45dc41f95`: no conflicts).** 2 files: `pipeline/library.rs` (+37/-3), `tests/replay.rs` (+15/-7). CI is at `action_required` on this head (fork workflow approval). **Existing verification:** Verified by @merzleckeier (Wine/VKD3D-Proton, RTX and RADV), @z3r0rc (same fix landed independently), @deynesdev (Linux/NVIDIA in game on this head) and @Kal0s-design (native, debug layer, WARP, raw `CreatePipelineLibrary` per blob kind). **This check:** Not re-reviewed in depth: the empty library is created from a null blob instead of an empty slice's dangling pointer, which VKD3D-Proton rejected. Root cause, small, verified on both Windows and Proton. It touches `library::open`, not `library::pipeline`, so it does not interact with #3185. I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here. **Verdict: ready** (root-cause fix verified natively and under Proton; needs CI approval). AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 21:34:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:34:45Z.


RUN (independent run on Windows, head f4ae7b922bc591918b43c4761e69f77572a4c8ac, merged into main b41763227aeed2d23c98af84bcbc1bddc7acdc90 with git merge --no-ff)

PR #2654, D3D12-VKD3D-EMPTY-PIPELINE-LIBRARY: the empty host pipeline library is created from a null blob (new blob_pointer() helper and a raw vtable call) instead of an empty slice's dangling pointer. It also logs a refused empty library, and tests/replay.rs makes its library the same way. Two files, +52/-10.

Merge: clean, no conflict. Toolchain from the repo, --locked, --release, native Windows 11, one shared target directory, no leonida.exe running during the builds.

Green

  • cargo test -p leonida-gpu --release --locked --lib: 704 passed, 0 failed, 59 ignored. All 7 pipeline::library tests pass, including the new an_empty_blob_is_given_as_a_null_pointer.
  • cargo test -p leonida-gpu --release --locked --features diagnostics --lib: 785 passed, 0 failed, 59 ignored. I ran this one because tests/replay.rs is behind feature = "diagnostics".
  • cargo test -p leonida-gpu --release --locked --features diagnostics --test replay: a_frame_is_recorded_and_replayed passes (1/1). Without the feature this file compiles to 0 tests.
  • No Python test is touched.

Red

The PR's only new test is in library.rs, next to the code it tests. Checking out main's library.rs removes the test and blob_pointer together, so it cannot go red that way. I mutated the new code instead, one change at a time, then restored the file with git checkout HEAD --:

Mutation Result
M1: blob_pointer always returns bytes.as_ptr() (the old behaviour) killed, the new unit test fails on blob_pointer(&[]).is_null() (6 passed, 1 failed)
M2: the call in open uses bytes.as_ptr().cast() instead of blob_pointer(bytes) survives, 7/7 pass
M3: the condition inverted, so a non-empty blob gets null killed by the same test

M2 is the gap KelboLive pointed out in review. The unit test checks the helper, not that open uses it. The raw-vtable call also passes a dangling pointer without error on native D3D12, so no native test can see the bug. Only VKD3D-Proton refuses it.

Review

  • Default-off switches: no switch is added or changed, so there is nothing to default off. d3d12/docs/switches.md does not need regenerating.
  • Ordering and lifetimes: make still builds the library from the bytes kept beside it in Library. A null pointer with length 0 is only given for an empty blob. raw is wrapped by from_raw only after .ok()? succeeded, so an error leaves nothing to release. blob is still dropped before the empty library is made. No fences are involved.
  • docs/d3d12_vulkan.md (§ on CreatePipelineLibrary) already says a null pointer with a size is E_INVALIDARG. A null pointer with size 0 is the opposite case and is not recorded there. That is a docs gap, not a blocker.
  • Claim: the body names item D3D12-VKD3D-EMPTY-PIPELINE-LIBRARY with a link to a claim comment on issue 2570.
  • Reviewer questions still open: (1) the M2 gap above (KelboLive). (2) The replay.rs change KelboLive asked for is done (f4ae7b922). (3) The useless_ptr_null_checks warning is fixed in 55ac5d337.
  • Overlap: git merge-tree of this head against #2789 (stale library driver stamp) conflicts in pipeline/library.rs, so whichever lands second needs a small merge. Against #3185 and #3150 it is clean. #2569, which the body mentions, is closed.
  • In-game runs posted on this exact head (f4ae7b922): one by deynesdev, Linux, Wine 11.21 plus VKD3D-Proton 3.2.0, RTX 4050 Laptop. On main, "no host pipeline library: pipelines are not kept". With the PR, the library is saved (331,640 bytes) and loaded at the next start. Median fps in the last 20 lines is 12.4 for both. It is a Wine/Proton run, not a native Windows in-game run. Kal0s-design ran native Windows with the debug layer and WARP on a merge (f4ae7b922 into 2fc7383b9): 9/9 on card and WARP, with and without the debug layer. merzleckeier and z3r0rc report Proton runs on earlier heads.

Not covered

  • No in-game run here. The change only matters under VKD3D-Proton and I ran native Windows only. The Wine/Proton behaviour rests on the runs posted by others.
  • The failure itself (E_INVALIDARG from a dangling pointer) cannot be reproduced on native D3D12, so my green run does not show the bug is gone. It shows nothing broke natively.
  • No clippy run, no ctest or C++ runtime build (the PR touches neither).

Verdict

PARTIAL: green on the merge, and the new unit test is killed by 2 of 3 mutations. M2 survives (the call site's use of blob_pointer is not asserted), and the real failure is only visible under VKD3D-Proton, where others have already confirmed it on this head. The fix is small and the code reads as correct. A conflict with #2789 in library.rs is to be expected. In-game run still required on native Windows if the maintainers want one on this head; a Proton in-game run is already posted on this head.

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359479291 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7359479291). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:34:45Z. --- RUN (independent run on Windows, head `f4ae7b922bc591918b43c4761e69f77572a4c8ac`, merged into `main` `b41763227aeed2d23c98af84bcbc1bddc7acdc90` with `git merge --no-ff`) PR #2654, `D3D12-VKD3D-EMPTY-PIPELINE-LIBRARY`: the empty host pipeline library is created from a null blob (new `blob_pointer()` helper and a raw vtable call) instead of an empty slice's dangling pointer. It also logs a refused empty library, and `tests/replay.rs` makes its library the same way. Two files, +52/-10. Merge: clean, no conflict. Toolchain from the repo, `--locked`, `--release`, native Windows 11, one shared target directory, no `leonida.exe` running during the builds. ## Green - `cargo test -p leonida-gpu --release --locked --lib`: 704 passed, 0 failed, 59 ignored. All 7 `pipeline::library` tests pass, including the new `an_empty_blob_is_given_as_a_null_pointer`. - `cargo test -p leonida-gpu --release --locked --features diagnostics --lib`: 785 passed, 0 failed, 59 ignored. I ran this one because `tests/replay.rs` is behind `feature = "diagnostics"`. - `cargo test -p leonida-gpu --release --locked --features diagnostics --test replay`: `a_frame_is_recorded_and_replayed` passes (1/1). Without the feature this file compiles to 0 tests. - No Python test is touched. ## Red The PR's only new test is in `library.rs`, next to the code it tests. Checking out main's `library.rs` removes the test and `blob_pointer` together, so it cannot go red that way. I mutated the new code instead, one change at a time, then restored the file with `git checkout HEAD --`: | Mutation | Result | |---|---| | M1: `blob_pointer` always returns `bytes.as_ptr()` (the old behaviour) | killed, the new unit test fails on `blob_pointer(&[]).is_null()` (6 passed, 1 failed) | | M2: the call in `open` uses `bytes.as_ptr().cast()` instead of `blob_pointer(bytes)` | **survives**, 7/7 pass | | M3: the condition inverted, so a non-empty blob gets null | killed by the same test | M2 is the gap KelboLive pointed out in review. The unit test checks the helper, not that `open` uses it. The raw-vtable call also passes a dangling pointer without error on native D3D12, so no native test can see the bug. Only VKD3D-Proton refuses it. ## Review - Default-off switches: no switch is added or changed, so there is nothing to default off. `d3d12/docs/switches.md` does not need regenerating. - Ordering and lifetimes: `make` still builds the library from the bytes kept beside it in `Library`. A null pointer with length 0 is only given for an empty blob. `raw` is wrapped by `from_raw` only after `.ok()?` succeeded, so an error leaves nothing to release. `blob` is still dropped before the empty library is made. No fences are involved. - `docs/d3d12_vulkan.md` (§ on `CreatePipelineLibrary`) already says a null pointer with a size is `E_INVALIDARG`. A null pointer with size 0 is the opposite case and is not recorded there. That is a docs gap, not a blocker. - Claim: the body names item `D3D12-VKD3D-EMPTY-PIPELINE-LIBRARY` with a link to a claim comment on issue 2570. - Reviewer questions still open: (1) the M2 gap above (KelboLive). (2) The `replay.rs` change KelboLive asked for is done (`f4ae7b922`). (3) The `useless_ptr_null_checks` warning is fixed in `55ac5d337`. - Overlap: `git merge-tree` of this head against #2789 (stale library driver stamp) **conflicts in `pipeline/library.rs`**, so whichever lands second needs a small merge. Against #3185 and #3150 it is clean. #2569, which the body mentions, is closed. - In-game runs posted on this exact head (`f4ae7b922`): one by deynesdev, Linux, Wine 11.21 plus VKD3D-Proton 3.2.0, RTX 4050 Laptop. On `main`, "no host pipeline library: pipelines are not kept". With the PR, the library is saved (331,640 bytes) and loaded at the next start. Median fps in the last 20 lines is 12.4 for both. It is a Wine/Proton run, not a native Windows in-game run. Kal0s-design ran native Windows with the debug layer and WARP on a merge (`f4ae7b922` into `2fc7383b9`): 9/9 on card and WARP, with and without the debug layer. merzleckeier and z3r0rc report Proton runs on earlier heads. ## Not covered - No in-game run here. The change only matters under VKD3D-Proton and I ran native Windows only. The Wine/Proton behaviour rests on the runs posted by others. - The failure itself (`E_INVALIDARG` from a dangling pointer) cannot be reproduced on native D3D12, so my green run does not show the bug is gone. It shows nothing broke natively. - No clippy run, no ctest or C++ runtime build (the PR touches neither). ## Verdict PARTIAL: green on the merge, and the new unit test is killed by 2 of 3 mutations. M2 survives (the call site's use of `blob_pointer` is not asserted), and the real failure is only visible under VKD3D-Proton, where others have already confirmed it on this head. The fix is small and the code reads as correct. A conflict with #2789 in `library.rs` is to be expected. In-game run still required on native Windows if the maintainers want one on this head; a Proton in-game run is already posted on this head. AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
bercedev commented 2026-12-02 23:34:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bercedev on 2026-12-02T23:34:50Z.


tested this merged onto main ef35d683e on linux: proton experimental 11.0, vkd3d-proton master f8c1cae83, rtx 4050 laptop 6 gb, nvidia 620.73.04

the fix does what it says. main logs "no host pipeline library: pipelines are not kept" on every start. with this the first launch started an empty library and saved it as it went (1327 made, 259 kb host-pipelines.bin), and the second launch logged "host pipeline library loaded" and loaded 1405 of 1418 early pipelines, with only 1 made fresh

it didn't take the long stalls away on this setup though. both launches still had 10-16 s present gaps in the world, and the median fps was lower than my main runs (7.8 to 9.0 against 12.2 to 13.6). those are single runs on a 6 gb card that's at its vram limit, so i wouldn't read the fps much, but whatever causes the 10 s waits here is not only the missing library

AI-assisted: yes (claude). runs played by me

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7362177250 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7362177250). Originally posted by [bercedev](https://github.com/bercedev) on 2026-12-02T23:34:50Z. --- tested this merged onto main ef35d683e on linux: proton experimental 11.0, vkd3d-proton master f8c1cae83, rtx 4050 laptop 6 gb, nvidia 620.73.04 the fix does what it says. main logs "no host pipeline library: pipelines are not kept" on every start. with this the first launch started an empty library and saved it as it went (1327 made, 259 kb host-pipelines.bin), and the second launch logged "host pipeline library loaded" and loaded 1405 of 1418 early pipelines, with only 1 made fresh it didn't take the long stalls away on this setup though. both launches still had 10-16 s present gaps in the world, and the median fps was lower than my main runs (7.8 to 9.0 against 12.2 to 13.6). those are single runs on a 6 gb card that's at its vram limit, so i wouldn't read the fps much, but whatever causes the 10 s waits here is not only the missing library AI-assisted: yes (claude). runs played by me
enlight3d commented 2026-12-03 00:54:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-03T00:54:13Z.


RUN (in game, gate-style): head f4ae7b922 tested in a batch of nine pull requests: #2609 (3fbcacc4e), #2654 (f4ae7b922), #2686 (4ce795127), #2823 (854796496), #2841 (24ff8f24c), #2890 (262439781), #3154 (854fc3441), #2588 (598930e5b) and #3119 (6097c033c), merged in that order with git merge --no-ff onto main f3865cae8. One conflict, in the credit table of d3d12/README.md when #2588 went in (both rows kept); no code conflict. Files touched by more than one of the nine: d3d12/docs/switches.md (#2686, #3119, #3154) and d3d12/README.md (#2588, #3119). Built with diagnostics,mimalloc, target x86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).

Launcher defaults except -PrecompileUsed, Series S settings, -NoDlss -NoFrameGen, standing at the save. On this main the launcher precompiles every recorded pipeline by default (88,671 here: a first warm-up with the plain defaults had made 9,000 of them after 660 s when it was stopped), so the runs use -PrecompileUsed (the 2,455 pipelines earlier runs drew with). A warm-up run first (#2686 changes the translator, so everything was translated again), then one run with the memory safety stop, ended 330 s after reaching the world:

Reached the world 75 s
Time in the world 331 s
Device losses 0
Crashes 0
Frame median 35.0 ms (28.2 fps rendered)
Card busy 85 %
Private memory, max 28.1 GB

Warnings: only kinds that a run on the same main with another pull request (#3128) printed too, in about the same numbers; no new kind. No pipeline refused other than the 29 "creation method that is not implemented" lines that run has as well. The last frame saved (8192) shows the world drawn normally.

This pull request's own lines: on Windows with NVIDIA the host pipeline library loaded (477 MB, mapped) and was written at the end of the run, as on main. The data folder already held a library, and the case this fixes (VKD3D-Proton refusing the empty blob) is not on this path; no "the host refused an empty pipeline library" line appeared.

Verdict: PASS for the batch (a pass covers each of the nine; a failure would not have said which). Not covered here: -RayTracing, DLSS and frame generation, other GPUs, Wine/Proton.

AI-assisted: Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7363725737 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7363725737). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-03T00:54:13Z. --- RUN (in game, gate-style): head f4ae7b922 tested **in a batch** of nine pull requests: #2609 (3fbcacc4e), #2654 (f4ae7b922), #2686 (4ce795127), #2823 (854796496), #2841 (24ff8f24c), #2890 (262439781), #3154 (854fc3441), #2588 (598930e5b) and #3119 (6097c033c), merged in that order with `git merge --no-ff` onto `main` f3865cae8. One conflict, in the credit table of `d3d12/README.md` when #2588 went in (both rows kept); no code conflict. Files touched by more than one of the nine: `d3d12/docs/switches.md` (#2686, #3119, #3154) and `d3d12/README.md` (#2588, #3119). Built with `diagnostics,mimalloc`, target `x86_64-pc-windows-msvc`. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300). Launcher defaults except `-PrecompileUsed`, Series S settings, `-NoDlss -NoFrameGen`, standing at the save. On this `main` the launcher precompiles every recorded pipeline by default (88,671 here: a first warm-up with the plain defaults had made 9,000 of them after 660 s when it was stopped), so the runs use `-PrecompileUsed` (the 2,455 pipelines earlier runs drew with). A warm-up run first (#2686 changes the translator, so everything was translated again), then one run with the memory safety stop, ended 330 s after reaching the world: | | | |---|---| | Reached the world | 75 s | | Time in the world | 331 s | | Device losses | 0 | | Crashes | 0 | | Frame median | 35.0 ms (28.2 fps rendered) | | Card busy | 85 % | | Private memory, max | 28.1 GB | Warnings: only kinds that a run on the same `main` with another pull request (#3128) printed too, in about the same numbers; no new kind. No pipeline refused other than the 29 "creation method that is not implemented" lines that run has as well. The last frame saved (8192) shows the world drawn normally. This pull request's own lines: on Windows with NVIDIA the host pipeline library loaded (477 MB, mapped) and was written at the end of the run, as on `main`. The data folder already held a library, and the case this fixes (VKD3D-Proton refusing the empty blob) is not on this path; no "the host refused an empty pipeline library" line appeared. Verdict: **PASS** for the batch (a pass covers each of the nine; a failure would not have said which). Not covered here: `-RayTracing`, DLSS and frame generation, other GPUs, Wine/Proton. AI-assisted: Claude Code (Claude Opus 5.5)
fiestorra commented 2026-12-03 03:28:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:28:31Z.


VERIFY-2654 — Windows nativo: 9 tests de library pasan, y el cambio es a mano por una razón concreta

Dos ficheros, library.rs +40 y tests/replay.rs +22/−10, seis días abierto:

cargo test -p leonida-gpu --lib library      9 passed; 1 ignored
cargo test -p leonida-gpu --test replay      0 passed (sin tests propios; compila)

El cambio, que es lo interesante: deja de llamar device.CreatePipelineLibrary(bytes) y llama a la entrada de la vtable a mano:

use windows::core::Interface;
let mut raw = std::ptr::null_mut();
(Interface::vtable(device).CreatePipelineLibrary)(
    Interface::as_raw(device), blob_pointer(bytes), bytes.len(),
    &ID3D12PipelineLibrary::IID, &mut raw,
)

Y la razón está en el nombre de la función que aparece: blob_pointer(bytes) — con un blob vacío tiene que pasar null, y la envoltura de windows-rs no ofrece esa forma: CreatePipelineLibrary(bytes) toma una slice, y una slice vacía produce un puntero no nulo con longitud cero, que es exactamente lo que el runtime rechaza.

Así que el vtable a mano es el precio de pasar null donde la API lo permite y la envoltura no. Es la clase de cambio que parece «bajar a la vtable por gusto» en un diff y es todo lo contrario — y el comentario SAFETY: lo dice: "an empty blob is a null pointer (blob_pointer); raw is ours on success."

Y tests/replay.rs cambia con él (22 líneas), que es donde el caso del blob vacío se ejerce de verdad — el test de library de arriba es el de la unidad.

Lo que no probé: el caso concreto de #… — un pipeline library con blob vacío contra VKD3D o contra el runtime de verdad, que necesita el título; aquí sólo compila y pasan los tests de la unidad.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366606283 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2654#issuecomment-7366606283). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T03:28:31Z. --- ## VERIFY-2654 — Windows nativo: 9 tests de `library` pasan, y el cambio es a mano por una razón concreta **Dos ficheros, `library.rs` +40 y `tests/replay.rs` +22/−10, seis días abierto**: ``` cargo test -p leonida-gpu --lib library 9 passed; 1 ignored cargo test -p leonida-gpu --test replay 0 passed (sin tests propios; compila) ``` **El cambio, que es lo interesante**: **deja de llamar `device.CreatePipelineLibrary(bytes)`** y **llama a la entrada de la vtable a mano**: ```rust use windows::core::Interface; let mut raw = std::ptr::null_mut(); (Interface::vtable(device).CreatePipelineLibrary)( Interface::as_raw(device), blob_pointer(bytes), bytes.len(), &ID3D12PipelineLibrary::IID, &mut raw, ) ``` **Y la razón está en el nombre de la función que aparece**: **`blob_pointer(bytes)`** — **con un blob vacío tiene que pasar `null`, y la envoltura de `windows-rs` no ofrece esa forma**: **`CreatePipelineLibrary(bytes)` toma una *slice*, y una slice vacía produce un puntero no nulo con longitud cero, que es exactamente lo que el runtime rechaza.** **Así que el `vtable` a mano es el precio de pasar `null` donde la API lo permite y la envoltura no.** **Es la clase de cambio que parece «bajar a la vtable por gusto» en un diff y es todo lo contrario** — **y el comentario `SAFETY:` lo dice**: *"an empty blob is a null pointer (`blob_pointer`); `raw` is ours on success."* **Y `tests/replay.rs` cambia con él** (22 líneas), **que es donde el caso del blob vacío se ejerce de verdad** — **el test de `library` de arriba es el de la unidad**. **Lo que no probé**: **el caso concreto de `#…`** — **un pipeline library con blob vacío contra VKD3D o contra el runtime de verdad**, **que necesita el título**; **aquí sólo compila y pasan los tests de la unidad.** Written with an AI assistant.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2654:upstream-pr/2654'
git switch 'upstream-pr/2654'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2654'
git switch 'upstream-pr/2654'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2654'
git switch 'upstream-pr/2654'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2654'
git switch 'main'
git merge --squash 'upstream-pr/2654'
git switch 'main'
git merge --ff-only 'upstream-pr/2654'
git switch 'main'
git merge 'upstream-pr/2654'
git push origin 'main'
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
ProjectLeonida/mandy!2654
No description provided.