From 157d1e7e63f14f5162c4a1f3161c9f8e98786c70 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sat, 8 Sep 2018 11:47:09 +0200 Subject: [PATCH] Only use mailbox emulation on AMD. --- gfx/common/vulkan_common.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index b7565a3e9b..fff238103d 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -38,6 +38,10 @@ #include "../../libretro-common/include/retro_math.h" #include "../../libretro-common/include/string/stdstring.h" +#define VENDOR_ID_AMD 0x1002 +#define VENDOR_ID_NV 0x10DE +#define VENDOR_ID_INTEL 0x8086 + // Windows is not particularly good at recreating swapchains. // Emulate vsync toggling by using vkAcquireNextImageKHR timeouts. #if defined(_WIN32) @@ -1500,10 +1504,6 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk) "VK_KHR_sampler_mirror_clamp_to_edge", }; -#ifdef VULKAN_EMULATE_MAILBOX - vk->emulate_mailbox = true; -#endif - #ifdef VULKAN_DEBUG static const char *device_layers[] = { "VK_LAYER_LUNARG_standard_validation" }; #endif @@ -1578,6 +1578,13 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk) vkGetPhysicalDeviceMemoryProperties(vk->context.gpu, &vk->context.memory_properties); +#ifdef VULKAN_EMULATE_MAILBOX + // AMD can emulate Mailbox on Windows, but not NV. + // Not tested on Intel. + if (vk->context.gpu_properties.vendorID == VENDOR_ID_AMD) + vk->emulate_mailbox = true; +#endif + RARCH_LOG("[Vulkan]: Using GPU: %s\n", vk->context.gpu_properties.deviceName); if (vk->context.device == VK_NULL_HANDLE)