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

Open
opened 2026-11-26 21:21:06 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2399
Author: @ERROR890
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/pso-stream-view-instancing


📝 Commits (2)

  • 3ae707c d3d12_xs: capture a pipeline stream that carries a VIEW_INSTANCING subobject
  • 3b5b36e Merge remote-tracking branch 'origin/main' into fix/pso-stream-view-instancing

📊 Changes

2 files changed (+39 additions, -1 deletions)

View changed files

📝 runtime/shims/d3d12_xs_pso_stream.cpp (+7 -1)
📝 runtime/test/pso_stream_test.cpp (+32 -0)

📄 Description

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.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2399 **Author:** [@ERROR890](https://github.com/ERROR890) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/pso-stream-view-instancing` --- ### 📝 Commits (2) - [`3ae707c`](https://github.com/ubiquitarianism/leonida/commit/3ae707cedee1242e52018620758261276a117309) d3d12_xs: capture a pipeline stream that carries a VIEW_INSTANCING subobject - [`3b5b36e`](https://github.com/ubiquitarianism/leonida/commit/3b5b36edd129dedabb9efadf3b6e1c7ef7118234) Merge remote-tracking branch 'origin/main' into fix/pso-stream-view-instancing ### 📊 Changes **2 files changed** (+39 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_xs_pso_stream.cpp` (+7 -1) 📝 `runtime/test/pso_stream_test.cpp` (+32 -0) </details> ### 📄 Description 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.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#2399
No description provided.