Skip to content

Commit 4e655da

Browse files
author
joaosaffran
committed
addressing comments
1 parent 4a0a955 commit 4e655da

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

llvm/lib/Target/DirectX/DXILRootSignature.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ static bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
352352
(Type == llvm::to_underlying(dxbc::DescriptorRangeType::Sampler));
353353

354354
if (Version == 1) {
355+
// Since the metadata is unversioned, we expect to explicitly see the values
356+
// that map to the version 1 behaviour here.
355357
if (IsSampler)
356358
return Flags == FlagT::DESCRIPTORS_VOLATILE;
357359
return Flags == (FlagT::DATA_VOLATILE | FlagT::DESCRIPTORS_VOLATILE);
@@ -395,9 +397,13 @@ static bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
395397
}
396398

397399
// When no descriptor flag is set, any data flag is allowed.
398-
if (!IsSampler)
399-
return (Flags & ~DataFlags) == FlagT::NONE;
400-
return (Flags & ~FlagT::NONE) == FlagT::NONE;
400+
FlagT Mask = FlagT::NONE;
401+
if (!IsSampler) {
402+
Mask |= FlagT::DATA_VOLATILE;
403+
Mask |= FlagT::DATA_STATIC;
404+
Mask |= FlagT::DATA_STATIC_WHILE_SET_AT_EXECUTE;
405+
}
406+
return (Flags & ~Mask) == FlagT::NONE;
401407
}
402408

403409
static bool validate(LLVMContext *Ctx, const mcdxbc::RootSignatureDesc &RSD) {
@@ -434,7 +440,7 @@ static bool validate(LLVMContext *Ctx, const mcdxbc::RootSignatureDesc &RSD) {
434440

435441
if (RSD.Version > 1) {
436442
if (!verifyDescriptorFlag(Descriptor.Flags))
437-
return reportValueError(Ctx, "DescriptorFlag", Descriptor.Flags);
443+
return reportValueError(Ctx, "DescriptorRangeFlag", Descriptor.Flags);
438444
}
439445
break;
440446
}

llvm/test/CodeGen/DirectX/ContainerData/RootSignature-RootDescriptor-Invalid-Flags.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
target triple = "dxil-unknown-shadermodel6.0-compute"
44

55

6-
; CHECK: error: Invalid value for DescriptorFlag: 3
6+
; CHECK: error: Invalid value for DescriptorRangeFlag: 3
77
; CHECK-NOT: Root Signature Definitions
88
define void @main() #0 {
99
entry:

0 commit comments

Comments
 (0)