Skip to content

d3d12: support console-numbered PSO streams in on-demand prepare path - #1818

Open
JesusACD wants to merge 1 commit into
ProjectLeonida:mainfrom
JesusACD:fix/ondemand-console-stream
Open

JesusACD wants to merge 1 commit into
ProjectLeonida:mainfrom
JesusACD:fix/ondemand-console-stream

Conversation

@JesusACD

Copy link
Copy Markdown

Claimed in the coordination issue as: #1608 (comment) (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 runtime: set SKIP_RETURN_CODE 77 on vk_xdxr_postbuild_readback (CI-XDXR-POSTBUILD-SKIP-CODE) #1418).
  • Ran on local GPU hardware from the built
    untime-windows artifact:
    • d3d12_mesh_test.exe (default eager mode): exit

@potatoe0100

Copy link
Copy Markdown
Contributor

Tested 05626b30e merged onto main 98c2f7777 (clean), native Windows 11 Pro 26H2 (build 26300), NVIDIA GeForce RTX 4060 (mesh shaders supported), driver 621.14, VS 2022 RelWithDebInfo + Ninja, llvm-mc 21.1.8.

  • Full ctest -j 6: 440 of 440 passed (main: 439 of 439; the extra one is this PR's), including d3d12_mesh.
  • run_gpu_tests.py: 209/263 passed, 53 skipped, identical to main (the one failure, cs_imgatomic_ext, is on main too).

AI-assisted testing (non-developer tester).

@GGandCo

GGandCo commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Windows / Intel UHD Graphics101.6314 integration check: 05626b3 applied privately onto main98c2f7777 with PR1836+1849 and local compatibility changes. Built MSVC RelWithDebInfo. With LEONIDA_PIPELINE_COMPILE=on-demand, d3d12_compute, d3d12_m2_textured, xbox_visible_texture_views, xbox_staged_texture_views, xbox_placed_texture_first_use, d3d12_host_prefix, replay_copy_offset, xmem and a private startup-metadata guard fixture pass. The two mesh fixtures skip because this GPU lacks VK_EXT_mesh_shader; mesh rendering/console-mesh behavior is therefore not verified here. Compute, staged/placed-texture first-use, prefix and metadata-guard tests also pass with Vulkan validation. Combined integration result, not isolated before/after. No gameplay claim. AI-assisted (OpenAI Codex).

@Rezn0r27

Rezn0r27 commented Nov 26, 2026 •

Copy link
Copy Markdown

Tested the runtime-windows artifact from run 45609322341, commit 05626b3, on Windows 11 with an RTX 5070 Laptop GPU. I ran d3d12_mesh_test.exe in default mode from the extracted directory on C:, with no D: drive mapped and the shaders in the packaged generated folder.

Both console-numbered mesh streams were created, all 4096 pixels matched, and the process exited with code 0. On the earlier #429 artifact I needed a temporary D: mapping to run the test on this machine. With this artifact, it passed directly from the extracted folder.

This covers the default-mode artifact test only. An earlier run through Codex CLI exited with 0xC0000409 without output; the cause is unknown. I ran the successful test in a regular PowerShell session. No game files were used. AI-assisted setup and reporting.

Follow-up: I also ran d3d12_mesh_test.exe with LEONIDA_PIPELINE_COMPILE=on-demand on the same commit (05626b3) in regular PowerShell, with no D: drive mapped. Both console-numbered mesh streams were created, all 4096 pixels matched, and the test exited with code 0. This run loaded the pipeline cache from the previous session.

Driver retest (621.24 → 621.40): I reran d3d12_mesh_test.exe with LEONIDA_PIPELINE_COMPILE=on-demand on the same RTX 5070 Laptop GPU, using the same artifact (05626b3) with no D: drive mapped. Both console-numbered mesh streams were created, all 4096 pixels matched, and the test exited with code 0 on both drivers. On 621.40, the runtime reported that the previous pipeline cache did not match the Vulkan device and wrote a new cache at the end.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 26, 2026
@JesusACD
JesusACD force-pushed the fix/ondemand-console-stream branch from 05626b3 to f4b46d6 Compare November 26, 2026 23:18
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants