Skip to content

Swapchain::tryAcquire: wait for the next image with a timeout - #145

Open
Reveares wants to merge 1 commit into
Try:masterfrom
Reveares:fix/hidden-window
Open

Reveares wants to merge 1 commit into
Try:masterfrom
Reveares:fix/hidden-window

Conversation

@Reveares

@Reveares Reveares commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Try/OpenGothic#1065

On X11 vkAcquireNextImageKHR without a timeout holds the loop until the compositor hands out an image, about once a second under mutter for a minimized or covered window. Timers fire at that rate too.
In OpenGothic a minimized or covered game on X11 keeps running at one frame per second.

Swapchain::tryAcquire(timeoutMs) waits for the next image at most that long and returns false if none is free yet. acquire() then hands out the image it got. Only Vulkan bounds the wait, the other backends return true. presentFence is reset only after an acquire that got an image, so a try that ran out leaves both fences for the next one, and a swapchain reset now resets the sync state, which also covers a reset between acquire() and present.

Run on Windows and Linux under GNOME (Xwayland) with OpenGothic.

@Reveares Reveares changed the title Add Swapchain::tryAcquire, do not render a hidden X11 window Swapchain::tryAcquire: wait for the next image with a timeout Nov 29, 2026
@Try

Try commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Hi, @Reveares and thanks for PR!

Why don't you add timeout directly to AbstractGraphicsApi::Swapchain::currentBackBuffer ?
if timeout condition is meet - just return null.
Top-level RHI can return empty Attachment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants