================
@@ -214,6 +214,39 @@ enum class ShaderVisibility : uint32_t {
 #include "DXContainerConstants.def"
 };
 
+inline dxil::ResourceClass
+toResourceClass(dxbc::DescriptorRangeType RangeType) {
+  using namespace dxbc;
+  switch (RangeType) {
+  case DescriptorRangeType::SRV:
+    return dxil::ResourceClass::SRV;
+  case DescriptorRangeType::UAV:
+    return dxil::ResourceClass::UAV;
+  case DescriptorRangeType::CBV:
+    return dxil::ResourceClass::CBuffer;
+  case DescriptorRangeType::Sampler:
+    return dxil::ResourceClass::Sampler;
+  }
+  llvm_unreachable("Unknown DescriptorRangeType");
+}
+
+inline dxil::ResourceClass toResourceClass(dxbc::RootParameterType Type) {
+  using namespace dxbc;
+  switch (Type) {
+  case RootParameterType::Constants32Bit:
+    return dxil::ResourceClass::CBuffer;
+  case RootParameterType::SRV:
+    return dxil::ResourceClass::SRV;
+  case RootParameterType::UAV:
+    return dxil::ResourceClass::UAV;
+  case RootParameterType::CBV:
+    return dxil::ResourceClass::CBuffer;
+  case dxbc::RootParameterType::DescriptorTable:
+    llvm_unreachable("DescriptorTable is not convertible to ResourceClass");
+  }
+  llvm_unreachable("Unknown RootParameterType");
+}
----------------
joaosaffran wrote:

Those are being moved to here, to be used in 
`Frontend/HLSL/RootSignatureMetadata.cpp` and 
`DirectX/DxilPostOptimizationValidation.cpp`

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

Reply via email to