mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
No more context mess (#1531)
* WIP: use Duckstation's context code to directly render into QT Widget from separate thread without two OpenGL contexts currently only works on Windows * reenable gay OSD * add back vsync * make it atleast a little more thread safe * linux support * don't segfault on closing * reorganise and cleanup build system it's still not good, but better than before * macos? * try to get it working on Ubuntu CI also update instructions * let's try this * ok how about this * try creating an OGL 4.3 context first (https://i.kym-cdn.com/photos/images/original/001/264/842/220.png) * fix Ubuntu * hm * try again for Windows * let's try this * make the OpenGL renderer work again that was stupid * do OGL surface resizing from the mainthread * Fix small mistake in GL context creation on macOS causing version 3.2 to be considered invalid * C stupidness * cleanup * don't let the emuthread deinit OGL if there's no OGL * reset lastScreenWidth/Height when deiniting OpenGL * disable stencil test while drawing framebuffers * macOS: Link Cocoa framework explicitly when not building with Qt6 Seems to be needed for the classes used by DuckStation's GL context code. * Set ScreenPanelGL's minimum size immediately Fixes GL context creation for OpenGL display on macOS using the wrong size as the underlying window was not resized to the correct size by Qt yet. * don't emit window updates when OGL display is used * stuff Arisotura said Co-authored-by: Nadia Holmquist Pedersen <nadia@nhp.sh>
This commit is contained in:
@ -28,6 +28,11 @@
|
||||
#include "ui_VideoSettingsDialog.h"
|
||||
|
||||
|
||||
inline bool UsesGL()
|
||||
{
|
||||
return (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||
}
|
||||
|
||||
VideoSettingsDialog* VideoSettingsDialog::currentDlg = nullptr;
|
||||
|
||||
|
||||
@ -73,6 +78,7 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
|
||||
|
||||
if (!Config::ScreenVSync)
|
||||
ui->sbVSyncInterval->setEnabled(false);
|
||||
setVsyncControlEnable(UsesGL());
|
||||
|
||||
if (Config::_3DRenderer == 0)
|
||||
{
|
||||
@ -88,14 +94,6 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
|
||||
ui->cbxGLResolution->setEnabled(true);
|
||||
ui->cbBetterPolygons->setEnabled(true);
|
||||
}
|
||||
|
||||
// sorry
|
||||
ui->cbVSync->hide();
|
||||
ui->cbVSync->setEnabled(false);
|
||||
ui->sbVSyncInterval->hide();
|
||||
ui->sbVSyncInterval->setEnabled(false);
|
||||
ui->label_2->hide();
|
||||
ui->groupBox->layout()->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||
}
|
||||
|
||||
VideoSettingsDialog::~VideoSettingsDialog()
|
||||
@ -112,7 +110,7 @@ void VideoSettingsDialog::on_VideoSettingsDialog_accepted()
|
||||
|
||||
void VideoSettingsDialog::on_VideoSettingsDialog_rejected()
|
||||
{
|
||||
bool old_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||
bool old_gl = UsesGL();
|
||||
|
||||
Config::_3DRenderer = oldRenderer;
|
||||
Config::ScreenUseGL = oldGLDisplay;
|
||||
@ -122,12 +120,17 @@ void VideoSettingsDialog::on_VideoSettingsDialog_rejected()
|
||||
Config::GL_ScaleFactor = oldGLScale;
|
||||
Config::GL_BetterPolygons = oldGLBetterPolygons;
|
||||
|
||||
bool new_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||
emit updateVideoSettings(old_gl != new_gl);
|
||||
emit updateVideoSettings(old_gl != UsesGL());
|
||||
|
||||
closeDlg();
|
||||
}
|
||||
|
||||
void VideoSettingsDialog::setVsyncControlEnable(bool hasOGL)
|
||||
{
|
||||
ui->cbVSync->setEnabled(hasOGL);
|
||||
ui->sbVSyncInterval->setEnabled(hasOGL);
|
||||
}
|
||||
|
||||
void VideoSettingsDialog::onChange3DRenderer(int renderer)
|
||||
{
|
||||
bool old_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||
@ -149,8 +152,7 @@ void VideoSettingsDialog::onChange3DRenderer(int renderer)
|
||||
ui->cbBetterPolygons->setEnabled(true);
|
||||
}
|
||||
|
||||
bool new_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||
emit updateVideoSettings(old_gl != new_gl);
|
||||
emit updateVideoSettings(old_gl != UsesGL());
|
||||
}
|
||||
|
||||
void VideoSettingsDialog::on_cbGLDisplay_stateChanged(int state)
|
||||
@ -159,8 +161,9 @@ void VideoSettingsDialog::on_cbGLDisplay_stateChanged(int state)
|
||||
|
||||
Config::ScreenUseGL = (state != 0);
|
||||
|
||||
bool new_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||
emit updateVideoSettings(old_gl != new_gl);
|
||||
setVsyncControlEnable(UsesGL());
|
||||
|
||||
emit updateVideoSettings(old_gl != UsesGL());
|
||||
}
|
||||
|
||||
void VideoSettingsDialog::on_cbVSync_stateChanged(int state)
|
||||
@ -168,11 +171,13 @@ void VideoSettingsDialog::on_cbVSync_stateChanged(int state)
|
||||
bool vsync = (state != 0);
|
||||
ui->sbVSyncInterval->setEnabled(vsync);
|
||||
Config::ScreenVSync = vsync;
|
||||
emit updateVideoSettings(false);
|
||||
}
|
||||
|
||||
void VideoSettingsDialog::on_sbVSyncInterval_valueChanged(int val)
|
||||
{
|
||||
Config::ScreenVSyncInterval = val;
|
||||
emit updateVideoSettings(false);
|
||||
}
|
||||
|
||||
void VideoSettingsDialog::on_cbSoftwareThreaded_stateChanged(int state)
|
||||
@ -189,6 +194,8 @@ void VideoSettingsDialog::on_cbxGLResolution_currentIndexChanged(int idx)
|
||||
|
||||
Config::GL_ScaleFactor = idx+1;
|
||||
|
||||
setVsyncControlEnable(UsesGL());
|
||||
|
||||
emit updateVideoSettings(false);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user