History

Disable chromium distance field text rendering on ATI GPUs

Bradley Austin Davis committed 8 years ago

Commit e7e9ca41 parent aa197941 file · +54 −38Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+54−38
@@ -2614,10 +2614,55 @@ void Application::initializeGL() { · 2613 unmodified lines
26142614 _isGLInitialized = true;
26152615 }
26162616
2617− _glWidget->makeCurrent();
2618− glClearColor(0.2f, 0.2f, 0.2f, 1);
2619− glClear(GL_COLOR_BUFFER_BIT);
2620− _glWidget->swapBuffers();
2617+ if (!_glWidget->makeCurrent()) {
2618+ qCWarning(interfaceapp, "Unable to make window context current");
2619+ }
2620+
2621+#if !defined(DISABLE_QML)
2622+ // Build a shared canvas / context for the Chromium processes
2623+ {
2624+ // Disable signed distance field font rendering on ATI/AMD GPUs, due to
2625+ // https://highfidelity.manuscript.com/f/cases/13677/Text-showing-up-white-on-Marketplace-app
2626+ std::string vendor{ (const char*)glGetString(GL_VENDOR) };
2627+ if ((vendor.find("AMD") != std::string::npos) || (vendor.find("ATI") != std::string::npos)) {
2628+ qputenv("QTWEBENGINE_CHROMIUM_FLAGS", QByteArray("--disable-distance-field-text"));
2629+ }
2630+
2631+ // Chromium rendering uses some GL functions that prevent nSight from capturing
2632+ // frames, so we only create the shared context if nsight is NOT active.
2633+ if (!nsightActive()) {
2634+ _chromiumShareContext = new OffscreenGLCanvas();
2635+ _chromiumShareContext->setObjectName("ChromiumShareContext");
2636+ _chromiumShareContext->create(_glWidget->qglContext());
2637+ if (!_chromiumShareContext->makeCurrent()) {
2638+ qCWarning(interfaceapp, "Unable to make chromium shared context current");
2639+ }
2640+ qt_gl_set_global_share_context(_chromiumShareContext->getContext());
2641+ _chromiumShareContext->doneCurrent();
2642+ // Restore the GL widget context
2643+ if (!_glWidget->makeCurrent()) {
2644+ qCWarning(interfaceapp, "Unable to make window context current");
2645+ }
2646+ } else {
2647+ qCWarning(interfaceapp) << "nSight detected, disabling chrome rendering";
2648+ }
2649+ }
2650+#endif
2651+
2652+ // Build a shared canvas / context for the QML rendering
2653+ {
2654+ _qmlShareContext = new OffscreenGLCanvas();
2655+ _qmlShareContext->setObjectName("QmlShareContext");
2656+ _qmlShareContext->create(_glWidget->qglContext());
2657+ if (!_qmlShareContext->makeCurrent()) {
2658+ qCWarning(interfaceapp, "Unable to make QML shared context current");
2659+ }
2660+ OffscreenQmlSurface::setSharedContext(_qmlShareContext->getContext());
2661+ _qmlShareContext->doneCurrent();
2662+ if (!_glWidget->makeCurrent()) {
2663+ qCWarning(interfaceapp, "Unable to make window context current");
2664+ }
2665+ }
26212666
26222667 // Build an offscreen GL context for the main thread.
26232668 _offscreenContext = new OffscreenGLCanvas();
@@ -2629,6 +2674,11 @@ void Application::initializeGL() { · 5 unmodified lines
26292674 _offscreenContext->doneCurrent();
26302675 _offscreenContext->setThreadContext();
26312676
2677+ _glWidget->makeCurrent();
2678+ glClearColor(0.2f, 0.2f, 0.2f, 1);
2679+ glClear(GL_COLOR_BUFFER_BIT);
2680+ _glWidget->swapBuffers();
2681+
26322682 // Move the GL widget context to the render event handler thread
26332683 _renderEventHandler = new RenderEventHandler(_glWidget->qglContext());
26342684 if (!_offscreenContext->makeCurrent()) {
@@ -2751,40 +2801,6 @@ extern void setupPreferences(); · 116 unmodified lines
27512801 static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false);
27522802
27532803 void Application::initializeUi() {
2754− // Build a shared canvas / context for the Chromium processes
2755−#if !defined(DISABLE_QML)
2756− // Chromium rendering uses some GL functions that prevent nSight from capturing
2757− // frames, so we only create the shared context if nsight is NOT active.
2758− if (!nsightActive()) {
2759− _chromiumShareContext = new OffscreenGLCanvas();
2760− _chromiumShareContext->setObjectName("ChromiumShareContext");
2761− _chromiumShareContext->create(_offscreenContext->getContext());
2762− if (!_chromiumShareContext->makeCurrent()) {
2763− qCWarning(interfaceapp, "Unable to make chromium shared context current");
2764− }
2765− qt_gl_set_global_share_context(_chromiumShareContext->getContext());
2766− _chromiumShareContext->doneCurrent();
2767− // Restore the GL widget context
2768− _offscreenContext->makeCurrent();
2769− } else {
2770− qCWarning(interfaceapp) << "nSIGHT detected, disabling chrome rendering";
2771− }
2772−#endif
2773−
2774− // Build a shared canvas / context for the QML rendering
2775− _qmlShareContext = new OffscreenGLCanvas();
2776− _qmlShareContext->setObjectName("QmlShareContext");
2777− _qmlShareContext->create(_offscreenContext->getContext());
2778− if (!_qmlShareContext->makeCurrent()) {
2779− qCWarning(interfaceapp, "Unable to make QML shared context current");
2780− }
2781− OffscreenQmlSurface::setSharedContext(_qmlShareContext->getContext());
2782− _qmlShareContext->doneCurrent();
2783− // Restore the GL widget context
2784− _offscreenContext->makeCurrent();
2785− // Make sure all QML surfaces share the main thread GL context
2786− OffscreenQmlSurface::setSharedContext(_offscreenContext->getContext());
2787−
27882804 AddressBarDialog::registerType();
27892805 ErrorDialog::registerType();
27902806 LoginDialog::registerType();