src/lucus-render/DirectX12/LucusD3D12RenderSystem.cpp
void D3D12RenderSystem::MoveToNextFrame() const
{
    // Schedule a Signal command in the queue.
    const UINT64 currentFenceValue = mFenceValues[mCurrentFrame];
    ThrowIfFailed(mDevice.mCommandQueue->Signal(mFence.Get(), currentFenceValue));

    // Update the back buffer index.
    mCurrentFrame = mWindow->mSwapChain->GetCurrentBackBufferIndex();

    // If the next frame is not ready to be rendered yet, wait until it is ready.
    if (mFence->GetCompletedValue() < mFenceValues[mCurrentFrame])
    {
        ThrowIfFailed(mFence->SetEventOnCompletion(mFenceValues[mCurrentFrame], mFenceEvent));
        WaitForSingleObjectEx(mFenceEvent, INFINITE, FALSE);
    }

    // Set the fence value for the next frame.
    mFenceValues[mCurrentFrame] = currentFenceValue + 1;
}
// Prepare to render the next frame.
Prepare to render the next frame.
Prepare to render the next frame .
void D3D12RenderSystem::MoveToNextFrame() const
{
    const UINT64 currentFenceValue = mFenceValues[mCurrentFrame];
    ThrowIfFailed(mDevice.mCommandQueue->Signal(mFence.Get(), currentFenceValue));
    mCurrentFrame = mWindow->mSwapChain->GetCurrentBackBufferIndex();
    if (mFence->GetCompletedValue() < mFenceValues[mCurrentFrame])
    {
        ThrowIfFailed(mFence->SetEventOnCompletion(mFenceValues[mCurrentFrame], mFenceEvent));
        WaitForSingleObjectEx(mFenceEvent, INFINITE, FALSE);
    }
    mFenceValues[mCurrentFrame] = currentFenceValue + 1;
}
void D3D12RenderSystem :: MoveToNextFrame ( ) const { const UINT64 currentFenceValue = mFenceValues [ mCurrentFrame ] ; ThrowIfFailed ( mDevice . mCommandQueue -> Signal ( mFence . Get ( ) , currentFenceValue ) ) ; mCurrentFrame = mWindow -> mSwapChain -> GetCurrentBackBufferIndex ( ) ; if ( mFence -> GetCompletedValue ( ) < mFenceValues [ mCurrentFrame ] ) { ThrowIfFailed ( mFence -> SetEventOnCompletion ( mFenceValues [ mCurrentFrame ] , mFenceEvent ) ) ; WaitForSingleObjectEx ( mFenceEvent , INFINITE , FALSE ) ; } mFenceValues [ mCurrentFrame ] = currentFenceValue + 1 ; }
Prepare to render the next frame.
Prepare to render the next frame .
// Schedule a Signal command in the queue. // Update the back buffer index. // If the next frame is not ready to be rendered yet, wait until it is ready. // Set the fence value for the next frame.