summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-08 08:20:02 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-08 08:20:48 +0100
commit4edba7c6fe684e4348932c26d45812ec3d8ee2a3 (patch)
tree1f49d7ebcf3a2df373a2b35343abf226caceafc7
parent8e34d6f5399a29d45f9402219f13b631e29fd4b0 (diff)
parent05b1d1e5cfbdefd4ad3ad34c224b50fbd8575ca1 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.75.7
-rw-r--r--src/imports/qtcanvas3d/canvas3d.cpp7
-rw-r--r--src/imports/qtcanvas3d/canvasrenderer.cpp13
-rw-r--r--src/imports/qtcanvas3d/openglversionchecker.cpp89
-rw-r--r--src/imports/qtcanvas3d/openglversionchecker_p.h74
-rw-r--r--src/imports/qtcanvas3d/qtcanvas3d.pro6
-rw-r--r--sync.profile10
6 files changed, 170 insertions, 29 deletions
diff --git a/src/imports/qtcanvas3d/canvas3d.cpp b/src/imports/qtcanvas3d/canvas3d.cpp
index 072c4b3..598fb17 100644
--- a/src/imports/qtcanvas3d/canvas3d.cpp
+++ b/src/imports/qtcanvas3d/canvas3d.cpp
@@ -46,6 +46,7 @@
#include "canvasglstatedump_p.h"
#include "renderjob_p.h"
#include "canvasrenderer_p.h"
+#include "openglversionchecker_p.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QOffscreenSurface>
@@ -118,10 +119,8 @@ Canvas::Canvas(QQuickItem *parent):
m_runningInDesigner = QGuiApplication::applicationDisplayName() == "Qml2Puppet";
setFlag(ItemHasContents, !(m_runningInDesigner || m_renderTarget != RenderTargetOffscreenBuffer));
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
- if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL))
- m_isSoftwareRendered = true;
-#endif
+ OpenGLVersionChecker checker;
+ m_isSoftwareRendered = checker.isSoftwareRenderer();
}
/*!
diff --git a/src/imports/qtcanvas3d/canvasrenderer.cpp b/src/imports/qtcanvas3d/canvasrenderer.cpp
index 192e8a7..69e7250 100644
--- a/src/imports/qtcanvas3d/canvasrenderer.cpp
+++ b/src/imports/qtcanvas3d/canvasrenderer.cpp
@@ -204,19 +204,6 @@ void CanvasRenderer::init(QQuickWindow *window, const CanvasContextAttributes &c
m_executeStartIndex = 0;
m_executeEndIndex = 0;
-#ifndef QT_NO_DEBUG
- const GLubyte *version = m_glContext->functions()->glGetString(GL_VERSION);
- qCDebug(canvas3dinfo).nospace() << "CanvasRenderer::" << __FUNCTION__
- << "OpenGL version:" << (const char *)version;
-
- version = m_glContext->functions()->glGetString(GL_SHADING_LANGUAGE_VERSION);
- qCDebug(canvas3dinfo).nospace() << "CanvasRenderer::" << __FUNCTION__
- << "GLSL version:" << (const char *)version;
-
- qCDebug(canvas3dinfo).nospace() << "CanvasRenderer::" << __FUNCTION__
- << "EXTENSIONS: " << extensions;
-#endif
-
#if defined(Q_OS_WIN)
// Check driver vendor. We need to do some additional checking with Intel GPUs in Windows,
// as our FBOs can get corrupted when some unrelated Qt Quick items are
diff --git a/src/imports/qtcanvas3d/openglversionchecker.cpp b/src/imports/qtcanvas3d/openglversionchecker.cpp
new file mode 100644
index 0000000..f7f3d69
--- /dev/null
+++ b/src/imports/qtcanvas3d/openglversionchecker.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCanvas3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "openglversionchecker_p.h"
+#include "canvas3d_p.h"
+#include <QtGui/QOpenGLContext>
+#include <QtGui/QOpenGLFunctions>
+#include <QtGui/QOffscreenSurface>
+
+QT_BEGIN_NAMESPACE
+QT_CANVAS3D_BEGIN_NAMESPACE
+
+OpenGLVersionChecker::OpenGLVersionChecker() :
+ m_softwareRenderer(false)
+{
+ QOpenGLContext *context = QOpenGLContext::currentContext();
+ QOffscreenSurface *surface = 0;
+ bool createdContext = false;
+ if (!context) {
+ context = new QOpenGLContext;
+ createdContext = context->create();
+ if (!createdContext) {
+ qCWarning(canvas3drendering,
+ "%s Warning: Couldn't resolve context for version checking.", __FUNCTION__);
+ delete context;
+ return;
+ } else {
+ surface = new QOffscreenSurface();
+ surface->setFormat(context->format());
+ surface->create();
+ context->makeCurrent(surface);
+ }
+ }
+
+ const GLubyte *glVersion = context->functions()->glGetString(GL_VERSION);
+ qCDebug(canvas3drendering, "%s OpenGL version: %s", __FUNCTION__, (const char*)glVersion);
+
+ const GLubyte *glslVersion = context->functions()->glGetString(GL_SHADING_LANGUAGE_VERSION);
+ qCDebug(canvas3drendering, "%s GLSL version: %s", __FUNCTION__, (const char*)glslVersion);
+
+ qCDebug(canvas3drendering) << __FUNCTION__ << "EXTENSIONS: " << context->extensions();
+
+ QString versionStr = QString::fromLatin1((const char *)glVersion).toLower();
+ if (versionStr.contains(QStringLiteral("mesa"))
+ || versionStr.contains(QStringLiteral("llvmpipe"))) {
+ m_softwareRenderer = true;
+ }
+ if (createdContext) {
+ context->doneCurrent();
+ delete context;
+ delete surface;
+ }
+}
+
+QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/imports/qtcanvas3d/openglversionchecker_p.h b/src/imports/qtcanvas3d/openglversionchecker_p.h
new file mode 100644
index 0000000..d2505e0
--- /dev/null
+++ b/src/imports/qtcanvas3d/openglversionchecker_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCanvas3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtCanvas3D API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef OPENGLVERSIONCHECKER_P_H
+#define OPENGLVERSIONCHECKER_P_H
+
+#include "canvas3dcommon_p.h"
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+QT_CANVAS3D_BEGIN_NAMESPACE
+
+class OpenGLVersionChecker
+{
+ Q_DISABLE_COPY(OpenGLVersionChecker)
+
+public:
+ OpenGLVersionChecker();
+ ~OpenGLVersionChecker() {};
+
+ bool isSoftwareRenderer() const { return m_softwareRenderer; }
+
+private:
+ bool m_softwareRenderer;
+};
+
+QT_CANVAS3D_END_NAMESPACE
+QT_END_NAMESPACE
+
+#endif // OPENGLVERSIONCHECKER_P_H
+
diff --git a/src/imports/qtcanvas3d/qtcanvas3d.pro b/src/imports/qtcanvas3d/qtcanvas3d.pro
index 4d4d7c2..9780c2e 100644
--- a/src/imports/qtcanvas3d/qtcanvas3d.pro
+++ b/src/imports/qtcanvas3d/qtcanvas3d.pro
@@ -30,7 +30,8 @@ SOURCES += arrayutils.cpp \
renderjob.cpp \
canvasrenderer.cpp \
canvastextureprovider.cpp \
- glstatestore.cpp
+ glstatestore.cpp \
+ openglversionchecker.cpp
HEADERS += arrayutils_p.h \
qcanvas3d_plugin.h \
@@ -58,7 +59,8 @@ HEADERS += arrayutils_p.h \
renderjob_p.h \
canvasrenderer_p.h \
canvastextureprovider_p.h \
- glstatestore_p.h
+ glstatestore_p.h \
+ openglversionchecker_p.h
OTHER_FILES = qmldir \
doc/* \
diff --git a/sync.profile b/sync.profile
index 133eb08..fbd493a 100644
--- a/sync.profile
+++ b/sync.profile
@@ -3,13 +3,3 @@
);
%moduleheaders = ( # restrict the module headers to those found in relative path
);
-# Module dependencies.
-# Every module that is required to build this module should have one entry.
-# Each of the module version specifiers can take one of the following values:
-# - A specific Git revision.
-# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
-#
-%dependencies = (
- "qtbase" => "",
- "qtdeclarative" => "",
-);