Skip to content

Commit

Permalink
Android: Fix crashes on screen rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Oct 9, 2023
1 parent ef35cbb commit 8c82189
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Common/GPU/Vulkan/VulkanFrameData.cpp
Expand Up @@ -84,6 +84,7 @@ void FrameData::AcquireNextImage(VulkanContext *vulkan, FrameDataShared &shared)
WARN_LOG(G3D, "VK_SUBOPTIMAL_KHR returned - ignoring");
break;
case VK_ERROR_OUT_OF_DATE_KHR:
case VK_ERROR_SURFACE_LOST_KHR:
case VK_TIMEOUT:
case VK_NOT_READY:
// We do not set hasAcquired here!
Expand Down
9 changes: 8 additions & 1 deletion Common/Render/ManagedTexture.cpp
Expand Up @@ -186,8 +186,15 @@ void ManagedTexture::DeviceLost() {

void ManagedTexture::DeviceRestored(Draw::DrawContext *draw) {
INFO_LOG(G3D, "ManagedTexture::DeviceRestored(%s)", filename_.c_str());
_assert_(!texture_);

draw_ = draw;

_dbg_assert_(!texture_);
if (texture_) {
ERROR_LOG(G3D, "ManagedTexture: Unexpected - texture already present: %s", filename_.c_str());
return;
}

// Vulkan: Can't load textures before the first frame has started.
// Should probably try to lift that restriction again someday..
loadPending_ = true;
Expand Down
1 change: 1 addition & 0 deletions android/jni/app-android.cpp
Expand Up @@ -1450,6 +1450,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runVulkanRenderLoo

if (g_vulkanRenderLoopThread.joinable()) {
ERROR_LOG(G3D, "runVulkanRenderLoop: Already running");
return false;
}

ANativeWindow *wnd = _surf ? ANativeWindow_fromSurface(env, _surf) : nullptr;
Expand Down

0 comments on commit 8c82189

Please sign in to comment.