[clang] [llvm] [DirectX] Validate registers are bound to root signature (PR #146785)
Finn Plummer via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 17 11:05:12 PDT 2025
================
@@ -316,6 +316,32 @@ findOverlappingRanges(llvm::SmallVector<RangeInfo> &Infos) {
return Overlaps;
}
+llvm::SmallVector<RangeInfo>
+findUnboundRanges(const llvm::SmallVectorImpl<RangeInfo> &Ranges,
+ const llvm::ArrayRef<RangeInfo> &Bindings) {
+ llvm::SmallVector<RangeInfo> Unbounds;
+ for (const auto &Range : Ranges) {
+ bool Bound = false;
+ // hlsl::rootsig::RangeInfo Range;
+ // Range.Space = ResBinding.Space;
+ // Range.LowerBound = ResBinding.LowerBound;
+ // Range.UpperBound = Range.LowerBound + ResBinding.Size - 1;
+
+ for (const auto &Binding : Bindings) {
+ if (Range.Space == Binding.Space &&
+ Range.LowerBound >= Binding.LowerBound &&
+ Range.UpperBound <= Binding.UpperBound) {
----------------
inbelic wrote:
I will forward [this comment](https://github.com/llvm/llvm-project/pull/146785#discussion_r2211828192), just so it doesn't get lost:
> Ah yep, sorry.
>
> I guess my original question was about something like:
>
> ```
> struct FooData { float data };
> ConstantBuffer<FooData> Foo[4] : register(b0);
>
> [RootSignature(DescriptorTable(CBV(b0, numDescriptors =2), CBV(b2, numDescriptors = 2))]
> ```
>
> Are all registers successfully bound? IIUC, the current logic wouldn't get something like that
https://github.com/llvm/llvm-project/pull/146785
More information about the cfe-commits
mailing list