Advertisement

A single command list cannot write to multiple buffers within a particular swapchain. [ STATE_SETTING ERROR #904: COMMAND_LIST_MULTIPLE_SWAPCHAIN_BUFFER_REFERENCES]

Started by September 22, 2018 07:54 PM
1 comment, last by DiligentDev 6 years, 4 months ago

Totally no information about this error on the internet, so I'm sharing the solution:

The same (one) back buffer resource is used in consecutive frames. Most probable cause of this is using only the first descriptor from render target descriptor heap in all frames, so every frame doing this


D3D12_CPU_DESCRIPTOR_HANDLE handle( rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart() );
commandList->OMSetRenderTargets( 1, &handle, false, nullptr );

instead of this


D3D12_CPU_DESCRIPTOR_HANDLE handle( rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart() );
handle.ptr += backBufferId * rtvDescriptorSize;
commandList->OMSetRenderTargets( 1, &handle, false, nullptr );

 

The error in fact means exactly what it says: you cannot use the same command list to record commands that use more than one swap chain buffer. To fix the error, you need to submit the command list and reset it before using it for the next buffer in the swap chain.

As for the render targets, using the same back buffer in every frame is incorrect. You need to query current back buffer index from the swap chain every time after you present.

This topic is closed to new replies.

Advertisement