diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-12-25 17:35:41 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-06 20:13:06 +0000 |
commit | cb14a3fe5122c879eae1fb480ed7ce82a699ddb6 (patch) | |
tree | b983a613c35ece61d561b5a9ef9cd66419f6c7fb /contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp | |
parent | 3d68ee6cbdb244de9fab1df8a2525d2fa592571e (diff) | |
parent | 99aabd70801bd4bc72c4942747f6d62c675112f5 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp b/contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp index 709fe3212623..bcdbe5eadc69 100644 --- a/contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp +++ b/contrib/llvm-project/llvm/lib/Frontend/HLSL/HLSLResource.cpp @@ -23,13 +23,15 @@ GlobalVariable *FrontendResource::getGlobalVariable() { cast<ConstantAsMetadata>(Entry->getOperand(0))->getValue()); } -StringRef FrontendResource::getSourceType() { - return cast<MDString>(Entry->getOperand(1))->getString(); -} - ResourceKind FrontendResource::getResourceKind() { return static_cast<ResourceKind>( cast<ConstantInt>( + cast<ConstantAsMetadata>(Entry->getOperand(1))->getValue()) + ->getLimitedValue()); +} +ElementType FrontendResource::getElementType() { + return static_cast<ElementType>( + cast<ConstantInt>( cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue()) ->getLimitedValue()); } @@ -49,14 +51,15 @@ uint32_t FrontendResource::getSpace() { ->getLimitedValue(); } -FrontendResource::FrontendResource(GlobalVariable *GV, StringRef TypeStr, - ResourceKind RK, bool IsROV, +FrontendResource::FrontendResource(GlobalVariable *GV, ResourceKind RK, + ElementType ElTy, bool IsROV, uint32_t ResIndex, uint32_t Space) { auto &Ctx = GV->getContext(); IRBuilder<> B(Ctx); Entry = MDNode::get( - Ctx, {ValueAsMetadata::get(GV), MDString::get(Ctx, TypeStr), + Ctx, {ValueAsMetadata::get(GV), ConstantAsMetadata::get(B.getInt32(static_cast<int>(RK))), + ConstantAsMetadata::get(B.getInt32(static_cast<int>(ElTy))), ConstantAsMetadata::get(B.getInt1(IsROV)), ConstantAsMetadata::get(B.getInt32(ResIndex)), ConstantAsMetadata::get(B.getInt32(Space))}); |