@@ -1361,6 +1361,7 @@ bool SemaHLSL::handleRootSignatureElements(
1361
1361
bool HasAnySampler = false ;
1362
1362
bool HasAnyNonSampler = false ;
1363
1363
uint32_t Offset = 0 ;
1364
+ bool Unbound = false ;
1364
1365
for (const auto &[Clause, ClauseElem] : UnboundClauses) {
1365
1366
SourceLocation Loc = ClauseElem->getLocation ();
1366
1367
if (Clause->Type == llvm::dxil::ResourceClass::Sampler)
@@ -1381,22 +1382,25 @@ bool SemaHLSL::handleRootSignatureElements(
1381
1382
llvm::hlsl::rootsig::DescriptorTableOffsetAppend) {
1382
1383
// Manually specified the offset
1383
1384
Offset = Clause->Offset ;
1385
+ Unbound = false ;
1386
+ } else if (Unbound) {
1387
+ // Trying to append onto unbound offset
1388
+ Diag (Loc, diag::err_hlsl_appending_onto_unbound);
1384
1389
}
1385
1390
1386
1391
uint64_t RangeBound = llvm::hlsl::rootsig::computeRangeBound (
1387
1392
Offset, Clause->NumDescriptors );
1388
1393
1389
- if (!llvm::hlsl::rootsig::verifyBoundOffset (Offset)) {
1390
- // Trying to append onto unbound offset
1391
- Diag (Loc, diag::err_hlsl_appending_onto_unbound);
1392
- } else if (!llvm::hlsl::rootsig::verifyNoOverflowedOffset (RangeBound)) {
1394
+ if (!llvm::hlsl::rootsig::verifyNoOverflowedOffset (RangeBound)) {
1393
1395
// Upper bound overflows maximum offset
1394
1396
Diag (Loc, diag::err_hlsl_offset_overflow) << Offset << RangeBound;
1395
1397
}
1396
1398
1397
1399
Offset = RangeBound == llvm::hlsl::rootsig::NumDescriptorsUnbounded
1398
1400
? uint32_t (RangeBound)
1399
1401
: uint32_t (RangeBound + 1 );
1402
+ Unbound = Clause->NumDescriptors ==
1403
+ llvm::hlsl::rootsig::NumDescriptorsUnbounded;
1400
1404
1401
1405
// Compute the register bounds and track resource binding
1402
1406
uint32_t LowerBound (Clause->Reg .Number );
0 commit comments