VideoCommon: Call Renderer::SurfaceChanged on render parent resize

This is needed because for some reason the WSI for NV Vulkan drivers
doesn't return VK_ERROR_OUT_OF_DATE_KHR, so there is no other way to know
that a resize has occured apart from polling, which is a poor solution for
X11 (since it is blocking).
This commit is contained in:
Stenzek
2016-08-13 22:08:53 +10:00
parent 5346078791
commit 6a99cbd9fc
6 changed files with 44 additions and 29 deletions

View File

@ -1620,12 +1620,16 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
OSD::DoCallbacks(OSD::CallbackType::OnFrame);
OSD::DrawMessages();
if (s_SurfaceNeedsChanged.IsSet())
#ifdef ANDROID
if (s_surface_needs_change.IsSet())
{
GLInterface->UpdateHandle(s_new_surface_handle);
GLInterface->UpdateSurface();
s_SurfaceNeedsChanged.Clear();
s_ChangedSurface.Set();
s_new_surface_handle = nullptr;
s_surface_needs_change.Clear();
s_surface_changed.Set();
}
#endif
// Copy the rendered frame to the real window
GLInterface->Swap();
@ -1814,4 +1818,16 @@ int Renderer::GetMaxTextureSize()
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &s_max_texture_size);
return s_max_texture_size;
}
void Renderer::ChangeSurface(void* new_surface_handle)
{
// Win32 polls the window size when redrawing, X11 runs an event loop in another thread.
// This is only necessary for Android at this point, although handling resizes here
// would be more efficient than polling.
#ifdef ANDROID
s_new_surface_handle = new_surface_handle;
s_surface_needs_change.Set();
s_surface_changed.Wait();
#endif
}
}