upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/root_signature.h7
-rw-r--r--runtime/src/shader_library.h9
2 files changed, 14 insertions, 2 deletions
diff --git a/runtime/src/root_signature.h b/runtime/src/root_signature.h
index 376962940..d1b8e38b4 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::Vertex; a mesh shader reads the same dwords through its translator-side
136// 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; that array is not modelled, so such a signature is refused, never truncated. 138// every parameter after it; that array is not modelled, so such a signature is refused, never truncated.
136enum class Stage : uint32_t { Vertex = 0, Pixel = 1, Geometry = 2, Compute = 3, Mesh = 4 }; 139enum class Stage : uint32_t { Vertex = 0, Pixel = 1, Geometry = 2, Compute = 3, Mesh = 4 };
diff --git a/runtime/src/shader_library.h b/runtime/src/shader_library.h
index 9f752317e..9cfb902ef 100644
--- a/runtime/src/shader_library.h
+++ b/runtime/src/shader_library.h
@@ -827,6 +827,9 @@ struct ShaderEntry {
827 // subgroup size. Empty for a native translation. 827 // subgroup size. Empty for a native translation.
828 std::string wave64_exchange; 828 std::string wave64_exchange;
829 bool emulated() const { return wave64_exchange == "workgroup"; } 829 bool emulated() const { return wave64_exchange == "workgroup"; }
830 // Mesh shaders: the index's "root_window" is {"sgpr": 16, "dword": 8}, so the module reads its root arguments
831 // from the graphics window (push dword 8 = root dword 0, D3D-448 follow-up). False for one translated before it.
832 bool graphics_root_window = false;
830 std::vector<SignatureElement> input_signature; // vertex shaders: what the input layout must feed 833 std::vector<SignatureElement> input_signature; // vertex shaders: what the input layout must feed
831 std::vector<std::uint32_t> inputs; // pixel shaders: input locations declared 834 std::vector<std::uint32_t> inputs; // pixel shaders: input locations declared
832 std::vector<std::uint32_t> outputs; // pixel/vertex shaders: output locations written 835 std::vector<std::uint32_t> outputs; // pixel/vertex shaders: output locations written
@@ -1026,6 +1029,12 @@ private:
1026 e.subgroup_size = u32(g); 1029 e.subgroup_size = u32(g);
1027 if (const Json* x = meta.find("wave64_exchange"); x && x->kind == Json::Kind::string) 1030 if (const Json* x = meta.find("wave64_exchange"); x && x->kind == Json::Kind::string)
1028 e.wave64_exchange = x->string; 1031 e.wave64_exchange = x->string;
1032 if (const Json* r = meta.find("root_window"); r && r->kind == Json::Kind::object) {
1033 const Json* sgpr = r->find("sgpr");
1034 const Json* dword = r->find("dword");
1035 e.graphics_root_window = sgpr && dword && sgpr->kind == Json::Kind::number &&
1036 dword->kind == Json::Kind::number && u32(sgpr) == 16 && u32(dword) == 8;
1037 }
1029 if (const Json* s = meta.find("input_signature"); s && s->kind == Json::Kind::array) { 1038 if (const Json* s = meta.find("input_signature"); s && s->kind == Json::Kind::array) {
1030 for (const Json& item : s->array) { 1039 for (const Json& item : s->array) {
1031 SignatureElement element; 1040 SignatureElement element;