[llvm-branch-commits] [llvm] [DirectX] Validating Root flags are denying shader stage (PR #153287)
Justin Bogner via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Sep 17 10:00:57 PDT 2025
================
@@ -236,21 +272,33 @@ 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 (!Reg) {
+ reportRegNotBound(M, RC, Binding);
+ continue;
+ }
- if (RC != ResourceClass::SRV && RC != ResourceClass::UAV)
- 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) {
+ reportInvalidHandleTyError(M, RC, Binding);
+ continue;
+ }
- if (ParamInfo->Type == dxbc::RootParameterType::DescriptorTable)
- continue;
+ HasBindings = true;
+ }
- if (RK != ResourceKind::RawBuffer && RK != ResourceKind::StructuredBuffer)
- reportInvalidHandleTyError(M, RC, Binding);
- } else {
- reportRegNotBound(M, RC, Binding);
- }
+ if (HasBindings && MMI.ShaderProfile != Triple::Compute) {
+ const dxbc::RootFlags Flags = dxbc::RootFlags(RSD.Flags);
+ const dxbc::RootFlags Mask = getEnvironmentDenyFlagMask(MMI.ShaderProfile);
----------------
bogner wrote:
Does this do the right thing for Library shaders? What about the various raytracing profiles (RayGeneration, Intersection, AnyHit, etc)? Is there some reason we can't get here for those?
https://github.com/llvm/llvm-project/pull/153287
More information about the llvm-branch-commits
mailing list