Fix for black text rendering white in web elements
Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -2607,10 +2607,55 @@ void Application::initializeGL() { · 2606 unmodified lines | ||
| 2607 | 2607 | _isGLInitialized = true; |
| 2608 | 2608 | } |
| 2609 | 2609 | |
| 2610 | − _glWidget->makeCurrent(); | |
| 2611 | − glClearColor(0.2f, 0.2f, 0.2f, 1); | |
| 2612 | − glClear(GL_COLOR_BUFFER_BIT); | |
| 2613 | − _glWidget->swapBuffers(); | |
| 2610 | + if (!_glWidget->makeCurrent()) { | |
| 2611 | + qCWarning(interfaceapp, "Unable to make window context current"); | |
| 2612 | + } | |
| 2613 | + | |
| 2614 | +#if !defined(DISABLE_QML) | |
| 2615 | + // Build a shared canvas / context for the Chromium processes | |
| 2616 | + { | |
| 2617 | + // Disable signed distance field font rendering on ATI/AMD GPUs, due to | |
| 2618 | + // https://highfidelity.manuscript.com/f/cases/13677/Text-showing-up-white-on-Marketplace-app | |
| 2619 | + std::string vendor{ (const char*)glGetString(GL_VENDOR) }; | |
| 2620 | + if ((vendor.find("AMD") != std::string::npos) || (vendor.find("ATI") != std::string::npos)) { | |
| 2621 | + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", QByteArray("--disable-distance-field-text")); | |
| 2622 | + } | |
| 2623 | + | |
| 2624 | + // Chromium rendering uses some GL functions that prevent nSight from capturing | |
| 2625 | + // frames, so we only create the shared context if nsight is NOT active. | |
| 2626 | + if (!nsightActive()) { | |
| 2627 | + _chromiumShareContext = new OffscreenGLCanvas(); | |
| 2628 | + _chromiumShareContext->setObjectName("ChromiumShareContext"); | |
| 2629 | + _chromiumShareContext->create(_glWidget->qglContext()); | |
| 2630 | + if (!_chromiumShareContext->makeCurrent()) { | |
| 2631 | + qCWarning(interfaceapp, "Unable to make chromium shared context current"); | |
| 2632 | + } | |
| 2633 | + qt_gl_set_global_share_context(_chromiumShareContext->getContext()); | |
| 2634 | + _chromiumShareContext->doneCurrent(); | |
| 2635 | + // Restore the GL widget context | |
| 2636 | + if (!_glWidget->makeCurrent()) { | |
| 2637 | + qCWarning(interfaceapp, "Unable to make window context current"); | |
| 2638 | + } | |
| 2639 | + } else { | |
| 2640 | + qCWarning(interfaceapp) << "nSight detected, disabling chrome rendering"; | |
| 2641 | + } | |
| 2642 | + } | |
| 2643 | +#endif | |
| 2644 | + | |
| 2645 | + // Build a shared canvas / context for the QML rendering | |
| 2646 | + { | |
| 2647 | + _qmlShareContext = new OffscreenGLCanvas(); | |
| 2648 | + _qmlShareContext->setObjectName("QmlShareContext"); | |
| 2649 | + _qmlShareContext->create(_glWidget->qglContext()); | |
| 2650 | + if (!_qmlShareContext->makeCurrent()) { | |
| 2651 | + qCWarning(interfaceapp, "Unable to make QML shared context current"); | |
| 2652 | + } | |
| 2653 | + OffscreenQmlSurface::setSharedContext(_qmlShareContext->getContext()); | |
| 2654 | + _qmlShareContext->doneCurrent(); | |
| 2655 | + if (!_glWidget->makeCurrent()) { | |
| 2656 | + qCWarning(interfaceapp, "Unable to make window context current"); | |
| 2657 | + } | |
| 2658 | + } | |
| 2614 | 2659 | |
| 2615 | 2660 | // Build an offscreen GL context for the main thread. |
| 2616 | 2661 | _offscreenContext = new OffscreenGLCanvas(); |
| @@ -2622,6 +2667,11 @@ void Application::initializeGL() { · 5 unmodified lines | ||
| 2622 | 2667 | _offscreenContext->doneCurrent(); |
| 2623 | 2668 | _offscreenContext->setThreadContext(); |
| 2624 | 2669 | |
| 2670 | + _glWidget->makeCurrent(); | |
| 2671 | + glClearColor(0.2f, 0.2f, 0.2f, 1); | |
| 2672 | + glClear(GL_COLOR_BUFFER_BIT); | |
| 2673 | + _glWidget->swapBuffers(); | |
| 2674 | + | |
| 2625 | 2675 | // Move the GL widget context to the render event handler thread |
| 2626 | 2676 | _renderEventHandler = new RenderEventHandler(_glWidget->qglContext()); |
| 2627 | 2677 | if (!_offscreenContext->makeCurrent()) { |
| @@ -2744,40 +2794,6 @@ extern void setupPreferences(); · 116 unmodified lines | ||
| 2744 | 2794 | static void addDisplayPluginToMenu(const DisplayPluginPointer& displayPlugin, int index, bool active = false); |
| 2745 | 2795 | |
| 2746 | 2796 | void Application::initializeUi() { |
| 2747 | − // Build a shared canvas / context for the Chromium processes | |
| 2748 | −#if !defined(DISABLE_QML) | |
| 2749 | − // Chromium rendering uses some GL functions that prevent nSight from capturing | |
| 2750 | − // frames, so we only create the shared context if nsight is NOT active. | |
| 2751 | − if (!nsightActive()) { | |
| 2752 | − _chromiumShareContext = new OffscreenGLCanvas(); | |
| 2753 | − _chromiumShareContext->setObjectName("ChromiumShareContext"); | |
| 2754 | − _chromiumShareContext->create(_offscreenContext->getContext()); | |
| 2755 | − if (!_chromiumShareContext->makeCurrent()) { | |
| 2756 | − qCWarning(interfaceapp, "Unable to make chromium shared context current"); | |
| 2757 | − } | |
| 2758 | − qt_gl_set_global_share_context(_chromiumShareContext->getContext()); | |
| 2759 | − _chromiumShareContext->doneCurrent(); | |
| 2760 | − // Restore the GL widget context | |
| 2761 | − _offscreenContext->makeCurrent(); | |
| 2762 | − } else { | |
| 2763 | − qCWarning(interfaceapp) << "nSIGHT detected, disabling chrome rendering"; | |
| 2764 | − } | |
| 2765 | −#endif | |
| 2766 | − | |
| 2767 | − // Build a shared canvas / context for the QML rendering | |
| 2768 | − _qmlShareContext = new OffscreenGLCanvas(); | |
| 2769 | − _qmlShareContext->setObjectName("QmlShareContext"); | |
| 2770 | − _qmlShareContext->create(_offscreenContext->getContext()); | |
| 2771 | − if (!_qmlShareContext->makeCurrent()) { | |
| 2772 | − qCWarning(interfaceapp, "Unable to make QML shared context current"); | |
| 2773 | − } | |
| 2774 | − OffscreenQmlSurface::setSharedContext(_qmlShareContext->getContext()); | |
| 2775 | − _qmlShareContext->doneCurrent(); | |
| 2776 | − // Restore the GL widget context | |
| 2777 | − _offscreenContext->makeCurrent(); | |
| 2778 | − // Make sure all QML surfaces share the main thread GL context | |
| 2779 | − OffscreenQmlSurface::setSharedContext(_offscreenContext->getContext()); | |
| 2780 | − | |
| 2781 | 2797 | AddressBarDialog::registerType(); |
| 2782 | 2798 | ErrorDialog::registerType(); |
| 2783 | 2799 | LoginDialog::registerType(); |