[llvm-branch-commits] [llvm] [DirectX] Validating Root flags are denying shader stage (PR #153287)

Finn Plummer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 15 13:53:04 PDT 2025


================
@@ -240,18 +254,63 @@ static void validateRootSignature(Module &M,
       const auto *ParamInfo =
           static_cast<const mcdxbc::RootParameterInfo *>(Reg->Cookie);
 
-      if (RC != ResourceClass::SRV && RC != ResourceClass::UAV)
+      if (RC != ResourceClass::SRV && RC != ResourceClass::UAV) {
+        HasBindings = true;
         continue;
+      }
 
-      if (ParamInfo->Type == dxbc::RootParameterType::DescriptorTable)
+      if (ParamInfo->Type == dxbc::RootParameterType::DescriptorTable) {
+        HasBindings = true;
         continue;
+      }
 
-      if (RK != ResourceKind::RawBuffer && RK != ResourceKind::StructuredBuffer)
+      if (RK != ResourceKind::RawBuffer &&
+          RK != ResourceKind::StructuredBuffer) {
         reportInvalidHandleTyError(M, RC, Binding);
+        continue;
+      }
+      HasBindings = true;
+
     } else {
       reportRegNotBound(M, RC, Binding);
     }
   }
+
+  if (HasBindings && MMI.ShaderProfile != Triple::Compute) {
+    dxbc::RootFlags Flags = dxbc::RootFlags(RSD.Flags);
----------------
inbelic wrote:

nit: it may be nicer if we define a separate function like `getEnvironmentDenyFlag` and then just invoked `reportIfDeniedShaderStageAccess` once. Might prevent a copy of this switch table appearing elsewhere

https://github.com/llvm/llvm-project/pull/153287


More information about the llvm-branch-commits mailing list