================
@@ -236,22 +273,35 @@ static void validateRootSignature(Module &M,
         BoundRegs.findBoundReg(RC, Binding.Space, Binding.LowerBound,
                                Binding.LowerBound + Binding.Size - 1);
 
-    if (Reg != nullptr) {
-      const auto *ParamInfo =
-          static_cast<const mcdxbc::RootParameterInfo *>(Reg->Cookie);
-
-      if (RC != ResourceClass::SRV && RC != ResourceClass::UAV)
-        continue;
-
-      if (ParamInfo->Type == dxbc::RootParameterType::DescriptorTable)
-        continue;
-
-      if (RK != ResourceKind::RawBuffer && RK != 
ResourceKind::StructuredBuffer)
-        reportInvalidHandleTyError(M, RC, Binding);
-    } else {
+    if (!Reg) {
       reportRegNotBound(M, RC, Binding);
+      continue;
+    }
+
+    const auto *ParamInfo =
+        static_cast<const mcdxbc::RootParameterInfo *>(Reg->Cookie);
+
+    const bool IsRootSRVOrUAV =
+        RC == ResourceClass::SRV || RC == ResourceClass::UAV;
+    const bool IsDescriptorTable =
+        ParamInfo->Type == dxbc::RootParameterType::DescriptorTable;
+    const bool IsRawOrStructuredBuffer =
+        RK != ResourceKind::RawBuffer && RK != ResourceKind::StructuredBuffer;
+    if (IsRootSRVOrUAV && !IsDescriptorTable && IsRawOrStructuredBuffer) {
----------------
joaosaffran wrote:

`IsRootSRVOrUAV`  only check if the resource being bound is `SRV` or `UAV`, is 
not checking which resource is being bounded to. In this validation, you can 
bound to a `DescriptorTable` but not with a `RootSRV` or `RootUAV`.

Here is a godbolt link with this example:
https://hlsl.godbolt.org/z/WW4qTs4hf

https://github.com/llvm/llvm-project/pull/153287
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to