[llvm-branch-commits] [llvm] [DirectX] Validating Root flags are denying shader stage (PR #153287)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Sep 17 16:51:53 PDT 2025
================
@@ -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
More information about the llvm-branch-commits
mailing list