summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-02-21 18:40:23 +0100
committerbunnei <bunneidev@gmail.com>2020-02-26 03:23:02 +0100
commitc6f78a4a6d8746b84b2891e536286d9d6a63015e (patch)
tree341376f25aaa9008eedcff6a39c6cfc84acc9ed8
parentfrontend: qt: bootmanager: Vulkan: Restore support for VK backend. (diff)
downloadyuzu-c6f78a4a6d8746b84b2891e536286d9d6a63015e.tar
yuzu-c6f78a4a6d8746b84b2891e536286d9d6a63015e.tar.gz
yuzu-c6f78a4a6d8746b84b2891e536286d9d6a63015e.tar.bz2
yuzu-c6f78a4a6d8746b84b2891e536286d9d6a63015e.tar.lz
yuzu-c6f78a4a6d8746b84b2891e536286d9d6a63015e.tar.xz
yuzu-c6f78a4a6d8746b84b2891e536286d9d6a63015e.tar.zst
yuzu-c6f78a4a6d8746b84b2891e536286d9d6a63015e.zip
-rw-r--r--src/yuzu/bootmanager.cpp15
-rw-r--r--src/yuzu/bootmanager.h9
2 files changed, 12 insertions, 12 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 704c5ecdd..c3dbb1a88 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -39,7 +39,10 @@
#include "yuzu/bootmanager.h"
#include "yuzu/main.h"
-EmuThread::EmuThread(Core::Frontend::GraphicsContext& core_context) : core_context(core_context) {}
+EmuThread::EmuThread(GRenderWindow& window)
+ : shared_context{window.CreateSharedContext()},
+ context{(Settings::values.use_asynchronous_gpu_emulation && shared_context) ? *shared_context
+ : window} {}
EmuThread::~EmuThread() = default;
@@ -55,15 +58,7 @@ static GMainWindow* GetMainWindow() {
void EmuThread::run() {
MicroProfileOnThreadCreate("EmuThread");
- // Acquire render context for duration of the thread if this is the rendering thread
- if (!Settings::values.use_asynchronous_gpu_emulation) {
- core_context.MakeCurrent();
- }
- SCOPE_EXIT({
- if (!Settings::values.use_asynchronous_gpu_emulation) {
- core_context.DoneCurrent();
- }
- });
+ Core::Frontend::ScopeAcquireContext acquire_context{context};
emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index 6710a6e7f..79b030304 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -17,6 +17,7 @@
#include "core/core.h"
#include "core/frontend/emu_window.h"
+class GRenderWindow;
class QKeyEvent;
class QScreen;
class QTouchEvent;
@@ -35,7 +36,7 @@ class EmuThread final : public QThread {
Q_OBJECT
public:
- explicit EmuThread(Core::Frontend::GraphicsContext& context);
+ explicit EmuThread(GRenderWindow& window);
~EmuThread() override;
/**
@@ -89,7 +90,11 @@ private:
std::mutex running_mutex;
std::condition_variable running_cv;
- Core::Frontend::GraphicsContext& core_context;
+ /// Only used in asynchronous GPU mode
+ std::unique_ptr<Core::Frontend::GraphicsContext> shared_context;
+
+ /// This is shared_context in asynchronous GPU mode, core_context in synchronous GPU mode
+ Core::Frontend::GraphicsContext& context;
signals:
/**