NVIDIAGameWorks / Streamline

Streamline Integration Framework
Other
391 stars 83 forks source link

[Vulkan] Validation Error: Not all objects have been destroyed at shutdown #31

Closed Bizzarrus closed 4 months ago

Bizzarrus commented 7 months ago

Hi :) I'm trying to integrate Streamline into our Vulkan renderer (currently only using NIS), and when shutting down the rendering engine, I get a lot of validation errors, saying that various objects have not been destroyed at the time the device itself was destroyed:

VUID-vkDestroyDevice-device-00378(ERROR / SPEC): msgNum: 1901072314 - Validation Error: [ VUID-vkDestroyDevice-device-00378 ] Object 0: handle = 0x20386c803b0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0x8a50150000001582, name = const buffer, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x71500fba | OBJ ERROR : For VkDevice 0x20386c803b0[], VkBuffer 0x8a50150000001582[const buffer] 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.211.0/windows/1.3-extensions/vkspec.html#VUID-vkDestroyDevice-device-00378) Objects: 2 [0] 0x20386c803b0, type: 3, name: NULL [1] 0x8a50150000001582, type: 9, name: const buffer

I can track back, that these constant buffer(s) was allocated by Streamline (thanks to the name). There are also many messages about other objects (without any name), which I assume also come from Streamline, but I can't validate that for sure. This is not really a blocking issue for me, but it would be nice to fix it.

Bizzarrus commented 7 months ago

Proper description of the issue: Using Vulkan and NIS, when destroying the vulkan device with the verification layer enabled, the verification layer prints numerous errors about child objects still being alive.

Repro:

  1. Download the SL Sample
  2. Fix issues in the SL Sample code to be able to run the sample (with NIS) on Vulkan: 2.1. You might also have to disable the slReflexSleep call in SLWrapper::Callback_FrameCount_Reflex_Sleep_Input_SimStart, as this seem to freeze on a vk semaphore 2.2. You'll also have to modify the code inside SLWrapper::TagResources_DLSS_NIS to actually set the input and output resource states when using vulkan (outputResource.state = uint32_t(vk::ImageLayout::eTransferSrcOptimal); and inputResource.state = uint32_t(vk::ImageLayout::eTransferDstOptimal); worked for me) 2.3. You might also have to add setShaderFloat16(true) to the vk::PhysicalDeviceVulkan12Features() when creating the vulkan device
  3. Run the SL Sample with -vk -debug from visual studio or similar (so you get the output log after the app closes)
  4. Turn NIS on
  5. Close the App regularly (not using the debugger to stop it). You'll find numerous validation errors in the output log right after shutting down the App, all complaining about objects still being alive when the device was destroyed.
jake-nv commented 4 months ago

Fixed in v2.4.10 (c709dd9)