Fix NVRHI device shutdown for SDL and do additional resource cleanup on exit

This commit is contained in:
Stephen Saunders 2022-10-28 14:11:10 -04:00
parent 8219860378
commit 9734df5f01
5 changed files with 29 additions and 7 deletions

View file

@ -785,7 +785,7 @@ void idImageManager::Shutdown()
deferredImages.DeleteContents( true );
deferredImageHash.Clear();
#if defined( USE_NVRHI )
commandList = nullptr;
commandList.Reset();
#endif
}

View file

@ -286,6 +286,9 @@ void idRenderModelManagerLocal::Shutdown()
{
models.DeleteContents( true );
hash.Free();
#if defined( USE_NVRHI )
commandList.Reset();
#endif
}
/*

View file

@ -2284,6 +2284,10 @@ void idRenderSystemLocal::Shutdown()
Clear();
#if defined( USE_NVRHI )
commandList.Reset();
#endif
ShutdownOpenGL();
bInitialized = false;

View file

@ -1083,6 +1083,20 @@ void DeviceManager_VK::DestroyDeviceAndSwapChain()
m_BarrierCommandList = nullptr;
while( m_FramesInFlight.size() > 0 )
{
auto query = m_FramesInFlight.front();
m_FramesInFlight.pop();
query = nullptr;
}
if( !m_QueryPool.empty() )
{
auto query = m_QueryPool.back();
m_QueryPool.pop_back();
query = nullptr;
}
m_NvrhiDevice = nullptr;
m_ValidationLayer = nullptr;
m_RendererString.clear();

View file

@ -534,12 +534,6 @@ bool VKimp_SetScreenParms( glimpParms_t parms )
void DeviceManager::Shutdown()
{
DestroyDeviceAndSwapChain();
// destroy window
VKimp_Shutdown();
// restore gamma
//VKimp_RestoreGamma();
}
#endif
@ -552,6 +546,13 @@ void VKimp_Shutdown()
{
common->Printf( "Shutting down Vulkan subsystem\n" );
#if defined( USE_NVRHI )
if( deviceManager )
{
deviceManager->Shutdown();
}
#endif
if( window )
{
SDL_DestroyWindow( window );