upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/d3d12_com.cpp
diff options
context:
space:
mode:
authoriFeyz <62035583+iFeyz@users.noreply.github.com>2026-11-24 16:45:13 +0100
committeriFeyz <62035583+iFeyz@users.noreply.github.com>2026-11-24 16:50:49 +0100
commit5fdd6abbc07a0b2e4120944b4e624e3a70ddb76e (patch)
tree22a6ccd466c4e735b5d78e1912d55d3c0a2e8a2a /runtime/shims/d3d12_com.cpp
parent1504c1af63aeab49fb451ee42d3d051b29d4c976 (diff)
D3D-448-GRAPHICS: graphics root arguments in the console layout, mesh shaders through a window
The graphics bind point laid root arguments out with pack() (from s0, two dwords per table), while the console starts them at s8 for VS/PS/GS with one dword per table (the corpus census, and the retail frame loop reading its tables at s8..s10). Compute already took the console layout (D3D-448); graphics waited because a mesh shader (s16) and a pixel shader (s8) share one push-constant block. - translator: user_data_dword() - a mesh shader loads s16..s31 from push dwords 8..23, s8..s15 as 0, s0..s7 unchanged, so root dword k is push dword 8 + k for every graphics stage; index.json records the window as "root_window" on mesh shaders. VS/PS/GS/CS are unchanged. - runtime: CreateRootSignature lays graphics out with pack_stage(Stage::Vertex) and checks Stage::Mesh (mesh_ok); a table is one dword at both bind points; DispatchMesh with a signature past the 16-dword mesh window invalidates the list; a mesh PSO whose mesh shader has no root_window (translated before) is refused with a log line. - fixtures: the GLSL stand-ins read the root arguments at push dword 8 + k; the M1.5/M2/M3 asm read their tables as one dword from s8. - tests: tests/semantic/test_ms_root_window.py (MeshEXT and --mesh-compute on the CPU interpreter), graphics-window cases in root_signature_test, the two refusals in d3d12_mesh_test. - docs: d3d12_vulkan.md 3.5, design.md user-data row.
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
-rw-r--r--runtime/shims/d3d12_com.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index 4f4904e96..f67254bc5 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -486,6 +486,11 @@ public:
486 d3d12_trace::record("ID3D12GraphicsCommandList6::DispatchMesh"); 486 d3d12_trace::record("ID3D12GraphicsCommandList6::DispatchMesh");
487 if (x > 65535 || y > 65535 || z > 65535 || std::uint64_t(x) * y * z > (1u << 22)) return check(false); 487 if (x > 65535 || y > 65535 || z > 65535 || std::uint64_t(x) * y * z > (1u << 22)) return check(false);
488 if (!graphics_pipeline_ || !graphics_.layout) return check(false); 488 if (!graphics_pipeline_ || !graphics_.layout) return check(false);
489 // A mesh shader reads the root arguments from s16 through a 16-dword window (RootArgumentLayout::mesh_ok).
490 if (!graphics_.layout->mesh_ok) {
491 stub("DispatchMesh(root signature larger than a mesh shader's root window)");
492 return check(false);
493 }
489 if (!(viewport_.width > 0) || !(viewport_.height > 0)) return; // as record_draw: nothing is rasterized 494 if (!(viewport_.width > 0) || !(viewport_.height > 0)) return; // as record_draw: nothing is rasterized
490 leonida::Draw draw{graphics_pipeline_, graphics_.data, draw_views(), depth_, {}, 0, viewport_, 495 leonida::Draw draw{graphics_pipeline_, graphics_.data, draw_views(), depth_, {}, 0, viewport_,
491 scissor_, blend_factor_, front_stencil_ref_, back_stencil_ref_, false, x, y, z, 0, 0}; 496 scissor_, blend_factor_, front_stencil_ref_, back_stencil_ref_, false, x, y, z, 0, 0};
@@ -1242,9 +1247,9 @@ private:
1242 if (!p) return; 1247 if (!p) return;
1243 const std::uint32_t first = first_dword(state, *p); 1248 const std::uint32_t first = first_dword(state, *p);
1244 write(state, first, std::uint32_t(va)); 1249 write(state, first, std::uint32_t(va));
1245 // In the compute layout a descriptor table is one dword, the 32-bit VA of its first descriptor (the heaps 1250 // In the console layout of both bind points a descriptor table is one dword, the 32-bit VA of its first
1246 // live below 4 GiB); a root view keeps both halves. The graphics layout gives every address two dwords. 1251 // descriptor (the heaps live below 4 GiB); a root view keeps both halves (D3D-448).
1247 if (!(is_compute(state) && type == rt::rootsig::ParamType::Table)) write(state, first + 1, std::uint32_t(va >> 32)); 1252 if (type != rt::rootsig::ParamType::Table) write(state, first + 1, std::uint32_t(va >> 32));
1248 } 1253 }
1249 1254
1250 D3D12_COMMAND_LIST_TYPE type_; 1255 D3D12_COMMAND_LIST_TYPE type_;