From 1236220647276ad81692becafa32ee9d374d269e Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 8 Mar 2021 00:13:00 -0800 Subject: ShaderResourceBinding{D3D12, Vk, GL} - removed the remaining duplicate code --- .../include/PipelineResourceSignatureVkImpl.hpp | 4 +--- .../src/PipelineResourceSignatureVkImpl.cpp | 7 +++--- .../src/ShaderResourceBindingVkImpl.cpp | 25 ---------------------- 3 files changed, 4 insertions(+), 32 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp index 2c3a4a55..9d4633f6 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp @@ -126,9 +126,7 @@ public: return IsCompatibleWith(*ValidatedCast(pPRS)); } - void InitSRBResourceCache(ShaderResourceCacheVk& ResourceCache, - IMemoryAllocator& CacheMemAllocator, - const char* DbgPipelineName) const; + void InitSRBResourceCache(ShaderResourceCacheVk& ResourceCache); // Copies static resources from the static resource cache to the destination cache void CopyStaticResources(ShaderResourceCacheVk& ResourceCache) const; diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp index 94a981d6..38520c8a 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp @@ -620,9 +620,7 @@ bool PipelineResourceSignatureVkImpl::IsCompatibleWith(const PipelineResourceSig return true; } -void PipelineResourceSignatureVkImpl::InitSRBResourceCache(ShaderResourceCacheVk& ResourceCache, - IMemoryAllocator& CacheMemAllocator, - const char* DbgPipelineName) const +void PipelineResourceSignatureVkImpl::InitSRBResourceCache(ShaderResourceCacheVk& ResourceCache) { const auto NumSets = GetNumDescriptorSets(); #ifdef DILIGENT_DEBUG @@ -630,6 +628,7 @@ void PipelineResourceSignatureVkImpl::InitSRBResourceCache(ShaderResourceCacheVk VERIFY_EXPR(m_DescriptorSetSizes[i] != ~0U); #endif + auto& CacheMemAllocator = m_SRBMemAllocator.GetResourceCacheDataAllocator(0); ResourceCache.InitializeSets(CacheMemAllocator, NumSets, m_DescriptorSetSizes.data()); const auto TotalResources = GetTotalResourceCount(); @@ -649,7 +648,7 @@ void PipelineResourceSignatureVkImpl::InitSRBResourceCache(ShaderResourceCacheVk { const char* DescrSetName = "Static/Mutable Descriptor Set"; #ifdef DILIGENT_DEVELOPMENT - std::string _DescrSetName(DbgPipelineName); + std::string _DescrSetName{m_Desc.Name}; _DescrSetName.append(" - static/mutable set"); DescrSetName = _DescrSetName.c_str(); #endif diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp index ead782c1..10241814 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp @@ -29,8 +29,6 @@ #include "ShaderResourceBindingVkImpl.hpp" #include "RenderDeviceVkImpl.hpp" #include "PipelineStateVkImpl.hpp" -#include "ShaderVkImpl.hpp" -#include "FixedLinearAllocator.hpp" namespace Diligent { @@ -39,29 +37,6 @@ ShaderResourceBindingVkImpl::ShaderResourceBindingVkImpl(IReferenceCounters* PipelineResourceSignatureVkImpl* pPRS) : TBase{pRefCounters, pPRS} { - const auto NumShaders = GetNumShaders(); - - // This will only allocate memory and initialize descriptor sets in the resource cache - // Resources will be initialized by InitializeResourceMemoryInCache() - auto& SRBMemAllocator = pPRS->GetSRBMemoryAllocator(); - auto& ResourceCacheDataAllocator = SRBMemAllocator.GetResourceCacheDataAllocator(0); - pPRS->InitSRBResourceCache(m_ShaderResourceCache, ResourceCacheDataAllocator, pPRS->GetDesc().Name); - - 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(NumShaders)); - - auto& VarDataAllocator = SRBMemAllocator.GetShaderVariableDataAllocator(s); - - // Create shader variable manager in place - // Initialize vars manager to reference mutable and dynamic variables - // Note that the cache has space for all variable types - const SHADER_RESOURCE_VARIABLE_TYPE VarTypes[] = {SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE, SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC}; - m_pShaderVarMgrs[MgrInd].Initialize(*pPRS, VarDataAllocator, VarTypes, _countof(VarTypes), ShaderType); - } } ShaderResourceBindingVkImpl::~ShaderResourceBindingVkImpl() -- cgit v1.2.3