libplacebo/display: defer submission until PictureDisplay
Calling pl_swapchain_submit_frame() in PictureRender() is the wrong place, and may cause frames to become visible sooner than intended.
The correct thing to do is to defer submission until the actual PictureDisplay() call, and merely flush the GPU work in PictureRender().
To handle the edge case of pl_swapchain_start_frame
failing (e.g. when
the window gets lost), we keep track of whether or not there's an active
FBO being rendered, and no-op in the case that there isn't. It might
seem like overkill to store a pl_tex
here when a bool will suffice,
but this is future-proofing for an upcoming redesign of the libplacebo
swapchain API.