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

Fix SDL+Vulkan example when minimized #3259

Closed
wants to merge 1 commit into from
Closed

Fix SDL+Vulkan example when minimized #3259

wants to merge 1 commit into from

Conversation

TomR5411
Copy link

Fixes crash when minimized / recover from minimized of SDL_Vulkan example by adding additional events,
SDL_WINDOWEVENT_MINIMIZED and SDL_WINDOWEVENT_RESTORED

Thomas

Fixes crash when minimized / recover from minimized of SDL_Vulkan example by adding additional events,
SDL_WINDOWEVENT_MINIMIZED and SDL_WINDOWEVENT_RESTORED
g_SwapChainResizeHeight = (int)event.window.data2;
g_SwapChainRebuild = true;
case SDL_WINDOWEVENT:
if (event.window.event == SDL_WINDOWEVENT_MINIMIZED)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix indentation to be consistent with other code.

@ocornut ocornut changed the title Update main.cpp Fix SDL+Vulkan example when minimized May 25, 2020
@ocornut
Copy link
Owner

ocornut commented May 25, 2020

Hello,
Thanks for reporting this.

  • I get a bunch of validation layer error when trying to resize to zero.
  • I'm not sure why you commented out the windowID compare, this is most likely required to work with multi-viewports.

Will look for another solution to this issue and try to patch the GLFW+Vulkan example which has the same issue.

(PS: As pointed out above it's generally good when making a pull-request to try to conform to the local coding style. Thanks!)

@TomR5411
Copy link
Author

TomR5411 commented May 25, 2020 via email

ocornut added a commit that referenced this pull request May 25, 2020
# Conflicts:
#	examples/example_glfw_vulkan/main.cpp
#	examples/example_sdl_vulkan/main.cpp
#	examples/imgui_impl_sdl.cpp
#	imgui.cpp
@ocornut
Copy link
Owner

ocornut commented May 25, 2020

Thomas,

  • with Vulkan debug layer your PR gets me a bunch of error/warnings as we cannot create a zero-sized swap chains.
  • the code is unnecessary repetitive and misleading, as SDL sends zero values in data1/data2 for minimize/restore events.
  • I changed SDL backend to report minimized windows as (0,0) to be consistent with other back-ends.

Pushed a couple of commits to address this in master and with multi-viewports, for both GLFW and SDL.

Thanks for the report!

@ocornut ocornut closed this May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants