Skip to content

Commit b42630a

Browse files
committed
clean up
1 parent ec10db8 commit b42630a

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ extractShaderVisibility(MDNode *Node, unsigned int OpId) {
7070

7171
static 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

7679
namespace {
@@ -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
}

llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ uint64_t computeRangeBound(uint32_t Offset, uint32_t Size) {
181181

182182
return uint64_t(Offset) + uint64_t(Size) - 1;
183183
}
184+
184185
} // namespace rootsig
185186
} // namespace hlsl
186187
} // namespace llvm

llvm/test/CodeGen/DirectX/rootsignature-validation-fail-sampler-mix.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ entry:
1515
!3 = !{!"DescriptorTable", i32 0, !4, !5}
1616
!4 = !{!"UAV", i32 1, i32 0, i32 0, i32 -1, i32 0}
1717
!5 = !{!"Sampler", i32 2, i32 0, i32 0, i32 -1, i32 0}
18-

0 commit comments

Comments
 (0)