[PR #1818] d3d12: support console-numbered PSO streams in on-demand prepare path #1830

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1818
Author: @JesusACD
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/ondemand-console-stream


📝 Commits (1)

  • 05626b3 d3d12: handle console PSO streams in on-demand prepare path

📊 Changes

4 files changed (+133 additions, -33 deletions)

View changed files

📝 runtime/CMakeLists.txt (+3 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+91 -23)
📝 runtime/shims/d3d12_xs_device.cpp (+13 -6)
📝 runtime/test/d3d12_mesh_test.cpp (+26 -4)

📄 Description

Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161618257 (RT-ONDEMAND-CONSOLE-STREAM)

What and why

Under LEONIDA_PIPELINE_COMPILE=on-demand (info.prepare_on_bind == true, the boot profile's compilation mode), set_device_outer routes Xbox device slots 86 (CreatePipelineState) and 55 (CreateDerivedPipelineState) through Device::prepare_console_stream instead of ID3D12Device2::CreatePipelineState.

Device::prepare_console_stream (
untime/shims/d3d12_vulkan_device.cpp) previously parsed streams only with PC subobject numbering and captured PsoStreamRecord with console = false:

  • A console-numbered mesh stream with raw subobject 24 (console MS, PC AS) left stream.as populated and stream.ms empty, failing at prepare_console_stream with E_NOTIMPL.
  • A console-numbered mesh stream also carrying raw subobject 26 (console RASTERIZER1, 40 bytes vs PC DEPTH_STENCIL2, 52 bytes) failed parse_pipeline_stream with E_INVALIDARG.
  • PsoStreamRecord::capture(source) was called without used_console, so raw console tags were neither walked with console payload sizes nor canonicalized to PC numbering for subsequent slot-55 derivation and bind-time PipelineState::resolve_type realization (d3d12_mesh_test failed at SUCCEEDED(console_hr) && console_pso.p, reported by @thiefyzheng and @adrianmjim).

Changes:

  • Retry console subobject numbering in Device::prepare_console_stream under the same guard as ID3D12Device2::CreatePipelineState (!record, console_stream_enum_enabled(), DXIL kind 13 mesh container, and no AS), and pass used_console to PsoStreamRecord::capture(source, used_console).
  • Match eager mesh/graphics refusal checks in prepare_console_stream (VK_EXT_mesh_shader availability, incompatible stages on mesh PSOs, device mesh limits, and graphics_root_window).
  • Reset used_console_stream / stream_refusal and run the LEONIDA_PSO_STREAM_AUDIT=1 hook on the prepare_stream branch of create_pso_from_stream (
    untime/shims/d3d12_xs_device.cpp).
  • Use ktest::shader_fixture_path in
    untime/test/d3d12_mesh_test.cpp, assert slot-86 refusals without VK_EXT_mesh_shader and for pre-
    oot_window mesh shaders, and register d3d12_mesh_on_demand (ENVIRONMENT LEONIDA_PIPELINE_COMPILE=on-demand, SKIP_RETURN_CODE 77) in
    untime/CMakeLists.txt.

Also checked git merge-tree against open PR #1695's hunks in d3d12_vulkan_device.cpp and d3d12_mesh_test.cpp: both files auto-merge cleanly without conflict.

Tested

  • Built
    untime-windows with MSVC (RelWithDebInfo, /W4 /permissive- /utf-8) via GitHub Actions (JesusACD/leonida run 45609322341; 416/417 non-skipped CPU CTest cases passed on the GPU-less runner, with d3d12_mesh and d3d12_mesh_on_demand cleanly skipping via code 77, and the sole runner failure being the pre-existing k_xdxr_postbuild_readback addressed in #1418).
  • Ran on local GPU hardware from the built
    untime-windows artifact:
    • d3d12_mesh_test.exe (default eager mode): exit

🔄 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/1818 **Author:** [@JesusACD](https://github.com/JesusACD) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/ondemand-console-stream` --- ### 📝 Commits (1) - [`05626b3`](https://github.com/ubiquitarianism/leonida/commit/05626b30ed84278caede11607dd01667fec2f781) d3d12: handle console PSO streams in on-demand prepare path ### 📊 Changes **4 files changed** (+133 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+3 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+91 -23) 📝 `runtime/shims/d3d12_xs_device.cpp` (+13 -6) 📝 `runtime/test/d3d12_mesh_test.cpp` (+26 -4) </details> ### 📄 Description Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161618257 (RT-ONDEMAND-CONSOLE-STREAM) ### What and why Under LEONIDA_PIPELINE_COMPILE=on-demand (info.prepare_on_bind == true, the boot profile's compilation mode), set_device_outer routes Xbox device slots 86 (CreatePipelineState) and 55 (CreateDerivedPipelineState) through Device::prepare_console_stream instead of ID3D12Device2::CreatePipelineState. Device::prepare_console_stream ( untime/shims/d3d12_vulkan_device.cpp) previously parsed streams only with PC subobject numbering and captured PsoStreamRecord with console = false: - A console-numbered mesh stream with raw subobject 24 (console MS, PC AS) left stream.as populated and stream.ms empty, failing at prepare_console_stream with E_NOTIMPL. - A console-numbered mesh stream also carrying raw subobject 26 (console RASTERIZER1, 40 bytes vs PC DEPTH_STENCIL2, 52 bytes) failed parse_pipeline_stream with E_INVALIDARG. - PsoStreamRecord::capture(source) was called without used_console, so raw console tags were neither walked with console payload sizes nor canonicalized to PC numbering for subsequent slot-55 derivation and bind-time PipelineState::resolve_type realization (d3d12_mesh_test failed at SUCCEEDED(console_hr) && console_pso.p, reported by @thiefyzheng and @adrianmjim). Changes: - Retry console subobject numbering in Device::prepare_console_stream under the same guard as ID3D12Device2::CreatePipelineState (!record, console_stream_enum_enabled(), DXIL kind 13 mesh container, and no AS), and pass used_console to PsoStreamRecord::capture(source, used_console). - Match eager mesh/graphics refusal checks in prepare_console_stream (VK_EXT_mesh_shader availability, incompatible stages on mesh PSOs, device mesh limits, and graphics_root_window). - Reset used_console_stream / stream_refusal and run the LEONIDA_PSO_STREAM_AUDIT=1 hook on the prepare_stream branch of create_pso_from_stream ( untime/shims/d3d12_xs_device.cpp). - Use ktest::shader_fixture_path in untime/test/d3d12_mesh_test.cpp, assert slot-86 refusals without VK_EXT_mesh_shader and for pre- oot_window mesh shaders, and register d3d12_mesh_on_demand (ENVIRONMENT LEONIDA_PIPELINE_COMPILE=on-demand, SKIP_RETURN_CODE 77) in untime/CMakeLists.txt. Also checked git merge-tree against open PR #1695's hunks in d3d12_vulkan_device.cpp and d3d12_mesh_test.cpp: both files auto-merge cleanly without conflict. ### Tested - Built untime-windows with MSVC (RelWithDebInfo, /W4 /permissive- /utf-8) via GitHub Actions (JesusACD/leonida run 45609322341; 416/417 non-skipped CPU CTest cases passed on the GPU-less runner, with d3d12_mesh and d3d12_mesh_on_demand cleanly skipping via code 77, and the sole runner failure being the pre-existing k_xdxr_postbuild_readback addressed in #1418). - Ran on local GPU hardware from the built untime-windows artifact: - d3d12_mesh_test.exe (default eager mode): exit --- <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#1830
No description provided.