d3d12_xs: capture a pipeline stream that carries a VIEW_INSTANCING subobject #2399

Merged
ERROR890 merged 2 commits from upstream-pr/2399 into main 2026-11-28 09:50:20 +00:00
ERROR890 commented 2026-11-26 19:30:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ERROR890 on 2026-11-26T19:30:09Z.


Claimed in the coordination issue as: PSO-STREAM-VIEW-INSTANCING
(https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7201353671)

Depends on: none.

Fixes: none.

What and why

The parser that decides creation models D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING
(shims/d3d12_vulkan_device.cpp): it refuses a non-zero ViewInstanceCount and accepts the subobject with a count of
0. The capture walker that keeps a stream for derivation (layout_of in shims/d3d12_xs_pso_stream.cpp) did not model
it, so that same stream created a PSO and was never captured. The PSO carried no PsoStreamRecord, and every
CreateDerivedPipelineState on it failed with E_FAIL ("base PSO has no kept stream") - a silent loss of the derived
states the title asks for, with nothing in the trace to say why.

The two walkers should agree: a stream the parser accepts has to be capturable. This models the subobject's size and
alignment in the capture walker. Only the ViewInstanceCount == 0 shape reaches it (a non-zero count is refused before
a PSO is created), so the payload's pViewInstanceLocations is never read; the walk needs the entry's size and
alignment to step over it, nothing more, and that is what the comment on the case says.

Testing

Built pso_stream_test with MSVC 19.44 (Windows SDK 10.0.26100) on Windows 11 26H2, Ninja build.
With this change:  pso_stream_test: OK, 0 failure(s)   (exit 0)
On main:           FAIL a stream with a zero-count VIEW_INSTANCING subobject is captured
                   1 failure (exit 1)
ctest -R "pso_stream|native_pso|process_cmdline" --output-on-failure:
                   100% tests passed, 0 tests failed out of 5.
Synthetic descriptor fixtures only. AI-assisted.

The new case is test_view_instancing_is_captured in runtime/test/pso_stream_test.cpp: a synthetic stream built the
same way as the existing cases, plus a zero-count VIEW_INSTANCING entry; it must be captured, keep the entry's
payload offset, and still derive a tag-1 record. No D3D12 device, no Vulkan device, no game files.

