Skip to content

Commit 3e54c9d

Browse files
committed
add colleciton of DescriptorTables
1 parent cb6c7c4 commit 3e54c9d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,32 @@ bool SemaHLSL::handleRootSignatureDecl(HLSLRootSignatureDecl *D,
11391139
Info.Visibility = Sampler->Visibility;
11401140
Infos.push_back(Info);
11411141
}
1142+
if (const auto *Clause =
1143+
std::get_if<llvm::hlsl::rootsig::DescriptorTableClause>(&Elem)) {
1144+
RangeInfo Info;
1145+
Info.LowerBound = Clause->Reg.Number;
1146+
assert(0 < Clause->NumDescriptors && "Verified as part of TODO(#129940)");
1147+
Info.UpperBound =
1148+
Clause->NumDescriptors == RangeInfo::Unbounded
1149+
? RangeInfo::Unbounded
1150+
: Info.LowerBound + Clause->NumDescriptors - 1; // use inclusive ranges []
1151+
1152+
Info.Class = Clause->Type;
1153+
Info.Space = Clause->Space;
1154+
// Note: Clause does not hold the visibility this will need to
1155+
Infos.push_back(Info);
1156+
}
1157+
if (const auto *Table =
1158+
std::get_if<llvm::hlsl::rootsig::DescriptorTable>(&Elem)) {
1159+
// Table holds the Visibility of all owned Clauses in Table, so iterate
1160+
// owned Clauses and update their corresponding RangeInfo
1161+
assert(Table->NumClauses <= Infos.size() && "RootElement");
1162+
// The last Table->NumClauses elements of Infos are the owned Clauses
1163+
// generated RangeInfo
1164+
auto TableInfos = MutableArrayRef<RangeInfo>(Infos).take_back(Table->NumClauses);
1165+
for (RangeInfo &Info : TableInfos)
1166+
Info.Visibility = Table->Visibility;
1167+
}
11421168
}
11431169

11441170
// 2. Sort the RangeInfo's by their GroupT to form groupings

0 commit comments

Comments
 (0)