Skip to content

Commit 84f449b

Browse files
committed
fixing range bug
1 parent e5ca2d6 commit 84f449b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

llvm/lib/Frontend/HLSL/HLSLBinding.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ bool BindingInfo::RegisterSpace::isBound(const BindingRange &Range) const {
8383

8484
if (It == FreeRanges.end())
8585
return true;
86-
return !(Range.LowerBound >= It->LowerBound &&
87-
Range.UpperBound <= It->UpperBound);
86+
return ((Range.LowerBound < It->LowerBound) && (Range.UpperBound < It->LowerBound)) ||
87+
((Range.LowerBound > It->UpperBound) && (Range.UpperBound > It->UpperBound));
8888
}
8989

9090
bool BindingInfo::isBound(dxil::ResourceClass RC, uint32_t Space,

llvm/lib/Target/DirectX/DXILPostOptimizationValidation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static void validateRootSignature(Module &M,
238238
const ResourceInfo::ResourceBinding &Binding = RI.getBinding();
239239
ResourceClass RC = DRTM[RI.getHandleTy()].getResourceClass();
240240
if (!Info.isBound(RC, Binding.Space,
241-
{Binding.LowerBound, Binding.LowerBound + Binding.Size}))
241+
{Binding.LowerBound, Binding.LowerBound + Binding.Size - 1}))
242242
reportRegNotBound(M, RC, Binding);
243243
}
244244
}

llvm/test/CodeGen/DirectX/rootsignature-validation-binding-limits-larger.ll renamed to llvm/test/CodeGen/DirectX/rootsignature-validation-binding-limits-upperbound.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
define void @CSMain() "hlsl.shader"="compute" {
1010
entry:
11-
%CB = tail call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 3, i32 0, i1 false, ptr nonnull @CB.str)
11+
%CB = tail call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 5, i32 0, i1 false, ptr nonnull @CB.str)
1212
ret void
1313
}
1414

@@ -17,4 +17,4 @@ entry:
1717
!0 = !{ptr @CSMain, !1, i32 2}
1818
!1 = !{!2}
1919
!2 = !{!"DescriptorTable", i32 0, !3}
20-
!3 = !{!"CBV", i32 3, i32 0, i32 0, i32 -1, i32 4}
20+
!3 = !{!"CBV", i32 5, i32 0, i32 0, i32 0, i32 4}

0 commit comments

Comments
 (0)