From 43b930855040cb05f7a19908ed2fa7a35b9b9380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Thu, 15 Jan 2026 08:02:32 +0100 Subject: [PATCH] dx12, vulkan: using block allocator for command lists --- WickedEngine/wiGraphicsDevice_DX12.cpp | 8 ++++---- WickedEngine/wiGraphicsDevice_DX12.h | 3 ++- WickedEngine/wiGraphicsDevice_Vulkan.cpp | 6 +++--- WickedEngine/wiGraphicsDevice_Vulkan.h | 3 ++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/WickedEngine/wiGraphicsDevice_DX12.cpp b/WickedEngine/wiGraphicsDevice_DX12.cpp index e94bd0e44..ebfb9cf73 100644 --- a/WickedEngine/wiGraphicsDevice_DX12.cpp +++ b/WickedEngine/wiGraphicsDevice_DX12.cpp @@ -5199,10 +5199,10 @@ std::mutex queue_locker; uint32_t cmd_current = cmd_count++; if (cmd_current >= commandlists.size()) { - commandlists.push_back(std::make_unique()); + commandlists.push_back(cmd_allocator.allocate()); } CommandList cmd; - cmd.internal_state = commandlists[cmd_current].get(); + cmd.internal_state = commandlists[cmd_current]; cmd_locker.unlock(); CommandList_DX12& commandlist = GetCommandList(cmd); @@ -5307,7 +5307,7 @@ std::mutex queue_locker; cmd_count = 0; for (uint32_t cmd = 0; cmd < cmd_last; ++cmd) { - CommandList_DX12& commandlist = *commandlists[cmd].get(); + CommandList_DX12& commandlist = *commandlists[cmd]; if (commandlist.queue == QUEUE_VIDEO_DECODE) { dx12_check(commandlist.GetVideoDecodeCommandList()->Close()); @@ -5385,7 +5385,7 @@ std::mutex queue_locker; for (uint32_t cmd = 0; cmd < cmd_last; ++cmd) { - CommandList_DX12& commandlist = *commandlists[cmd].get(); + CommandList_DX12& commandlist = *commandlists[cmd]; for (auto& swapchain : commandlist.swapchains) { auto swapchain_internal = to_internal(swapchain); diff --git a/WickedEngine/wiGraphicsDevice_DX12.h b/WickedEngine/wiGraphicsDevice_DX12.h index 4433ada34..40c99b880 100644 --- a/WickedEngine/wiGraphicsDevice_DX12.h +++ b/WickedEngine/wiGraphicsDevice_DX12.h @@ -264,7 +264,8 @@ namespace wi::graphics return (ID3D12VideoDecodeCommandList*)commandLists[queue].Get(); } }; - wi::vector> commandlists; + wi::allocator::BlockAllocator cmd_allocator; + wi::vector commandlists; uint32_t cmd_count = 0; wi::SpinLock cmd_locker; diff --git a/WickedEngine/wiGraphicsDevice_Vulkan.cpp b/WickedEngine/wiGraphicsDevice_Vulkan.cpp index 33df289cb..4072be90a 100644 --- a/WickedEngine/wiGraphicsDevice_Vulkan.cpp +++ b/WickedEngine/wiGraphicsDevice_Vulkan.cpp @@ -7129,10 +7129,10 @@ using namespace vulkan_internal; uint32_t cmd_current = cmd_count++; if (cmd_current >= commandlists.size()) { - commandlists.push_back(std::make_unique()); + commandlists.push_back(cmd_allocator.allocate()); } CommandList cmd; - cmd.internal_state = commandlists[cmd_current].get(); + cmd.internal_state = commandlists[cmd_current]; cmd_locker.unlock(); CommandList_Vulkan& commandlist = GetCommandList(cmd); @@ -7309,7 +7309,7 @@ using namespace vulkan_internal; cmd_count = 0; for (uint32_t cmd = 0; cmd < cmd_last; ++cmd) { - CommandList_Vulkan& commandlist = *commandlists[cmd].get(); + CommandList_Vulkan& commandlist = *commandlists[cmd]; vulkan_check(vkEndCommandBuffer(commandlist.GetCommandBuffer())); CommandQueue& queue = queues[commandlist.queue]; diff --git a/WickedEngine/wiGraphicsDevice_Vulkan.h b/WickedEngine/wiGraphicsDevice_Vulkan.h index 9b1477d29..ca3732556 100644 --- a/WickedEngine/wiGraphicsDevice_Vulkan.h +++ b/WickedEngine/wiGraphicsDevice_Vulkan.h @@ -386,7 +386,8 @@ namespace wi::graphics return commandBuffers[buffer_index][queue]; } }; - wi::vector> commandlists; + wi::allocator::BlockAllocator cmd_allocator; + wi::vector commandlists; uint32_t cmd_count = 0; wi::SpinLock cmd_locker;