captureSize used m_width for the row count, but the swap-chain readback
copies m_height rows (capture() reports _size = height * pitch, and
ReadbackVK::pitch() is width * bpp/8). A backbuffer taller than wide
under-allocates the readback buffer and overruns it. Use m_height, which
matches the GL backend's width*height*4.
Acquiring waited forever for an image on every swap chain from the one
submit thread, so a single swap chain that is no longer served (e.g. a
fully occluded window on a Wayland compositor without fifo-v1, which
stops releasing buffers) stalled rendering of all windows. Window swap
chains now acquire without blocking and are skipped for the frame when
no image is available; only the main back buffer may block, as that is
the frame pacing. Image availability acts as natural back pressure, no
compositor specific behavior is needed.
When acquiring a window frame buffer swap chain returns
VK_SUBOPTIMAL_KHR or VK_ERROR_OUT_OF_DATE_KHR it is flagged with
m_needToRecreateSwapchain and acquire then refuses forever: only the
main back buffer is recreated (by updateResolution), so the window
permanently stops updating (easily triggered by moving the window to a
display with a different scale). Recreate flagged window swap chains
when acquiring them.
Toggling BGFX_RESET_VSYNC via bgfx::reset() only updated the main/init swap
chain. Secondary swap chains created through createFrameBuffer(nwh, ...) kept
their initial vsync state, leaving framerate capped at refresh rate. D3D12
already handled this correctly.
D3D11: forward present flags to FrameBufferD3D11::present so it can pass
DXGI_PRESENT_ALLOW_TEARING alongside syncInterval=0. Compute presentFlags once
in flip() and reuse for both secondary framebuffers and the main swap chain.
Vulkan: in updateResolution, iterate m_windows and call FrameBufferVK::update
on each valid secondary framebuffer so SwapChainVK::update sees the new
BGFX_RESET_VSYNC and recreates the swapchain with the correct present mode.
OpenGL (WGL/EGL): wglSwapIntervalEXT is per-context, eglSwapInterval is
per-surface. Cache the desired interval in GlContext::m_swapInterval and
re-apply it in makeCurrent() whenever a different context/surface becomes
current, so secondary SwapChainGL instances pick up the current value. Also
honor the initial BGFX_RESET_VSYNC flag in create() instead of hard-coding 0.