summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-03-08 08:13:00 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:17 +0000
commit1236220647276ad81692becafa32ee9d374d269e (patch)
treebb4a65ac072031344d1518691dbeb9c30b40d885 /Graphics/GraphicsEngineVulkan
parentUnified implementations of SRB in D3D12, Vk and GL (diff)
downloadDiligentCore-1236220647276ad81692becafa32ee9d374d269e.tar.gz
DiligentCore-1236220647276ad81692becafa32ee9d374d269e.zip
ShaderResourceBinding{D3D12, Vk, GL} - removed the remaining duplicate code
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp4
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp7
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp25
3 files changed, 4 insertions, 32 deletions
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<const PipelineResourceSignatureVkImpl>(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<int>(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()