fix vulkan handle releasing

This commit is contained in:
pufferffish 2024-06-15 21:11:07 +01:00
parent b958cd2848
commit b6554e9b8c
2 changed files with 13 additions and 1 deletions

View File

@ -228,6 +228,11 @@ func GetGPUInfo() GpuInfoList {
C.oneapi_release(*oHandles.oneapi)
}
}
if vHandles != nil {
if vHandles.vulkan != nil {
C.vk_release(*vHandles.vulkan)
}
}
}()
if !bootstrapped {

View File

@ -213,9 +213,16 @@ void vk_check_vram(vk_handle_t rh, int i, mem_info_t *resp) {
resp->major = VK_API_VERSION_MAJOR(properties.apiVersion);
resp->minor = VK_API_VERSION_MINOR(properties.apiVersion);
resp->patch = VK_API_VERSION_PATCH(properties.apiVersion);
}
void vk_release(vk_handle_t rh) {
LOG(rh.verbose, "releasing vulkan library\n");
(*rh.vkDestroyInstance)(rh.vk, NULL);
UNLOAD_LIBRARY(rh.vk_handle);
rh.vk_handle = NULL;
#ifdef __linux__
LOG(rh.verbose, "releasing libcap library\n");
UNLOAD_LIBRARY(rh.cap_handle);
rh.cap_handle = NULL;
#endif
}