diff options
| author | iFeyz <62035583+iFeyz@users.noreply.github.com> | 2026-11-24 19:53:18 +0100 |
|---|---|---|
| committer | iFeyz <62035583+iFeyz@users.noreply.github.com> | 2026-11-24 19:53:18 +0100 |
| commit | 00fc23b9a9eeb1a75f1fec2b58024bea15c26663 (patch) | |
| tree | e2bd20349c6f0ec1bdb9f8317a06a369eb8894e6 /runtime/shims/d3d12_com.cpp | |
| parent | b2da1c0add9009678130b9bf898f2e6b8a4ae30f (diff) | |
D3D-448-GRAPHICS: a graphics signature past the console window keeps its inline part; the rest goes to the argument block
On the console the parameter that does not fit and every one after it go to the argument block behind
s[0:1], the ones before stay inline. No VS, PS or GS of 1.0.2.1 reads s[0:1] as an address
(root_spill_census), so the graphics bind point now lays the inline part out from s8 and stores nothing
for the rest (rt::rootsig::Spill::block), instead of giving the whole signature the PC layout. A write
to such a parameter is dropped before kNoSgpr plus an offset could wrap to dword 0. The retail start-up
signatures (25 and 30 dwords, every parameter visible to every stage, #974 review) are the case; the
per-visibility log line is gone, LEONIDA_GRAPHICS_ROOT_LAYOUT=pc stays. Compute still refuses a spill.
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index 7fcfceebb..4349a6a91 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -1234,9 +1234,19 @@ private: | |||
| 1234 | if ((count && !data) || std::uint64_t(offset) + count > p->constant_count) return check(false); | 1234 | if ((count && !data) || std::uint64_t(offset) + count > p->constant_count) return check(false); |
| 1235 | const auto* values = static_cast<const std::uint32_t*>(data); | 1235 | const auto* values = static_cast<const std::uint32_t*>(data); |
| 1236 | const std::uint32_t first = first_dword(state, *p); | 1236 | const std::uint32_t first = first_dword(state, *p); |
| 1237 | if (first == rt::rootsig::kNoSgpr) return spilled(); | ||
| 1237 | for (UINT i = 0; i < count; ++i) write(state, first + offset + i, values[i]); | 1238 | for (UINT i = 0; i < count; ++i) write(state, first + offset + i, values[i]); |
| 1238 | } | 1239 | } |
| 1239 | 1240 | ||
| 1241 | // A parameter of the argument block behind s[0:1] (rt::rootsig::Spill::block, graphics): no shader reads it, so | ||
| 1242 | // its value is not stored; kNoSgpr plus an offset must never reach write(). | ||
| 1243 | static void spilled() { | ||
| 1244 | static std::atomic<bool> said{false}; | ||
| 1245 | if (!said.exchange(true)) | ||
| 1246 | std::fprintf(stderr, "[rt] d3d12: root arguments in the argument block behind s[0:1] are not stored (no " | ||
| 1247 | "graphics shader reads them)\n"); | ||
| 1248 | } | ||
| 1249 | |||
| 1240 | void address(RootState& state, UINT index, std::uint64_t va, rt::rootsig::ParamType type) { | 1250 | void address(RootState& state, UINT index, std::uint64_t va, rt::rootsig::ParamType type) { |
| 1241 | if (list_.closed()) return; | 1251 | if (list_.closed()) return; |
| 1242 | if (defer([=, compute = &state == &compute_](GraphicsCommandList& l) { | 1252 | if (defer([=, compute = &state == &compute_](GraphicsCommandList& l) { |
| @@ -1246,10 +1256,11 @@ private: | |||
| 1246 | const RootArgumentLayout::Parameter* p = parameter(state, index, type); | 1256 | const RootArgumentLayout::Parameter* p = parameter(state, index, type); |
| 1247 | if (!p) return; | 1257 | if (!p) return; |
| 1248 | const std::uint32_t first = first_dword(state, *p); | 1258 | const std::uint32_t first = first_dword(state, *p); |
| 1259 | if (first == rt::rootsig::kNoSgpr) return spilled(); | ||
| 1249 | write(state, first, std::uint32_t(va)); | 1260 | write(state, first, std::uint32_t(va)); |
| 1250 | // In the console layout of both bind points a descriptor table is one dword, the 32-bit VA of its first | 1261 | // In the console layout of both bind points a descriptor table is one dword, the 32-bit VA of its first |
| 1251 | // descriptor (the heaps live below 4 GiB); a root view keeps both halves (D3D-448). A graphics signature | 1262 | // descriptor (the heaps live below 4 GiB); a root view keeps both halves (D3D-448). Under |
| 1252 | // past the console window keeps pack()'s layout, where every address takes two dwords. | 1263 | // LEONIDA_GRAPHICS_ROOT_LAYOUT=pc the graphics bind point keeps pack()'s layout, two dwords per address. |
| 1253 | const bool console = is_compute(state) || state.layout->graphics_console; | 1264 | const bool console = is_compute(state) || state.layout->graphics_console; |
| 1254 | if (!(console && type == rt::rootsig::ParamType::Table)) write(state, first + 1, std::uint32_t(va >> 32)); | 1265 | if (!(console && type == rt::rootsig::ParamType::Table)) write(state, first + 1, std::uint32_t(va >> 32)); |
| 1255 | } | 1266 | } |