Skip to content

d3d12: take console subobject type 24 as the mesh shader in streams without MS - #8815

Closed
LooperSalty wants to merge 1 commit into
ProjectLeonida:mainfrom
LooperSalty:d3d12-console-vs-hs-subobjects
Closed

LooperSalty wants to merge 1 commit into
ProjectLeonida:mainfrom
LooperSalty:d3d12-console-vs-hs-subobjects

Conversation

@LooperSalty

@LooperSalty LooperSalty commented Nov 23, 2026 •

Copy link
Copy Markdown

Claimed in: #8504 (comment)

Depends on: none

What and why

Slot 86 pipeline streams carry a subobject of type 24. parse_pipeline_stream took it as an amplification shader, so create_graphics refused those PSOs ("amplification shaders are not supported"). @TreXito's static reading in #8186 showed that type 24 exists in the retail title. Retail boots then showed what it is: the console's mesh shader.

  • @sh1shu1: every refused slot-86 payload size (430, all distinct) matches the size of a mesh-shader container in the carve index, 0 misses; only 150 match any vertex-shader container.
  • @lines9686-rgb, 180 s bounded boots with LEONIDA_STUB_PIPELINES=1: type 24 as AS (main) is refused and the boot dies at 118 s; as VS (the previous head of this PR) gives 1,554 distinct "no translated vs" and the boot dies at 28 s; as MS the boot runs the full 180 s with no exception, 65,536+ PresentX, 0 graphics stubs, and the PSOs are real mesh pipelines.

What this PR does (map_console_stages, after the parse loop):

  • In a stream with no PC MS subobject (type 25), 24 is taken as the MS (ms = as), with the PS it carries, so the PSO builds as a mesh pipeline on VK_EXT_mesh_shader.
  • A stream that already has an MS subobject keeps main's behaviour: 24 stays an amplification shader, refused by create_graphics.
  • Type 23 is not mapped: nobody has seen it at run time, so it stays an unknown type (E_INVALIDARG) as on main.
  • The remap is logged once.

Thanks @TreXito for the static reading, and @sh1shu1 and @lines9686-rgb for the measurements that corrected the first version of this PR (which took 24 as the VS and 23 as the HS).

Tested

Windows 11 26300, RTX 4070 SUPER, MSVC RelWithDebInfo, base main 5d74c27.

  • d3d12_mesh_test, new cases in the part that needs VK_EXT_mesh_shader: PS + 24 without MS creates a mesh PSO; 24 + a real MS keeps the AS refusal (E_NOTIMPL); 24 + VS is E_INVALIDARG (a mesh PSO has no vertex stage); 23 is E_INVALIDARG. The first case fails on main and passes now.
  • Full ctest on this branch: 262/265. The failures (d3d12_vulkan_device, d3d12_depth_resolve, d3d12_indirect_rt) are the ones that also fail on main on this machine; the run was not on an idle machine.
  • Not re-measured on a retail boot without LEONIDA_STUB_PIPELINES for this head; the retail evidence is the two measurements credited above.

Limits

  • Type 23 (maybe the console AS, per @sh1shu1) is left open until someone sees it at run time.
  • The mesh PSO is built from the program that the title passes as type 24; whether every such program is a translated ms was only checked through the carve sizes and the stubbed boot, not with real shaders loaded.
  • The "logged once" behaviour is checked by hand (one line in the test output), not by an assertion.
  • Runtime: mesh-shader PSOs from pipeline state streams and DispatchMesh (D3D-29) #1712 (open) overlaps (mesh pipelines); whichever lands second needs a rebase.

Slot numbers and counts only, no game data. AI-assisted (Claude Code).

cc @ItsNotRexed

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Windows 11.

  • Excellent resolution for retail console graphics pipeline streams (slot 86):
    • In streams lacking a Mesh Shader (MS) subobject, cleanly remaps console subobject type 24 → VS and 23 → HS into vacant slots.
    • Streams containing MS preserve the mesh pipeline path intact (type 24 remaining AS).
    • Unblocks retail PSO creation across thousands of graphics shaders that previously failed with unrecognised subobject types.
  • Regression tests in \d3d12_mesh_test\ cover standalone type 24, combinations with HS, and negative controls.
  • Clean-room check and \git diff --check\ pass.

LGTM!

@lohant27-netizen

Copy link
Copy Markdown

Tested 8e8c5dfa1 on Windows 11 (10.0.26300), NVIDIA GeForce RTX 5070 (driver 32.0.16.2101, subgroup 32), MSVC with SDK 10.0.26100, Release, merged onto main 867d922f0 together with #8815, #8814, #8809, #8784, #8783 and #8813 (no conflicts): pass.

