From 1f3ad386b11f84b65f70350099ac629d3cea8c9c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 6 May 2020 14:29:04 +0200 Subject: Switch away from QT_NO_OPENGL Change-Id: I310265dacc9b1c8d391e82b6adf52b70c037d9b9 Reviewed-by: Michal Klocek --- src/core/api/qtwebenginecoreglobal.cpp | 12 +++--- src/core/compositor/delegated_frame_node.cpp | 44 +++++++++++----------- src/core/content_browser_client_qt.cpp | 2 +- src/core/ozone/gl_context_qt.cpp | 6 +-- src/core/ozone/gl_ozone_egl_qt.cpp | 6 +-- src/core/web_engine_context.cpp | 16 ++++---- .../render_widget_host_view_qt_delegate_quick.cpp | 2 +- .../api/qtwebenginewidgetsglobal.cpp | 6 +-- .../render_widget_host_view_qt_delegate_widget.cpp | 2 +- 9 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index 9e2a4a5b1..ce4362741 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -40,7 +40,7 @@ #include "qtwebenginecoreglobal_p.h" #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #ifdef Q_OS_MACOS #include @@ -49,14 +49,14 @@ #endif #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QT_BEGIN_NAMESPACE Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); QT_END_NAMESPACE #endif -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #ifdef Q_OS_MACOS static bool needsOfflineRendererWorkaround() { @@ -75,7 +75,7 @@ static bool needsOfflineRendererWorkaround() #endif namespace QtWebEngineCore { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) static QOpenGLContext *shareContext; static void deleteShareContext() @@ -94,7 +94,7 @@ static void deleteShareContext() Q_WEBENGINECORE_PRIVATE_EXPORT void initialize() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #ifdef Q_OS_WIN32 qputenv("QT_D3DCREATE_MULTITHREADED", "1"); #endif @@ -134,6 +134,6 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize() // Classes like QOpenGLWidget check for the attribute app->setAttribute(Qt::AA_ShareOpenGLContexts); -#endif // QT_NO_OPENGL +#endif // QT_CONFIG(opengl) } } // namespace QtWebEngineCore diff --git a/src/core/compositor/delegated_frame_node.cpp b/src/core/compositor/delegated_frame_node.cpp index 2dcdfe73e..fcaae27bb 100644 --- a/src/core/compositor/delegated_frame_node.cpp +++ b/src/core/compositor/delegated_frame_node.cpp @@ -68,7 +68,7 @@ #include "components/viz/service/display/bsp_tree.h" #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include # include @@ -79,7 +79,7 @@ #include #include -#if !defined(QT_NO_EGL) +#if QT_CONFIG(egl) #include #include #endif @@ -108,14 +108,14 @@ #define GL_LINE_LOOP 0x0002 #endif -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QT_BEGIN_NAMESPACE Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); QT_END_NAMESPACE #endif namespace QtWebEngineCore { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) class MailboxTexture : public QSGTexture, protected QOpenGLFunctions { public: MailboxTexture(const CompositorResource *resource, bool hasAlphaChannel, int target = -1); @@ -141,7 +141,7 @@ private: #endif friend class DelegatedFrameNode; }; -#endif // QT_NO_OPENGL +#endif // QT_CONFIG(opengl) class RectClipNode : public QSGClipNode { @@ -167,7 +167,7 @@ public: QSGNode *) = 0; virtual void setupSolidColorNode(const QRect &, const QColor &, QSGNode *) = 0; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) virtual void setupDebugBorderNode(QSGGeometry *, QSGFlatColorMaterial *, QSGNode *) = 0; virtual void setupYUVVideoNode(QSGTexture *, QSGTexture *, QSGTexture *, QSGTexture *, const QRectF &, const QRectF &, const QSizeF &, const QSizeF &, @@ -177,7 +177,7 @@ public: virtual void setupStreamVideoNode(MailboxTexture *, const QRectF &, const QMatrix4x4 &, QSGNode *) = 0; #endif // GL_OES_EGL_image_external -#endif // QT_NO_OPENGL +#endif // QT_CONFIG(opengl) protected: QVector *m_sceneGraphNodes; }; @@ -234,7 +234,7 @@ public: if (rectangleNode->color() != color) rectangleNode->setColor(color); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) void setupDebugBorderNode(QSGGeometry *geometry, QSGFlatColorMaterial *material, QSGNode *) override { @@ -259,7 +259,7 @@ public: Q_UNREACHABLE(); } #endif // GL_OES_EGL_image_external -#endif // QT_NO_OPENGL +#endif // QT_CONFIG(opengl) private: QVector::iterator m_nodeIterator; @@ -314,7 +314,7 @@ public: m_sceneGraphNodes->append(rectangleNode); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) void setupDebugBorderNode(QSGGeometry *geometry, QSGFlatColorMaterial *material, QSGNode *layerChain) override { @@ -363,7 +363,7 @@ public: m_sceneGraphNodes->append(svideoNode); } #endif // GL_OES_EGL_image_external -#endif // QT_NO_OPENGL +#endif // QT_CONFIG(opengl) private: RenderWidgetHostViewQtDelegate *m_apiDelegate; @@ -421,7 +421,7 @@ static QSGNode *buildLayerChain(QSGNode *chainParent, const viz::SharedQuadState return layerChain; } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) MailboxTexture::MailboxTexture(const CompositorResource *resource, bool hasAlphaChannel, int target) : m_textureId(resource->texture_id) , m_fence(resource->texture_fence) @@ -476,7 +476,7 @@ void MailboxTexture::bind() } #endif } -#endif // !QT_NO_OPENGL +#endif // QT_CONFIG(opengl) RectClipNode::RectClipNode(const QRectF &rect) : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 4) @@ -488,12 +488,12 @@ RectClipNode::RectClipNode(const QRectF &rect) } DelegatedFrameNode::DelegatedFrameNode() -#if defined(USE_OZONE) && !defined(QT_NO_OPENGL) +#if defined(USE_OZONE) && QT_CONFIG(opengl) : m_contextShared(true) #endif { setFlag(UsePreprocess); -#if defined(USE_OZONE) && !defined(QT_NO_OPENGL) +#if defined(USE_OZONE) && QT_CONFIG(opengl) QOpenGLContext *currentContext = QOpenGLContext::currentContext() ; QOpenGLContext *sharedContext = qt_gl_global_share_context(); if (currentContext && sharedContext && !QOpenGLContext::areSharing(currentContext, sharedContext)) { @@ -569,14 +569,14 @@ static bool areRenderPassStructuresEqual(const viz::CompositorFrame *frameData, const viz::DrawQuad *prevQuad = *prevIt; if (quad->material != prevQuad->material) return false; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (quad->material == viz::DrawQuad::Material::kYuvVideoContent) return false; #ifdef GL_OES_EGL_image_external if (quad->material == viz::DrawQuad::Material::kStreamVideoContent) return false; #endif // GL_OES_EGL_image_external -#endif // QT_NO_OPENGL +#endif // QT_CONFIG(opengl) if (!areSharedQuadStatesEqual(quad->shared_quad_state, prevQuad->shared_quad_state)) return false; if (quad->shared_quad_state->is_clipped && quad->visible_rect != prevQuad->visible_rect) { @@ -880,7 +880,7 @@ void DelegatedFrameNode::handleQuad( Q_UNUSED(scquad->force_anti_aliasing_off); nodeHandler->setupSolidColorNode(toQt(quad->rect), toQt(scquad->color), currentLayerChain); break; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) } case viz::DrawQuad::Material::kDebugBorder: { const viz::DebugBorderDrawQuad *dbquad = viz::DebugBorderDrawQuad::MaterialCast(quad); @@ -913,7 +913,7 @@ void DelegatedFrameNode::handleQuad( toQt(quad->rect), toQt(tquad->tex_coord_rect), QSGImageNode::NoTransform, currentLayerChain); break; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) } case viz::DrawQuad::Material::kYuvVideoContent: { const viz::YUVVideoDrawQuad *vquad = viz::YUVVideoDrawQuad::MaterialCast(quad); @@ -952,7 +952,7 @@ void DelegatedFrameNode::handleQuad( nodeHandler->setupStreamVideoNode(texture, toQt(squad->rect), qMatrix, currentLayerChain); break; #endif // GL_OES_EGL_image_external -#endif // QT_NO_OPENGL +#endif // QT_CONFIG(opengl) } case viz::DrawQuad::Material::kSurfaceContent: Q_UNREACHABLE(); @@ -1050,7 +1050,7 @@ QSharedPointer DelegatedFrameNode::createBitmapTexture(const Composi QSharedPointer DelegatedFrameNode::createMailboxTexture(const CompositorResource *resource, bool hasAlphaChannel, int target) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) return QSharedPointer::create(resource, hasAlphaChannel, target); #else Q_UNREACHABLE(); @@ -1059,7 +1059,7 @@ QSharedPointer DelegatedFrameNode::createMailboxTexture(const Co void DelegatedFrameNode::copyMailboxTextures() { -#if !defined(QT_NO_OPENGL) && defined(USE_OZONE) +#if QT_CONFIG(opengl) && defined(USE_OZONE) // Workaround when context is not shared QTBUG-48969 // Make slow copy between two contexts. if (!m_contextShared) { diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index cac392182..05957c26f 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -312,7 +312,7 @@ private: void ShareGroupQtQuick::AboutToAddFirstContext() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) // This currently has to be setup by ::main in all applications using QQuickWebEngineView with delegated rendering. QOpenGLContext *shareContext = qt_gl_global_share_context(); if (!shareContext) { diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp index e9337874a..10347bdc7 100644 --- a/src/core/ozone/gl_context_qt.cpp +++ b/src/core/ozone/gl_context_qt.cpp @@ -59,7 +59,7 @@ namespace { inline void *resourceForContext(const QByteArray &resource) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLContext *shareContext = qt_gl_global_share_context(); if (!shareContext) { qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function."); @@ -153,7 +153,7 @@ void* GLContextHelper::getNativeDisplay() QFunctionPointer GLContextHelper::getGlXGetProcAddress() { QFunctionPointer get_proc_address = nullptr; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (QOpenGLContext *context = qt_gl_global_share_context()) { get_proc_address = context->getProcAddress("glXGetProcAddress"); } @@ -164,7 +164,7 @@ QFunctionPointer GLContextHelper::getGlXGetProcAddress() QFunctionPointer GLContextHelper::getEglGetProcAddress() { QFunctionPointer get_proc_address = nullptr; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (QOpenGLContext *context = qt_gl_global_share_context()) { get_proc_address = context->getProcAddress("eglGetProcAddress"); } diff --git a/src/core/ozone/gl_ozone_egl_qt.cpp b/src/core/ozone/gl_ozone_egl_qt.cpp index 2fa86d79b..c692920cf 100644 --- a/src/core/ozone/gl_ozone_egl_qt.cpp +++ b/src/core/ozone/gl_ozone_egl_qt.cpp @@ -55,9 +55,9 @@ #include #include -#include // for QT_NO_OPENGL +#include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #include QT_BEGIN_NAMESPACE Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); @@ -88,7 +88,7 @@ bool GLOzoneEGLQt::LoadGLES2Bindings(gl::GLImplementation /*implementation*/) reinterpret_cast( base::GetFunctionPointerFromNativeLibrary(eglgles2Library, "eglGetProcAddress")); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (!get_proc_address) { // QTBUG-63341 most likely libgles2 not linked with libegl -> fallback to qpa if (QOpenGLContext *context = qt_gl_global_share_context()) { diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index efd5239d8..a28e469a3 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -125,7 +125,7 @@ #include #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif #include @@ -138,7 +138,7 @@ using namespace QtWebEngineCore; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QT_BEGIN_NAMESPACE Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); QT_END_NAMESPACE @@ -146,7 +146,7 @@ QT_END_NAMESPACE namespace { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) bool usingANGLE() { #if defined(Q_OS_WIN) @@ -179,7 +179,7 @@ bool usingDefaultSGBackend() return device.isEmpty(); } -#endif //QT_NO_OPENGL +#endif // QT_CONFIG(opengl) #if QT_CONFIG(webengine_pepper_plugins) void dummyGetPluginCallback(const std::vector&) { @@ -208,7 +208,7 @@ bool usingSoftwareDynamicGL() { if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) return true; -#if defined(Q_OS_WIN) && !defined(QT_NO_OPENGL) +#if defined(Q_OS_WIN) && QT_CONFIG(opengl) HMODULE handle = static_cast(QOpenGLContext::openGLModuleHandle()); wchar_t path[MAX_PATH]; DWORD size = GetModuleFileName(handle, path, MAX_PATH); @@ -605,7 +605,7 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitch(switches::kDisableES3GLContext); #endif bool threadedGpu = false; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) threadedGpu = QOpenGLContext::supportsThreadedOpenGL(); #if defined(Q_OS_MACOS) // QtBase disabled it when building on 10.14+, unfortunately we still need it @@ -692,7 +692,7 @@ WebEngineContext::WebEngineContext() GLContextHelper::initialize(); const char *glType = 0; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) const bool tryGL = (usingDefaultSGBackend() && !usingSoftwareDynamicGL() && QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) @@ -758,7 +758,7 @@ WebEngineContext::WebEngineContext() qWarning("WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed."); } } -#endif +#endif // QT_CONFIG(opengl) if (glType) { parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType); diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index d5aae271f..6a5bef16d 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -63,7 +63,7 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW setFocus(true); setActiveFocusOnTab(true); -#if defined(Q_OS_MACOS) && !defined(QT_NO_OPENGL) +#if defined(Q_OS_MACOS) && QT_CONFIG(opengl) // Check that the default QSurfaceFormat OpenGL profile is compatible with the global OpenGL // shared context profile, otherwise this could lead to a nasty crash. QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext(); diff --git a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp index a39c0e483..5949f3d6e 100644 --- a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp +++ b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp @@ -49,13 +49,13 @@ namespace QtWebEngineCore QT_BEGIN_NAMESPACE -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); #endif static void initialize() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (QCoreApplication::instance()) { //On window/ANGLE, calling QtWebEngine::initialize from DllMain will result in a crash. if (!qt_gl_global_share_context()) { @@ -67,7 +67,7 @@ static void initialize() } //QCoreApplication is not yet instantiated, ensuring the call will be deferred qAddPreRoutine(QtWebEngineCore::initialize); -#endif // QT_NO_OPENGL +#endif // QT_CONFIG(opengl) } Q_CONSTRUCTOR_FUNCTION(initialize) diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index 66b4cffea..1dfcc4c5a 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -107,7 +107,7 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende format.setDepthBufferSize(24); format.setStencilBufferSize(8); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext(); if (globalSharedContext) { QSurfaceFormat sharedFormat = globalSharedContext->format(); -- cgit v1.2.3