Vulkan temporary workaround for swapchain recycling (nvidia) -

Both swapchain recreation methods are proper andwithin the Vulkan specs.
The differnece is retroarch follows method (apparently proposed in
vulkan samples) that "hopes" the driver will reuse some of the old
swapchain resources, while the other method destroys everything and
recreates from scratch. At the moment on Nvidia drivers the second
method is stable while the first method is unreliable in all cases
today.
This commit is contained in:
twinaphex 2018-01-21 04:40:01 +01:00
parent 7ab2cbf877
commit 2178b6d10f

View File

@ -2552,6 +2552,15 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
old_swapchain = vk->swapchain;
if (/* NVIDIA WAR */
vk->context.gpu_properties.vendorID == 0x10DE &&
old_swapchain != VK_NULL_HANDLE)
{
RARCH_LOG("[Vulkan]: Old swapchain destroyed.\n");
vkDestroySwapchainKHR(vk->context.device, old_swapchain, NULL);
old_swapchain = VK_NULL_HANDLE;
}
info.surface = vk->vk_surface;
info.minImageCount = desired_swapchain_images;
info.imageFormat = format.format;
@ -2575,7 +2584,8 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
return false;
}
if (old_swapchain != VK_NULL_HANDLE)
if ( vk->context.gpu_properties.vendorID != 0x10DE &&
old_swapchain != VK_NULL_HANDLE)
{
RARCH_LOG("[Vulkan]: Recycled old swapchain.\n");
vkDestroySwapchainKHR(vk->context.device, old_swapchain, NULL);