Swap buffers in waitToRender() instead of renderFrame()

This commit is contained in:
Cameron Gutman 2023-12-26 15:45:31 -06:00
parent 9ed8252cc6
commit bb8e229814

View file

@ -593,6 +593,12 @@ bool PlVkRenderer::isSurfacePresentationSupportedByPhysicalDevice(VkPhysicalDevi
void PlVkRenderer::waitToRender()
{
// With libplacebo's Vulkan backend, all swap_buffers does is wait for queued
// presents to finish. This happens to be exactly what we want to do here, since
// it lets us wait to select a queued frame for rendering until we know that we
// can present without blocking in renderFrame().
pl_swapchain_swap_buffers(m_Swapchain);
// Handle the swapchain being resized
int vkDrawableW, vkDrawableH;
SDL_Vulkan_GetDrawableSize(m_Window, &vkDrawableW, &vkDrawableH);
@ -755,7 +761,6 @@ void PlVkRenderer::renderFrame(AVFrame *frame)
SDL_PushEvent(&event);
goto UnmapExit;
}
pl_swapchain_swap_buffers(m_Swapchain);
UnmapExit:
// Delete any textures that need to be destroyed