inexorgame / vulkan-renderer

A new 3D game engine for Linux and Windows using C++20 and Vulkan API 1.3, in very early but ongoing development
https://inexor.org
MIT License
756 stars 33 forks source link

Swapchain is not properly destroyed during exit #517

Closed IAmNotHanni closed 1 year ago

IAmNotHanni commented 1 year ago

Describe The Bug

Vulkan validation layers say the swapchain was not properly destroyed when the program is shut down.

Steps To Reproduce

  1. Clone and compile current master branch
  2. Run inexor-vulkan-renderer-example
  3. Exit inexor-vulkan-renderer-example

Expected Behavior

All Vulkan resources must be destroyed properly before destroying the Vulkan device.

Affected Code

The Swapchain code

Operating System

All operating systems (although I am only testing on Linux Mint right now)

Application Version

main

Additional Context

No response

Relevant Log Output

VUID-vkDestroyDevice-device-00378(ERROR / SPEC): msgNum: 1901072314 - Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x62500025f900, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 
0xf56c9b0000000004, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x62500025f900[], VkSwapchainKHR 0xf56c9b0000000004[] has not been destroyed. The Vulkan spec states: All child objects 
created on device must have been destroyed prior to destroying device (https://vulkan.lunarg.com/doc/view/1.3.236.0/linux/1.3-extensions/vkspec.html#VUID-vkDestroyDevice-device-00378)
    Objects: 2
        [0] 0x62500025f900, type: 3, name: NULL
        [1] 0xf56c9b0000000004, type: 1000001000, name: NULL