From d43452f0ce64da4158b7d598c4049bba5ddbed5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 8 Nov 2022 22:27:02 +0100 Subject: [PATCH] Fix to shutdown sequence --- Common/GPU/OpenGL/thin3d_gl.cpp | 1 - Common/GPU/Vulkan/thin3d_vulkan.cpp | 2 -- android/jni/AndroidJavaGLContext.cpp | 1 - android/jni/AndroidJavaGLContext.h | 1 - android/jni/app-android.cpp | 12 +++++++----- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index a251db1e0c..480f0cc3bb 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -212,7 +212,6 @@ GLuint ShaderStageToOpenGL(ShaderStage stage) { class OpenGLShaderModule : public ShaderModule { public: OpenGLShaderModule(GLRenderManager *render, ShaderStage stage, const std::string &tag) : render_(render), stage_(stage), tag_(tag) { - DEBUG_LOG(G3D, "Shader module created (%p)", this); glstage_ = ShaderStageToOpenGL(stage); } diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index bba23a25e4..5f08266e3a 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -198,7 +198,6 @@ public: const std::string &GetSource() const { return source_; } ~VKShaderModule() { if (module_) { - DEBUG_LOG(G3D, "Queueing %s (shmodule %p) for release", tag_.c_str(), module_); VkShaderModule shaderModule = module_->BlockUntilReady(); vulkan_->Delete().QueueDeleteShaderModule(shaderModule); vulkan_->Delete().QueueCallback([](VulkanContext *context, void *m) { @@ -268,7 +267,6 @@ public: vkrDesc = new VKRGraphicsPipelineDesc(); } ~VKPipeline() { - DEBUG_LOG(G3D, "Queueing %s (pipeline) for release", tag_.c_str()); if (pipeline) { pipeline->QueueForDeletion(vulkan_); } diff --git a/android/jni/AndroidJavaGLContext.cpp b/android/jni/AndroidJavaGLContext.cpp index 08e52034a5..ebf22b143c 100644 --- a/android/jni/AndroidJavaGLContext.cpp +++ b/android/jni/AndroidJavaGLContext.cpp @@ -38,7 +38,6 @@ bool AndroidJavaEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int void AndroidJavaEGLGraphicsContext::ShutdownFromRenderThread() { INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::Shutdown"); - renderManager_->WaitUntilQueueIdle(); renderManager_ = nullptr; // owned by draw_. delete draw_; draw_ = nullptr; diff --git a/android/jni/AndroidJavaGLContext.h b/android/jni/AndroidJavaGLContext.h index 919bd8b80f..4b4ff95d14 100644 --- a/android/jni/AndroidJavaGLContext.h +++ b/android/jni/AndroidJavaGLContext.h @@ -40,7 +40,6 @@ public: } void StopThread() override { - renderManager_->WaitUntilQueueIdle(); renderManager_->StopThread(); } diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 65ec1f216e..b510942036 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -868,16 +868,18 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { EmuThreadStop("shutdown"); INFO_LOG(SYSTEM, "BeginAndroidShutdown"); graphicsContext->BeginAndroidShutdown(); - INFO_LOG(SYSTEM, "Joining emuthread"); - EmuThreadJoin(); // Now, it could be that we had some frames queued up. Get through them. // We're on the render thread, so this is synchronous. - while (graphicsContext->ThreadFrame()) { - INFO_LOG(SYSTEM, "graphicsContext->ThreadFrame executed to clear buffers"); - } + do { + INFO_LOG(SYSTEM, "Executing graphicsContext->ThreadFrame to clear buffers"); + } while (graphicsContext->ThreadFrame()); graphicsContext->ThreadEnd(); + INFO_LOG(SYSTEM, "ThreadEnd called."); graphicsContext->ShutdownFromRenderThread(); INFO_LOG(SYSTEM, "Graphics context now shut down from NativeApp_shutdown"); + + INFO_LOG(SYSTEM, "Joining emuthread"); + EmuThreadJoin(); } INFO_LOG(SYSTEM, "NativeApp.shutdown() -- begin");