Skip to content

Commit bce790c

Browse files
author
joaosaffran
committed
address comments
1 parent 5c677a5 commit bce790c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

llvm/lib/Target/DirectX/DXILRootSignature.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ static bool parseRootDescriptors(LLVMContext *Ctx,
175175
}
176176

177177
static bool parseDescriptorRange(LLVMContext *Ctx,
178-
mcdxbc::RootSignatureDesc &RSD,
179178
mcdxbc::DescriptorTable &Table,
180179
MDNode *RangeDescriptorNode) {
181180

@@ -197,9 +196,9 @@ static bool parseDescriptorRange(LLVMContext *Ctx,
197196
.Case("UAV", llvm::to_underlying(dxbc::DescriptorRangeType::UAV))
198197
.Case("Sampler",
199198
llvm::to_underlying(dxbc::DescriptorRangeType::Sampler))
200-
.Default(-1u);
199+
.Default(~0U);
201200

202-
if (Range.RangeType == -1u)
201+
if (Range.RangeType == ~0U)
203202
return reportError(Ctx, "Invalid Descriptor Range type: " + *ElementText);
204203

205204
if (std::optional<uint32_t> Val = extractMdIntValue(RangeDescriptorNode, 1))
@@ -254,7 +253,7 @@ static bool parseDescriptorTable(LLVMContext *Ctx,
254253
if (Element == nullptr)
255254
return reportError(Ctx, "Missing Root Element Metadata Node.");
256255

257-
if (parseDescriptorRange(Ctx, RSD, Table, Element))
256+
if (parseDescriptorRange(Ctx, Table, Element))
258257
return true;
259258
}
260259

@@ -354,8 +353,8 @@ static bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
354353

355354
if (Version == 1) {
356355
if (IsSampler)
357-
return Flags == FlagT::NONE;
358-
return Flags == FlagT::DESCRIPTORS_VOLATILE;
356+
return Flags == FlagT::DESCRIPTORS_VOLATILE;
357+
return Flags == (FlagT::DATA_VOLATILE | FlagT::DESCRIPTORS_VOLATILE);
359358
}
360359

361360
// The data-specific flags are mutually exclusive.
@@ -392,7 +391,10 @@ static bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
392391
Mask |= FlagT::DATA_STATIC;
393392
Mask |= FlagT::DATA_STATIC_WHILE_SET_AT_EXECUTE;
394393
}
395-
return (Flags & ~Mask) == FlagT::NONE;
394+
395+
if (!IsSampler)
396+
return (Flags & ~Mask) == FlagT::NONE;
397+
return false;
396398
}
397399

398400
// When no descriptor flag is set, any data flag is allowed.

0 commit comments

Comments
 (0)