Skip to content

Commit

Permalink
Additional check and clear
Browse files Browse the repository at this point in the history
  • Loading branch information
shatyuka committed Mar 1, 2024
1 parent 5f9264c commit 91ed90b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2094,7 +2094,10 @@ void destroy_gpu_instance()
// NCNN_LOGE("destroy_gpu_instance");

if (g_instance.glslang_initialized)
{
glslang::FinalizeProcess();
g_instance.glslang_initialized = false;
}

for (int i = 0; i < NCNN_MAX_GPU_COUNT; i++)
{
Expand All @@ -2106,15 +2109,18 @@ void destroy_gpu_instance()
}

#if ENABLE_VALIDATION_LAYER
if (support_VK_EXT_debug_utils)
if (support_VK_EXT_debug_utils && g_instance.callback)
{
DestroyDebugUtilsMessengerEXT(g_instance, g_instance.callback, NULL);
g_instance.callback = 0;
}
#endif // ENABLE_VALIDATION_LAYER

if (vkDestroyInstance)
{
vkDestroyInstance(g_instance, 0);
vkDestroyInstance = 0;
}

g_instance.instance = 0;

Expand Down

0 comments on commit 91ed90b

Please sign in to comment.