mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
(vulkan_common.c) Prevent some more collissions in the future
This commit is contained in:
parent
02ce39869c
commit
163be3ccfd
@ -31,10 +31,10 @@
|
|||||||
#include "../../libretro-common/include/retro_timers.h"
|
#include "../../libretro-common/include/retro_timers.h"
|
||||||
#include "../../configuration.h"
|
#include "../../configuration.h"
|
||||||
|
|
||||||
static dylib_t vulkan_library;
|
static dylib_t vulkan_library;
|
||||||
static VkInstance cached_instance;
|
static VkInstance cached_instance_vk;
|
||||||
static VkDevice cached_device;
|
static VkDevice cached_device_vk;
|
||||||
static retro_vulkan_destroy_device_t cached_destroy_device;
|
static retro_vulkan_destroy_device_t cached_destroy_device_vk;
|
||||||
|
|
||||||
#ifdef VULKAN_DEBUG
|
#ifdef VULKAN_DEBUG
|
||||||
static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb(
|
static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb(
|
||||||
@ -1437,7 +1437,7 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
|
|||||||
iface = NULL;
|
iface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cached_device && iface && iface->create_device)
|
if (!cached_device_vk && iface && iface->create_device)
|
||||||
{
|
{
|
||||||
struct retro_vulkan_context context = { 0 };
|
struct retro_vulkan_context context = { 0 };
|
||||||
const VkPhysicalDeviceFeatures features = { 0 };
|
const VkPhysicalDeviceFeatures features = { 0 };
|
||||||
@ -1478,10 +1478,10 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cached_device && cached_destroy_device)
|
if (cached_device_vk && cached_destroy_device_vk)
|
||||||
{
|
{
|
||||||
vk->context.destroy_device = cached_destroy_device;
|
vk->context.destroy_device = cached_destroy_device_vk;
|
||||||
cached_destroy_device = NULL;
|
cached_destroy_device_vk = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vulkan_context_init_gpu(vk))
|
if (!vulkan_context_init_gpu(vk))
|
||||||
@ -1565,10 +1565,10 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
|
|||||||
device_info.ppEnabledLayerNames = device_layers;
|
device_info.ppEnabledLayerNames = device_layers;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cached_device)
|
if (cached_device_vk)
|
||||||
{
|
{
|
||||||
vk->context.device = cached_device;
|
vk->context.device = cached_device_vk;
|
||||||
cached_device = NULL;
|
cached_device_vk = NULL;
|
||||||
|
|
||||||
video_driver_set_video_cache_context_ack();
|
video_driver_set_video_cache_context_ack();
|
||||||
RARCH_LOG("[Vulkan]: Using cached Vulkan context.\n");
|
RARCH_LOG("[Vulkan]: Using cached Vulkan context.\n");
|
||||||
@ -1736,10 +1736,10 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cached_instance)
|
if (cached_instance_vk)
|
||||||
{
|
{
|
||||||
vk->context.instance = cached_instance;
|
vk->context.instance = cached_instance_vk;
|
||||||
cached_instance = NULL;
|
cached_instance_vk = NULL;
|
||||||
res = VK_SUCCESS;
|
res = VK_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2239,9 +2239,9 @@ void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk,
|
|||||||
|
|
||||||
if (video_driver_is_video_cache_context())
|
if (video_driver_is_video_cache_context())
|
||||||
{
|
{
|
||||||
cached_device = vk->context.device;
|
cached_device_vk = vk->context.device;
|
||||||
cached_instance = vk->context.instance;
|
cached_instance_vk = vk->context.instance;
|
||||||
cached_destroy_device = vk->context.destroy_device;
|
cached_destroy_device_vk = vk->context.destroy_device;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2253,6 +2253,7 @@ void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk,
|
|||||||
vk->context.destroy_device();
|
vk->context.destroy_device();
|
||||||
|
|
||||||
vkDestroyInstance(vk->context.instance, NULL);
|
vkDestroyInstance(vk->context.instance, NULL);
|
||||||
|
|
||||||
if (vulkan_library)
|
if (vulkan_library)
|
||||||
{
|
{
|
||||||
dylib_close(vulkan_library);
|
dylib_close(vulkan_library);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user