From d5f53da79d944869eb88416494ecf10a47eee90d Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 13 Dec 2022 12:30:15 -0500 Subject: renderer_opengl: refactor context acquire --- src/yuzu/bootmanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/yuzu/bootmanager.cpp') diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 5b5b6fed8..1437dec88 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -61,8 +61,6 @@ void EmuThread::run() { // Main process has been loaded. Make the context current to this thread and begin GPU and CPU // execution. - gpu.Start(); - gpu.ObtainContext(); emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0); @@ -77,6 +75,7 @@ void EmuThread::run() { emit LoadProgress(VideoCore::LoadCallbackStage::Complete, 0, 0); gpu.ReleaseContext(); + gpu.Start(); system.GetCpuManager().OnGpuReady(); -- cgit v1.2.3 From 29fbce9fe6007ca0d7aafebb47fe9c5edbfe9393 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Mon, 12 Dec 2022 22:18:26 -0500 Subject: RenderWidget: Set WA_DontCreateNativeAncestors Some windowing systems like wayland are designed to show hardware accellerated surfaces as subsurfaces and not native windows. --- src/yuzu/bootmanager.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/yuzu/bootmanager.cpp') diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 1437dec88..d2103e86f 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -223,6 +223,7 @@ class RenderWidget : public QWidget { public: explicit RenderWidget(GRenderWindow* parent) : QWidget(parent), render_window(parent) { setAttribute(Qt::WA_NativeWindow); + setAttribute(Qt::WA_DontCreateNativeAncestors); setAttribute(Qt::WA_PaintOnScreen); } -- cgit v1.2.3 From 2221afaf265c15d0d3a2e551f172bed6567fc11a Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 13 Dec 2022 13:17:44 -0500 Subject: OpenGL: Check for threading support We need this. --- src/yuzu/bootmanager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/yuzu/bootmanager.cpp') diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index d2103e86f..0ba7fff7a 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -952,6 +952,12 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(std::pair minimal bool GRenderWindow::InitializeOpenGL() { #ifdef HAS_OPENGL + if (!QOpenGLContext::supportsThreadedOpenGL()) { + QMessageBox::warning(this, tr("OpenGL not available!"), + tr("OpenGL shared contexts are not supported.")); + return false; + } + // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, // WA_DontShowOnScreen, WA_DeleteOnClose auto child = new OpenGLRenderWidget(this); -- cgit v1.2.3 From 09e3029c1118616394e5e9c45dfcdd4adcdf86ad Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 13 Dec 2022 14:39:03 -0500 Subject: gl_device: Use a more robust way to use strict context mode Instead of checking a environment variable which may not actually exist or is just wrong, ask QT if it's running on the wayland platform. --- src/yuzu/bootmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/yuzu/bootmanager.cpp') diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 0ba7fff7a..1a47fb9c9 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -314,6 +314,8 @@ GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, input_subsystem->Initialize(); this->setMouseTracking(true); + strict_context_required = QGuiApplication::platformName() == QStringLiteral("wayland"); + connect(this, &GRenderWindow::FirstFrameDisplayed, parent, &GMainWindow::OnLoadComplete); connect(this, &GRenderWindow::ExecuteProgramSignal, parent, &GMainWindow::OnExecuteProgram, Qt::QueuedConnection); -- cgit v1.2.3