[clang] [llvm] [DirectX] Validate registers are bound to root signature (PR #146785)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 25 11:39:04 PDT 2025
================
@@ -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
More information about the llvm-commits
mailing list