aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2020-05-27 21:29:47 +0200
committerArisotura <thetotalworm@gmail.com>2020-05-27 21:29:47 +0200
commitef2802ae31c4af965457216a190535b41efe749d (patch)
treea7dcdf5b0cb42bb3770b1d04438f6c3ca02e1b8f /src/frontend/qt_sdl
parent256360aebba709d7b8565cd35bd9d42473219fd5 (diff)
* use GL shim window instead of offscreen surface
* disable vsync by default (we'll take care of it later)
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r--src/frontend/qt_sdl/main.cpp19
-rw-r--r--src/frontend/qt_sdl/main.h13
2 files changed, 29 insertions, 3 deletions
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp
index 096b91c..8f2a61e 100644
--- a/src/frontend/qt_sdl/main.cpp
+++ b/src/frontend/qt_sdl/main.cpp
@@ -268,7 +268,7 @@ void EmuThread::initOpenGL()
QOpenGLContext* windowctx = mainWindow->getOGLContext();
QSurfaceFormat format = windowctx->format();
- oglSurface = new QOffscreenSurface();
+ /*oglSurface = new QOffscreenSurface();
oglSurface->setFormat(format);
oglSurface->create();
if (!oglSurface->isValid())
@@ -277,7 +277,8 @@ void EmuThread::initOpenGL()
printf("oglSurface shat itself :(\n");
delete oglSurface;
return;
- }
+ }*/
+ oglSurface = new GLShim(format);
oglContext = new QOpenGLContext();//oglSurface);
oglContext->setFormat(oglSurface->format());
@@ -957,6 +958,19 @@ void ScreenPanelGL::onScreenLayoutChanged()
}
+GLShim::GLShim(QSurfaceFormat& format) : QWindow()
+{
+ setSurfaceType(QSurface::OpenGLSurface);
+ setFormat(format);
+ create();
+ hide();
+}
+
+GLShim::~GLShim()
+{
+}
+
+
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
{
setWindowTitle("melonDS " MELONDS_VERSION);
@@ -1835,6 +1849,7 @@ int main(int argc, char** argv)
format.setStencilBufferSize(8);
format.setVersion(3, 2);
format.setProfile(QSurfaceFormat::CoreProfile);
+ format.setSwapInterval(0);
QSurfaceFormat::setDefaultFormat(format);
audioSync = SDL_CreateCond();
diff --git a/src/frontend/qt_sdl/main.h b/src/frontend/qt_sdl/main.h
index 67c93d0..2a24960 100644
--- a/src/frontend/qt_sdl/main.h
+++ b/src/frontend/qt_sdl/main.h
@@ -21,6 +21,7 @@
#include <QThread>
#include <QWidget>
+#include <QWindow>
#include <QMainWindow>
#include <QImage>
#include <QActionGroup>
@@ -74,7 +75,7 @@ private:
int PrevEmuStatus;
int EmuRunning;
- QOffscreenSurface* oglSurface;
+ QSurface* oglSurface;
QOpenGLContext* oglContext;
};
@@ -162,6 +163,16 @@ private:
};
+class GLShim : public QWindow
+{
+ Q_OBJECT
+
+public:
+ explicit GLShim(QSurfaceFormat& format);
+ ~GLShim();
+};
+
+
class MainWindow : public QMainWindow
{
Q_OBJECT