summaryrefslogtreecommitdiffstats
path: root/src/yuzu
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-06-20 05:31:04 +0200
committerGitHub <noreply@github.com>2020-06-20 05:31:04 +0200
commit7d1dca4c981d04bcb18cd5ecc6a4fe3f71d85560 (patch)
treec806783957549f1127c7d8bfda28abefa5b3ab8d /src/yuzu
parentMerge pull request #4113 from ogniK5377/boxcat-disable (diff)
parentbootmanager: Remove references to OpenGL for macOS (diff)
downloadyuzu-7d1dca4c981d04bcb18cd5ecc6a4fe3f71d85560.tar
yuzu-7d1dca4c981d04bcb18cd5ecc6a4fe3f71d85560.tar.gz
yuzu-7d1dca4c981d04bcb18cd5ecc6a4fe3f71d85560.tar.bz2
yuzu-7d1dca4c981d04bcb18cd5ecc6a4fe3f71d85560.tar.lz
yuzu-7d1dca4c981d04bcb18cd5ecc6a4fe3f71d85560.tar.xz
yuzu-7d1dca4c981d04bcb18cd5ecc6a4fe3f71d85560.tar.zst
yuzu-7d1dca4c981d04bcb18cd5ecc6a4fe3f71d85560.zip
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/CMakeLists.txt4
-rw-r--r--src/yuzu/bootmanager.cpp17
2 files changed, 19 insertions, 2 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 8b9404718..75c27e39e 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -208,6 +208,10 @@ if (MSVC)
copy_yuzu_unicorn_deps(yuzu)
endif()
+if (NOT APPLE)
+ target_compile_definitions(yuzu PRIVATE HAS_OPENGL)
+endif()
+
if (ENABLE_VULKAN)
target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include)
target_compile_definitions(yuzu PRIVATE HAS_VULKAN)
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 1f5e43043..696da2137 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -8,13 +8,16 @@
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QMessageBox>
-#include <QOffscreenSurface>
-#include <QOpenGLContext>
#include <QPainter>
#include <QScreen>
#include <QStringList>
#include <QWindow>
+#ifdef HAS_OPENGL
+#include <QOffscreenSurface>
+#include <QOpenGLContext>
+#endif
+
#if !defined(WIN32) && HAS_VULKAN
#include <qpa/qplatformnativeinterface.h>
#endif
@@ -98,6 +101,7 @@ void EmuThread::run() {
#endif
}
+#ifdef HAS_OPENGL
class OpenGLSharedContext : public Core::Frontend::GraphicsContext {
public:
/// Create the original context that should be shared from
@@ -183,6 +187,7 @@ private:
std::unique_ptr<QOffscreenSurface> offscreen_surface{};
QSurface* surface;
};
+#endif
class DummyContext : public Core::Frontend::GraphicsContext {};
@@ -473,6 +478,7 @@ void GRenderWindow::resizeEvent(QResizeEvent* event) {
}
std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const {
+#ifdef HAS_OPENGL
if (Settings::values.renderer_backend == Settings::RendererBackend::OpenGL) {
auto c = static_cast<OpenGLSharedContext*>(main_context.get());
// Bind the shared contexts to the main surface in case the backend wants to take over
@@ -480,6 +486,7 @@ std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedCont
return std::make_unique<OpenGLSharedContext>(c->GetShareContext(),
child_widget->windowHandle());
}
+#endif
return std::make_unique<DummyContext>();
}
@@ -560,6 +567,7 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal
}
bool GRenderWindow::InitializeOpenGL() {
+#ifdef HAS_OPENGL
// TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground,
// WA_DontShowOnScreen, WA_DeleteOnClose
auto child = new OpenGLRenderWidget(this);
@@ -571,6 +579,11 @@ bool GRenderWindow::InitializeOpenGL() {
std::make_unique<OpenGLSharedContext>(context->GetShareContext(), child->windowHandle()));
return true;
+#else
+ QMessageBox::warning(this, tr("OpenGL not available!"),
+ tr("yuzu has not been compiled with OpenGL support."));
+ return false;
+#endif
}
bool GRenderWindow::InitializeVulkan() {