diff options
| author | aslan2142 <jan.trencansky@protonmail.com> | 2026-11-25 04:00:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-25 04:00:46 +0100 |
| commit | b07b9ecb09b47fa6496f01ad9d8fe87d205bd5d8 (patch) | |
| tree | e9527fe991b1c4fbd39a312969271f1c4c5a2358 /runtime/src | |
| parent | 0eeb1e663af5a3fe086c8dd0dfc5156bf69cc331 (diff) | |
| parent | b8563e949ed389fff20be91c73687a70b5213469 (diff) | |
Merge pull request #974 from iFeyz/feat/d3d448-graphics-root-layout
D3D-448-GRAPHICS: graphics root arguments in the console layout, mesh shaders through a window
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/root_signature.h | 7 | ||||
| -rw-r--r-- | runtime/src/shader_library.h | 9 |
2 files changed, 14 insertions, 2 deletions
diff --git a/runtime/src/root_signature.h b/runtime/src/root_signature.h index 60b0d5632..e7976fc73 100644 --- a/runtime/src/root_signature.h +++ b/runtime/src/root_signature.h | |||
| @@ -129,8 +129,11 @@ constexpr uint32_t kMaxD3d12Cost = 64; | |||
| 129 | // in this layout equals the program's RSRC2 USER_SGPR count in 29 of 29, and the programs read the tables and | 129 | // in this layout equals the program's RSRC2 USER_SGPR count in 29 of 29, and the programs read the tables and |
| 130 | // root CBVs at exactly these SGPRs (tools/rootsig_census.py --disasm). The game's compute census agrees (lowest | 130 | // root CBVs at exactly these SGPRs (tools/rootsig_census.py --disasm). The game's compute census agrees (lowest |
| 131 | // pointer s4, one-dword tables). | 131 | // pointer s4, one-dword tables). |
| 132 | // - vertex/pixel/geometry s8 and mesh s16: a hypothesis from the corpus census only (lowest pointer SGPR per stage); | 132 | // - vertex/pixel/geometry s8 and mesh s16: from the corpus census (lowest pointer SGPR per stage) and one live |
| 133 | // no signature confirms them, and visibility is not modelled (every parameter takes its place in every stage). | 133 | // retail frame (a VS and PS reading their tables at s8, s9, s10; issue #14, comment 7131556366); no serialized |
| 134 | // signature confirms them yet, and visibility is not modelled (every parameter takes its place in every stage). | ||
| 135 | // The graphics bind point uses Stage::Pixel (s8, as vertex and geometry); a mesh shader reads the same dwords | ||
| 136 | // through its translator-side window (docs/d3d12_vulkan.md section 3.5). | ||
| 134 | // A parameter that does not fit goes to the console's spill array behind s[0:1] (compute, section 7) together with | 137 | // A parameter that does not fit goes to the console's spill array behind s[0:1] (compute, section 7) together with |
| 135 | // every parameter after it. For compute that packed spill array (1 dword per 32-bit constant, 2 per root descriptor, | 138 | // every parameter after it. For compute that packed spill array (1 dword per 32-bit constant, 2 per root descriptor, |
| 136 | // 1 per descriptor table, no alignment padding) is modelled in StagePackResult; non-compute stages still refuse spills | 139 | // 1 per descriptor table, no alignment padding) is modelled in StagePackResult; non-compute stages still refuse spills |
diff --git a/runtime/src/shader_library.h b/runtime/src/shader_library.h index ae045e80b..a359287cb 100644 --- a/runtime/src/shader_library.h +++ b/runtime/src/shader_library.h | |||
| @@ -865,6 +865,9 @@ struct ShaderEntry { | |||
| 865 | // stages or an index written without the analysis. | 865 | // stages or an index written without the analysis. |
| 866 | std::string wave64_graphics; | 866 | std::string wave64_graphics; |
| 867 | bool emulated() const { return wave64_exchange == "workgroup"; } | 867 | bool emulated() const { return wave64_exchange == "workgroup"; } |
| 868 | // Mesh shaders: the index's "root_window" is {"sgpr": 16, "dword": 8}, so the module reads its root arguments | ||
| 869 | // from the graphics window (push dword 8 = root dword 0, D3D-448 follow-up). False for one translated before it. | ||
| 870 | bool graphics_root_window = false; | ||
| 868 | std::vector<SignatureElement> input_signature; // vertex shaders: what the input layout must feed | 871 | std::vector<SignatureElement> input_signature; // vertex shaders: what the input layout must feed |
| 869 | std::vector<std::uint32_t> inputs; // pixel shaders: input locations declared | 872 | std::vector<std::uint32_t> inputs; // pixel shaders: input locations declared |
| 870 | std::vector<std::uint32_t> outputs; // pixel/vertex shaders: output locations written | 873 | std::vector<std::uint32_t> outputs; // pixel/vertex shaders: output locations written |
| @@ -1177,6 +1180,12 @@ private: | |||
| 1177 | e.subgroup_size = u32(g); | 1180 | e.subgroup_size = u32(g); |
| 1178 | if (const Json* x = meta.find("wave64_exchange"); x && x->kind == Json::Kind::string) | 1181 | if (const Json* x = meta.find("wave64_exchange"); x && x->kind == Json::Kind::string) |
| 1179 | e.wave64_exchange = x->string; | 1182 | e.wave64_exchange = x->string; |
| 1183 | if (const Json* r = meta.find("root_window"); r && r->kind == Json::Kind::object) { | ||
| 1184 | const Json* sgpr = r->find("sgpr"); | ||
| 1185 | const Json* dword = r->find("dword"); | ||
| 1186 | e.graphics_root_window = sgpr && dword && sgpr->kind == Json::Kind::number && | ||
| 1187 | dword->kind == Json::Kind::number && u32(sgpr) == 16 && u32(dword) == 8; | ||
| 1188 | } | ||
| 1180 | if (const Json* wg = meta.find("wave64_graphics"); wg && wg->kind == Json::Kind::string) | 1189 | if (const Json* wg = meta.find("wave64_graphics"); wg && wg->kind == Json::Kind::string) |
| 1181 | e.wave64_graphics = wg->string; | 1190 | e.wave64_graphics = wg->string; |
| 1182 | if (const Json* s = meta.find("input_signature"); s && s->kind == Json::Kind::array) { | 1191 | if (const Json* s = meta.find("input_signature"); s && s->kind == Json::Kind::array) { |