Skip to content

08 Presentation

Inan Evin edited this page Nov 19, 2023 · 1 revision

After you have submitted viable work on the GPU, you can present any number of swapchains. Please note that you need to make sure if you are presenting a swapchain, you must have submitted work on the queue that you have used when creating the swapchain.

// This does the actual *recording* of every single command stream alive.
m_lgx->CloseCommandStreams(&currentFrame.graphicsStream, 1);

// Submit work on gpu.
m_lgx->SubmitCommandStreams({.targetQueue = m_lgx->GetPrimaryQueue(CommandType::Graphics), .streams = &currentFrame.graphicsStream, .streamCount = 1, .useWait = true, .waitCount = 1, .waitSemaphores = &currentFrame.transferSemaphore, .waitValues = &currentFrame.transferSemaphoreValue});

// Present main swapchain.
m_lgx->Present({.swapchains = &m_swapchain, .swapchainCount = 1});

// Let LinaGX know we are finalizing this frame.
m_lgx->EndFrame();

Make sure you present before ending the frame, and you are good to go.

Check out Examples for more complex cases demonstrating the full power of LinaGX.

Clone this wiki locally