mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:15:51 +01:00
[PR #974] [MERGED] D3D-448-GRAPHICS: graphics root arguments in the console layout, mesh shaders through a window #1011
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1011
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/974
Author: @iFeyz
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:feat/d3d448-graphics-root-layout📝 Commits (7)
5fdd6abD3D-448-GRAPHICS: graphics root arguments in the console layout, mesh shaders through a window74e55acD3D-448-GRAPHICS: a graphics signature past the console window keeps the PC layout instead of being refused161314cD3D-448-GRAPHICS: docs - what mesh shaders read below s16, counted on the corpus (#14 comment 7138532347): 3 of 9,282, one 32-bit constant eachc170c08D3D-448-GRAPHICS: LEONIDA_GRAPHICS_ROOT_LAYOUT=pc puts every graphics signature back in the PC layout (diagnostic)b2da1c0D3D-448-GRAPHICS: a graphics signature past the console window logs its dwords per shader visibility00fc23bD3D-448-GRAPHICS: a graphics signature past the console window keeps its inline part; the rest goes to the argument blockb8563e9Merge main into D3D-448-GRAPHICS (#974)📊 Changes
15 files changed (+354 additions, -41 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+29 -9)📝
docs/design.md(+1 -1)📝
runtime/CMakeLists.txt(+2 -12)📝
runtime/shims/d3d12_com.cpp(+17 -0)📝
runtime/shims/d3d12_com.h(+10 -4)📝
runtime/shims/d3d12_vulkan_device.cpp(+23 -2)📝
runtime/src/root_signature.h(+5 -2)📝
runtime/src/shader_library.h(+9 -0)📝
runtime/test/d3d12_mesh_test.cpp(+67 -6)📝
runtime/test/glsl/ms_draw.mesh(+3 -2)📝
runtime/test/glsl/ps_draw.frag(+1 -1)📝
runtime/test/glsl/ps_image_atomic.frag(+1 -1)📝
runtime/test/root_signature_test.cpp(+42 -0)➕
tests/semantic/test_ms_root_window.py(+116 -0)📝
tools/rdna2spirv.py(+28 -1)📄 Description
Claimed in the coordination issue as: D3D-448-GRAPHICS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136707785)
What and why
The graphics bind point still laid root arguments out with
pack()(from s0, two dwords per table), while the consolestarts them at s8 for VS/PS/GS with one dword per table (census in
docs/d3d12_vulkan.md3.5, and @DadaCap's liveretail measurement in #14, comment 7131556366: the VS of a textured draw reads its tables at s8/s10, the PS at s9).
So on the retail frame loop no root argument reached a graphics shader. Compute already used the console layout
(D3D-448,
7c225260); graphics was held back because a mesh shader (s16) and a pixel shader (s8) share onepush-constant block. This adds the per-stage window that was missing and switches graphics over.
tools/rdna2spirv.py):user_data_dword()— a mesh shader loads s16..s31 from push dwords 8..23(root dword k sits at push dword 8 + k for every graphics stage), s8..s15 (below its base, not root data) as 0,
s0..s7 unchanged. VS/PS/GS/CS are unchanged (SGPR i = push dword i). The index records
"root_window": {"sgpr": 16, "dword": 8}on mesh shaders.CreateRootSignaturebuilds the graphics layout withpack_stage(Stage::Vertex)and checksStage::Mesh(RootArgumentLayout::mesh_ok);address()writes a table as one dword at both bind points;DispatchMeshwith a signature past the 16-dword mesh window invalidates the list; a mesh PSO whose mesh shaderhas no
root_windowin the index (translated before this) is refused with a log line asking for the shaders stage.their tables as one 32-bit dword from s8 (a short prologue rebuilds the 64-bit pair with a zero high half, as game
shaders do;
ps_m15/vs_m15rewritten sinces_getpc_b64must stay first).docs/d3d12_vulkan.md3.5 and the CreateRootSignature bullet, the user-data row ofdocs/design.md,d3d12_com.handroot_signature.hcomments.Retail evidence: @DadaCap's
boot-prototypebranch (not for merge) switches the graphics layout to the samepack_stage(Stage::Vertex)when its title window is active, and with it the title's first-run menu appears on screen(@DesertGamer, RTX 5070, #14 comment 7134166197). This PR makes that layout unconditional, with tests, and adds what
the prototype does not have: the mesh window (there a mesh shader still reads its s16.. from push dword 16 while the
arguments sit at 8..) and the refusals for a signature or a mesh shader the window cannot serve.
Compatible with the spill block of ROOT-SIG-SPILL-MODEL (@djrolfes, #14 comments 7135596787 / 7135760764): every
graphics stage, mesh included, still reads s0..s7 from push dwords 0..7, so the block pointer in
s[0:1]can bewritten there for graphics as it will be for compute.
Open, not guessed: what a mesh shader reads in s8..s15 (it now reads 0).
python -I tools/user_sgpr_census.py <spirv/index.json> --base ms=16on a corpus lists any read below s16 — a run from someone with the package wouldsettle it. Visibility is still not modelled (D3D-318 measured one block in root order for VS/PS).
Coordination: touches
CreateRootSignatureandaddress()next to ROOT-SIG-SPILL-MODEL (@djrolfes, spill areafor compute);
pack_stageand the spill refusal are unchanged here, so either rebases cleanly on the other. If#424 (indirect mesh dispatch) lands, its path should check
mesh_oklikeDispatchMeshdoes.Tested
python -I scripts/run_semantic_tests.py tests/semantic— 470 files, 6,147 tests, 1 file failed:test_image_cube_store_glc, the WindowsLLVM_MCpath split reported as TEST-CUBE-WINPATH (claimed byTimIdle; that file and the code it tests are untouched here). New
tests/semantic/test_ms_root_window.py(4 tests: the dword mapping, a mesh shader as MeshEXT and with--mesh-computerun by the CPU interpreter, no window on other stages); it fails onmain.ctestonmain1504c1af+ this: 301 of 305 pass. The 4 failures are the sameas on
mainhere (d3d12_clear,d3d12_execute_indirect_validation,d3d12_texture_tiles,d3d12_pipeline_library_host, all already reported in #14);vk_queue_query_syncis flaky here onmaintoo.d3d12_draw_test,d3d12_translated_draw_test(M1.5),d3d12_m2_textured_test,d3d12_m2_formats_test,d3d12_m3_frame_test,d3d12_mesh_test,d3d12_geometry_test,d3d12_depth24_draw_testandd3d12_bundle_testrun on the GPU and match pixel-exact.d3d12_mesh_testadds the two refusals;root_signature_testadds the graphics-window cases.scripts/check_no_game_data.pyon every changed file,tests/test_docs_links.py,tests/test_text_write_line_endings.py,python -m compileall -q make_game.py tools tests.it would show whether the black frame moves.
GPUs tested: AMD Radeon RX 9070 XT (RDNA4), AMD Windows driver 32.0.32029.2010 (Vulkan 1.4.359), Windows 11 26200
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.