From 4034daa12ebeea3ac6afe896e914853ecbd981f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 16 Jun 2021 20:15:28 +0200 Subject: [PATCH] Enable glyph cache workaround for Apple M-family of GPUs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without the workaround, and when using a Core GL profile, we hit a code path in QSGOpenGLDistanceFieldGlyphCache::resizeTexture() that produced corrupt glyphs on M1 hardware. We fix this by enabling the workaround, so that the user doesn't have to set QT_ENABLE_GLYPH_CACHE_WORKAROUND themselves. None-Core contexts do not have this problem, but the logic in QOpenGLContext does not account for recreated contexts with different formats, so we can't limit the workaround to Core formats only. With the unified memory architecture of the M1 hardware, the workaround should have limited negative effects. In Qt 6 this is not a problem, since Qt Declarative effectively always uses the workaround code-path, but it's worth recording the fact that we need the workaround. Fixes: QTBUG-89379 Change-Id: Icfd8b8b23c0dcda3fea8663d81d0e225134eec5e Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Laszlo Agocs (cherry picked from commit aeeaa7d253239b4b45e419bcad5cfde5c5714080) Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qopenglcontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index e8c64bdc01f..5124510c0de 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1023,7 +1023,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) || qstrcmp(rendererString, "GC800 core") == 0 || qstrcmp(rendererString, "GC1000 core") == 0 || strstr(rendererString, "GC2000") != 0 - || qstrcmp(rendererString, "Immersion.16") == 0; + || qstrcmp(rendererString, "Immersion.16") == 0 + || qstrncmp(rendererString, "Apple Mx", 7) == 0; } needsWorkaroundSet = true; }