native.cpp; create cpu_context only when async gpu enabled and reset it after use

This commit is contained in:
SachinVin 2021-04-14 00:09:17 +05:30 committed by bunnei
parent 6d9e652eb0
commit 14154d8e78

View File

@ -228,8 +228,9 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0); LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
std::unique_ptr<Frontend::GraphicsContext> cpu_context{window->CreateSharedContext()}; std::unique_ptr<Frontend::GraphicsContext> cpu_context;
if (Settings::values.use_asynchronous_gpu_emulation) { if (Settings::values.use_asynchronous_gpu_emulation) {
cpu_context = window->CreateSharedContext();
cpu_context->MakeCurrent(); cpu_context->MakeCurrent();
} }
@ -237,6 +238,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
if (Settings::values.use_asynchronous_gpu_emulation) { if (Settings::values.use_asynchronous_gpu_emulation) {
cpu_context->DoneCurrent(); cpu_context->DoneCurrent();
cpu_context.reset();
} }
LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Complete, 0, 0); LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Complete, 0, 0);