summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-10-02 06:17:55 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-10-02 06:17:55 +0000
commit9286fdcd21cfa7cdbc70a42d6bd1ea2d7b907e5e (patch)
tree38179e316803efc4731aa2513c39ac5a5a0d0384 /Graphics/GraphicsEngineVulkan
parentRemoved ForceRelease parameter of IDeviceContext::FinishFrame() (diff)
downloadDiligentCore-9286fdcd21cfa7cdbc70a42d6bd1ea2d7b907e5e.tar.gz
DiligentCore-9286fdcd21cfa7cdbc70a42d6bd1ea2d7b907e5e.zip
Reworked D3D12DynamicHeap to use release queues
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h17
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp26
2 files changed, 15 insertions, 28 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
index cd598c40..71f7a28c 100644
--- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
@@ -29,6 +29,7 @@
#include "DeviceContextVk.h"
#include "DeviceContextBase.h"
+#include "DeviceContextNextGenBase.h"
#include "VulkanUtilities/VulkanCommandBufferPool.h"
#include "VulkanUtilities/VulkanCommandBuffer.h"
#include "VulkanUploadHeap.h"
@@ -46,10 +47,10 @@ namespace Diligent
{
/// Implementation of the Diligent::IDeviceContext interface
-class DeviceContextVkImpl final : public DeviceContextBase<IDeviceContextVk, BufferVkImpl, TextureViewVkImpl, PipelineStateVkImpl>
+class DeviceContextVkImpl final : public DeviceContextNextGenBase< DeviceContextBase<IDeviceContextVk, BufferVkImpl, TextureViewVkImpl, PipelineStateVkImpl> >
{
public:
- using TDeviceContextBase = DeviceContextBase<IDeviceContextVk, BufferVkImpl, TextureViewVkImpl, PipelineStateVkImpl>;
+ using TDeviceContextBase = DeviceContextNextGenBase< DeviceContextBase<IDeviceContextVk, BufferVkImpl, TextureViewVkImpl, PipelineStateVkImpl> >;
DeviceContextVkImpl(IReferenceCounters* pRefCounters,
class RenderDeviceVkImpl* pDevice,
@@ -233,16 +234,6 @@ private:
FixedBlockMemoryAllocator m_CmdListAllocator;
- const Uint32 m_ContextId;
- const Uint32 m_CommandQueueId;
-
- // This mask indicates which command queues command buffers from this context were submitted to.
- // For immediate context, this will always be 1 << m_CommandQueueId.
- // For deferred contexts, this will accumulate bits of the queues to which command buffers
- // were submitted to before FinishFrame() was called. This mask is used to release resources
- // allocated by the context during the frame when FinishFrame() is called.
- Uint64 m_SubmittedBuffersCmdQueueMask = 0;
-
// Semaphores are not owned by the command context
std::vector<VkSemaphore> m_WaitSemaphores;
std::vector<VkPipelineStageFlags> m_WaitDstStageMasks;
@@ -286,8 +277,6 @@ private:
VulkanDynamicHeap m_DynamicHeap;
DynamicDescriptorSetAllocator m_DynamicDescrSetAllocator;
- Atomics::AtomicInt64 m_ContextFrameNumber;
-
PipelineLayout::DescriptorSetBindInfo m_DescrSetBindInfo;
std::shared_ptr<GenerateMipsVkHelper> m_GenerateMipsHelper;
RefCntAutoPtr<IShaderResourceBinding> m_GenerateMipsSRB;
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 202babab..d7e572ac 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -52,12 +52,16 @@ namespace Diligent
Uint32 ContextId,
Uint32 CommandQueueId,
std::shared_ptr<GenerateMipsVkHelper> GenerateMipsHelper) :
- TDeviceContextBase {pRefCounters, pDeviceVkImpl, bIsDeferred},
- m_NumCommandsToFlush {bIsDeferred ? std::numeric_limits<decltype(m_NumCommandsToFlush)>::max() : Attribs.NumCommandsToFlushCmdBuffer},
- m_CmdListAllocator { GetRawAllocator(), sizeof(CommandListVkImpl), 64 },
- m_ContextId {ContextId},
- m_CommandQueueId {CommandQueueId},
- m_SubmittedBuffersCmdQueueMask{bIsDeferred ? 0 : Uint64{1} << CommandQueueId},
+ TDeviceContextBase
+ {
+ pRefCounters,
+ pDeviceVkImpl,
+ ContextId,
+ CommandQueueId,
+ bIsDeferred ? std::numeric_limits<decltype(m_NumCommandsToFlush)>::max() : Attribs.NumCommandsToFlushCmdBuffer,
+ bIsDeferred
+ },
+ m_CmdListAllocator { GetRawAllocator(), sizeof(CommandListVkImpl), 64 },
// Command pools must be thread safe because command buffers are returned into pools by release queues
// potentially running in another thread
m_CmdPool
@@ -84,7 +88,6 @@ namespace Diligent
pDeviceVkImpl->GetDynamicDescriptorPool(),
GetContextObjectName("Dynamic descriptor set allocator", bIsDeferred, ContextId),
},
- m_ContextFrameNumber(0),
m_GenerateMipsHelper(std::move(GenerateMipsHelper))
{
m_GenerateMipsHelper->CreateSRB(&m_GenerateMipsSRB);
@@ -774,18 +777,13 @@ namespace Diligent
// be destroyed before the pools are actually returned to the global pool manager.
m_DynamicDescrSetAllocator.ReleasePools(m_SubmittedBuffersCmdQueueMask);
- if (m_bIsDeferred)
- {
- // For deferred context, reset submitted cmd queue mask
- m_SubmittedBuffersCmdQueueMask = 0;
- }
- else
+ if (!m_bIsDeferred)
{
// Make all stale resource move into the release queue
DeviceVkImpl.FlushStaleResources(m_CommandQueueId);
}
- Atomics::AtomicIncrement(m_ContextFrameNumber);
+ EndFrame();
}
void DeviceContextVkImpl::Flush()