Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cetra3
Copy link

@cetra3 cetra3 commented Jul 11, 2025

I've ran into an issue using Zed in a Tiling WM that it gets stuck in a loop and never resolves itself. This is because there is something invalidating the surface, but not sure what it is exactly. The fix is to, when this happens, reinitialise the surface.

This PR makes the acquire_frame return a Result so the callee can handle this case correctly: VK_ERROR_OUT_OF_DATE_KHR: The swap chain has become incompatible with the surface and can no longer be used for rendering. Usually happens after a window resize, but there seems to be other reasons for it.

@kvark
Copy link
Owner

kvark commented Jul 27, 2025

Thank you for the PR!
The current implementation intentionally handles the out of date internally. The assumption is that the user has another mechanism of getting the signal of surface being resized (like an event from the window system), and that will make the user to recreate the surface. So "out of date" is essentially ignored, with a warning in the log.
We need to understand why this approach doesn't work for your Tiling WM.

@cetra3
Copy link
Author

cetra3 commented Jul 28, 2025

@kvark how do I check why a surface is out of date without this change & is there any logging/debug I can look at to check why it is going out of date. Essentially if it's not a resize event but another event, the app gets stuck and has no way of fixing it

@cetra3
Copy link
Author

cetra3 commented Jul 30, 2025

How about a new method that returns a Result and this method calls that method internally?

That way the signature is kept the same but we can still get the error out if we want to

@cetra3 cetra3 force-pushed the error_on_out_of_date branch from 0a9c319 to 372d92c Compare July 30, 2025 01:40
@cetra3
Copy link
Author

cetra3 commented Jul 30, 2025

I've adjusted the PR to include a try_acquire_frame method, but keeping the semantics/signature of acquire_frame intact

@cetra3 cetra3 force-pushed the error_on_out_of_date branch from 372d92c to 3d4e6ba Compare July 30, 2025 01:44
@kvark
Copy link
Owner

kvark commented Aug 21, 2025

how do I check why a surface is out of date without this change

With current code, the only error that is not fatal is OUT_OF_DATE, in which case we'd return a "dummy" frame. Admittedly, the user can't know if it's dummy. We could expose a simple method, e.g. is_valid(), for the user to know.

The approach you are suggesting - via try_acquire_frame is fine. The only problem is that it's not platform-agnostic.
We'd either need to define an error type that is platform-agnostic and implement this for other backends, or we add "vulkan" somewhere in the function name to make it clear that this is backend-specific.

@cetra3 cetra3 force-pushed the error_on_out_of_date branch from 3d4e6ba to b2abd40 Compare August 23, 2025 03:22
@cetra3
Copy link
Author

cetra3 commented Aug 23, 2025

I've adjusted the method to be called vulkan_try_acquire_frame

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