11.6 C
New York
Friday, March 14, 2025

directx12 – Are there frequent errors resulting in STATE_SETTING ERROR #907: EXECUTECOMMANDLISTS_WRONGSWAPCHAINBUFFERREFERENCE?


I received an error

D3D12 ERROR: ID3D12CommandQueue::ExecuteCommandLists: A command record,
which writes to a swapchain again buffer, might solely be executed when
that again buffer is the again buffer that can be introduced through the
subsequent name to Current*. Such a again buffer can be known as the
“present again buffer”. Swap Chain: 0x00000229F3B300E0:’Unnamed Object’

  • Present Again Buffer Buffer: 0x00000229EC40DC50:’Unnamed ID3D12Resource Object’ – Tried Write Buffer:
    0x00000229EC40D0C0:’Unnamed ID3D12Resource Object’ [ STATE_SETTING
    ERROR #907: EXECUTECOMMANDLISTS_WRONGSWAPCHAINBUFFERREFERENCE]

resulting in

D3D12: Eradicating Gadget. D3D12 ERROR: ID3D12Device::RemoveDevice:
Gadget removing has been triggered for the next motive
(DXGI_ERROR_ACCESS_DENIED: The applying tried to make use of a useful resource
it doesn’t entry to. This might be, for instance, rendering to a
texture whereas solely having learn entry.). [ EXECUTION ERROR #232:
DEVICE_REMOVAL_PROCESS_AT_FAULT]

taking place at m_swapChain->Current(1, 0):

    m_AnimTime += 0.1f;
    PopulateCommandList();
    ID3D12CommandList* ppCommandLists[] = { m_commandList.Get() };
    m_commandQueue->ExecuteCommandLists(_countof(ppCommandLists), &ppCommandLists[0]);
    CheckErrors(m_swapChain->Current(1, 0));

I’ve frequent command record:

auto DX12CudaInterop::PopulateCommandList() -> void
{
    // Command record allocators can solely be reset when the related 
    // command lists have completed execution on the GPU; apps ought to use 
    // fences to find out GPU execution progress.
    CheckErrors(m_commandAllocators[m_frameIndex]->Reset());

    // Nevertheless, when ExecuteCommandList() is known as on a specific command 
    // record, that command record can then be reset at any time and have to be earlier than 
    // re-recording.
    CheckErrors(m_commandList->Reset(m_commandAllocators[m_frameIndex].Get(), m_pipelineState.Get()));

    m_commandList->SetGraphicsRootSignature(m_rootSignature.Get());
    
    ID3D12DescriptorHeap* ppHeaps[] = { m_srvHeap.Get() };
    m_commandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);
    m_commandList->SetGraphicsRootDescriptorTable(0, m_srvHeap->GetGPUDescriptorHandleForHeapStart());

    // Set mandatory state.
    m_commandList->RSSetViewports(1, &m_viewport);
    m_commandList->RSSetScissorRects(1, &m_scissorRect);

    // Point out that the again buffer can be used as a render goal.
    m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(),
        D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET));

    CD3DX12_CPU_DESCRIPTOR_HANDLE rtvHandle(m_rtvHeap->GetCPUDescriptorHandleForHeapStart(), m_frameIndex, m_rtvDescriptorSize);
    m_commandList->OMSetRenderTargets(1, &rtvHandle, FALSE, nullptr);

    // Report instructions.
    const float clearColor[] = { 0.0f, 0.2f, 0.4f, 1.0f };
    m_commandList->ClearRenderTargetView(rtvHandle, clearColor, 0, nullptr);
    m_commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
    m_commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView);
    m_commandList->DrawInstanced(4, 1, 0, 0);

    // Point out that the again buffer will now be used to current.
    m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(),
        D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT));

    CheckErrors(m_commandList->Shut());
}

The best way to examine additional this ? Are there frequent errors I ought to verify ?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles