🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Vulkan Shutdown: A Story of References, Passion, Mystery, and Horror

Started by
6 comments, last by L. Spiro 3 years ago

When my program shuts down I get this:

DXGI WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Producer at 0x0000000000116E38, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING:     Live Object at 0x00000000036FB9F0, Refcount: 1. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live                         Object :      1 [ STATE_CREATION WARNING #0: ]

But the only Vulkan object I have created is the instance: ::vkCreateInstance( &iciInstInfo, nullptr, &m_iInstance ) It is properly destroyed when the window closes, before exiting the program:

        ::vkDestroyInstance( m_iInstance, nullptr );
        m_iInstance = nullptr;

I have verified both functions as being called once. There are no other objects being created. Instance is created, instance is destroyed, end. Is this normal?


I’ve killed Steam and don’t see anything that should be barging in and putting an overlay or otherwise into my program.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Advertisement

I can only say not using DXGI i have no such issues.
Actually i create a window, then VK instance, then swapchain. It also works to create VK instance first before anything else.
So maybe you could do it before DXGI and destroy it after that, to get rid of the warning?

Have you considered the fact that this could be a false positive ? when exactly do you release the vulkan instance ?

Programmer71 said:

Have you considered the fact that this could be a false positive ? when exactly do you release the vulkan instance ?

My whole main() is this:

INT APIENTRY wWinMain( HINSTANCE _hInstance, HINSTANCE /*_hPrevInstance*/, LPWSTR /*_lpwsCmdLine*/, INT /*_iCmdShow*/ ) {
	/*ls::CWindow wWindow;
	wWindow.CreateRenderWindow(
		1280, 720,
		false, 32,
		L"L. Spiro Tech Demo" );*/
	ls::CVulkanDevice::LSG_VULKAN_INIT viInit = { 0 };
	viInit.hInst = _hInstance;
	//viInit.hWnd = wWindow.GetWindow();
	viInit.hWnd = NULL;
	viInit.pcWindowName = "L. Spiro Tech";
	viInit.ui32AppVersion = 1;
	ls::CVulkanDevice::Init( viInit );
	//INT iRet = wWindow.Run();
	
	ls::CVulkanDevice::DestroyVulkan();
	//return iRet;
	return 0;
}

I removed the window code just to make it clear that there is literally nothing else happening besides creating the Vulkan instance and then destroying it.

	bool CVulkanDevice::Init( const LSG_VULKAN_INIT &_viInit ) {
		// Create the instance.
		VkApplicationInfo aiAppInfo = {
			VK_STRUCTURE_TYPE_APPLICATION_INFO,			// sType
			nullptr,									// pNext
			_viInit.pcWindowName,						// pApplicationName
			_viInit.ui32AppVersion,						// applicationVersion
			"L. Spiro Tech",							// pEngineName
			VK_MAKE_VERSION( 1, 0, 0 ),					// engineVersion
			VK_API_VERSION_1_2							// apiVersion
		};

		const char * pcExt[] = {
			VK_KHR_SURFACE_EXTENSION_NAME,
			VK_KHR_WIN32_SURFACE_EXTENSION_NAME,
		};

		VkInstanceCreateInfo iciInstInfo = {
			VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,		// sType
			nullptr,									// pNext
			0,											// flags
			&aiAppInfo,									// pApplicationInfo
			0,											// enabledLayerCount
			nullptr,									// ppEnabledLayerNames
			LS_ELEMENTS( pcExt ),						// enabledExtensionCount
			pcExt										// ppEnabledExtensionNames
		};

		if ( PrintVulkanError( "CVulkanDevice::Init(): ", ::vkCreateInstance( &iciInstInfo, nullptr, &m_iInstance ) ) ) {
			ResetInternal();
			return false;
		}

		return true;
	}

	void CVulkanDevice::DestroyVulkan() {
		ResetInternal();
	}
	void CVulkanDevice::ResetInternal() {
		::vkDestroyInstance( m_iInstance, nullptr );
		m_iInstance = nullptr;
	}

So there is literally nothing but create-instance, destroy-instance.
I can find no indications through documentation that the single resource I create is being mismanaged, but I can’t accept this reporting as “normal” behavior.

What could be happening here?


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

In my opinion i think this is still a false positive, visual studio often does this when i create some stl strings inside the main. The fact is that the debugger ends before exiting the main loop and reports stack allocated entities as memory leaks. This bug was reported years ago and despite being declared fixed, it still happens.

I am not yet into Vulkan, but I do not know if there are data structures to declare before initting the context, try to move your data structures outside ‘main’ if they are being allocated using the stack.

In my opinion i think this is still a false positive, visual studio often does this when i create some stl strings inside the main. The fact is that the debugger ends before exiting the main loop and reports stack allocated entities as memory leaks. This bug was reported years ago and despite being declared fixed, it still happens.

I am not yet into Vulkan, but I do not know if there are data structures to declare before initting the context, try to move your data structures outside ‘main’ if they are being allocated using the stack.

I don’t believe this is related to Visual Studio, as it should be only related to the Vulkan validation layers on a system-wide level (which I have set to report these kinds of issues).
In any case I removed them from the stack and get the same result.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

It’s a Vulkan driver issue. Windows 7 is not as tested (not tested at all by Khronos, maybe tested by NVIDIA) and it uses DXGI internally to enumerate drivers and physical devices.
It’s confirmed to be a bug on the other end.

It does not happen on Windows 10.

Thank you everyone.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement