Does it make sense to create an allocator per renderTarget in the swapchain?
<p><a href="https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/Samples/Desktop/D3D12HelloWorld" rel="nofollow">The HelloWorld examples from Microsoft</a> mostly use a single CommandAllocator and then wait until the previous frame is fully done. However they also say (in all caps) that it's not how it should be done.</p>

<p>So my idea is to create an Allocator per frame in the swapchain and keep which fence value to wait on in a circular buffer:</p>

<pre><code>struct frame_resources{
    ID3D12Resource* renderTarget;
    ID3D12CommandAllocator* allocator;
    uint64 fenceValue;
} resources[FRAME_COUNT];


uint frameIndex = swapChain-&gt;GetCurrentBackBufferIndex();
UINT64 lastFence;
MSG msg;
ZeroMemory(&amp;msg, sizeof(msg));
while (msg.message != WM_QUIT)
{
    if (PeekMessage(&amp;msg, NULL, 0U, 0U, PM_REMOVE))
    {
        TranslateMessage(&amp;msg);
        DispatchMessage(&amp;msg);
        continue;
    }

    if (fence-&gt;GetCompletedValue() &lt; resources[frameIndex].fenceValue)
    {
        fence-&gt;SetEventOnCompletion(resources[frameIndex].fenceValue, fenceEvent);

        DWORD result = MsgWaitForMultipleObjects(1, &amp;fenceEvent, FALSE, INFINITE, QS_ALLEVENTS);
        if(result == WAIT_OBJECT_0 + 1)
            continue; //message in the queue
    }

    resources[frameIndex].allocator-&gt;Reset();

    commandList-&gt;Reset(resources[frameIndex].allocator, 0);

    //...

    commandList-&gt;Close();
    commandQueue-&gt;ExecuteCommandLists(1, &amp;CommandList);

    lastFence++;
    resources[frameIndex].fenceValue = lastFence;
    commandQueue-&gt;Signal(fence, lastFence);

    swapChain-&gt;Present(0, DXGI_PRESENT_RESTART);
    frameIndex = swapChain-&gt;GetCurrentBackBufferIndex();
}
</code></pre>

<p>Is this a sane approach? Or is there a better way?</p>