[llvm] [HLSL] Add descriptor table metadata parsing (PR #142492)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 11 10:54:09 PDT 2025
================
@@ -241,6 +328,77 @@ 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;
+}
+
+template <typename... FlagTypes>
+static bool isFlagSet(uint32_t Flags, FlagTypes... FlagsToCheck) {
+ return ((Flags & llvm::to_underlying(FlagsToCheck)) | ...) == Flags;
+}
+
+static bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
+ uint32_t Flags) {
+ const bool IsSampler =
+ (Type == llvm::to_underlying(dxbc::DescriptorRangeType::Sampler));
+
+ if (Version == 1) {
+ if (IsSampler) {
+ return Flags == 0;
+ }
+ return Flags ==
+ llvm::to_underlying(dxbc::DescriptorRangeFlag::DESCRIPTORS_VOLATILE);
+ }
----------------
joaosaffran wrote:
The metadata representation, for descriptor tables, always contains a flag values, so the spec expect me to verify that. I will fix the values though.
https://github.com/llvm/llvm-project/pull/142492
More information about the llvm-commits
mailing list