aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp b/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp
index dde7255e0425..d3ff12a1f7b3 100644
--- a/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResource.cpp
@@ -233,9 +233,8 @@ void ResourceBase::print(raw_ostream &OS, StringRef IDPrefix,
}
UAVResource::UAVResource(uint32_t I, FrontendResource R)
- : ResourceBase(I, R),
- Shape(static_cast<ResourceBase::Kinds>(R.getResourceKind())),
- GloballyCoherent(false), HasCounter(false), IsROV(false), ExtProps() {
+ : ResourceBase(I, R), Shape(R.getResourceKind()), GloballyCoherent(false),
+ HasCounter(false), IsROV(R.getIsROV()), ExtProps() {
parseSourceType(R.getSourceType());
}
@@ -259,26 +258,10 @@ void UAVResource::print(raw_ostream &OS) const {
// information we need to remove the source type string from here (See issue:
// https://github.com/llvm/llvm-project/issues/57991).
void UAVResource::parseSourceType(StringRef S) {
- IsROV = S.startswith("RasterizerOrdered");
- if (IsROV)
- S = S.substr(strlen("RasterizerOrdered"));
- if (S.startswith("RW"))
- S = S.substr(strlen("RW"));
-
- // Note: I'm deliberately not handling any of the Texture buffer types at the
- // moment. I want to resolve the issue above before adding Texture or Sampler
- // support.
- Shape = StringSwitch<ResourceBase::Kinds>(S)
- .StartsWith("Buffer<", Kinds::TypedBuffer)
- .StartsWith("ByteAddressBuffer<", Kinds::RawBuffer)
- .StartsWith("StructuredBuffer<", Kinds::StructuredBuffer)
- .Default(Kinds::Invalid);
- assert(Shape != Kinds::Invalid && "Unsupported buffer type");
-
S = S.substr(S.find("<") + 1);
constexpr size_t PrefixLen = StringRef("vector<").size();
- if (S.startswith("vector<"))
+ if (S.starts_with("vector<"))
S = S.substr(PrefixLen, S.find(",") - PrefixLen);
else
S = S.substr(0, S.find(">"));