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

Swapchain recreation fails when window is minimized (or restored) #88

Open
9 tasks
johannesugb opened this issue Jan 7, 2021 · 1 comment
Open
9 tasks
Assignees
Labels
bug Something isn't working Vulkan Vulkan-centric task

Comments

@johannesugb
Copy link
Member

In all the example applications which support swapchain recreation (hello_world, multi_invokee_rendering, model_loader, ray_tracing_triangle_meshes), swapchain recreation works fine when the image is resized, but problems occur when the window is minimized (leading to image size of 0, 0) or restored (if the problems didn't occur before, they occur here - still because of image size 0, 0).

In Debug mode, validation errors occur:

[Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01689 ] Object 0: handle = 0x1444f005268, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x13140d69 | vkCreateSwapchainKHR(): pCreateInfo->imageExtent = (0, 0) which is illegal. The Vulkan spec states: imageExtent members width and height must both be non-zero (https://vulkan.lunarg.com/doc/view/1.2.162.0/windows/1.2-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01689)

While hello_world only displays the validation errors and continues to work afterwards, model_loader and ray_tracing_triangle_meshes completely fail and crash.

The problem definitely has to do with recreating an image_view and I think that at least one problem is the std::holds_alternative<vk::Image>(aTemplate->mImage)-case in root::create_image_from_template. The image views from the swap chain are wrapped in image directly and are not created via root::create_image. Therefore, the image_t::mCreateInfo member does not contain valid information, and when attempting to create a new image from a template, an image of size 0, 0 fails to be created. (I'm not 100% sure about this, though => exact reasons are to be investigated!)

Definition of done:

  • The window minimization/restoration case is handled properly by the framework
  • The swapchain is recreated properly for these cases
  • When image size is 0, 0, no new images or image_views are attempted to be created (would fail anyways... at the latest when allocating memory via VMA, I think.)
  • No validation errors are shown anymore because the case has been properly handled
  • The hello_world example's window can be minimized and restored without errors or crashes.
  • The multi_invokee_rendering example's window can be minimized and restored without errors or crashes.
  • The model_loader example's window can be minimized and restored without errors or crashes.
  • The ray_tracing_triangle_meshes example's window can be minimized and restored without errors or crashes.
  • The code is well documented and the Contribution Guidelines have been followed.
@saaye-tu saaye-tu self-assigned this Jan 7, 2021
@johannesugb johannesugb added bug Something isn't working Vulkan Vulkan-centric task labels Jan 9, 2021
@saaye-tu
Copy link
Collaborator

saaye-tu commented Jan 18, 2021

Because of the restructuring done in issue #67, this problem does not happen anymore.

reason: swap chain is not recreated immediately when window is being minimized.

Please confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Vulkan Vulkan-centric task
Development

No branches or pull requests

2 participants