mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Vulkan/Android: Workaround weird WSI return codes in landscape mode.
Android WSI wants you to use preTransform, and if it is not used correctly, Android 10 will return VK_SUBOPTIMAL_KHR, and we would create a new swapchain every frame. This workaround just ignores this error, since it's not really an error. A more "proper" fix is to use prerotate and modify the MVP matrices, which might help certain devices with crummy display processors.
This commit is contained in:
parent
5062374c72
commit
96723c6f70
@ -229,6 +229,11 @@ static void vulkan_emulated_mailbox_loop(void *userdata)
|
||||
mailbox->result = vkAcquireNextImageKHR(mailbox->device, mailbox->swapchain, UINT64_MAX,
|
||||
VK_NULL_HANDLE, fence, &mailbox->index);
|
||||
|
||||
/* VK_SUBOPTIMAL_KHR can be returned on Android 10 when prerotate is not dealt with.
|
||||
* This is not an error we need to care about, and we'll treat it as SUCCESS. */
|
||||
if (mailbox->result == VK_SUBOPTIMAL_KHR)
|
||||
mailbox->result = VK_SUCCESS;
|
||||
|
||||
if (mailbox->result == VK_SUCCESS)
|
||||
vkWaitForFences(mailbox->device, 1, &fence, true, UINT64_MAX);
|
||||
vkResetFences(mailbox->device, 1, &fence);
|
||||
@ -2621,6 +2626,13 @@ void vulkan_present(gfx_ctx_vulkan_data_t *vk, unsigned index)
|
||||
#endif
|
||||
err = vkQueuePresentKHR(vk->context.queue, &present);
|
||||
|
||||
/* VK_SUBOPTIMAL_KHR can be returned on Android 10 when prerotate is not dealt with.
|
||||
* This is not an error we need to care about, and we'll treat it as SUCCESS. */
|
||||
if (result == VK_SUBOPTIMAL_KHR)
|
||||
result = VK_SUCCESS;
|
||||
if (err == VK_SUBOPTIMAL_KHR)
|
||||
err = VK_SUCCESS;
|
||||
|
||||
#ifdef WSI_HARDENING_TEST
|
||||
trigger_spurious_error_vkresult(&err);
|
||||
#endif
|
||||
@ -2796,6 +2808,11 @@ retry:
|
||||
err = vkAcquireNextImageKHR(vk->context.device,
|
||||
vk->swapchain, UINT64_MAX,
|
||||
VK_NULL_HANDLE, fence, &vk->context.current_swapchain_index);
|
||||
|
||||
/* VK_SUBOPTIMAL_KHR can be returned on Android 10 when prerotate is not dealt with.
|
||||
* This is not an error we need to care about, and we'll treat it as SUCCESS. */
|
||||
if (err == VK_SUBOPTIMAL_KHR)
|
||||
err = VK_SUCCESS;
|
||||
}
|
||||
|
||||
if (err == VK_SUCCESS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user