Skip to content

Commit 496ab5d

Browse files
committed
review: clarify the struct the in-memory representation
- formally document the structure of the in-memory representation of a root signature as an array of the defined RootElements
1 parent dfe18c0 commit 496ab5d

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ struct RootConstants {
8888
// Models the end of a descriptor table and stores its visibility
8989
struct DescriptorTable {
9090
ShaderVisibility Visibility = ShaderVisibility::All;
91-
uint32_t NumClauses = 0; // The number of clauses in the table
91+
// Denotes that the previous NumClauses in the RootElement array
92+
// are the clauses in the table.
93+
uint32_t NumClauses = 0;
9294

9395
void dump(raw_ostream &OS) const;
9496
};
@@ -123,7 +125,21 @@ struct DescriptorTableClause {
123125
void dump(raw_ostream &OS) const;
124126
};
125127

126-
// Models RootElement : RootConstants | DescriptorTable | DescriptorTableClause
128+
/// Models RootElement : RootFlags | RootConstants | DescriptorTable
129+
/// | DescriptorTableClause
130+
///
131+
/// A Root Signature is modeled in-memory by an array of RootElements. These
132+
/// aim to map closely to their DSL grammar reprsentation defined in the spec.
133+
///
134+
/// Each optional parameter has its default value defined in the struct, and,
135+
/// each mandatory parameter does not have a default initialization.
136+
///
137+
/// For the variants RootFlags, RootConstants and DescriptorTableClause: each
138+
/// data member maps directly to a parameter in the grammar.
139+
///
140+
/// The DescriptorTable is modelled by having its Clauses as the previous
141+
/// RootElements in the array, and it holds a data member for the Visibility
142+
/// parameter.
127143
using RootElement = std::variant<RootFlags, RootConstants, DescriptorTable,
128144
DescriptorTableClause>;
129145

0 commit comments

Comments
 (0)