@@ -70,7 +70,10 @@ extractShaderVisibility(MDNode *Node, unsigned int OpId) {
70
70
71
71
static uint64_t updateOngoingOffset (uint64_t CurOfset, uint64_t NumDescriptors,
72
72
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;
74
77
}
75
78
76
79
namespace {
@@ -558,7 +561,7 @@ Error validateDescriptorTableRegisterOverflow(mcdxbc::DescriptorTable Table,
558
561
// Errors for this check should be emitted before this point.
559
562
if (Range.NumDescriptors <= 0 )
560
563
continue ;
561
- dxil::ResourceClass RangeType =
564
+ const dxil::ResourceClass & RangeType =
562
565
static_cast <dxil::ResourceClass>(Range.RangeType );
563
566
564
567
if (Range.OffsetInDescriptorsFromTableStart != DescriptorTableOffsetAppend)
@@ -584,8 +587,6 @@ Error validateDescriptorTableRegisterOverflow(mcdxbc::DescriptorTable Table,
584
587
return make_error<DescriptorRangeOverflowError>(
585
588
RangeType, Range.BaseShaderRegister , Range.RegisterSpace );
586
589
587
- // Append to the current offset if DescriptorTableOffsetAppend, otherwise
588
- // calculate the new Offset.
589
590
Offset = updateOngoingOffset (Offset, Range.NumDescriptors ,
590
591
Range.OffsetInDescriptorsFromTableStart );
591
592
}
@@ -668,14 +669,12 @@ Error MetadataParser::validateRootSignature(
668
669
" DescriptorFlag" , Range.Flags ));
669
670
670
671
if (Error Err =
671
- validateDescriptorTableSamplerMixin (Table, Info.Location )) {
672
+ validateDescriptorTableSamplerMixin (Table, Info.Location ))
672
673
DeferredErrs = joinErrors (std::move (DeferredErrs), std::move (Err));
673
- }
674
674
675
675
if (Error Err =
676
- validateDescriptorTableRegisterOverflow (Table, Info.Location )) {
676
+ validateDescriptorTableRegisterOverflow (Table, Info.Location ))
677
677
DeferredErrs = joinErrors (std::move (DeferredErrs), std::move (Err));
678
- }
679
678
}
680
679
break ;
681
680
}
0 commit comments