[clang] [HLSL] Collect explicit resource binding information (PR #111203)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 15 08:33:55 PDT 2024
================
@@ -83,6 +81,49 @@ static RegisterType getRegisterType(StringRef Slot) {
}
}
+static ResourceClass getResourceClass(RegisterType RT) {
+ switch (RT) {
+ case RegisterType::SRV:
+ return ResourceClass::SRV;
+ case RegisterType::UAV:
+ return ResourceClass::UAV;
+ case RegisterType::CBuffer:
+ return ResourceClass::CBuffer;
+ case RegisterType::Sampler:
+ return ResourceClass::Sampler;
+ default:
+ llvm_unreachable("unexpected RegisterType value");
----------------
bogner wrote:
Let's explicitly spell out all of the enum values here instead of having a default case. This will play better with `-Wcovered-switch` if we add a new enum value at some point and forget to update this switch.
https://github.com/llvm/llvm-project/pull/111203
More information about the cfe-commits
mailing list