@@ -70,7 +70,10 @@ extractShaderVisibility(MDNode *Node, unsigned int OpId) {
7070
7171static uint64_t updateOngoingOffset (uint64_t CurOfset, uint64_t NumDescriptors,
7272 uint64_t Offset) {
73- return Offset == ~0U ? CurOfset + NumDescriptors : Offset + NumDescriptors;
73+ // Append to the current offset if DescriptorTableOffsetAppend is set,
74+ // otherwise calculate the new Offset.
75+ return Offset == DescriptorTableOffsetAppend ? CurOfset + NumDescriptors
76+ : Offset + NumDescriptors;
7477}
7578
7679namespace {
@@ -558,7 +561,7 @@ Error validateDescriptorTableRegisterOverflow(mcdxbc::DescriptorTable Table,
558561 // Errors for this check should be emitted before this point.
559562 if (Range.NumDescriptors <= 0 )
560563 continue ;
561- dxil::ResourceClass RangeType =
564+ const dxil::ResourceClass & RangeType =
562565 static_cast <dxil::ResourceClass>(Range.RangeType );
563566
564567 if (Range.OffsetInDescriptorsFromTableStart != DescriptorTableOffsetAppend)
@@ -584,8 +587,6 @@ Error validateDescriptorTableRegisterOverflow(mcdxbc::DescriptorTable Table,
584587 return make_error<DescriptorRangeOverflowError>(
585588 RangeType, Range.BaseShaderRegister , Range.RegisterSpace );
586589
587- // Append to the current offset if DescriptorTableOffsetAppend, otherwise
588- // calculate the new Offset.
589590 Offset = updateOngoingOffset (Offset, Range.NumDescriptors ,
590591 Range.OffsetInDescriptorsFromTableStart );
591592 }
@@ -668,14 +669,12 @@ Error MetadataParser::validateRootSignature(
668669 " DescriptorFlag" , Range.Flags ));
669670
670671 if (Error Err =
671- validateDescriptorTableSamplerMixin (Table, Info.Location )) {
672+ validateDescriptorTableSamplerMixin (Table, Info.Location ))
672673 DeferredErrs = joinErrors (std::move (DeferredErrs), std::move (Err));
673- }
674674
675675 if (Error Err =
676- validateDescriptorTableRegisterOverflow (Table, Info.Location )) {
676+ validateDescriptorTableRegisterOverflow (Table, Info.Location ))
677677 DeferredErrs = joinErrors (std::move (DeferredErrs), std::move (Err));
678- }
679678 }
680679 break ;
681680 }
0 commit comments