dx12, vulkan: using block allocator for command lists

This commit is contained in:
Turánszki János
2026-01-15 08:02:32 +01:00
parent 1e86d499ae
commit 43b9308550
4 changed files with 11 additions and 9 deletions
+4 -4
View File
@@ -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<CommandList_DX12>());
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);
+2 -1
View File
@@ -264,7 +264,8 @@ namespace wi::graphics
return (ID3D12VideoDecodeCommandList*)commandLists[queue].Get();
}
};
wi::vector<std::unique_ptr<CommandList_DX12>> commandlists;
wi::allocator::BlockAllocator<CommandList_DX12, 64> cmd_allocator;
wi::vector<CommandList_DX12*> commandlists;
uint32_t cmd_count = 0;
wi::SpinLock cmd_locker;
+3 -3
View File
@@ -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<CommandList_Vulkan>());
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];
+2 -1
View File
@@ -386,7 +386,8 @@ namespace wi::graphics
return commandBuffers[buffer_index][queue];
}
};
wi::vector<std::unique_ptr<CommandList_Vulkan>> commandlists;
wi::allocator::BlockAllocator<CommandList_Vulkan, 64> cmd_allocator;
wi::vector<CommandList_Vulkan*> commandlists;
uint32_t cmd_count = 0;
wi::SpinLock cmd_locker;