From 3e6c6e6fe592addded40c06db0cc78430422a8c2 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 17 Jul 2021 13:22:42 +0200 Subject: [PATCH] Fixed incorrect command allocator reset during execution --- src/ComputeSharp/Graphics/GraphicsDevice.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.cs b/src/ComputeSharp/Graphics/GraphicsDevice.cs index bc7d8cb2..30932b32 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.cs @@ -326,17 +326,14 @@ namespace ComputeSharp d3D12CommandQueue->Signal(d3D12Fence, d3D12FenceValue).Assert(); - // Enqueue the command allocator pool so that it can be reused later. We can do this - // before checking and awaiting the fence as the command list and allocaton can already - // be reused right after the call to ExecuteCommandLists, and this way we can potentially - // do this work in parallel while the GPU dispatching is still being executed. - commandListPool.Return(commandList.DetachD3D12CommandList(), commandList.DetachD3D12CommandAllocator()); - // If the fence value hasn't been reached, wait until the operation completes if (d3D12FenceValue > d3D12Fence->GetCompletedValue()) { d3D12Fence->SetEventOnCompletion(d3D12FenceValue, default).Assert(); } + + // Return the rented command list and command allocator so that they can be reused + commandListPool.Return(commandList.DetachD3D12CommandList(), commandList.DetachD3D12CommandAllocator()); } ///