bootmanager: Remove references to OpenGL for macOS

OpenGL macOS headers definitions clash heavily with each other
This commit is contained in:
MerryMage 2020-06-17 12:37:15 +01:00
parent b19fe55f84
commit 778f86989a
2 changed files with 19 additions and 2 deletions

View File

@ -208,6 +208,10 @@ if (MSVC)
copy_yuzu_unicorn_deps(yuzu) copy_yuzu_unicorn_deps(yuzu)
endif() endif()
if (NOT APPLE)
target_compile_definitions(yuzu PRIVATE HAS_OPENGL)
endif()
if (ENABLE_VULKAN) if (ENABLE_VULKAN)
target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include) target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include)
target_compile_definitions(yuzu PRIVATE HAS_VULKAN) target_compile_definitions(yuzu PRIVATE HAS_VULKAN)

View File

@ -8,13 +8,16 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMessageBox> #include <QMessageBox>
#include <QOffscreenSurface>
#include <QOpenGLContext>
#include <QPainter> #include <QPainter>
#include <QScreen> #include <QScreen>
#include <QStringList> #include <QStringList>
#include <QWindow> #include <QWindow>
#ifdef HAS_OPENGL
#include <QOffscreenSurface>
#include <QOpenGLContext>
#endif
#if !defined(WIN32) && HAS_VULKAN #if !defined(WIN32) && HAS_VULKAN
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
#endif #endif
@ -98,6 +101,7 @@ void EmuThread::run() {
#endif #endif
} }
#ifdef HAS_OPENGL
class OpenGLSharedContext : public Core::Frontend::GraphicsContext { class OpenGLSharedContext : public Core::Frontend::GraphicsContext {
public: public:
/// Create the original context that should be shared from /// Create the original context that should be shared from
@ -183,6 +187,7 @@ private:
std::unique_ptr<QOffscreenSurface> offscreen_surface{}; std::unique_ptr<QOffscreenSurface> offscreen_surface{};
QSurface* surface; QSurface* surface;
}; };
#endif
class DummyContext : public Core::Frontend::GraphicsContext {}; class DummyContext : public Core::Frontend::GraphicsContext {};
@ -473,6 +478,7 @@ void GRenderWindow::resizeEvent(QResizeEvent* event) {
} }
std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const { std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const {
#ifdef HAS_OPENGL
if (Settings::values.renderer_backend == Settings::RendererBackend::OpenGL) { if (Settings::values.renderer_backend == Settings::RendererBackend::OpenGL) {
auto c = static_cast<OpenGLSharedContext*>(main_context.get()); auto c = static_cast<OpenGLSharedContext*>(main_context.get());
// Bind the shared contexts to the main surface in case the backend wants to take over // 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(), return std::make_unique<OpenGLSharedContext>(c->GetShareContext(),
child_widget->windowHandle()); child_widget->windowHandle());
} }
#endif
return std::make_unique<DummyContext>(); return std::make_unique<DummyContext>();
} }
@ -560,6 +567,7 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal
} }
bool GRenderWindow::InitializeOpenGL() { bool GRenderWindow::InitializeOpenGL() {
#ifdef HAS_OPENGL
// TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground,
// WA_DontShowOnScreen, WA_DeleteOnClose // WA_DontShowOnScreen, WA_DeleteOnClose
auto child = new OpenGLRenderWidget(this); auto child = new OpenGLRenderWidget(this);
@ -571,6 +579,11 @@ bool GRenderWindow::InitializeOpenGL() {
std::make_unique<OpenGLSharedContext>(context->GetShareContext(), child->windowHandle())); std::make_unique<OpenGLSharedContext>(context->GetShareContext(), child->windowHandle()));
return true; 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() { bool GRenderWindow::InitializeVulkan() {