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
455e34edcf
commit
86bcbf1716
|
@ -123,6 +123,7 @@ set(SOURCE_FILES
|
|||
MessagePainter.cpp
|
||||
MultiplayerController.cpp
|
||||
ObjView.cpp
|
||||
OpenGLBug.cpp
|
||||
OverrideView.cpp
|
||||
PaletteView.cpp
|
||||
PlacementControl.cpp
|
||||
|
|
|
@ -44,6 +44,8 @@ using QOpenGLFunctions_Baseline = QOpenGLFunctions_3_2_Core;
|
|||
#define OVERHEAD_NSEC 300000
|
||||
#endif
|
||||
|
||||
#include "OpenGLBug.h"
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
QHash<QSurfaceFormat, bool> DisplayGL::s_supports;
|
||||
|
@ -959,7 +961,12 @@ QOpenGLContext* PainterGL::shareContext() {
|
|||
|
||||
void PainterGL::updateFramebufferHandle() {
|
||||
QOpenGLFunctions_Baseline* fn = m_gl->versionFunctions<QOpenGLFunctions_Baseline>();
|
||||
fn->glFlush();
|
||||
// TODO: Figure out why glFlush doesn't work here on Intel/Windows
|
||||
if (glContextHasBug(OpenGLBug::CROSS_THREAD_FLUSH)) {
|
||||
fn->glFinish();
|
||||
} else {
|
||||
fn->glFlush();
|
||||
}
|
||||
|
||||
CoreController::Interrupter interrupter(m_context);
|
||||
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