diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-10-05 04:51:33 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-10-05 04:51:33 +0000 |
| commit | c7391919d2e9d34e7f4fc18e8ffc174a9eabfb5e (patch) | |
| tree | 1ff73fa0f1ae15b057db84bdeb12de1c5b19b97f /Graphics/GraphicsEngineVulkan | |
| parent | Added ReleaseStaleResources() to IRenderDevice interface + a bunch of minor c... (diff) | |
| download | DiligentCore-c7391919d2e9d34e7f4fc18e8ffc174a9eabfb5e.tar.gz DiligentCore-c7391919d2e9d34e7f4fc18e8ffc174a9eabfb5e.zip | |
Reworked context pool management in D3D12
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
4 files changed, 6 insertions, 10 deletions
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<ShaderResourceLayoutVk*>(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<const ShaderVkImpl>(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<void>(ResourceLayoutDataAllocator)) + m_LogicalDevice(LogicalDevice) { } @@ -86,13 +84,12 @@ void ShaderResourceLayoutVk::AllocateMemory(std::shared_ptr<const SPIRVShaderRes VERIFY(TotalResources <= Uint32{std::numeric_limits<Uint16>::max()}, "Total number of resources exceeds Uint16 max representable value" ); m_NumResources[SHADER_VARIABLE_TYPE_NUM_TYPES] = static_cast<Uint16>(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<void, STDDeleterRawMem<void> >(pRawMem, Allocator); } void ShaderResourceLayoutVk::InitializeStaticResourceLayout(std::shared_ptr<const SPIRVShaderResources> 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) { |
