diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 20d8ac64e0..42779d75c8 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -96,6 +96,7 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb( RARCH_ERR("[Vulkan]: Error: %s: %s\n", pLayerPrefix, pMessage); } +#if 0 else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT) { RARCH_WARN("[Vulkan]: Warning: %s: %s\n", @@ -111,6 +112,7 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb( RARCH_LOG("[Vulkan]: Information: %s: %s\n", pLayerPrefix, pMessage); } +#endif return VK_FALSE; } @@ -147,27 +149,21 @@ VkResult vulkan_emulated_mailbox_acquire_next_image(struct vulkan_emulated_mailb if (!mailbox->has_pending_request) { mailbox->request_acquire = true; - mailbox->has_pending_request = true; scond_signal(mailbox->cond); } - if (!mailbox->acquired) - { - /* Wait some arbitrary time here for good measure. - * This lets us grab the index from mailbox_begin_acquire early. */ - scond_wait_timeout(mailbox->cond, mailbox->lock, 1000); - } + mailbox->has_pending_request = true; if (mailbox->acquired) { res = mailbox->result; *index = mailbox->index; mailbox->has_pending_request = false; + mailbox->acquired = false; } else res = VK_TIMEOUT; - mailbox->acquired = false; slock_unlock(mailbox->lock); return res; } @@ -1697,13 +1693,9 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk) &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; - */ - vk->emulate_mailbox = true; + /* Win32 windowed mode seems to deal just fine with toggling VSync. + * Fullscreen however ... */ + vk->emulate_mailbox = vk->fullscreen; #endif RARCH_LOG("[Vulkan]: Using GPU: %s\n", vk->context.gpu_properties.deviceName); diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index 5e340abbcb..e42d137fec 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -160,6 +160,9 @@ typedef struct gfx_ctx_vulkan_data VkSwapchainKHR swapchain; struct vulkan_emulated_mailbox mailbox; + /* Used to check if we need to use mailbox emulation or not. + * Only relevant on Windows for now. */ + bool fullscreen; } gfx_ctx_vulkan_data_t; struct vulkan_display_surface_info diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c index 88341b70ab..6a1db88800 100644 --- a/gfx/drivers_context/wgl_ctx.c +++ b/gfx/drivers_context/wgl_ctx.c @@ -584,6 +584,8 @@ static bool gfx_ctx_wgl_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { + win32_vk.fullscreen = fullscreen; + if (!win32_set_video_mode(NULL, width, height, fullscreen)) { RARCH_ERR("[WGL]: win32_set_video_mode failed.\n");