Skip to content

d3d12: a pipeline stream the PC numbering cannot read is read with the console's, its 24 the mesh shader (D3D-CONSOLE-STREAM-ENUM) - #496

Open
Kokonotcu wants to merge 1 commit into
ProjectLeonida:mainfrom
Kokonotcu:pr/console-stream-enum
Open

Kokonotcu wants to merge 1 commit into
ProjectLeonida:mainfrom
Kokonotcu:pr/console-stream-enum

Conversation

@Kokonotcu

Copy link
Copy Markdown
Contributor

Claim: D3D-CONSOLE-STREAM-ENUM (#14).

What was wrong: the console's pipeline-state subobject enum has no gap at 23, where the PC's has one. The PC numbering is VIEW_INSTANCING 22, AS 24, MS 25, DEPTH_STENCIL2 26, and so on. As a result, the title's mesh-shader subobject is 24, which the PC reading takes for an amplification shader. The layer refuses an AS, so those PSOs fail as unsupported.

docs/retail_boot_intel_host.md section 3 measured this in a retail boot: 430 such PSOs were refused, and each one's 24 carried a payload the size of one of the title's mesh-shader containers (430 of 430; 280 of those sizes match no vertex shader, against the VS reading proposed on the old repository's issue 8815). The translator makes 9,282 of the title's 26,503 shaders mesh shaders.

What changed: CreatePipelineState reads a stream again with the console numbering (a type from 23 on is the PC type one above it) when either:

  • the PC reading refuses it, or
  • the PC reading leaves it with an AS and no MS, which is no valid PC stream.

It takes the console reading only when that reading holds an MS and no AS. A stream the PC reading accepts is never read differently, so no PSO that builds today changes. LEONIDA_XS_STREAM_ENUM=pc turns it off. The first renumbered stream is logged once.

What this assumes beyond the measurement: that the console shifts every type from 23 on, not only the mesh shader. Only 24 is measured. The shift of 25 and up is the reading under which a 24 = MS is consistent; it is used only for streams that fail today anyway.

Tests (d3d12_mesh_test, new checks):

  • A console stream with the MS as 24 makes a mesh PSO.
  • So does the MS as 24 with RASTERIZER1 as 26 (the PC reading refuses that one as a truncated DEPTH_STENCIL2).
  • An MS (25) with a 24 in PC numbering is still refused as an AS.
  • The existing 9 invalid and 2 not-implemented refusals are unchanged, and the draws still match all 4096 pixels.

Tested on Windows 10, i7-11800H, RTX 3080 Laptop (NVIDIA driver), on main 8f481cf16: d3d12_mesh passes. Not yet tested on a retail boot.

🤖 Generated with Claude Code

…e console's (its 24 is the mesh shader)

The console's pipeline-state subobject enum has no gap at 23 where the PC's has one (PC: VIEW_INSTANCING 22, AS 24, MS 25, DEPTH_STENCIL2 26, ...), so the title's mesh-shader subobject is 24, which the PC reading takes for an amplification shader. A retail boot (docs/retail_boot_intel_host.md, section 3) refused 430 such PSOs as unsupported; each one's 24 carried a payload the size of one of the title's mesh-shader containers (430 of 430, 280 of those sizes match no vertex shader). The translator makes 9,282 of the title's 26,503 shaders mesh shaders.

CreatePipelineState now reads a stream again with the console numbering (a type from 23 on is the PC type one above it) when the PC reading refuses it or leaves it with an AS and no MS, and takes that reading when it holds an MS and no AS. A stream the PC reading accepts is never read differently, so no PSO that builds today changes. LEONIDA_XS_STREAM_ENUM=pc turns it off.

d3d12_mesh_test: console streams (MS as 24; MS as 24 with RASTERIZER1 as 26, which the PC reading refuses as a truncated DEPTH_STENCIL2) make mesh PSOs; an MS with a 24 in PC numbering is still refused as an AS; the 9 invalid and 2 not-implemented refusals are unchanged; the draws still match all 4096 pixels (RTX 3080 Laptop).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LloydNicholson added a commit to LloydNicholson/leonida-cont that referenced this pull request Nov 24, 2026
… lazy PSOs, console formats, XG, title memory)

Measured on the retail boot under Wine 11.22 (RX 9060 XT, RADV): it now creates 10,000+ slot 57 pipelines, runs
its loading frame loop at ~2.5-4 GB, and, with the hang check held off (LEONIDA_SLOW_STARTUP=1), starts real
rendering at ~120 s. Frames are still black, and that run stops at game+0x13360a3 (a game object with a garbage
vtable; not caused by anything below that was tested).

From open pull requests (applied as patches, conflicts resolved here):
- ProjectLeonida#511 (VibeClauding): LEONIDA_LAZY_PSO=1, pipelines built at first draw/dispatch. Local fix on top: the rect-list
  path's VS words were cleared before rect_list_geometry read them, refusing every rectangle-list PSO; the compute
  compile keeps this branch's host-stall scope.
- ProjectLeonida#496 (Rüzgar Koray Genç): console pipeline-stream numbering (24 = mesh shader).
- ProjectLeonida#461 (oscarlosu-lab): xg_xs texture layout and computer (ported from Marvisak/VIctory, GPL-3.0).
- Draft ProjectLeonida#321 (Mumogg, 237f9e0): vertex/index views in title CPU memory copied into a ring (title_memory).

Local fixes:
- Slot 57 pipeline blob elements: +0x00 is SemanticIndex, +0x08 InputSlot (swapped before; docs/fspx.md and the
  device_proxy test updated). ~4,900 "input layout does not feed COLOR1" refusals were this.
- FSPX graphics stages that read their code base use the kind-6 program as code (was empty -> E_OUTOFMEMORY).
- Console formats 118/119/120 (hypothesis: D16_UNORM_S8_UINT family) aliased to the D24S8 family at the device's
  entry points.
- Depth-stencil + UAV stand-in extended to slots 108, 127 and the slot-133 texture fallback; a UAV initial state on
  such a texture starts in COMMON. Slot 108 logs refusals (the title asserts its answer is below 4 GiB).
- 8-bit RGBA/BGRA render targets accept a UNORM/sRGB view without a castable list.
- Fence slot 12 mirrors refreshed by one poller thread (LEONIDA_FENCE_MIRROR=tp keeps the thread-pool waits, which
  queued on Wine's wait-queue lock); xs_proxy_mock tests run in tp mode.
- Slot-133 shadow buffers keep their VirtualQuery layout between refreshes (178 MB: 70 ms -> ~8.5 ms) and the
  refresh counts as a host stall.

Diagnostics and experiments (off unless noted):
- LEONIDA_DRAW_DIAG=1: per-present draw counts and per-draw pipeline/target/depth/viewport/vb0 for early frames.
- Slot 57 refusal layout dump and created/failed totals; refused RTV and committed-resource details; failed
  ExecuteCommandLists names its vulkan_replay.h line (on by default, test-branch lines).
- LEONIDA_SLOW_STARTUP=1: guest Sleep of 1-2.1 s lasts 2.1 s, so the startup hang check never counts (hides hangs).
- LEONIDA_XG_NO_COPY=1: texture computer slots 8/9 copy nothing.

Co-authored-by: VibeClauding <360230414+VibeClauding@users.noreply.github.com>
Co-authored-by: Rüzgar Koray Genç <koray_genc1@hotmail.com>
Co-authored-by: oscarlosu-lab <251827664+oscarlosu-lab@users.noreply.github.com>
Co-authored-by: Mumogg <104529023+Mumogg@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@towade

towade commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

The retail-boot test the description lists as not done, on Windows 11 26300, MSVC 19.44, own 1.0.2.1 copy, AMD Radeon RX 9070 XT (RDNA4, 32.0.32029.2010): pass.

Base: #321 at e0d4fd2b8 + #511 (LEONIDA_LAZY_PSO=1, LEONIDA_ARENA_MB=2048, so the boot gets past the up-front PSOs on AMD) + #588 (format 118), all cherry-picked, --trace --trace-d3d12, the executable's network blocked. Then this PR's 30dd1a450 on top (no conflict). Counts only.

without this PR with it
amplification shaders are not supported (the game has none) lines 98 (distinct sizes) 0
CreatePipelineState unsupported 1,443 615
D3D12 calls up to the run's end (the title's int3, unchanged) 84,737 84,657

The runtime logs a pipeline stream the PC numbering cannot read ... is read with the console's subobject numbering (its 24 is the mesh shader) once, and no PSO the run made before fails now (failed stays at 2). The remaining 615 refusals are not this PR's: most are pipeline-library compute programs my work folder doesn't have translated (1,538 of 2,684), the rest the rectangle-list/#511 interaction I described on #511.

d3d12_mesh_test: passes on the RX 9070 XT; on an Intel UHD 770 it exits 77 (no VK_EXT_mesh_shader), as expected.

Not checked: whether the renumbered streams draw correctly (the run doesn't get far enough into frames to tell).

AI-assisted (Claude Code).

@otaviosza

Copy link
Copy Markdown

Tested on native Windows: Windows 10 22H2 (19045), NVIDIA GeForce RTX 3060, driver 610.88 (32.0.16.1088), MSVC 19.44, own 1.0.2.1 copy, LEONIDA_D3D12=vulkan, LEONIDA_LAZY_PSO=1. Runtime = #321 + #470 + #588 + #461 + #511 + this PR (cherry-picked cleanly); shaders built with main + #387 + #583 + #674 + #647 + #593.

  • Without this PR the log has four amplification shaders are not supported (the game has none) refusals (stream payloads 2580–2796 bytes) shortly before the run ends.
  • With it, those refusals are gone and the log shows the fallback once: a pipeline stream the PC numbering cannot read (an AS and no MS, or refused) is read with the console's subobject numbering (its 24 is the mesh shader). No other new failure.
  • The run still ends at about 15 s with the same title-side access violation as without the PR, so that stop is not caused by these refused mesh PSOs (details in Coordinating who works on what #14).

demoz53 added a commit to demoz53/leonida that referenced this pull request Nov 24, 2026
…g cannot read is read with the console's (its 24 is the mesh shader)
demoz53 added a commit to demoz53/leonida that referenced this pull request Nov 24, 2026
…peline-stream notes

ProjectLeonida#496 reads LEONIDA_XS_STREAM_ENUM in d3d12_vulkan_device.cpp but documents it
nowhere, so test_docs_env_vars fails on integration after batch 5c. One
paragraph under D3D-29's stream bullets says what the console reading does
and what =pc turns off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Snooozs

Snooozs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Independent check. Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, LEONIDA_VK_VALIDATION=1, merged onto main 82a2aab without conflicts, test targets rebuilt; RTX 5060 Ti (621.01) and a Ryzen 7 7700 iGPU (1002:164E, AMD 31.0.22044.1). On the iGPU the pipeline tests fail on plain main too (128 push-constant bytes), so they say nothing there.

  • RTX 5060 Ti: d3d12_mesh_test passes on main and with this PR, with the new line console-numbered streams: 2 mesh PSOs (MS as 24, RASTERIZER1 as 26); 0 VUID lines.

Reading note: the comment above parse_pipeline_stream says the console numbering is used "only for a stream the PC reading leaves with an AS and no MS", but CreatePipelineState also retries any stream the PC reading refuses (FAILED(parsed)), as its own comment says. The second reading must still hold an MS and no AS, so I see no valid PC stream changing, but the first comment should say it.

Synthetic tests only, no game files. AI-assisted (Claude Code): I read the diff and ran the tests on that machine.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants