Merge pull request #16156 from hrydgard/opengl-thread-refactor

OpenGL threading refactor
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2023-01-31 11:14:01 +01:00
commit c8dce81ff0
23 files changed
+224 -286

No files matched your search

-1
View File
@@ -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;
-1
View File
@@ -40,7 +40,6 @@ public:
}
void StopThread() override {
renderManager_->WaitUntilQueueIdle();
renderManager_->StopThread();
}
+10 -9
View File
@@ -335,7 +335,7 @@ static void EmuThreadFunc() {
while (emuThreadState != (int)EmuThreadState::QUIT_REQUESTED) {
UpdateRunLoopAndroid(env);
}
INFO_LOG(SYSTEM, "QUIT_REQUESTED found, left loop. Setting state to STOPPED.");
INFO_LOG(SYSTEM, "QUIT_REQUESTED found, left EmuThreadFunc loop. Setting state to STOPPED.");
emuThreadState = (int)EmuThreadState::STOPPED;
NativeShutdownGraphics();
@@ -868,17 +868,18 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) {
EmuThreadStop("shutdown");
INFO_LOG(SYSTEM, "BeginAndroidShutdown");
graphicsContext->BeginAndroidShutdown();
// Skipping GL calls, the old context is gone.
while (graphicsContext->ThreadFrame()) {
INFO_LOG(SYSTEM, "graphicsContext->ThreadFrame executed to clear buffers");
}
INFO_LOG(SYSTEM, "Joining emuthread");
EmuThreadJoin();
INFO_LOG(SYSTEM, "Joined emuthread");
// Now, it could be that we had some frames queued up. Get through them.
// We're on the render thread, so this is synchronous.
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");