diff options
| author | 2020-06-17 12:37:15 +0100 | |
|---|---|---|
| committer | 2020-06-18 15:47:44 +0100 | |
| commit | 778f86989a446e73133d893c6588c728e6fb2206 (patch) | |
| tree | f15de22f7373248aebe6fb0f45fe8a93bc85571d /src | |
| parent | memory_manager: Explicitly specifcy std::min<size_t> (diff) | |
| download | yuzu-778f86989a446e73133d893c6588c728e6fb2206.tar.gz yuzu-778f86989a446e73133d893c6588c728e6fb2206.tar.xz yuzu-778f86989a446e73133d893c6588c728e6fb2206.zip | |
bootmanager: Remove references to OpenGL for macOS
OpenGL macOS headers definitions clash heavily with each other
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 17 |
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) | |||
| 208 | copy_yuzu_unicorn_deps(yuzu) | 208 | copy_yuzu_unicorn_deps(yuzu) |
| 209 | endif() | 209 | endif() |
| 210 | 210 | ||
| 211 | if (NOT APPLE) | ||
| 212 | target_compile_definitions(yuzu PRIVATE HAS_OPENGL) | ||
| 213 | endif() | ||
| 214 | |||
| 211 | if (ENABLE_VULKAN) | 215 | if (ENABLE_VULKAN) |
| 212 | target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include) | 216 | target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include) |
| 213 | target_compile_definitions(yuzu PRIVATE HAS_VULKAN) | 217 | 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 @@ | |||
| 8 | #include <QHBoxLayout> | 8 | #include <QHBoxLayout> |
| 9 | #include <QKeyEvent> | 9 | #include <QKeyEvent> |
| 10 | #include <QMessageBox> | 10 | #include <QMessageBox> |
| 11 | #include <QOffscreenSurface> | ||
| 12 | #include <QOpenGLContext> | ||
| 13 | #include <QPainter> | 11 | #include <QPainter> |
| 14 | #include <QScreen> | 12 | #include <QScreen> |
| 15 | #include <QStringList> | 13 | #include <QStringList> |
| 16 | #include <QWindow> | 14 | #include <QWindow> |
| 17 | 15 | ||
| 16 | #ifdef HAS_OPENGL | ||
| 17 | #include <QOffscreenSurface> | ||
| 18 | #include <QOpenGLContext> | ||
| 19 | #endif | ||
| 20 | |||
| 18 | #if !defined(WIN32) && HAS_VULKAN | 21 | #if !defined(WIN32) && HAS_VULKAN |
| 19 | #include <qpa/qplatformnativeinterface.h> | 22 | #include <qpa/qplatformnativeinterface.h> |
| 20 | #endif | 23 | #endif |
| @@ -98,6 +101,7 @@ void EmuThread::run() { | |||
| 98 | #endif | 101 | #endif |
| 99 | } | 102 | } |
| 100 | 103 | ||
| 104 | #ifdef HAS_OPENGL | ||
| 101 | class OpenGLSharedContext : public Core::Frontend::GraphicsContext { | 105 | class OpenGLSharedContext : public Core::Frontend::GraphicsContext { |
| 102 | public: | 106 | public: |
| 103 | /// Create the original context that should be shared from | 107 | /// Create the original context that should be shared from |
| @@ -183,6 +187,7 @@ private: | |||
| 183 | std::unique_ptr<QOffscreenSurface> offscreen_surface{}; | 187 | std::unique_ptr<QOffscreenSurface> offscreen_surface{}; |
| 184 | QSurface* surface; | 188 | QSurface* surface; |
| 185 | }; | 189 | }; |
| 190 | #endif | ||
| 186 | 191 | ||
| 187 | class DummyContext : public Core::Frontend::GraphicsContext {}; | 192 | class DummyContext : public Core::Frontend::GraphicsContext {}; |
| 188 | 193 | ||
| @@ -473,6 +478,7 @@ void GRenderWindow::resizeEvent(QResizeEvent* event) { | |||
| 473 | } | 478 | } |
| 474 | 479 | ||
| 475 | std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const { | 480 | std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const { |
| 481 | #ifdef HAS_OPENGL | ||
| 476 | if (Settings::values.renderer_backend == Settings::RendererBackend::OpenGL) { | 482 | if (Settings::values.renderer_backend == Settings::RendererBackend::OpenGL) { |
| 477 | auto c = static_cast<OpenGLSharedContext*>(main_context.get()); | 483 | auto c = static_cast<OpenGLSharedContext*>(main_context.get()); |
| 478 | // Bind the shared contexts to the main surface in case the backend wants to take over | 484 | // 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 | |||
| 480 | return std::make_unique<OpenGLSharedContext>(c->GetShareContext(), | 486 | return std::make_unique<OpenGLSharedContext>(c->GetShareContext(), |
| 481 | child_widget->windowHandle()); | 487 | child_widget->windowHandle()); |
| 482 | } | 488 | } |
| 489 | #endif | ||
| 483 | return std::make_unique<DummyContext>(); | 490 | return std::make_unique<DummyContext>(); |
| 484 | } | 491 | } |
| 485 | 492 | ||
| @@ -560,6 +567,7 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal | |||
| 560 | } | 567 | } |
| 561 | 568 | ||
| 562 | bool GRenderWindow::InitializeOpenGL() { | 569 | bool GRenderWindow::InitializeOpenGL() { |
| 570 | #ifdef HAS_OPENGL | ||
| 563 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, | 571 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, |
| 564 | // WA_DontShowOnScreen, WA_DeleteOnClose | 572 | // WA_DontShowOnScreen, WA_DeleteOnClose |
| 565 | auto child = new OpenGLRenderWidget(this); | 573 | auto child = new OpenGLRenderWidget(this); |
| @@ -571,6 +579,11 @@ bool GRenderWindow::InitializeOpenGL() { | |||
| 571 | std::make_unique<OpenGLSharedContext>(context->GetShareContext(), child->windowHandle())); | 579 | std::make_unique<OpenGLSharedContext>(context->GetShareContext(), child->windowHandle())); |
| 572 | 580 | ||
| 573 | return true; | 581 | return true; |
| 582 | #else | ||
| 583 | QMessageBox::warning(this, tr("OpenGL not available!"), | ||
| 584 | tr("yuzu has not been compiled with OpenGL support.")); | ||
| 585 | return false; | ||
| 586 | #endif | ||
| 574 | } | 587 | } |
| 575 | 588 | ||
| 576 | bool GRenderWindow::InitializeVulkan() { | 589 | bool GRenderWindow::InitializeVulkan() { |