diff options
author | Finn Plummer <mail@inbelic.dev> | 2025-08-07 16:10:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-07 16:10:50 -0700 |
commit | cb2d56ce960714ce6fce39e8b846326969a30c2d (patch) | |
tree | 61161e03f939c0a305e4cc45ce532d741b932bf6 /llvm/lib/Frontend/HLSL | |
parent | 47f54e499210c2a66da0441b7ae54974a57d2182 (diff) | |
download | llvm-cb2d56ce960714ce6fce39e8b846326969a30c2d.zip llvm-cb2d56ce960714ce6fce39e8b846326969a30c2d.tar.gz llvm-cb2d56ce960714ce6fce39e8b846326969a30c2d.tar.bz2 |
[NFC][HLSL][DirectX] Consolidate `ResourceClassNames` (#152213)
During the split of the various `Frontend/HLSL` libraries, there was an
oversight to duplicate the `ResourceClassNames` definitions. This commit
simply consolidates the definitions into `DXContainer.h` as
`getResourceClasses`
Diffstat (limited to 'llvm/lib/Frontend/HLSL')
-rw-r--r-- | llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp | 11 |
2 files changed, 3 insertions, 17 deletions
diff --git a/llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp b/llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp index 79904fc..574883e 100644 --- a/llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp +++ b/llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp @@ -92,16 +92,9 @@ static raw_ostream &operator<<(raw_ostream &OS, return OS; } -static const EnumEntry<dxil::ResourceClass> ResourceClassNames[] = { - {"CBV", dxil::ResourceClass::CBuffer}, - {"SRV", dxil::ResourceClass::SRV}, - {"UAV", dxil::ResourceClass::UAV}, - {"Sampler", dxil::ResourceClass::Sampler}, -}; - static raw_ostream &operator<<(raw_ostream &OS, const ClauseType &Type) { OS << enumToStringRef(dxil::ResourceClass(llvm::to_underlying(Type)), - ArrayRef(ResourceClassNames)); + dxbc::getResourceClasses()); return OS; } diff --git a/llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp b/llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp index 9cf4ed1..1cda308 100644 --- a/llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp +++ b/llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp @@ -51,13 +51,6 @@ static std::optional<StringRef> extractMdStringValue(MDNode *Node, return NodeText->getString(); } -static const EnumEntry<dxil::ResourceClass> ResourceClassNames[] = { - {"CBV", dxil::ResourceClass::CBuffer}, - {"SRV", dxil::ResourceClass::SRV}, - {"UAV", dxil::ResourceClass::UAV}, - {"Sampler", dxil::ResourceClass::Sampler}, -}; - namespace { // We use the OverloadVisit with std::visit to ensure the compiler catches if a @@ -128,7 +121,7 @@ MDNode *MetadataBuilder::BuildRootDescriptor(const RootDescriptor &Descriptor) { IRBuilder<> Builder(Ctx); StringRef ResName = enumToStringRef(dxil::ResourceClass(to_underlying(Descriptor.Type)), - ArrayRef(ResourceClassNames)); + dxbc::getResourceClasses()); assert(!ResName.empty() && "Provided an invalid Resource Class"); SmallString<7> Name({"Root", ResName}); Metadata *Operands[] = { @@ -170,7 +163,7 @@ MDNode *MetadataBuilder::BuildDescriptorTableClause( IRBuilder<> Builder(Ctx); StringRef ResName = enumToStringRef(dxil::ResourceClass(to_underlying(Clause.Type)), - ArrayRef(ResourceClassNames)); + dxbc::getResourceClasses()); assert(!ResName.empty() && "Provided an invalid Resource Class"); Metadata *Operands[] = { MDString::get(Ctx, ResName), |