1

I am getting the error

D3D12 ERROR: ID3D12CommandQueue::ExecuteCommandLists: A command list, which writes to a swapchain back buffer, may only be executed when that back buffer is the back buffer that will be presented during the next call to Present*. Such a back buffer is also referred to as the "current back buffer"

However, I am using the index returned from IDXGISwapChain::GetCurrentBackBufferIndex? So what's going wrong?

Tom Huntington
  • 2,260
  • 10
  • 20

1 Answers1

1

I was calling IDXGISwapChain1::Present before calling ID3D12CommandQueue::ExecuteCommandLists:

auto index = IDXGISwapChain::GetCurrentBackBufferIndex() // gets index
IDXGISwapChain::Present() // increments backbuffer, makes index stale
ID3D12CommandQueue::ExecuteCommandLists() // BOOM, commandList used stale index
Tom Huntington
  • 2,260
  • 10
  • 20