Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactive Fractal example completely freezes when going full-screen on MacOS #2208

Closed
voidburn opened this issue May 15, 2023 · 8 comments · Fixed by #2221
Closed

Interactive Fractal example completely freezes when going full-screen on MacOS #2208

voidburn opened this issue May 15, 2023 · 8 comments · Fixed by #2221

Comments

@voidburn
Copy link

Issue

Going full-screen on while running the "Interactive Fractal" example freezes the screen in which the application is open (apparently indefinitely). Similar behavior is shown with the "Multi Window Game of Life" (with either window), but that one recovers after a while rendering at a lower resolution than the native one for the monitor.

No error is reported in the terminal where I launched the example, either in debug or release mode. The only solution is to kill the application (luckily I have a second monitor that remains working).

This is what it looks like once the application is frozen (the black parts are the rest of the monitor area, screenshot taken with the system utility):
image

@rauba-code
Copy link
Contributor

rauba-code commented Jun 2, 2023

I'm a game dev who is using Vulkano, and was experiencing the same issue. It happens because Vulkano examples don't follow the Winit recommendations of rendering (it re-renders every time after every single event and starves resources).

I tested this way of rendering in all Linux X, Wayland and MacOS:

*control_flow = ControlFlow::Poll; // Setting this to 'Wait' skips frames on X.
// ...
WindowEvent::MainEventsCleared => window.request_redraw(),
WindowEvent::RedrawRequested => {
// Rendering begins here
},
// ...

EDIT: One may want to add more request_redraw() after the input events, especially if you insist on using ControlFlow::Wait.

@marc0246
Copy link
Contributor

marc0246 commented Jun 2, 2023

Did #2218 solve your issue as well mayhaps? Seems similar enough.

@rauba-code
Copy link
Contributor

@marc0246 Checked out master, on debug this issue persists. Checking on release...

@rauba-code
Copy link
Contributor

On release, it still exists.

@marc0246
Copy link
Contributor

marc0246 commented Jun 3, 2023

@rauba-code I see, thanks. These issues exist only in the interactive fractal and game of life examples for you as well correct?

@rauba-code
Copy link
Contributor

rauba-code commented Jun 3, 2023

Yes, these two permanently freeze.

The others freeze only for a second or so when going fullscreen. Freezing and occasional flashing for a second also appears when hovering over the top of a menu bar. They do not lag at all when resizing a window.

rauba-code added a commit to rauba-code/vulkano that referenced this issue Jun 3, 2023
This commit solves the problem of freezing when going fullscreen for MacOS.
It was caused because winit may behave unexpectedly when using
run_return. Winit crate generally discourages the use of that
(see: <https://docs.rs/winit/latest/winit/platform/run_return/trait.EventLoopExtRunReturn.html#tymethod.run_return>).

NOTE. This commit only solves the problem for `interactive_fractal`
binary, but not the `multi_window_game_of_life` binary.
@rauba-code
Copy link
Contributor

I fixed the issue for interactive_fractal. Check this commit.

When I finish with multi_window_game_of_life, I'd like to make a PR.

rauba-code added a commit to rauba-code/vulkano that referenced this issue Jun 3, 2023
This commit solves the problem of freezing when going fullscreen for MacOS.
It was caused because winit may behave unexpectedly when using
run_return. Winit crate generally discourages the use of that
(see: <https://docs.rs/winit/latest/winit/platform/run_return/trait.EventLoopExtRunReturn.html#tymethod.run_return>).

NOTE. This commit only solves the problem for `interactive_fractal`
binary, but not the `multi_window_game_of_life` binary.
marc0246 added a commit that referenced this issue Jun 4, 2023
…2221)

* Updated  #2208

This commit solves the problem of freezing when going fullscreen for MacOS.
It was caused because winit may behave unexpectedly when using
run_return. Winit crate generally discourages the use of that
(see: <https://docs.rs/winit/latest/winit/platform/run_return/trait.EventLoopExtRunReturn.html#tymethod.run_return>).

NOTE. This commit only solves the problem for `interactive_fractal`
binary, but not the `multi_window_game_of_life` binary.

* Some display servers (like X.org) are not redrawing for every frame.

* Fixed the same bug for  example binary.

* Remove ControlFlow::Poll (it is the default anyway) in interactive_fractal

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>

* Remove ControlFlow::Poll (it is the default anyway) in multi_window_game_of_life

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>

---------

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
@voidburn
Copy link
Author

voidburn commented Jun 6, 2023

Thanks for looking into this guys, sorry I was on vacation this past week. I've tested it as well and now everything works as expected!

Thank you! <3

hakolao pushed a commit to hakolao/vulkano that referenced this issue Feb 20, 2024
…rs#2208 (vulkano-rs#2221)

* Updated  vulkano-rs#2208

This commit solves the problem of freezing when going fullscreen for MacOS.
It was caused because winit may behave unexpectedly when using
run_return. Winit crate generally discourages the use of that
(see: <https://docs.rs/winit/latest/winit/platform/run_return/trait.EventLoopExtRunReturn.html#tymethod.run_return>).

NOTE. This commit only solves the problem for `interactive_fractal`
binary, but not the `multi_window_game_of_life` binary.

* Some display servers (like X.org) are not redrawing for every frame.

* Fixed the same bug for  example binary.

* Remove ControlFlow::Poll (it is the default anyway) in interactive_fractal

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>

* Remove ControlFlow::Poll (it is the default anyway) in multi_window_game_of_life

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>

---------

Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
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 a pull request may close this issue.

3 participants