From c7391919d2e9d34e7f4fc18e8ffc174a9eabfb5e Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 4 Oct 2018 21:51:33 -0700 Subject: Reworked context pool management in D3D12 --- Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h | 3 +-- Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp | 2 +- Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp | 9 +++------ Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h index 019501eb..3ce40f5b 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h @@ -112,8 +112,7 @@ class ShaderResourceLayoutVk { public: ShaderResourceLayoutVk(IObject& Owner, - const VulkanUtilities::VulkanLogicalDevice& LogicalDevice, - IMemoryAllocator& ResourceLayoutDataAllocator); + const VulkanUtilities::VulkanLogicalDevice& LogicalDevice); ShaderResourceLayoutVk (const ShaderResourceLayoutVk&) = delete; ShaderResourceLayoutVk (ShaderResourceLayoutVk&&) = delete; diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index 3161d084..b5a80d84 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -143,7 +143,7 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters m_ShaderResourceLayouts = reinterpret_cast(pResLayoutRawMem); for (Uint32 s=0; s < m_NumShaders; ++s) { - new (m_ShaderResourceLayouts + s) ShaderResourceLayoutVk(*this, LogicalDevice, GetRawAllocator()); + new (m_ShaderResourceLayouts + s) ShaderResourceLayoutVk(*this, LogicalDevice); auto* pShaderVk = GetShader(s); ShaderResources[s] = pShaderVk->GetShaderResources(); ShaderSPIRVs[s] = pShaderVk->GetSPIRV(); diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index 3c468729..fc986cf7 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -38,11 +38,9 @@ namespace Diligent { ShaderResourceLayoutVk::ShaderResourceLayoutVk(IObject& Owner, - const VulkanUtilities::VulkanLogicalDevice& LogicalDevice, - IMemoryAllocator& ResourceLayoutDataAllocator) : + const VulkanUtilities::VulkanLogicalDevice& LogicalDevice) : m_Owner(Owner), - m_LogicalDevice(LogicalDevice), - m_ResourceBuffer(nullptr, STDDeleterRawMem(ResourceLayoutDataAllocator)) + m_LogicalDevice(LogicalDevice) { } @@ -86,13 +84,12 @@ void ShaderResourceLayoutVk::AllocateMemory(std::shared_ptr::max()}, "Total number of resources exceeds Uint16 max representable value" ); m_NumResources[SHADER_VARIABLE_TYPE_NUM_TYPES] = static_cast(TotalResources); - VERIFY( &m_ResourceBuffer.get_deleter().m_Allocator == &Allocator, "Inconsistent memory allocators" ); size_t MemSize = TotalResources * sizeof(VkResource); if(MemSize == 0) return; auto *pRawMem = ALLOCATE(Allocator, "Raw memory buffer for shader resource layout resources", MemSize); - m_ResourceBuffer.reset(pRawMem); + m_ResourceBuffer = std::unique_ptr >(pRawMem, Allocator); } void ShaderResourceLayoutVk::InitializeStaticResourceLayout(std::shared_ptr pSrcResources, diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index 8117aa30..10ca267f 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -38,7 +38,7 @@ namespace Diligent ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pRenderDeviceVk, const ShaderCreationAttribs& CreationAttribs) : TShaderBase(pRefCounters, pRenderDeviceVk, CreationAttribs.Desc), - m_StaticResLayout(*this, pRenderDeviceVk->GetLogicalDevice(), GetRawAllocator()), + m_StaticResLayout(*this, pRenderDeviceVk->GetLogicalDevice()), m_StaticResCache(ShaderResourceCacheVk::DbgCacheContentType::StaticShaderResources), m_StaticVarsMgr(*this) { -- cgit v1.2.3