================
@@ -24,6 +26,48 @@ using namespace llvm;
 using namespace llvm::dxil;
 
 namespace {
+static const char *ResourceClassToString(llvm::dxil::ResourceClass Class) {
+  switch (Class) {
+  case ResourceClass::SRV:
+    return "SRV";
+  case ResourceClass::UAV:
+    return "UAV";
+  case ResourceClass::CBuffer:
+    return "CBuffer";
+  case ResourceClass::Sampler:
+    return "Sampler";
+  }
+}
+
+static ResourceClass RangeToResourceClass(uint32_t RangeType) {
+  using namespace dxbc;
+  switch (static_cast<DescriptorRangeType>(RangeType)) {
----------------
joaosaffran wrote:

`DescriptorRangeType` is supposed to match the binary format representation, so 
it uses 32 bits and the numbers are supposed to match the ones used in DXC when 
creating the binary file. Other than that, I think it might be possible to 
reuse `ResourceClass` in place of `DescriptorRangeType`, if we remember to do 
the correct conversions when reading and writing. My only concern is to create 
a dependency that might make future code harder to maintain, since we currently 
extend `ResourceClass` without the concern of breaking the binary file. 
Thoughts ?

https://github.com/llvm/llvm-project/pull/146785
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to