diff options
author | Joao Saffran <{ID}+{username}@users.noreply.github.com> | 2025-08-14 17:49:37 -0700 |
---|---|---|
committer | Joao Saffran <{ID}+{username}@users.noreply.github.com> | 2025-08-14 17:49:37 -0700 |
commit | bf5714d7abf8d3dfe4d1e8d108b95ac113dcf092 (patch) | |
tree | 0eafe33d5207af28ce2d4f6d5cb5c76b3c2c3789 | |
parent | d3349cec0490c0b8d26d5ff21f32b2b292bf2f28 (diff) | |
download | llvm-users/joaosaffran/153276.zip llvm-users/joaosaffran/153276.tar.gz llvm-users/joaosaffran/153276.tar.bz2 |
moving code to where I think make senseusers/joaosaffran/153276
-rw-r--r-- | llvm/include/llvm/BinaryFormat/DXContainer.h | 33 | ||||
-rw-r--r-- | llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h | 33 | ||||
-rw-r--r-- | llvm/lib/Target/DirectX/DXILPostOptimizationValidation.cpp | 12 |
3 files changed, 39 insertions, 39 deletions
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h index f74c977..355a86420 100644 --- a/llvm/include/llvm/BinaryFormat/DXContainer.h +++ b/llvm/include/llvm/BinaryFormat/DXContainer.h @@ -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"); +} + LLVM_ABI ArrayRef<EnumEntry<ShaderVisibility>> getShaderVisibility(); #define SHADER_VISIBILITY(Val, Enum) \ diff --git a/llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h b/llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h index a112fe6..096cd9dd 100644 --- a/llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h +++ b/llvm/include/llvm/Frontend/HLSL/RootSignatureMetadata.h @@ -28,39 +28,6 @@ class Metadata; namespace hlsl { namespace rootsig { -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"); -} - template <typename T> class RootSignatureValidationError : public ErrorInfo<RootSignatureValidationError<T>> { diff --git a/llvm/lib/Target/DirectX/DXILPostOptimizationValidation.cpp b/llvm/lib/Target/DirectX/DXILPostOptimizationValidation.cpp index b78cc63..1d2c9a3 100644 --- a/llvm/lib/Target/DirectX/DXILPostOptimizationValidation.cpp +++ b/llvm/lib/Target/DirectX/DXILPostOptimizationValidation.cpp @@ -13,7 +13,6 @@ #include "llvm/ADT/SmallString.h" #include "llvm/Analysis/DXILMetadataAnalysis.h" #include "llvm/Analysis/DXILResource.h" -#include "llvm/Frontend/HLSL/RootSignatureMetadata.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicsDirectX.h" @@ -237,10 +236,11 @@ static void validateRootSignatureBindings(Module &M, case dxbc::RootParameterType::CBV: { dxbc::RTS0::v2::RootDescriptor Desc = RSD.ParametersContainer.getRootDescriptor(ParamInfo.Location); - Builder.trackBinding(hlsl::rootsig::toResourceClass(static_cast<dxbc::RootParameterType>( - ParamInfo.Header.ParameterType)), - Desc.RegisterSpace, Desc.ShaderRegister, - Desc.ShaderRegister, &ParamInfo); + Builder.trackBinding( + dxbc::toResourceClass(static_cast<dxbc::RootParameterType>( + ParamInfo.Header.ParameterType)), + Desc.RegisterSpace, Desc.ShaderRegister, Desc.ShaderRegister, + &ParamInfo); break; } @@ -254,7 +254,7 @@ static void validateRootSignatureBindings(Module &M, ? Range.BaseShaderRegister : Range.BaseShaderRegister + Range.NumDescriptors - 1; Builder.trackBinding( - hlsl::rootsig::toResourceClass( + dxbc::toResourceClass( static_cast<dxbc::DescriptorRangeType>(Range.RangeType)), Range.RegisterSpace, Range.BaseShaderRegister, UpperBound, &ParamInfo); |