@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified head 8e8c5dfa1 merged onto main (867d922f0) on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo, NVIDIA GeForce RTX 5060 Ti, driver 610.88, Vulkan 1.4.341):

  • python -I scripts/check_no_game_data.py on both changed files: clean (exit 0)
  • cmake --build runtime/build --target d3d12_mesh_test --parallel: built cleanly
  • .\runtime\build\d3d12_mesh_test.exe: passed (console stream subobjects 24 and 23 remapped to VS and HS (no mesh subobject); D3D-29: mesh tier 1; mesh and VS PSOs from pipeline state streams (9 refused as invalid, 2 as not implemented); DispatchMesh over X, Y and Z and a stream VS draw matched all 4096 pixels)

AI-assisted.

@LooperSalty

Copy link
Copy Markdown
Author

Correction of the measurement in the description. The "602 → 219" figure compared two different local stacks. Re-measured with this exact commit (8e8c5dfa, cherry-picked onto the same local stack, nothing else changed) on the retail 1.0.2.1 boot (native Windows 11, RTX 4070 SUPER 610.88, Vulkan backend, 26.5k translated shaders, LEONIDA_STUB_PIPELINES=1), counting CreatePipelineState results in the d3d12 trace over the whole creation phase (57,423 calls in both runs):

  • without the commit: 54,282 created, 3,140 refused (at least 2,048 of them are "no MS, no VS, PS present" streams, i.e. type 24)
  • with the commit: 57,203 created, 219 refused, so 2,921 more PSOs are created
  • the remap line is logged once; no "amplification shaders are not supported" refusal remains in the run

The remaining 219 have other causes (e.g. depth-bounds, subobject 21), not looked into here. Both runs end in the same unrelated host AV (null write, caller game+0x5ebea38) about 40 s in, after 4 PresentX; the PSO counts above cover the full creation phase, which completes before that. Single run per variant. Sorry for the wrong number. AI-assisted (Claude Code).

@ethandepstein-del

Copy link
Copy Markdown

Independent Windows + RTX 5080 GPU verification of 8e8c5dfa1 (merge-base 867d922f0) on NVIDIA GeForce RTX 5080 (Blackwell, desktop, NVIDIA driver 617.42, Vulkan API 1.4.351, Vulkan SDK 1.4.363.0, MSVC 19.44.35230.0, Windows 11, Ryzen 7 9800X3D, DISABLE_RTSS_LAYER=1, DISABLE_VULKAN_OBS_CAPTURE=1, no game files):

Build & Tests

  • scripts/build_runtime.ps1 (CMake + Ninja, RelWithDebInfo, -DLEONIDA_REQUIRE_VULKAN=ON): OK (git diff --check clean).
  • d3d12_mesh_test.exe: PASS (D3D-29: mesh tier 1; mesh and VS PSOs from pipeline state streams (9 refused as invalid, 2 as not implemented); DispatchMesh over X, Y and Z and a stream VS draw matched all 4096 pixels; ... statistics queries around mesh draws resolve).
  • ctest -R "d3d12_mesh|d3d12_vulkan_device|d3d12_draw|d3d12_translated_draw":
    • d3d12_mesh: PASS (0.40s)
    • d3d12_draw: PASS (0.28s)
    • d3d12_translated_draw: PASS (0.28s)
    • d3d12_vulkan_device: pre-existing baseline failure (line 6574: tiles == 1, identical to main 867d922f0, unrelated to this PR).

Code check

  • map_console_stages() remapping for !out.has_ms (24 → g.VS, 23 → g.HS, duplicate/conflict → E_INVALIDARG) and out.has_ms (24 stays AS, 23 → E_INVALIDARG) looks clean and matches the new test cases.
  • Minor non-blocking note: an empty {nullptr, 0} subobject of type 23 sets out.has_graphics_stage = true unconditionally (whereas stage(g.HS) checks for non-empty bytecode), though it is still rejected downstream.

(AI-assisted)

@lines9686-rgb

Copy link
Copy Markdown
Contributor

