mirror of https://github.com/mgba-emu/mgba.git
Qt: Work around Mesa issue 8035
This commit is contained in:
parent
70e6470e8b
commit
9df06383b5
|
@ -670,8 +670,20 @@ void PainterGL::filter(bool filter) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef GL_DEBUG_OUTPUT_SYNCHRONOUS
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
|
||||
#endif
|
||||
|
||||
void PainterGL::start() {
|
||||
makeCurrent();
|
||||
#if defined(BUILD_GLES3) && !defined(Q_OS_MAC)
|
||||
if (glContextHasBug(OpenGLBug::GLTHREAD_BLOCKS_SWAP)) {
|
||||
// Suggested on Discord as a way to strongly hint that glthread should be disabled
|
||||
// See https://gitlab.freedesktop.org/mesa/mesa/-/issues/8035
|
||||
QOpenGLFunctions_Baseline* fn = m_gl->versionFunctions<QOpenGLFunctions_Baseline>();
|
||||
fn->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (m_supportsShaders && m_shader.passes) {
|
||||
|
|
|
@ -18,6 +18,7 @@ bool glContextHasBug(OpenGLBug bug) {
|
|||
QOpenGLFunctions* fn = context->functions();
|
||||
QString vendor(reinterpret_cast<const char*>(fn->glGetString(GL_VENDOR)));
|
||||
QString renderer(reinterpret_cast<const char*>(fn->glGetString(GL_RENDERER)));
|
||||
QString version(reinterpret_cast<const char*>(fn->glGetString(GL_VERSION)));
|
||||
|
||||
switch (bug) {
|
||||
case OpenGLBug::CROSS_THREAD_FLUSH:
|
||||
|
@ -26,6 +27,10 @@ bool glContextHasBug(OpenGLBug bug) {
|
|||
#else
|
||||
return vendor == "Intel";
|
||||
#endif
|
||||
|
||||
case OpenGLBug::GLTHREAD_BLOCKS_SWAP:
|
||||
return version.contains(" Mesa ");
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
namespace QGBA {
|
||||
|
||||
enum class OpenGLBug {
|
||||
// mgba.io/i/2761
|
||||
CROSS_THREAD_FLUSH
|
||||
CROSS_THREAD_FLUSH, // mgba.io/i/2761
|
||||
GLTHREAD_BLOCKS_SWAP, // mgba.io/i/2767
|
||||
};
|
||||
|
||||
bool glContextHasBug(OpenGLBug);
|
||||
|
|
Loading…
Reference in New Issue