summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-08-30 20:54:00 +0200
committerMichal Klocek <michal.klocek@qt.io>2021-09-04 07:15:06 +0200
commit8548008f53bbcebf65580304c89ea9d2a265bd85 (patch)
tree005398b2e18bcec7205d6c70f74c67dd352ba142 /src
parent1bdc7956e7065bf73413109182c215bcefe2d817 (diff)
Enable no opengl builds
By mistake opengl was marked as required library, but should be just optional. Fix compilation issues. This should enable build on yet another coin node. Pick-to: 6.2 Change-Id: Id87404928e6b042d902fcfe0a7fed99a6806456f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/api/CMakeLists.txt2
-rw-r--r--src/core/compositor/display_overrides.cpp4
-rw-r--r--src/core/web_engine_context.cpp12
-rw-r--r--src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp4
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp5
6 files changed, 24 insertions, 5 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 24617b367..8d361de97 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -96,7 +96,6 @@ foreach(arch ${archs})
compositor/content_gpu_client_qt.cpp compositor/content_gpu_client_qt.h
compositor/display_overrides.cpp
compositor/display_software_output_surface.cpp compositor/display_software_output_surface.h
- compositor/display_skia_output_device.cpp compositor/display_skia_output_device.h
content_browser_client_qt.cpp content_browser_client_qt.h
content_client_qt.cpp content_client_qt.h
content_main_delegate_qt.cpp content_main_delegate_qt.h
@@ -200,6 +199,7 @@ foreach(arch ${archs})
SOURCES
compositor/compositor_resource_fence.cpp compositor/compositor_resource_fence.h
compositor/display_gl_output_surface.cpp compositor/display_gl_output_surface.h
+ compositor/display_skia_output_device.cpp compositor/display_skia_output_device.h
)
extend_gn_target(${buildGn} CONDITION MACOS AND QT_FEATURE_opengl
diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt
index e711d362a..dd667df76 100644
--- a/src/core/api/CMakeLists.txt
+++ b/src/core/api/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(Qt6 ${PROJECT_VERSION} REQUIRED COMPONENTS Gui Network OpenGL Quick)
+find_package(Qt6 ${PROJECT_VERSION} REQUIRED COMPONENTS Gui Network Quick)
find_package(Qt6 ${PROJECT_VERSION} QUIET OPTIONAL_COMPONENTS WebChannel Positioning)
set(qtWebEngineProcessName QtWebEngineProcess)
diff --git a/src/core/compositor/display_overrides.cpp b/src/core/compositor/display_overrides.cpp
index 4636d7a3a..d41765272 100644
--- a/src/core/compositor/display_overrides.cpp
+++ b/src/core/compositor/display_overrides.cpp
@@ -66,10 +66,14 @@ viz::OutputSurfaceProviderImpl::CreateSoftwareOutputSurface()
std::unique_ptr<viz::SkiaOutputDevice>
viz::SkiaOutputSurfaceImplOnGpu::CreateOutputDevice()
{
+#if QT_CONFIG(opengl)
return std::make_unique<QtWebEngineCore::DisplaySkiaOutputDevice>(
context_state_,
shared_gpu_deps_->memory_tracker(),
GetDidSwapBuffersCompleteCallback());
+#else
+ return nullptr;
+#endif // QT_CONFIG(opengl)
}
void gpu::InProcessCommandBuffer::GetTextureQt(
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index c9f82c31c..24df73bc8 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -132,8 +132,8 @@
#include <QMutex>
#include <QOffscreenSurface>
#if QT_CONFIG(opengl)
-# include <QOpenGLContext>
-# include <qopenglcontext_platform.h>
+#include <QOpenGLContext>
+#include <qopenglcontext_platform.h>
#endif
#include <QQuickWindow>
#include <QStringList>
@@ -246,7 +246,7 @@ static const char *getGLType(bool enableGLSoftwareRendering)
return glType;
}
#else
-static cont char *getGLType(bool enableGLSoftwareRendering)
+static const char *getGLType(bool enableGLSoftwareRendering)
{
return nullptr;
}
@@ -262,6 +262,7 @@ static void logContext(const char *glType, base::CommandLine *cmd)
{
QLoggingCategory webEngineContextLog("qt.webenginecontext");
if (webEngineContextLog.isInfoEnabled()) {
+#if QT_CONFIG(opengl)
const QSurfaceFormat sharedFormat = qt_gl_global_share_context()->format();
const auto profile = QMetaEnum::fromType<QSurfaceFormat::OpenGLContextProfile>().valueToKey(
sharedFormat.profile());
@@ -284,6 +285,9 @@ static void logContext(const char *glType, base::CommandLine *cmd)
glType, type, profile, sharedFormat.majorVersion(), sharedFormat.minorVersion(),
usingDefaultSGBackend() ? "yes" : "no", usingSoftwareDynamicGL() ? "yes" : "no",
usingANGLE() ? "yes" : "no", qPrintable(params.join(" ")));
+#else
+ qCInfo(webEngineContextLog) << "WebEngine compiled with no opengl enabled.";
+#endif //QT_CONFIG(opengl)
}
}
@@ -737,6 +741,7 @@ WebEngineContext::WebEngineContext()
const char *glType = getGLType(enableGLSoftwareRendering);
if (glType) {
+#if QT_CONFIG(opengl)
parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType);
parsedCommandLine->AppendSwitch(switches::kInProcessGPU);
if (enableGLSoftwareRendering) {
@@ -766,6 +771,7 @@ WebEngineContext::WebEngineContext()
if (!usingANGLE() || isGLES2Context)
parsedCommandLine->AppendSwitch(switches::kDisableES3GLContext);
#endif
+#endif //QT_CONFIG(opengl)
} else {
parsedCommandLine->AppendSwitch(switches::kDisableGpu);
}
diff --git a/src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp b/src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp
index 6e4168cda..cdc0cf426 100644
--- a/src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webenginequick/render_widget_host_view_qt_delegate_quick.cpp
@@ -341,11 +341,15 @@ QSGNode *RenderWidgetHostViewQtDelegateQuick::updatePaintNode(QSGNode *oldNode,
node->setTexture(win->createTextureFromImage(image));
} else if (comp->type() == Compositor::Type::OpenGL) {
QQuickWindow::CreateTextureOptions texOpts;
+#if QT_CONFIG(opengl)
if (comp->hasAlphaChannel())
texOpts.setFlag(QQuickWindow::TextureHasAlphaChannel);
int texId = comp->textureId();
node->setTexture(QNativeInterface::QSGOpenGLTexture::fromNative(texId, win, texSize, texOpts));
node->setTextureCoordinatesTransform(QSGImageNode::MirrorVertically);
+#else
+ Q_UNREACHABLE();
+#endif
} else {
Q_UNREACHABLE();
}
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 9bfa49065..5a447ef1d 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -124,12 +124,17 @@ protected:
QImage image = comp->image();
node->setTexture(win->createTextureFromImage(image));
} else if (comp->type() == Compositor::Type::OpenGL) {
+#if QT_CONFIG(opengl)
QQuickWindow::CreateTextureOptions texOpts;
if (comp->hasAlphaChannel())
texOpts.setFlag(QQuickWindow::TextureHasAlphaChannel);
int texId = comp->textureId();
node->setTexture(QNativeInterface::QSGOpenGLTexture::fromNative(texId, win, texSize, texOpts));
node->setTextureCoordinatesTransform(QSGImageNode::MirrorVertically);
+#else
+ Q_UNREACHABLE();
+
+#endif
} else {
Q_UNREACHABLE();
}