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

Open
github-bot wants to merge 1 commit from github-bot/gh-1818 into main AGit
Owner

@⁠JesusACD on GitHub · 2026-11-25 12:31 UTC · original
JesusACD:fix/ondemand-console-stream → main · +133 −33 · 4 files · 1 commits · open

Claimed in the coordination issue as: #1608 (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
**@⁠JesusACD** on GitHub · 2026-11-25 12:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1818) `JesusACD:fix/ondemand-console-stream` → `main` · +133 −33 · 4 files · 1 commits · open Claimed in the coordination issue as: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 (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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:07:00 +00:00
Author
Owner

@⁠potatoe0100 on GitHub · 2026-11-25 13:12 UTC · original

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

**@⁠potatoe0100** on GitHub · 2026-11-25 13:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1818#issuecomment-7163449696) 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).
Author
Owner

@⁠GGandCo on GitHub · 2026-11-25 13:58 UTC · original

Windows / Intel UHD Graphics101.6314 integration check: 05626b30e 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).

**@⁠GGandCo** on GitHub · 2026-11-25 13:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1818#issuecomment-7164568566) Windows / Intel UHD Graphics101.6314 integration check: 05626b30e 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).
Author
Owner

@⁠Rezn0r27 on GitHub · 2026-11-26 14:21 UTC · original · edited 2026-11-26 21:43 UTC

Tested the runtime-windows artifact from run 45609322341, commit 05626b30e, 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 (05626b30e) 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 (05626b30e) 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.

**@⁠Rezn0r27** on GitHub · 2026-11-26 14:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1818#issuecomment-7194701455) · edited 2026-11-26 21:43 UTC Tested the runtime-windows artifact from run 45609322341, commit 05626b30e, 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 (05626b30e) 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 (05626b30e) 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-bot force-pushed github-bot/gh-1818 from 05626b30ed to f4b46d6d78 2026-11-27 00:36:17 +00:00 Compare
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1818/head:github-bot/gh-1818'
git switch 'github-bot/gh-1818'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1818'
git switch 'github-bot/gh-1818'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1818'
git switch 'github-bot/gh-1818'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1818'
git switch 'main'
git merge --squash 'github-bot/gh-1818'
git switch 'main'
git merge --ff-only 'github-bot/gh-1818'
git switch 'main'
git merge 'github-bot/gh-1818'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.