diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-08 08:13:00 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:17 +0000 |
| commit | 1236220647276ad81692becafa32ee9d374d269e (patch) | |
| tree | bb4a65ac072031344d1518691dbeb9c30b40d885 /Graphics/GraphicsEngineD3D12 | |
| parent | Unified implementations of SRB in D3D12, Vk and GL (diff) | |
| download | DiligentCore-1236220647276ad81692becafa32ee9d374d269e.tar.gz DiligentCore-1236220647276ad81692becafa32ee9d374d269e.zip | |
ShaderResourceBinding{D3D12, Vk, GL} - removed the remaining duplicate code
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
3 files changed, 3 insertions, 32 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp index 93c2af1d..497c57c3 100644 --- a/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp @@ -141,9 +141,7 @@ public: bool IsCompatibleWith(const PipelineResourceSignatureD3D12Impl& Other) const; - void InitSRBResourceCache(ShaderResourceCacheD3D12& ResourceCache, - IMemoryAllocator& CacheMemAllocator, - const char* DbgPipelineName) const; + void InitSRBResourceCache(ShaderResourceCacheD3D12& ResourceCache); void CopyStaticResources(ShaderResourceCacheD3D12& ResourceCache) const; diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp index 8b15a523..a0d7f6ed 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp @@ -432,11 +432,9 @@ size_t PipelineResourceSignatureD3D12Impl::CalculateHash() const return Hash; } -void PipelineResourceSignatureD3D12Impl::InitSRBResourceCache(ShaderResourceCacheD3D12& ResourceCache, - IMemoryAllocator& CacheMemAllocator, - const char* DbgPipelineName) const +void PipelineResourceSignatureD3D12Impl::InitSRBResourceCache(ShaderResourceCacheD3D12& ResourceCache) { - ResourceCache.Initialize(CacheMemAllocator, m_pDevice, m_RootParams); + ResourceCache.Initialize(m_SRBMemAllocator.GetResourceCacheDataAllocator(0), m_pDevice, m_RootParams); } void PipelineResourceSignatureD3D12Impl::CopyStaticResources(ShaderResourceCacheD3D12& DstResourceCache) const diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp index 17c39480..6e272d9f 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp @@ -31,7 +31,6 @@ #include "RenderDeviceD3D12Impl.hpp" #include "PipelineResourceSignatureD3D12Impl.hpp" -#include "FixedLinearAllocator.hpp" namespace Diligent { @@ -40,30 +39,6 @@ ShaderResourceBindingD3D12Impl::ShaderResourceBindingD3D12Impl(IReferenceCounter PipelineResourceSignatureD3D12Impl* pPRS) : TBase{pRefCounters, pPRS} { - auto& SRBMemAllocator = pPRS->GetSRBMemoryAllocator(); - auto& ResourceCacheDataAllocator = SRBMemAllocator.GetResourceCacheDataAllocator(0); - pPRS->InitSRBResourceCache(m_ShaderResourceCache, ResourceCacheDataAllocator, pPRS->GetDesc().Name); - - const auto NumShaders = GetNumShaders(); - for (Uint32 s = 0; s < NumShaders; ++s) - { - const auto ShaderType = pPRS->GetActiveShaderStageType(s); - const auto ShaderInd = GetShaderTypePipelineIndex(ShaderType, pPRS->GetPipelineType()); - const auto MgrInd = m_ActiveShaderStageIndex[ShaderInd]; - VERIFY_EXPR(MgrInd >= 0 && MgrInd < static_cast<int>(NumShaders)); - - auto& VarDataAllocator = SRBMemAllocator.GetShaderVariableDataAllocator(s); - - // It is important that initialization is separated from construction because it provides exception safety. - constexpr SHADER_RESOURCE_VARIABLE_TYPE AllowedVarTypes[] = {SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE, SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC}; - m_pShaderVarMgrs[MgrInd].Initialize( - *pPRS, - VarDataAllocator, - AllowedVarTypes, - _countof(AllowedVarTypes), - ShaderType // - ); - } } ShaderResourceBindingD3D12Impl::~ShaderResourceBindingD3D12Impl() |
