diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 22:14:11 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 22:14:11 -0500 |
| commit | 275cb01456b408c5f7ee985d7b70a5e1b696cc6f (patch) | |
| tree | fa5c064e3c959b000df7606ac471b567552d1bac /runtime/shims/d3d12_com.cpp | |
| parent | 50740a1bc541b2d007f87cad86f7a776f994f3e7 (diff) | |
| parent | 1cfc29af74effd6b95fdc0aad2e6badee8f192ff (diff) | |
Merge main into carry/old-9921-ms-compressed-exports (after #1197)
- tools/rdna2spirv.py, mesh_export: #1197's misc-vector return for pos1
(Layer/ViewportIndex) comes first, then this pull request's compressed
components; both kept.
- docs/design.md, "Mesh shaders" row: main's row (with #1197's sentence)
plus this pull request's compressed-export sentence.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index b6ec111c7..f919cc1eb 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -529,6 +529,11 @@ public: | |||
| 529 | d3d12_trace::record("ID3D12GraphicsCommandList6::DispatchMesh"); | 529 | d3d12_trace::record("ID3D12GraphicsCommandList6::DispatchMesh"); |
| 530 | if (x > 65535 || y > 65535 || z > 65535 || std::uint64_t(x) * y * z > (1u << 22)) return check(false); | 530 | if (x > 65535 || y > 65535 || z > 65535 || std::uint64_t(x) * y * z > (1u << 22)) return check(false); |
| 531 | if (!graphics_pipeline_ || !graphics_.layout) return check(false); | 531 | if (!graphics_pipeline_ || !graphics_.layout) return check(false); |
| 532 | // A mesh shader reads the root arguments from s16 through a 16-dword window (RootArgumentLayout::mesh_ok). | ||
| 533 | if (!graphics_.layout->mesh_ok) { | ||
| 534 | stub("DispatchMesh(root signature larger than a mesh shader's root window)"); | ||
| 535 | return check(false); | ||
| 536 | } | ||
| 532 | if (!any_nonempty_viewport()) return; // as record_draw: nothing is rasterized | 537 | if (!any_nonempty_viewport()) return; // as record_draw: nothing is rasterized |
| 533 | leonida::Draw draw{graphics_pipeline_, graphics_user_data(), draw_views(), depth_, {}, 0, viewport_, | 538 | leonida::Draw draw{graphics_pipeline_, graphics_user_data(), draw_views(), depth_, {}, 0, viewport_, |
| 534 | scissor_, blend_factor_, front_stencil_ref_, back_stencil_ref_, false, x, y, z, 0, 0}; | 539 | scissor_, blend_factor_, front_stencil_ref_, back_stencil_ref_, false, x, y, z, 0, 0}; |
| @@ -1440,9 +1445,20 @@ private: | |||
| 1440 | if ((count && !data) || std::uint64_t(offset) + count > p->constant_count) return check(false); | 1445 | if ((count && !data) || std::uint64_t(offset) + count > p->constant_count) return check(false); |
| 1441 | const auto* values = static_cast<const std::uint32_t*>(data); | 1446 | const auto* values = static_cast<const std::uint32_t*>(data); |
| 1442 | const std::uint32_t first = first_dword(state, *p); | 1447 | const std::uint32_t first = first_dword(state, *p); |
| 1448 | if (first == rt::rootsig::kNoSgpr) return spilled(); | ||
| 1443 | for (UINT i = 0; i < count; ++i) write(state, first + offset + i, values[i]); | 1449 | for (UINT i = 0; i < count; ++i) write(state, first + offset + i, values[i]); |
| 1444 | } | 1450 | } |
| 1445 | 1451 | ||
| 1452 | // A parameter in the spill array behind s[0:1] (a compute signature past s31: pack_stage gives it no SGPR, only a | ||
| 1453 | // spill_dword): that array is not written yet, so its value is not stored; kNoSgpr plus an offset must never | ||
| 1454 | // reach write(), where it would wrap round to s0. | ||
| 1455 | static void spilled() { | ||
| 1456 | static std::atomic<bool> said{false}; | ||
| 1457 | if (!said.exchange(true)) | ||
| 1458 | std::fprintf(stderr, "[rt] d3d12: root arguments in the spill array behind s[0:1] are not stored (the " | ||
| 1459 | "array is not written yet)\n"); | ||
| 1460 | } | ||
| 1461 | |||
| 1446 | void address(RootState& state, UINT index, std::uint64_t va, rt::rootsig::ParamType type) { | 1462 | void address(RootState& state, UINT index, std::uint64_t va, rt::rootsig::ParamType type) { |
| 1447 | if (list_.closed()) return; | 1463 | if (list_.closed()) return; |
| 1448 | if (defer([=, compute = &state == &compute_](GraphicsCommandList& l) { | 1464 | if (defer([=, compute = &state == &compute_](GraphicsCommandList& l) { |
| @@ -1466,6 +1482,7 @@ private: | |||
| 1466 | tables_.emplace_back(va, p->table_descriptors); | 1482 | tables_.emplace_back(va, p->table_descriptors); |
| 1467 | } | 1483 | } |
| 1468 | const std::uint32_t first = first_dword(state, *p); | 1484 | const std::uint32_t first = first_dword(state, *p); |
| 1485 | if (first == rt::rootsig::kNoSgpr) return spilled(); | ||
| 1469 | write(state, first, std::uint32_t(va)); | 1486 | write(state, first, std::uint32_t(va)); |
| 1470 | // In the console layouts a descriptor table is one dword, the 32-bit VA of its first descriptor (the heaps | 1487 | // In the console layouts a descriptor table is one dword, the 32-bit VA of its first descriptor (the heaps |
| 1471 | // live below 4 GiB); a root view keeps both halves. pack()'s graphics layout gives every address two dwords. | 1488 | // live below 4 GiB); a root view keeps both halves. pack()'s graphics layout gives every address two dwords. |