Android: Fix race/crash when switching away/back to the emulation activity

This commit is contained in:
Connor McLaughlin
2020-10-27 11:58:46 +10:00
parent 80a377d45a
commit 7ce55ca800
4 changed files with 13 additions and 8 deletions

View File

@ -124,6 +124,9 @@ bool OpenGLHostDisplay::DownloadTexture(const void* texture_handle, u32 x, u32 y
void OpenGLHostDisplay::SetVSync(bool enabled)
{
if (m_gl_context->GetWindowInfo().type == WindowInfo::Type::Surfaceless)
return;
// Window framebuffer has to be bound to call SetSwapInterval.
GLint current_fbo = 0;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &current_fbo);

View File

@ -234,6 +234,9 @@ bool VulkanHostDisplay::DownloadTexture(const void* texture_handle, u32 x, u32 y
void VulkanHostDisplay::SetVSync(bool enabled)
{
if (!m_swap_chain)
return;
// This swap chain should not be used by the current buffer, thus safe to destroy.
g_vulkan_context->WaitForGPUIdle();
m_swap_chain->SetVSync(enabled);