diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-09-24 04:12:45 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-09-24 04:12:45 +0000 |
| commit | 6db171fd90382721ab64dfddc32f76fffa7a8829 (patch) | |
| tree | 07e3f247f9f47f75075d4669a8bed3590c8061a4 /Graphics/GraphicsEngineVulkan | |
| parent | Reworked dynamic descriptor set allocation/deallocation in Vk backend (diff) | |
| download | DiligentCore-6db171fd90382721ab64dfddc32f76fffa7a8829.tar.gz DiligentCore-6db171fd90382721ab64dfddc32f76fffa7a8829.zip | |
Removed m_NextCmdBuffNumber from DeviceContextVkImpl plus other minor updates
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
4 files changed, 7 insertions, 23 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h index 992a1d8e..51ca42fc 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h @@ -42,12 +42,10 @@ public: CommandListVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pDevice, IDeviceContext* pDeferredCtx, - VkCommandBuffer vkCmdBuff, - Uint64 CommandListNumber) : + VkCommandBuffer vkCmdBuff) : TCommandListBase (pRefCounters, pDevice), m_pDeferredCtx (pDeferredCtx), - m_vkCmdBuff (vkCmdBuff), - m_CommandBufferNumber(CommandListNumber) + m_vkCmdBuff (vkCmdBuff) { } @@ -57,20 +55,16 @@ public: } void Close(VkCommandBuffer& CmdBuff, - RefCntAutoPtr<IDeviceContext>& pDeferredCtx, - Uint64& CommandBufferNumber) + RefCntAutoPtr<IDeviceContext>& pDeferredCtx) { CmdBuff = m_vkCmdBuff; m_vkCmdBuff = VK_NULL_HANDLE; pDeferredCtx = std::move(m_pDeferredCtx); - CommandBufferNumber = m_CommandBufferNumber; - m_CommandBufferNumber = 0; } private: RefCntAutoPtr<IDeviceContext> m_pDeferredCtx; VkCommandBuffer m_vkCmdBuff; - Uint64 m_CommandBufferNumber; // Command buffer number in the deferred context that recorded this command list }; } diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h index ae443b34..da7ebe7e 100644 --- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h @@ -294,9 +294,6 @@ private: VulkanUploadHeap m_UploadHeap; DynamicDescriptorSetAllocator m_DynamicDescrSetAllocator; - // Number of the command buffer currently being recorded by the context and that will - // be submitted next - Atomics::AtomicInt64 m_NextCmdBuffNumber; Atomics::AtomicInt64 m_ContextFrameNumber; Uint64 m_LastSubmittedFenceValue = 0; diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index c067f768..9c602b8c 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -73,7 +73,6 @@ namespace Diligent GetContextObjectName("Upload heap", bIsDeferred, ContextId), Attribs.UploadHeapPageSize }, - m_NextCmdBuffNumber(0), m_ContextFrameNumber(0), m_DynamicHeap { @@ -815,8 +814,6 @@ namespace Diligent } // Release temporary resources that were used by this context while recording the last command buffer - auto SubmittedCmdBuffNumber = m_NextCmdBuffNumber; - Atomics::AtomicIncrement(m_NextCmdBuffNumber); // TODO: rework auto CompletedFenceValue = pDeviceVkImpl->GetCompletedFenceValue(0); ReleaseStaleContextResources(m_LastSubmittedFenceValue, CompletedFenceValue); @@ -1371,14 +1368,11 @@ namespace Diligent auto* pDeviceVkImpl = m_pDevice.RawPtr<RenderDeviceVkImpl>(); CommandListVkImpl *pCmdListVk( NEW_RC_OBJ(m_CmdListAllocator, "CommandListVkImpl instance", CommandListVkImpl) - (pDeviceVkImpl, this, vkCmdBuff, m_NextCmdBuffNumber) ); + (pDeviceVkImpl, this, vkCmdBuff) ); pCmdListVk->QueryInterface( IID_CommandList, reinterpret_cast<IObject**>(ppCommandList) ); m_CommandBuffer.SetVkCmdBuffer(VK_NULL_HANDLE); - // Increment command buffer number, but do not release any resources until the command list is executed - Atomics::AtomicIncrement(m_NextCmdBuffNumber); - m_CommandBuffer.Reset(); m_State = ContextState{}; m_DescrSetBindInfo.Reset(); @@ -1422,8 +1416,7 @@ namespace Diligent CommandListVkImpl* pCmdListVk = ValidatedCast<CommandListVkImpl>(pCommandList); VkCommandBuffer vkCmdBuff = VK_NULL_HANDLE; RefCntAutoPtr<IDeviceContext> pDeferredCtx; - Uint64 DeferredCtxCmdBuffNumber = 0; - pCmdListVk->Close(vkCmdBuff, pDeferredCtx, DeferredCtxCmdBuffNumber); + pCmdListVk->Close(vkCmdBuff, pDeferredCtx); VERIFY(vkCmdBuff != VK_NULL_HANDLE, "Trying to execute empty command buffer"); VERIFY_EXPR(pDeferredCtx); VkSubmitInfo SubmitInfo = {}; diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index 67729dfc..7a10b8d7 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -311,12 +311,12 @@ void RenderDeviceVkImpl::FinishFrame(bool ReleaseAllResources) FlushStaleResources(0); // TODO: rework this - auto CompletedFenceValue = ReleaseAllResources ? std::numeric_limits<Uint64>::max() : m_CommandQueues[0].CmdQueue->GetCompletedFenceValue(); + //auto CompletedFenceValue = ReleaseAllResources ? std::numeric_limits<Uint64>::max() : m_CommandQueues[0].CmdQueue->GetCompletedFenceValue(); //m_MainDescriptorPool.ReleaseStaleAllocations(CompletedFenceValue); m_MemoryMgr.ShrinkMemory(); - PurgeReleaseQueues(); + PurgeReleaseQueues(ReleaseAllResources); } |
