[llvm] [HLSL] Add descriptor table metadata parsing (PR #142492)
Finn Plummer via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 17 15:34:53 PDT 2025
================
@@ -241,6 +332,66 @@ static bool verifyRegisterSpace(uint32_t RegisterSpace) {
static bool verifyDescriptorFlag(uint32_t Flags) { return (Flags & ~0xE) == 0; }
+static bool verifyRangeType(uint32_t Type) {
+ switch (Type) {
+ case llvm::to_underlying(dxbc::DescriptorRangeType::CBV):
+ case llvm::to_underlying(dxbc::DescriptorRangeType::SRV):
+ case llvm::to_underlying(dxbc::DescriptorRangeType::UAV):
+ case llvm::to_underlying(dxbc::DescriptorRangeType::Sampler):
+ return true;
+ };
+
+ return false;
+}
+
+static bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
+ uint32_t FlagsVal) {
+ using FlagT = dxbc::DescriptorRangeFlag;
+ FlagT Flags = FlagT(FlagsVal);
+
+ const bool IsSampler =
+ (Type == llvm::to_underlying(dxbc::DescriptorRangeType::Sampler));
+
+ if (Version == 1) {
+ if (IsSampler)
+ return Flags == FlagT::NONE;
+ return Flags == FlagT::DESCRIPTORS_VOLATILE;
+ }
+
+ // The data-specific flags are mutually exclusive.
----------------
inbelic wrote:
the descriptor flags are also mutually exclusive. Do we want an explicit check for this? It seems like it is covered below. Maybe it is good for clarity?
https://github.com/llvm/llvm-project/pull/142492
More information about the llvm-commits
mailing list