GPUs tested: n/a (CPU-only test).

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator
    change in this pull request.)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5516026988 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2399). Originally posted by [ERROR890](https://github.com/ERROR890) on 2026-11-26T19:30:09Z. --- Claimed in the coordination issue as: PSO-STREAM-VIEW-INSTANCING (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7201353671) Depends on: none. Fixes: none. ### What and why The parser that decides creation models `D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING` (`shims/d3d12_vulkan_device.cpp`): it refuses a non-zero `ViewInstanceCount` and accepts the subobject with a count of 0. The capture walker that keeps a stream for derivation (`layout_of` in `shims/d3d12_xs_pso_stream.cpp`) did not model it, so that same stream created a PSO and was never captured. The PSO carried no `PsoStreamRecord`, and every `CreateDerivedPipelineState` on it failed with E_FAIL ("base PSO has no kept stream") - a silent loss of the derived states the title asks for, with nothing in the trace to say why. The two walkers should agree: a stream the parser accepts has to be capturable. This models the subobject's size and alignment in the capture walker. Only the `ViewInstanceCount == 0` shape reaches it (a non-zero count is refused before a PSO is created), so the payload's `pViewInstanceLocations` is never read; the walk needs the entry's size and alignment to step over it, nothing more, and that is what the comment on the case says. ### Testing ``` Built pso_stream_test with MSVC 19.44 (Windows SDK 10.0.26100) on Windows 11 26H2, Ninja build. With this change: pso_stream_test: OK, 0 failure(s) (exit 0) On main: FAIL a stream with a zero-count VIEW_INSTANCING subobject is captured 1 failure (exit 1) ctest -R "pso_stream|native_pso|process_cmdline" --output-on-failure: 100% tests passed, 0 tests failed out of 5. Synthetic descriptor fixtures only. AI-assisted. ``` The new case is `test_view_instancing_is_captured` in `runtime/test/pso_stream_test.cpp`: a synthetic stream built the same way as the existing cases, plus a zero-count `VIEW_INSTANCING` entry; it must be captured, keep the entry's payload offset, and still derive a tag-1 record. No D3D12 device, no Vulkan device, no game files. GPUs tested: n/a (CPU-only test). ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator change in this pull request.)
ecox982745 commented 2026-11-26 19:48:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T19:48:21Z.


Confirmed through the D3D12 proxy and a GPU readback on Windows 11, RTX 4090, NVIDIA 616.64, with Vulkan validation enabled. I built base 2d43417d49 and PR head 3b5b36edd1 with the same local extension to d3d12_mesh_test.cpp.

Placement of a zero-count VIEW_INSTANCING entry Base PR head
Omitted from both streams Draw matched Draw matched
Vertex pipeline only Slot 86 created the base. Slot 55 returned E_FAIL on the first derivation. Chained derivation and draw matched
Console-numbered mesh pipeline only Slot 86 created the base. Slot 55 returned E_FAIL on the mesh derivation. Derivation and draw matched
Both pipelines Stopped at the first vertex pipeline derivation with E_FAIL Both derived pipelines drew correctly

The probe placed the entry first in the vertex stream and immediately before SAMPLE_MASK in the mesh stream. The base sample mask was zero. For the vertex draw I derived twice, restored the full mask on the second derivation and released both earlier PSOs before drawing. For the mesh draw I used the fixture's tag-3 mask override through slot 55. On the PR, all four combinations matched the fixture's expected RGBA values at all 4,096 pixels. Each run also matched the 4,096-pixel indirect mesh readback.

On the base, the failing cases logged base PSO has no kept stream. A separate one-view vertex stream with a valid location still returned E_NOTIMPL and a null PSO on both revisions. The four PR runs reported no Vulkan validation errors. All inputs were synthetic.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7201979513 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2399#issuecomment-7201979513). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-26T19:48:21Z. --- Confirmed through the D3D12 proxy and a GPU readback on Windows 11, RTX 4090, NVIDIA 616.64, with Vulkan validation enabled. I built base `2d43417d49` and PR head `3b5b36edd1` with the same local extension to `d3d12_mesh_test.cpp`. | Placement of a zero-count VIEW_INSTANCING entry | Base | PR head | | --- | --- | --- | | Omitted from both streams | Draw matched | Draw matched | | Vertex pipeline only | Slot 86 created the base. Slot 55 returned `E_FAIL` on the first derivation. | Chained derivation and draw matched | | Console-numbered mesh pipeline only | Slot 86 created the base. Slot 55 returned `E_FAIL` on the mesh derivation. | Derivation and draw matched | | Both pipelines | Stopped at the first vertex pipeline derivation with `E_FAIL` | Both derived pipelines drew correctly | The probe placed the entry first in the vertex stream and immediately before SAMPLE_MASK in the mesh stream. The base sample mask was zero. For the vertex draw I derived twice, restored the full mask on the second derivation and released both earlier PSOs before drawing. For the mesh draw I used the fixture's tag-3 mask override through slot 55. On the PR, all four combinations matched the fixture's expected RGBA values at all 4,096 pixels. Each run also matched the 4,096-pixel indirect mesh readback. On the base, the failing cases logged `base PSO has no kept stream`. A separate one-view vertex stream with a valid location still returned `E_NOTIMPL` and a null PSO on both revisions. The four PR runs reported no Vulkan validation errors. All inputs were synthetic.
lixonik commented 2026-11-26 20:43:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T20:43:10Z.

Review: COMMENTED


Built pso_stream_test with MSVC on Windows 11 and ran it through CTest. It passed, including capture of a stream with a zero-count VIEW_INSTANCING, its unchanged payload offset, and derivation from the captured stream. I checked the capture walker against the creation parser for that entry. This was a CPU-only check of the stream walker.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6080301241 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2399#pullrequestreview-6080301241). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T20:43:10Z. **Review:** COMMENTED --- Built `pso_stream_test` with MSVC on Windows 11 and ran it through CTest. It passed, including capture of a stream with a zero-count `VIEW_INSTANCING`, its unchanged payload offset, and derivation from the captured stream. I checked the capture walker against the creation parser for that entry. This was a CPU-only check of the stream walker. AI-assisted.
MoonEyes commented 2026-11-28 09:50:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T09:50:12Z.


Red/green: the PR's test fails on main and passes with this PR (checked by OreoFR).
Runtime batch of 20 PRs tested by OreoFR (full build, ctest without the game, Python suite, translator): same results as main 09c153948, RTX 4070 Laptop / Windows 11.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237498192 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2399#issuecomment-7237498192). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T09:50:12Z. --- Red/green: the PR's test fails on main and passes with this PR (checked by OreoFR). Runtime batch of 20 PRs tested by OreoFR (full build, ctest without the game, Python suite, translator): same results as main 09c153948, RTX 4070 Laptop / Windows 11. AI-assisted (Claude Code, Claude Opus 5.5)
OreoFR commented 2026-11-28 22:02:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:02:21Z.


Verified by OreoFR

  • Base: main 09c153948 + PR head 3b5b36edd; integration package 1 of 6 (20 PRs, merged without conflict)
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite
  • Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps)
  • Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures
  • Verdict: CLEAN PACKAGE (no new failure vs main)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246452122 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2399#issuecomment-7246452122). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T22:02:21Z. --- **Verified by OreoFR** - Base: main `09c153948` + PR head `3b5b36edd`; integration package 1 of 6 (20 PRs, merged without conflict) - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite - Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps) - Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures - Verdict: CLEAN PACKAGE (no new failure vs main) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
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!2399
No description provided.