mirror of https://github.com/mgba-emu/mgba.git
Qt: Start OpenGL bug list with glFlush cross-thread on Windows (fixes #2761)
This commit is contained in:
parent
fac26cda3c
commit
63a019b749
|
@ -118,6 +118,7 @@ set(SOURCE_FILES
|
||||||
MessagePainter.cpp
|
MessagePainter.cpp
|
||||||
MultiplayerController.cpp
|
MultiplayerController.cpp
|
||||||
ObjView.cpp
|
ObjView.cpp
|
||||||
|
OpenGLBug.cpp
|
||||||
OverrideView.cpp
|
OverrideView.cpp
|
||||||
PaletteView.cpp
|
PaletteView.cpp
|
||||||
PlacementControl.cpp
|
PlacementControl.cpp
|
||||||
|
|
|
@ -44,6 +44,8 @@ using QOpenGLFunctions_Baseline = QOpenGLFunctions_3_2_Core;
|
||||||
#define OVERHEAD_NSEC 300000
|
#define OVERHEAD_NSEC 300000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "OpenGLBug.h"
|
||||||
|
|
||||||
using namespace QGBA;
|
using namespace QGBA;
|
||||||
|
|
||||||
QHash<QSurfaceFormat, bool> DisplayGL::s_supports;
|
QHash<QSurfaceFormat, bool> DisplayGL::s_supports;
|
||||||
|
@ -959,7 +961,12 @@ QOpenGLContext* PainterGL::shareContext() {
|
||||||
|
|
||||||
void PainterGL::updateFramebufferHandle() {
|
void PainterGL::updateFramebufferHandle() {
|
||||||
QOpenGLFunctions_Baseline* fn = m_gl->versionFunctions<QOpenGLFunctions_Baseline>();
|
QOpenGLFunctions_Baseline* fn = m_gl->versionFunctions<QOpenGLFunctions_Baseline>();
|
||||||
|
// TODO: Figure out why glFlush doesn't work here on Intel/Windows
|
||||||
|
if (glContextHasBug(OpenGLBug::CROSS_THREAD_FLUSH)) {
|
||||||
|
fn->glFinish();
|
||||||
|
} else {
|
||||||
fn->glFlush();
|
fn->glFlush();
|
||||||
|
}
|
||||||
|
|
||||||
CoreController::Interrupter interrupter(m_context);
|
CoreController::Interrupter interrupter(m_context);
|
||||||
if (!m_context->hardwareAccelerated()) {
|
if (!m_context->hardwareAccelerated()) {
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/* Copyright (c) 2013-2022 Jeffrey Pfau
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
#include "OpenGLBug.h"
|
||||||
|
|
||||||
|
#include <QOpenGLContext>
|
||||||
|
#include <QOpenGLFunctions>
|
||||||
|
|
||||||
|
namespace QGBA {
|
||||||
|
|
||||||
|
bool glContextHasBug(OpenGLBug bug) {
|
||||||
|
QOpenGLContext* context = QOpenGLContext::currentContext();
|
||||||
|
if (!context) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
QOpenGLFunctions* fn = context->functions();
|
||||||
|
QString vendor(reinterpret_cast<const char*>(fn->glGetString(GL_VENDOR)));
|
||||||
|
QString renderer(reinterpret_cast<const char*>(fn->glGetString(GL_RENDERER)));
|
||||||
|
|
||||||
|
switch (bug) {
|
||||||
|
case OpenGLBug::CROSS_THREAD_FLUSH:
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
return vendor == "Intel";
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
/* Copyright (c) 2013-2022 Jeffrey Pfau
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace QGBA {
|
||||||
|
|
||||||
|
enum class OpenGLBug {
|
||||||
|
// mgba.io/i/2761
|
||||||
|
CROSS_THREAD_FLUSH
|
||||||
|
};
|
||||||
|
|
||||||
|
bool glContextHasBug(OpenGLBug);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue