qt: Disable OpenGL 3.0 renderer for macOS.

Until it's figured out, macOS has dummy implementation to keep it
building.
This commit is contained in:
ts-korhonen
2022-02-27 21:57:14 +02:00
parent 4ec8e80042
commit d3b00ff27b
4 changed files with 63 additions and 8 deletions

View File

@@ -49,13 +49,6 @@ add_library(ui STATIC
qt_softwarerenderer.hpp
qt_hardwarerenderer.cpp
qt_hardwarerenderer.hpp
qt_openglrenderer.cpp
qt_openglrenderer.hpp
qt_opengloptions.cpp
qt_opengloptions.hpp
qt_opengloptionsdialog.cpp
qt_opengloptionsdialog.hpp
qt_opengloptionsdialog.ui
qt_settings.cpp
qt_settings.hpp
@@ -137,6 +130,19 @@ add_library(ui STATIC
../qt_resources.qrc
)
if(NOT APPLE)
target_sources(ui PRIVATE
qt_openglrenderer.cpp
qt_openglrenderer.hpp
qt_opengloptions.cpp
qt_opengloptions.hpp
qt_opengloptionsdialog.cpp
qt_opengloptionsdialog.hpp
qt_opengloptionsdialog.ui
)
else()
target_sources(ui PRIVATE qt_opengldummy.hpp)
endif()
if(WIN32)
enable_language(RC)

View File

@@ -231,6 +231,9 @@ MainWindow::MainWindow(QWidget *parent) :
ui->actionHardware_Renderer_OpenGL_ES->setVisible(QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES);
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGLES && vid_api == 2) vid_api = 1;
#endif
#ifdef Q_OS_MACOS
ui->actionOpenGL_3_0_Core->setVisible(false);
#endif
if (QApplication::platformName().contains("eglfs") && vid_api >= 1) {
fprintf(stderr, "OpenGL renderers are unsupported on EGLFS.\n");

40
src/qt/qt_opengldummy.hpp Normal file
View File

@@ -0,0 +1,40 @@
#ifndef QT_OPENGLDUMMY_HPP
#define QT_OPENGLDUMMY_HPP
#include <QResizeEvent>
#include <QWidget>
#include <QWindow>
#include <atomic>
#include <tuple>
#include <vector>
#include "qt_renderercommon.hpp"
/* Dummy implementation of OpenGLRenderer so macOS builds. */
class OpenGLRenderer : public QWindow, public RendererCommon {
Q_OBJECT
public:
OpenGLRenderer(QWidget *parent = nullptr) { emit errorInitializing(); }
virtual std::vector<std::tuple<uint8_t *, std::atomic_flag *>> getBuffers() { return std::vector<std::tuple<uint8_t *, std::atomic_flag *>>(); }
signals:
void initialized();
void errorInitializing();
public slots:
void onBlit(int buf_idx, int x, int y, int w, int h) { }
protected:
void exposeEvent(QExposeEvent *event) override
{
if (!done)
emit errorInitializing();
done = true;
}
private:
bool done = false;
};
#endif

View File

@@ -22,15 +22,21 @@
#include "ui_qt_rendererstack.h"
#include "qt_hardwarerenderer.hpp"
#include "qt_openglrenderer.hpp"
#include "qt_softwarerenderer.hpp"
#ifndef Q_OS_MACOS
# include "qt_openglrenderer.hpp"
#else
# include "qt_opengldummy.hpp"
#endif
#include "qt_mainwindow.hpp"
#include "qt_util.hpp"
#include "evdev_mouse.hpp"
#include <QScreen>
#include <QTimer>
#ifdef __APPLE__
# include <CoreGraphics/CoreGraphics.h>