mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
frontend: qt: bootmanager: Acquire a shared context in main emu thread.
This commit is contained in:
parent
e25297536f
commit
c6f78a4a6d
2 changed files with 12 additions and 12 deletions
|
@ -39,7 +39,10 @@
|
||||||
#include "yuzu/bootmanager.h"
|
#include "yuzu/bootmanager.h"
|
||||||
#include "yuzu/main.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;
|
EmuThread::~EmuThread() = default;
|
||||||
|
|
||||||
|
@ -55,15 +58,7 @@ static GMainWindow* GetMainWindow() {
|
||||||
void EmuThread::run() {
|
void EmuThread::run() {
|
||||||
MicroProfileOnThreadCreate("EmuThread");
|
MicroProfileOnThreadCreate("EmuThread");
|
||||||
|
|
||||||
// Acquire render context for duration of the thread if this is the rendering thread
|
Core::Frontend::ScopeAcquireContext acquire_context{context};
|
||||||
if (!Settings::values.use_asynchronous_gpu_emulation) {
|
|
||||||
core_context.MakeCurrent();
|
|
||||||
}
|
|
||||||
SCOPE_EXIT({
|
|
||||||
if (!Settings::values.use_asynchronous_gpu_emulation) {
|
|
||||||
core_context.DoneCurrent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
|
emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
|
|
||||||
|
class GRenderWindow;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QScreen;
|
class QScreen;
|
||||||
class QTouchEvent;
|
class QTouchEvent;
|
||||||
|
@ -35,7 +36,7 @@ class EmuThread final : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EmuThread(Core::Frontend::GraphicsContext& context);
|
explicit EmuThread(GRenderWindow& window);
|
||||||
~EmuThread() override;
|
~EmuThread() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,7 +90,11 @@ private:
|
||||||
std::mutex running_mutex;
|
std::mutex running_mutex;
|
||||||
std::condition_variable running_cv;
|
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:
|
signals:
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue