upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/src/root_signature.cpp
diff options
context:
space:
mode:
authoraslan2142 <jan.trencansky@protonmail.com>2026-11-25 23:57:31 +0100
committerGitHub <noreply@github.com>2026-11-25 23:57:31 +0100
commit809d1869afb66f6778bcc6758b050d3ea97e7bba (patch)
treed177747a68a58411df831ac0a6836b2393a4a95c /runtime/src/root_signature.cpp
parentd34c426ef9f89e63c1261eb1d8a40bf8cc62a1db (diff)
parent48245b436d0890ad67f2a6b9098840bdea90e189 (diff)
Merge pull request #657 from aslan2142/root-constants-zero
OLD-8904: restore old upstream PR 8904 - root_signature: accept root constants of 0 values, as the host does (D3D-942)
Diffstat (limited to 'runtime/src/root_signature.cpp')
-rw-r--r--runtime/src/root_signature.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/runtime/src/root_signature.cpp b/runtime/src/root_signature.cpp
index 10dd1e02c..41d3f6c5a 100644
--- a/runtime/src/root_signature.cpp
+++ b/runtime/src/root_signature.cpp
@@ -17,10 +17,8 @@ PackResult pack(const RootSignature& sig) {
17 out.error = "unknown root parameter type"; 17 out.error = "unknown root parameter type";
18 return out; 18 return out;
19 } 19 }
20 if (p.type == ParamType::Constants && p.num_values == 0) { 20 // A constant parameter of 0 values is valid (the host serializer warns, CreateRootSignature answers S_OK):
21 out.error = "root constant parameter needs at least 1 dword"; 21 // it takes no dwords, so it gets no provenance entry and the parameters after it pack as if it were absent.
22 return out;
23 }
24 const uint32_t dwords = p.type == ParamType::Table ? 2 22 const uint32_t dwords = p.type == ParamType::Table ? 2
25 : p.type == ParamType::Descriptor ? 2 23 : p.type == ParamType::Descriptor ? 2
26 : p.num_values; 24 : p.num_values;
@@ -71,15 +69,12 @@ StagePackResult pack_stage(const RootSignature& sig, Stage stage) {
71 out.error = "unknown root parameter type"; 69 out.error = "unknown root parameter type";
72 return out; 70 return out;
73 } 71 }
74 if (p.type == ParamType::Constants && p.num_values == 0) {
75 out.error = "root constant parameter needs at least 1 dword";
76 return out;
77 }
78 cost += param_cost(p.type, p.num_values); 72 cost += param_cost(p.type, p.num_values);
79 if (cost > kMaxD3d12Cost) { 73 if (cost > kMaxD3d12Cost) {
80 out.error = "root signature exceeds the 64-dword D3D12 cost limit"; 74 out.error = "root signature exceeds the 64-dword D3D12 cost limit";
81 return out; 75 return out;
82 } 76 }
77 // 0 for a constant parameter of 0 values, which then shares its first SGPR with the next parameter.
83 const uint64_t dwords = stage_dwords(p.type, p.num_values); 78 const uint64_t dwords = stage_dwords(p.type, p.num_values);
84 if (!spilling && next + dwords <= kMaxUserSgprs) { 79 if (!spilling && next + dwords <= kMaxUserSgprs) {
85 first.push_back(static_cast<uint32_t>(next)); 80 first.push_back(static_cast<uint32_t>(next));