mirror of https://github.com/mgba-emu/mgba.git
Qt: Show a dummy shader settings tab if shaders aren't supported
This commit is contained in:
parent
67c3c40989
commit
afff68cfc0
1
CHANGES
1
CHANGES
|
@ -58,6 +58,7 @@ Misc:
|
||||||
- Qt: Pass logging context through to video proxy thread (fixes mgba.io/i/3095)
|
- Qt: Pass logging context through to video proxy thread (fixes mgba.io/i/3095)
|
||||||
- Qt: Show maker code and game version in ROM info
|
- Qt: Show maker code and game version in ROM info
|
||||||
- Qt: Make window corners square on Windows 11 (fixes mgba.io/i/3285)
|
- Qt: Make window corners square on Windows 11 (fixes mgba.io/i/3285)
|
||||||
|
- Qt: Show a dummy shader settings tab if shaders aren't supported
|
||||||
- Res: Port NSO-gba-colors shader (closes mgba.io/i/2834)
|
- Res: Port NSO-gba-colors shader (closes mgba.io/i/2834)
|
||||||
- Scripting: Add `callbacks:oneshot` for single-call callbacks
|
- Scripting: Add `callbacks:oneshot` for single-call callbacks
|
||||||
- Switch: Add bilinear filtering option (closes mgba.io/i/3111)
|
- Switch: Add bilinear filtering option (closes mgba.io/i/3111)
|
||||||
|
|
|
@ -397,29 +397,38 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
|
||||||
shortcutView->setController(shortcutController);
|
shortcutView->setController(shortcutController);
|
||||||
shortcutView->setInputController(inputController);
|
shortcutView->setInputController(inputController);
|
||||||
addPage(tr("Shortcuts"), shortcutView, Page::SHORTCUTS);
|
addPage(tr("Shortcuts"), shortcutView, Page::SHORTCUTS);
|
||||||
|
|
||||||
|
#if defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||||
|
m_dummyShader = new QLabel(tr("Shaders are not supported when the display driver is not OpenGL.\n\n"
|
||||||
|
"If it is set to OpenGL and you still see this, your graphics card or drivers may be too old."));
|
||||||
|
m_dummyShader->setWordWrap(true);
|
||||||
|
m_dummyShader->setAlignment(Qt::AlignCenter);
|
||||||
|
addPage(tr("Shaders"), m_dummyShader, Page::SHADERS);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsView::~SettingsView() {
|
SettingsView::~SettingsView() {
|
||||||
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
#if defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||||
setShaderSelector(nullptr);
|
if (m_shader) {
|
||||||
|
m_shader->setParent(nullptr);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
|
void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
|
||||||
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
#if defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||||
if (m_shader) {
|
auto items = m_ui.tabs->findItems(tr("Shaders"), Qt::MatchFixedString);
|
||||||
auto items = m_ui.tabs->findItems(tr("Shaders"), Qt::MatchFixedString);
|
for (QListWidgetItem* item : items) {
|
||||||
for (const auto& item : items) {
|
delete item;
|
||||||
m_ui.tabs->removeItemWidget(item);
|
}
|
||||||
}
|
if (!m_shader) {
|
||||||
m_ui.stackedWidget->removeWidget(m_shader);
|
m_ui.stackedWidget->removeWidget(m_dummyShader);
|
||||||
m_shader->setParent(nullptr);
|
|
||||||
}
|
}
|
||||||
m_shader = shaderSelector;
|
m_shader = shaderSelector;
|
||||||
if (shaderSelector) {
|
if (shaderSelector) {
|
||||||
m_ui.stackedWidget->addWidget(m_shader);
|
addPage(tr("Shaders"), m_shader, Page::SHADERS);
|
||||||
m_ui.tabs->addItem(tr("Shaders"));
|
} else {
|
||||||
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, m_shader, &ShaderSelector::saved);
|
addPage(tr("Shaders"), m_dummyShader, Page::SHADERS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -579,7 +588,6 @@ void SettingsView::updateConfig() {
|
||||||
if (displayDriver != m_controller->getQtOption("displayDriver")) {
|
if (displayDriver != m_controller->getQtOption("displayDriver")) {
|
||||||
m_controller->setQtOption("displayDriver", displayDriver);
|
m_controller->setQtOption("displayDriver", displayDriver);
|
||||||
Display::setDriver(static_cast<Display::Driver>(displayDriver.toInt()));
|
Display::setDriver(static_cast<Display::Driver>(displayDriver.toInt()));
|
||||||
setShaderSelector(nullptr);
|
|
||||||
emit displayDriverChanged();
|
emit displayDriverChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ public:
|
||||||
SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, LogController* logController, QWidget* parent = nullptr);
|
SettingsView(ConfigController* controller, InputController* inputController, ShortcutController* shortcutController, LogController* logController, QWidget* parent = nullptr);
|
||||||
~SettingsView();
|
~SettingsView();
|
||||||
|
|
||||||
void setShaderSelector(ShaderSelector* shaderSelector);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void biosLoaded(int platform, const QString&);
|
void biosLoaded(int platform, const QString&);
|
||||||
void audioDriverChanged();
|
void audioDriverChanged();
|
||||||
|
@ -66,6 +64,7 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void selectPage(Page);
|
void selectPage(Page);
|
||||||
|
void setShaderSelector(ShaderSelector* shaderSelector);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void selectBios(QLineEdit*);
|
void selectBios(QLineEdit*);
|
||||||
|
@ -81,6 +80,7 @@ private:
|
||||||
ConfigController* m_controller;
|
ConfigController* m_controller;
|
||||||
InputController* m_input;
|
InputController* m_input;
|
||||||
ShaderSelector* m_shader = nullptr;
|
ShaderSelector* m_shader = nullptr;
|
||||||
|
QLabel* m_dummyShader;
|
||||||
LogConfigModel m_logModel;
|
LogConfigModel m_logModel;
|
||||||
QTimer m_checkTimer;
|
QTimer m_checkTimer;
|
||||||
|
|
||||||
|
|
|
@ -550,6 +550,7 @@ void Window::openSettingsWindow(SettingsView::Page page) {
|
||||||
#ifdef USE_SQLITE3
|
#ifdef USE_SQLITE3
|
||||||
connect(settingsWindow, &SettingsView::libraryCleared, m_libraryView, &LibraryController::clear);
|
connect(settingsWindow, &SettingsView::libraryCleared, m_libraryView, &LibraryController::clear);
|
||||||
#endif
|
#endif
|
||||||
|
connect(this, &Window::shaderSelectorAdded, settingsWindow, &SettingsView::setShaderSelector);
|
||||||
openView(settingsWindow);
|
openView(settingsWindow);
|
||||||
settingsWindow->selectPage(page);
|
settingsWindow->selectPage(page);
|
||||||
}
|
}
|
||||||
|
@ -1050,7 +1051,12 @@ void Window::reloadDisplayDriver() {
|
||||||
}
|
}
|
||||||
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
||||||
m_shaderView.reset();
|
m_shaderView.reset();
|
||||||
m_shaderView = std::make_unique<ShaderSelector>(m_display.get(), m_config);
|
if (m_display->supportsShaders()) {
|
||||||
|
m_shaderView = std::make_unique<ShaderSelector>(m_display.get(), m_config);
|
||||||
|
emit shaderSelectorAdded(m_shaderView.get());
|
||||||
|
} else {
|
||||||
|
emit shaderSelectorAdded(nullptr);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect(m_display.get(), &QGBA::Display::hideCursor, [this]() {
|
connect(m_display.get(), &QGBA::Display::hideCursor, [this]() {
|
||||||
|
|
|
@ -73,6 +73,7 @@ signals:
|
||||||
void startDrawing();
|
void startDrawing();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
void paused(bool);
|
void paused(bool);
|
||||||
|
void shaderSelectorAdded(ShaderSelector*);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setController(CoreController* controller, const QString& fname);
|
void setController(CoreController* controller, const QString& fname);
|
||||||
|
|
Loading…
Reference in New Issue