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

[Merged by Bors] - Fix window size change panic #2858

Closed

Conversation

superdump
Copy link
Contributor

Objective

Using fullscreen or trying to resize a window caused a panic. Fix that.

Solution

  • Don't wholesale overwrite the ExtractedWindows resource when extracting windows
    • This could cause an accumulation of unused windows that are holding onto swap chain frames?
  • Check the if width and/or height changed since the last frame
  • If the size changed, recreate the swap chain
  • Ensure dimensions are >= 1 to avoid panics due to any dimension being 0

@superdump
Copy link
Contributor Author

Long-term this should probably be implemented using the window creation / resizing / etc events but that was a rabbit hole I didn't want to go down for now.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Review labels Sep 22, 2021
@jakobhellermann
Copy link
Contributor

Tested on linux/vulkan, works as expected 👍

@superdump
Copy link
Contributor Author

One thing I didn't test yet but accidentally did earlier was moving a window between screens that are using different scale factors. I think it should work but I need to test.

@superdump
Copy link
Contributor Author

One thing I didn't test yet but accidentally did earlier was moving a window between screens that are using different scale factors. I think it should work but I need to test.

It works too. :)

@cart
Copy link
Member

cart commented Sep 23, 2021

Just tested on Windows and Linux. Looks good to me!

@cart
Copy link
Member

cart commented Sep 23, 2021

bors r+

bors bot pushed a commit that referenced this pull request Sep 23, 2021
# Objective

Using fullscreen or trying to resize a window caused a panic. Fix that.

## Solution

- Don't wholesale overwrite the ExtractedWindows resource when extracting windows
  - This could cause an accumulation of unused windows that are holding onto swap chain frames?
- Check the if width and/or height changed since the last frame
- If the size changed, recreate the swap chain
- Ensure dimensions are >= 1 to avoid panics due to any dimension being 0
@bors
Copy link
Contributor

bors bot commented Sep 23, 2021

@bors bors bot changed the title Fix window size change panic [Merged by Bors] - Fix window size change panic Sep 23, 2021
@bors bors bot closed this Sep 23, 2021
bors bot pushed a commit that referenced this pull request Oct 15, 2021
Copy link

@lafi-99 lafi-99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leavl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants