From 4abb0ef33187c2ff994f97748e5688ceb8b7cc75 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Sun, 26 Jun 2016 21:02:32 +0200 Subject: [PATCH] Vulkan: Cache destroy device callback. --- gfx/common/vulkan_common.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 1e921159fd..c3342623ec 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -32,6 +32,7 @@ static dylib_t vulkan_library; static VkInstance cached_instance; static VkDevice cached_device; +static retro_vulkan_destroy_device_t cached_destroy_device; #ifdef VULKAN_DEBUG static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb( @@ -1279,6 +1280,12 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk) } } + if (cached_device && cached_destroy_device) + { + vk->context.destroy_device = cached_destroy_device; + cached_destroy_device = NULL; + } + if (vk->context.gpu == VK_NULL_HANDLE) { if (vkEnumeratePhysicalDevices(vk->context.instance, @@ -1824,8 +1831,9 @@ void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk, if (video_driver_is_video_cache_context()) { - cached_device = vk->context.device; - cached_instance = vk->context.instance; + cached_device = vk->context.device; + cached_instance = vk->context.instance; + cached_destroy_device = vk->context.destroy_device; } else {