update pool
This commit is contained in:
parent
5e9b0bb305
commit
df8e818ac5
2
engine/3rdparty/zlib/include/zstd/pool.h
vendored
2
engine/3rdparty/zlib/include/zstd/pool.h
vendored
@ -41,7 +41,7 @@ namespace zstd {
|
||||
};
|
||||
T acquire() {
|
||||
if (m_tail == m_head) {
|
||||
return std::move(newT());
|
||||
return newT();
|
||||
}
|
||||
int tail = m_tail % m_size;
|
||||
m_tail++;
|
||||
|
||||
@ -6,9 +6,9 @@ namespace vulkanapi {
|
||||
:mName(name)
|
||||
,mDevice(device)
|
||||
,mQueue(queue)
|
||||
,mCommandPool(CommandPool(device, queueFlags, queue.QueueFamilyIndex()))
|
||||
,mWork(CommandThreadWorker(name, 64))
|
||||
,mImmediateExeCmd(CommandBuffer(mCommandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY))
|
||||
,mCommandPool(device, queueFlags, queue.QueueFamilyIndex())
|
||||
,mWork(name, 64)
|
||||
,mImmediateExeCmd(mCommandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY)
|
||||
{
|
||||
|
||||
}
|
||||
@ -22,6 +22,7 @@ namespace vulkanapi {
|
||||
mWork.Invoke([=]() {
|
||||
CommandBuffer cmd = mCommandPool.Pop();
|
||||
Buffer(cmd, fn, callback);
|
||||
mCommandPool.Push(cmd);
|
||||
});
|
||||
}
|
||||
|
||||
@ -32,7 +33,6 @@ namespace vulkanapi {
|
||||
cmd.EndRecord();
|
||||
cmd.Submit(mQueue.Ptr());
|
||||
cmd.WaitFofFence(mDevice.Ptr());
|
||||
mCommandPool.Push(cmd);
|
||||
callback();
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ namespace vulkanapi {
|
||||
public:
|
||||
CommandBuffer(CommandPool& commandPool, VkCommandBufferLevel level);
|
||||
~CommandBuffer();
|
||||
CommandBuffer(CommandBuffer* other)noexcept:CommandBuffer(std::forward<CommandBuffer>(*other)) {};
|
||||
CommandBuffer(CommandBuffer&& other)noexcept;
|
||||
VkCommandBuffer& Ptr() {
|
||||
return mPtr;
|
||||
|
||||
@ -23,11 +23,11 @@ namespace vulkanapi {
|
||||
};
|
||||
CommandBuffer Pop()
|
||||
{
|
||||
return std::move(mPool.acquire());
|
||||
return mPool.acquire();
|
||||
}
|
||||
void Push(CommandBuffer& cmd)
|
||||
{
|
||||
mPool.release(std::forward<CommandBuffer>(cmd));
|
||||
mPool.release(&cmd);
|
||||
}
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user