From 08ad9b36d44e3cca0802bb1198036c5d77c844cc Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 25 Aug 2016 18:20:47 -0400 Subject: config: Add a setting for graphics V-Sync. --- src/citra_qt/bootmanager.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/citra_qt/bootmanager.cpp') diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 414b2f8af..a9669c559 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -119,6 +119,7 @@ GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) : QGLFormat fmt; fmt.setVersion(3,3); fmt.setProfile(QGLFormat::CoreProfile); + fmt.setSwapInterval(VideoCore::g_vsync_enabled); // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X fmt.setOption(QGL::NoDeprecatedFunctions); -- cgit v1.2.3 From 02702c66052c10b10ba0a6af6ab34734886d3728 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 29 Aug 2016 21:28:58 -0400 Subject: qt: Recreate GL context on startup to support changing V-Sync. --- src/citra_qt/bootmanager.cpp | 60 ++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'src/citra_qt/bootmanager.cpp') diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index a9669c559..6dddde9ba 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -107,37 +107,13 @@ private: }; GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) : - QWidget(parent), keyboard_id(0), emu_thread(emu_thread) { + QWidget(parent), keyboard_id(0), emu_thread(emu_thread), child(nullptr) { std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); setWindowTitle(QString::fromStdString(window_title)); keyboard_id = KeyMap::NewDeviceId(); ReloadSetKeymaps(); - - // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose - QGLFormat fmt; - fmt.setVersion(3,3); - fmt.setProfile(QGLFormat::CoreProfile); - fmt.setSwapInterval(VideoCore::g_vsync_enabled); - // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X - fmt.setOption(QGL::NoDeprecatedFunctions); - - child = new GGLWidgetInternal(fmt, this); - QBoxLayout* layout = new QHBoxLayout(this); - - resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); - layout->addWidget(child); - layout->setMargin(0); - setLayout(layout); - - OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); - - OnFramebufferSizeChanged(); - NotifyClientAreaSizeChanged(std::pair(child->width(), child->height())); - - BackupGeometry(); - } void GRenderWindow::moveContext() @@ -282,6 +258,40 @@ void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) NotifyClientAreaSizeChanged(std::make_pair(width, height)); } +void GRenderWindow::InitRenderTarget() { + if (child) { + delete child; + } + + if (layout()) { + delete layout(); + } + + // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose + QGLFormat fmt; + fmt.setVersion(3, 3); + fmt.setProfile(QGLFormat::CoreProfile); + fmt.setSwapInterval(Settings::values.use_vsync); + + // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X + fmt.setOption(QGL::NoDeprecatedFunctions); + + child = new GGLWidgetInternal(fmt, this); + QBoxLayout* layout = new QHBoxLayout(this); + + resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); + layout->addWidget(child); + layout->setMargin(0); + setLayout(layout); + + OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); + + OnFramebufferSizeChanged(); + NotifyClientAreaSizeChanged(std::pair(child->width(), child->height())); + + BackupGeometry(); +} + void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) { setMinimumSize(minimal_size.first, minimal_size.second); } -- cgit v1.2.3