summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-05-06 14:29:04 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-05-11 14:07:37 +0200
commit1f3ad386b11f84b65f70350099ac629d3cea8c9c (patch)
treec457ba6256f9832a7d441efe43479e7274140f4d /src/core
parent58cd21c0aa7a9dc5a18ea411dcf462a2ee8193f6 (diff)
Switch away from QT_NO_OPENGL
Change-Id: I310265dacc9b1c8d391e82b6adf52b70c037d9b9 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp12
-rw-r--r--src/core/compositor/delegated_frame_node.cpp44
-rw-r--r--src/core/content_browser_client_qt.cpp2
-rw-r--r--src/core/ozone/gl_context_qt.cpp6
-rw-r--r--src/core/ozone/gl_ozone_egl_qt.cpp6
-rw-r--r--src/core/web_engine_context.cpp16
6 files changed, 43 insertions, 43 deletions
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 <QGuiApplication>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QOpenGLContext>
#ifdef Q_OS_MACOS
#include <sys/types.h>
@@ -49,14 +49,14 @@
#endif
#include <QThread>
-#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 <QOpenGLContext>
# include <QOpenGLFunctions>
# include <QSGFlatColorMaterial>
@@ -79,7 +79,7 @@
#include <QSGImageNode>
#include <QSGRectangleNode>
-#if !defined(QT_NO_EGL)
+#if QT_CONFIG(egl)
#include <EGL/egl.h>
#include <EGL/eglext.h>
#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<QSGNode*> *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<QSGNode*>::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<QSGTexture> DelegatedFrameNode::createBitmapTexture(const Composi
QSharedPointer<MailboxTexture> DelegatedFrameNode::createMailboxTexture(const CompositorResource *resource, bool hasAlphaChannel, int target)
{
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
return QSharedPointer<MailboxTexture>::create(resource, hasAlphaChannel, target);
#else
Q_UNREACHABLE();
@@ -1059,7 +1059,7 @@ QSharedPointer<MailboxTexture> 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 <EGL/egl.h>
#include <dlfcn.h>
-#include <QtGui/qtgui-config.h> // for QT_NO_OPENGL
+#include <QtGui/qtgui-config.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <QOpenGLContext>
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
@@ -88,7 +88,7 @@ bool GLOzoneEGLQt::LoadGLES2Bindings(gl::GLImplementation /*implementation*/)
reinterpret_cast<gl::GLGetProcAddressProc>(
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 <QGuiApplication>
#include <QMutex>
#include <QOffscreenSurface>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
# include <QOpenGLContext>
#endif
#include <QQuickWindow>
@@ -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<content::WebPluginInfo>&)
{
@@ -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<HMODULE>(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);