From 14154d8e78b51be4b74bc315e23f1ee89a500bd2 Mon Sep 17 00:00:00 2001 From: SachinVin Date: Wed, 14 Apr 2021 00:09:17 +0530 Subject: [PATCH] native.cpp; create `cpu_context` only when async gpu enabled and reset it after use --- src/android/app/src/main/jni/native.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index c7f6d1228..c744e362f 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -228,8 +228,9 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) { LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0); - std::unique_ptr cpu_context{window->CreateSharedContext()}; + std::unique_ptr cpu_context; if (Settings::values.use_asynchronous_gpu_emulation) { + cpu_context = window->CreateSharedContext(); cpu_context->MakeCurrent(); } @@ -237,6 +238,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) { if (Settings::values.use_asynchronous_gpu_emulation) { cpu_context->DoneCurrent(); + cpu_context.reset(); } LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Complete, 0, 0);