Retail boot data for this PR (Windows 11, RTX 3060 Ti, NVIDIA 621.24, own 1.0.2.1 copy, local boot-chain stack with #7880 and frame-token adoption, LEONIDA_STUB_PIPELINES=1).

  • Without this PR, the boot runs 118 s, presenting the whole time. It then stops on amplification shaders are not supported (the game has none); bytes 4668, and a null-pointer write follows. That "AS" is the console type-24 subobject, as described here.
  • With this PR, the remap fires (console stream subobjects 24 and 23 remapped to VS and HS). But none of the type-24 programs is found as a VS. 1,554 distinct no translated vs for FSSM sha256 ... lines appear in 3 minutes. I looked up the first one in the translated index: it exists, but with stage ms, a NGG program (the MSNC_VS_ family), which the translator emits as MeshEXT (design.md, "Mesh shaders"). So remapping 24 to VS finds nothing, more than 4,096 graphics PSOs become stubs, and the boot dies earlier, at 28 s.

So when the type-24 program's FSSM is translated as ms, the PSO probably has to become a mesh pipeline, with the title's draws routed to it, rather than a VS pipeline. That overlaps #1712. A VS lookup that falls back to the ms entry for the same fssm_sha256 would at least show how many of the 1,554 are NGG only.

Counts and stage names only. AI-assisted (Claude Code).

@sh1shu1

sh1shu1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Data point against the VS reading of type 24, from a retail boot with LEONIDA_STUB_PIPELINES=1 on tibzejoker:rt5-integration 5fef1f1 plus #7078, #7009, #7755, #7290 (Intel i7-8700, RTX 4070 SUPER 616.92, Windows 11 26200, own 1.0.2.1 copy, counts only):

  • main's parser refused 430 slot-86 streams with "amplification shaders are not supported"; each refusal logs the subobject's byte count, and the byte counts are all distinct.
  • Matched against the carve index of the same copy (work/shaders/dxbc/index.json, size by stage): all 430 equal the size of a mesh-shader container (ms), 0 misses. Only 150 of them equal any vertex-shader container size, so at least 280 of the 430 payloads are not any VS of the corpus. The background rate of an arbitrary size in that range matching some ms container is about 20 %, so 430/430 is not chance.
  • So the payload at type 24 is the mesh shader, which also fits what the description measured (no VS, no PC-MS, a PS present): those are MS + PS pipelines. The simplest reading is that the console enum has no gap at 23 (PC: VIEW_INSTANCING 22, nothing at 23, AS 24, MS 25): console MS = 24 and, presumably, console AS = 23 rather than HS. I never saw a 23 in 89,964 calls (no "unknown subobject type" line).
  • Remapping 24 to VS would hand a mesh program to the vertex stage once real shaders are loaded; taking 24 as MS (the container's own program kind can confirm it) keeps those 430 pipelines as mesh pipelines.

Method, so anyone with a copy can repeat it: collect the byte counts from the refusal lines, then look each one up in the carve index's size field grouped by stage. AI-assisted (Claude Code, Claude Fable 5.1).

@kristofbarany

Copy link
Copy Markdown

Tested 8e8c5df merged onto main 5d74c27 (clean merge) on NVIDIA GeForce RTX 4070, driver 621.24, native Windows 11 Pro 26300, MSVC 14.44.35207, Ninja RelWithDebInfo: pass.

No game data used. AI-assisted (Claude Code).

@lines9686-rgb

Copy link
Copy Markdown
Contributor

Retail-boot A/B for @sh1shu1's reading (console MS = 24). Same stack as my comment above: Windows 11, RTX 3060 Ti, NVIDIA 621.24, own copy, LEONIDA_STUB_PIPELINES=1, LEONIDA_ARENA_MB=2048, 180 s bounded runs. The only change between the rows is how map_console_stages takes type 24 in a stream without MS:

type 24 taken as result
AS (main's parser) refused ("amplification shaders are not supported"); the boot dies at 118 s
VS (this PR) 1,554 distinct no translated vs (the programs exist only as ms); the boot dies at 28 s
MS (local switch: out.ms = out.as; out.has_ms = true) runs the full 180 s with no exception: 65,536+ PresentX, 0 graphics stubs and no no translated ms/vs lines. The PSOs are real mesh pipelines (VK_EXT_mesh_shader)

So the runtime supports sh1shu1's carve-size evidence: taking 24 as the mesh shader is what lets these streams build. The frames are still black (the title is loading). The next lines in that run are a bindless image array is full; dimension 1 and storage view not supported for depth-stencil image format: 124.

Suggestion for this PR: take 24 as MS when the stream has no MS subobject (with the PS it carries). What 23 is (AS, per sh1shu1) stays open; I saw no type 23 either.

Counts only. AI-assisted (Claude Code).

@LooperSalty

Copy link
Copy Markdown
Author

@sh1shu1 @lines9686-rgb you're right, and thank you for the carve-size match (430/430 against ms containers) and the A/B (MS: 180 s, 65,536+ PresentX, 0 stubs; VS: dies at 28 s). Type 24 is the console mesh shader, not the VS. My "3,140 → 219" was measured with LEONIDA_STUB_PIPELINES=1, so it counted PSOs that were accepted while their vertex program was never found; it doesn't support the VS reading.

I'm reworking this PR now: in a stream with no PC MS subobject, take 24 as the MS (with the PS it carries), so these PSOs build as mesh pipelines; drop the 23 → HS remap, since nobody has seen a type 23 at run time (23 stays an unknown type until it is measured); move the new test cases into the mesh-capable part of d3d12_mesh_test. I'll post the new head and a retail A/B with real shaders (no stubs). AI-assisted (Claude Code).

…ithout MS

Slot 86 pipeline streams carry a subobject of type 24, which
parse_pipeline_stream took as an amplification shader, so create_graphics
refused those PSOs ("amplification shaders are not supported"). TreXito's
static reading of the retail title showed that type 24 exists there
(Leonida#8186). sh1shu1 and lines9686-rgb then showed what it is: every
refused payload size matches a mesh-shader container, and taking 24 as the
mesh shader lets a retail boot run with real mesh pipelines, where taking
it as a vertex shader finds no translated VS (Leonida#8815).

A stream with no PC MS subobject (type 25) now takes 24 as its MS. A stream
that already has an MS keeps the PC reading: 24 stays an AS, which is
refused. Type 23 is not mapped: nobody has seen it at run time, so it stays
an unknown type (E_INVALIDARG) as on main. The remap is logged once.

Tests: d3d12_mesh covers 24 with PS and no MS (mesh pipeline created), 24
with a real MS (AS refused), 24 with a VS (mesh PSO with a vertex stage,
E_INVALIDARG) and 23 (E_INVALIDARG). The first case fails on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LwHrL5Lxc1rum25b6tnpo8
@LooperSalty
LooperSalty force-pushed the d3d12-console-vs-hs-subobjects branch from 8e8c5df to 5b2d819 Compare November 23, 2026 21:57
@LooperSalty LooperSalty changed the title d3d12: take console subobject types 24/23 as VS/HS in streams without MS d3d12: take console subobject type 24 as the mesh shader in streams without MS Nov 23, 2026
@LooperSalty

Copy link
Copy Markdown
Author

New head 5b2d8195 (rebased on main 5d74c27, single commit, force-pushed to the fork branch).

Reworked after @sh1shu1's carve-size match and @lines9686-rgb's A/B: in a pipeline state stream with no PC MS subobject, console subobject type 24 is now taken as the mesh shader (out.ms = out.as), so those PSOs build as mesh pipelines. A stream that already has an MS keeps main's reading (24 = AS, refused). The 23 -> HS remap is gone: 23 is an unknown type again (E_INVALIDARG), since nobody has seen it at run time. The remap is still logged once.

Tests (d3d12_mesh_test, in the part that needs VK_EXT_mesh_shader): PS + 24 without MS creates a mesh PSO; 24 + a real MS keeps the AS refusal; 24 + VS is E_INVALIDARG; 23 is E_INVALIDARG. The first case fails on main and passes now.

Windows 11 26300, RTX 4070 SUPER, MSVC RelWithDebInfo: d3d12_mesh_test passes. Full ctest 262/265; the 3 failures (d3d12_vulkan_device, d3d12_depth_resolve, d3d12_indirect_rt) are the same ones that fail on main on this machine, and the run was not on an idle machine.

I have not re-measured on a retail boot without LEONIDA_STUB_PIPELINES; the retail evidence for the MS reading is lines9686-rgb's A/B and sh1shu1's size match above. The VS/HS wording in the earlier description and my "3,140 -> 219" figure no longer apply.

AI-assisted (Claude Code).

@sh1shu1

sh1shu1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 5b2d819 on NVIDIA RTX 4070 SUPER (driver 616.92), Windows 11 26200, Intel i7-8700, MSVC 14.44, RelWithDebInfo, merge-base main 5d74c27: pass.

  • d3d12_mesh_test (the file with the new stream cases): passes without the validation layer, same summary as main ("mesh and VS PSOs from pipeline state streams (9 refused as invalid, 2 as not implemented) ... matched all 4096 pixels"). With LEONIDA_VK_VALIDATION=1 it fails on this head and on main 867d922 alike, the known 3 × VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076, not from this PR.
  • ctest xs_proxy_mock* (6), queue_proxy, d3d12_compute, d3d12_draw, d3d12_stub_pipelines: pass.
  • Not run here yet: the retail boot with real shaders (this copy's translation is being merged; a stubs-only boot cannot tell MS from VS at type 24).
    AI-assisted (Claude Code, Claude Fable 5.1).

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.

9 participants