@@ -1335,7 +1335,7 @@ bool SemaHLSL::handleRootSignatureElements(
13351335 bool HasNonSampler = false ;
13361336 uint32_t Offset = 0 ;
13371337 for (const auto &[Clause, ClauseElem] : UnboundClauses) {
1338- SourceLocation Loc = RootSigElem. getLocation ();
1338+ SourceLocation Loc = ClauseElem-> getLocation ();
13391339 if (Clause->Type == llvm::dxil::ResourceClass::Sampler)
13401340 HasSampler = true ;
13411341 else
@@ -1356,19 +1356,20 @@ bool SemaHLSL::handleRootSignatureElements(
13561356 Offset = Clause->Offset ;
13571357 }
13581358
1359- uint64_t NextOffset =
1360- llvm::hlsl::rootsig::nextOffset ( Offset, Clause->NumDescriptors );
1359+ uint64_t RangeBound = llvm::hlsl::rootsig::computeRangeBound (
1360+ Offset, Clause->NumDescriptors );
13611361
13621362 if (!llvm::hlsl::rootsig::verifyBoundOffset (Offset)) {
13631363 // Trying to append onto unbound offset
13641364 Diag (Loc, diag::err_hlsl_appending_onto_unbound);
1365- } else if (!llvm::hlsl::rootsig::verifyNoOverflowedOffset (NextOffset -
1366- 1 )) {
1365+ } else if (!llvm::hlsl::rootsig::verifyNoOverflowedOffset (RangeBound)) {
13671366 // Upper bound overflows maximum offset
1368- Diag (Loc, diag::err_hlsl_offset_overflow) << Offset << NextOffset - 1 ;
1367+ Diag (Loc, diag::err_hlsl_offset_overflow) << Offset << RangeBound ;
13691368 }
13701369
1371- Offset = uint32_t (NextOffset);
1370+ Offset = RangeBound == llvm::hlsl::rootsig::NumDescriptorsUnbounded
1371+ ? uint32_t (RangeBound)
1372+ : uint32_t (RangeBound + 1 );
13721373
13731374 // Compute the register bounds and track resource binding
13741375 uint32_t LowerBound (Clause->Reg .Number );
0 commit comments