diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index 0528922fbea..896f3acaf70 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -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(); + fn->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + } +#endif #if defined(BUILD_GLES2) || defined(BUILD_GLES3) if (m_supportsShaders && m_shader.passes) { diff --git a/src/platform/qt/OpenGLBug.cpp b/src/platform/qt/OpenGLBug.cpp index e00310c5669..df007c1cb97 100644 --- a/src/platform/qt/OpenGLBug.cpp +++ b/src/platform/qt/OpenGLBug.cpp @@ -18,6 +18,7 @@ bool glContextHasBug(OpenGLBug bug) { QOpenGLFunctions* fn = context->functions(); QString vendor(reinterpret_cast(fn->glGetString(GL_VENDOR))); QString renderer(reinterpret_cast(fn->glGetString(GL_RENDERER))); + QString version(reinterpret_cast(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; } diff --git a/src/platform/qt/OpenGLBug.h b/src/platform/qt/OpenGLBug.h index fda0ed55592..5b5bc77360b 100644 --- a/src/platform/qt/OpenGLBug.h +++ b/src/platform/qt/OpenGLBug.h @@ -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);