Qt: Fix GL-less build (fixes #788)

This commit is contained in:
Vicki Pfau 2017-07-11 09:59:01 -07:00
parent 5167fce4c7
commit 6e03d88818
5 changed files with 19 additions and 0 deletions

View File

@ -179,6 +179,7 @@ Bugfixes:
- GB Audio: Fix zombie mode bit masking - GB Audio: Fix zombie mode bit masking
- GBA Timer: Fix count-up timing overflowing timer 3 - GBA Timer: Fix count-up timing overflowing timer 3
- Core: Fix rewinding getting out of sync (fixes mgba.io/i/791) - Core: Fix rewinding getting out of sync (fixes mgba.io/i/791)
- Qt: Fix GL-less build
Misc: Misc:
- Qt: Add language selector - Qt: Add language selector
- GBA Timer: Improve accuracy of timers - GBA Timer: Improve accuracy of timers

View File

@ -187,17 +187,21 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
} }
SettingsView::~SettingsView() { SettingsView::~SettingsView() {
#if defined(BUILD_GL) || defined(BUILD_GLES)
if (m_shader) { if (m_shader) {
m_ui.stackedWidget->removeWidget(m_shader); m_ui.stackedWidget->removeWidget(m_shader);
m_shader->setParent(nullptr); m_shader->setParent(nullptr);
} }
#endif
} }
void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) { void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
#if defined(BUILD_GL) || defined(BUILD_GLES)
m_shader = shaderSelector; m_shader = shaderSelector;
m_ui.stackedWidget->addWidget(m_shader); m_ui.stackedWidget->addWidget(m_shader);
m_ui.tabs->addItem(tr("Shaders")); m_ui.tabs->addItem(tr("Shaders"));
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, m_shader, &ShaderSelector::saved); connect(m_ui.buttonBox, &QDialogButtonBox::accepted, m_shader, &ShaderSelector::saved);
#endif
} }
void SettingsView::selectBios(QLineEdit* bios) { void SettingsView::selectBios(QLineEdit* bios) {

View File

@ -21,6 +21,8 @@
#include <mgba-util/vfs.h> #include <mgba-util/vfs.h>
#include "platform/video-backend.h" #include "platform/video-backend.h"
#if defined(BUILD_GL) || defined(BUILD_GLES)
#if !defined(_WIN32) || defined(USE_EPOXY) #if !defined(_WIN32) || defined(USE_EPOXY)
#include "platform/opengl/gles2.h" #include "platform/opengl/gles2.h"
#endif #endif
@ -280,3 +282,5 @@ void ShaderSelector::buttonPressed(QAbstractButton* button) {
break; break;
} }
} }
#endif

View File

@ -6,6 +6,8 @@
#ifndef QGBA_SHADER_SELECTOR_H #ifndef QGBA_SHADER_SELECTOR_H
#define QGBA_SHADER_SELECTOR_H #define QGBA_SHADER_SELECTOR_H
#if defined(BUILD_GL) || defined(BUILD_GLES)
#include <QDialog> #include <QDialog>
#include "ui_ShaderSelector.h" #include "ui_ShaderSelector.h"
@ -56,3 +58,5 @@ private:
} }
#endif #endif
#endif

View File

@ -78,7 +78,9 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
updateTitle(); updateTitle();
m_display = Display::create(this); m_display = Display::create(this);
#if defined(BUILD_GL) || defined(BUILD_GLES)
m_shaderView = new ShaderSelector(m_display, m_config); m_shaderView = new ShaderSelector(m_display, m_config);
#endif
m_logo.setDevicePixelRatio(m_screenWidget->devicePixelRatio()); m_logo.setDevicePixelRatio(m_screenWidget->devicePixelRatio());
m_logo = m_logo; // Free memory left over in old pixmap m_logo = m_logo; // Free memory left over in old pixmap
@ -274,6 +276,7 @@ void Window::loadConfig() {
enterFullScreen(); enterFullScreen();
} }
#if defined(BUILD_GL) || defined(BUILD_GLES)
if (opts->shader) { if (opts->shader) {
struct VDir* shader = VDirOpen(opts->shader); struct VDir* shader = VDirOpen(opts->shader);
if (shader) { if (shader) {
@ -282,6 +285,7 @@ void Window::loadConfig() {
shader->close(shader); shader->close(shader);
} }
} }
#endif
m_mruFiles = m_config->getMRU(); m_mruFiles = m_config->getMRU();
updateMRU(); updateMRU();
@ -459,9 +463,11 @@ void Window::exportSharkport() {
void Window::openSettingsWindow() { void Window::openSettingsWindow() {
SettingsView* settingsWindow = new SettingsView(m_config, &m_inputController, m_shortcutController); SettingsView* settingsWindow = new SettingsView(m_config, &m_inputController, m_shortcutController);
#if defined(BUILD_GL) || defined(BUILD_GLES)
if (m_display->supportsShaders()) { if (m_display->supportsShaders()) {
settingsWindow->setShaderSelector(m_shaderView); settingsWindow->setShaderSelector(m_shaderView);
} }
#endif
connect(settingsWindow, &SettingsView::biosLoaded, m_controller, &GameController::loadBIOS); connect(settingsWindow, &SettingsView::biosLoaded, m_controller, &GameController::loadBIOS);
connect(settingsWindow, &SettingsView::audioDriverChanged, m_controller, &GameController::reloadAudioDriver); connect(settingsWindow, &SettingsView::audioDriverChanged, m_controller, &GameController::reloadAudioDriver);
connect(settingsWindow, &SettingsView::displayDriverChanged, this, &Window::mustRestart); connect(settingsWindow, &SettingsView::displayDriverChanged, this, &Window::mustRestart);