From 87e70a1a99396767ab519aceebd843c1eb2da223 Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 19 Feb 2021 14:03:18 -0800 Subject: PipelineResourceSignatureD3D12Impl: some refactoring --- .../include/PipelineResourceSignatureBase.hpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp index 9f5b6cdc..50a52dad 100644 --- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp @@ -57,6 +57,19 @@ Int32 FindImmutableSampler(const ImmutableSamplerDesc* ImtblSamplers, const char* ResourceName, const char* SamplerSuffix); +/// Returns true if two pipeline resources are compatible +inline bool PipelineResourcesCompatible(const PipelineResourceDesc& lhs, const PipelineResourceDesc& rhs) +{ + // Ignore resource names. + // clang-format off + return lhs.ShaderStages == rhs.ShaderStages && + lhs.ArraySize == rhs.ArraySize && + lhs.ResourceType == rhs.ResourceType && + lhs.VarType == rhs.VarType && + lhs.Flags == rhs.Flags; + // clang-format on +} + /// Template class implementing base functionality of the pipeline resource signature object. /// \tparam BaseInterface - Base interface that this class will inheret @@ -165,8 +178,8 @@ protected: void CopyDescription(FixedLinearAllocator& Allocator, const PipelineResourceSignatureDesc& Desc) noexcept(false) { - PipelineResourceDesc* pResources = Allocator.Allocate(Desc.NumResources); - ImmutableSamplerDesc* pSamplers = Allocator.Allocate(Desc.NumImmutableSamplers); + PipelineResourceDesc* pResources = Allocator.ConstructArray(Desc.NumResources); + ImmutableSamplerDesc* pSamplers = Allocator.ConstructArray(Desc.NumImmutableSamplers); for (Uint32 i = 0; i < Desc.NumResources; ++i) { -- cgit v1.2.3