summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/geometryloaders/.prev_configure.cmake3
-rw-r--r--src/plugins/geometryloaders/CMakeLists.txt3
-rw-r--r--src/plugins/geometryloaders/configure.cmake3
-rw-r--r--src/plugins/geometryloaders/configure.pri20
-rw-r--r--src/plugins/geometryloaders/default/CMakeLists.txt3
-rw-r--r--src/plugins/geometryloaders/default/basegeometryloader.cpp49
-rw-r--r--src/plugins/geometryloaders/default/basegeometryloader_p.h40
-rw-r--r--src/plugins/geometryloaders/default/default.pro19
-rw-r--r--src/plugins/geometryloaders/default/main.cpp40
-rw-r--r--src/plugins/geometryloaders/default/objgeometryloader.cpp57
-rw-r--r--src/plugins/geometryloaders/default/objgeometryloader.h40
-rw-r--r--src/plugins/geometryloaders/default/plygeometryloader.cpp42
-rw-r--r--src/plugins/geometryloaders/default/plygeometryloader.h40
-rw-r--r--src/plugins/geometryloaders/default/stlgeometryloader.cpp42
-rw-r--r--src/plugins/geometryloaders/default/stlgeometryloader.h40
-rw-r--r--src/plugins/geometryloaders/fbx/CMakeLists.txt3
-rw-r--r--src/plugins/geometryloaders/fbx/fbx.pro19
-rw-r--r--src/plugins/geometryloaders/fbx/fbxgeometryloader.cpp40
-rw-r--r--src/plugins/geometryloaders/fbx/fbxgeometryloader.h40
-rw-r--r--src/plugins/geometryloaders/fbx/main.cpp40
-rw-r--r--src/plugins/geometryloaders/geometryloaders.pro4
-rw-r--r--src/plugins/geometryloaders/gltf/CMakeLists.txt3
-rw-r--r--src/plugins/geometryloaders/gltf/gltf.pro16
-rw-r--r--src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp64
-rw-r--r--src/plugins/geometryloaders/gltf/gltfgeometryloader.h40
-rw-r--r--src/plugins/geometryloaders/gltf/main.cpp40
-rw-r--r--src/plugins/renderers/CMakeLists.txt3
-rw-r--r--src/plugins/renderers/configure.cmake3
-rw-r--r--src/plugins/renderers/dummy/CMakeLists.txt3
-rw-r--r--src/plugins/renderers/dummy/dummy.pro0
-rw-r--r--src/plugins/renderers/opengl/CMakeLists.txt6
-rw-r--r--src/plugins/renderers/opengl/debug/debug.pri9
-rw-r--r--src/plugins/renderers/opengl/debug/imguirenderer.cpp161
-rw-r--r--src/plugins/renderers/opengl/debug/imguirenderer_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp66
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h42
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp43
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp53
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp44
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp42
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h43
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp43
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp45
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp45
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp56
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/graphicshelpers.pri33
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp43
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h51
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp90
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h42
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp40
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h40
-rw-r--r--src/plugins/renderers/opengl/io/glbuffer.cpp40
-rw-r--r--src/plugins/renderers/opengl/io/glbuffer_p.h40
-rw-r--r--src/plugins/renderers/opengl/io/io.pri8
-rw-r--r--src/plugins/renderers/opengl/main.cpp40
-rw-r--r--src/plugins/renderers/opengl/managers/gl_handle_types_p.h40
-rw-r--r--src/plugins/renderers/opengl/managers/glresourcemanagers.cpp40
-rw-r--r--src/plugins/renderers/opengl/managers/glresourcemanagers_p.h40
-rw-r--r--src/plugins/renderers/opengl/managers/managers.pri8
-rw-r--r--src/plugins/renderers/opengl/opengl.cmake3
-rw-r--r--src/plugins/renderers/opengl/opengl.pri41
-rw-r--r--src/plugins/renderers/opengl/opengl.pro13
-rw-r--r--src/plugins/renderers/opengl/renderer/commandexecuter.cpp42
-rw-r--r--src/plugins/renderers/opengl/renderer/commandexecuter_p.h40
-rw-r--r--src/plugins/renderers/opengl/renderer/frameprofiler_p.h44
-rw-r--r--src/plugins/renderers/opengl/renderer/glfence_p.h40
-rw-r--r--src/plugins/renderers/opengl/renderer/gllights.cpp40
-rw-r--r--src/plugins/renderers/opengl/renderer/gllights_p.h40
-rw-r--r--src/plugins/renderers/opengl/renderer/glshader.cpp55
-rw-r--r--src/plugins/renderers/opengl/renderer/glshader_p.h40
-rw-r--r--src/plugins/renderers/opengl/renderer/logging.cpp40
-rw-r--r--src/plugins/renderers/opengl/renderer/logging_p.h40
-rw-r--r--src/plugins/renderers/opengl/renderer/openglvertexarrayobject.cpp47
-rw-r--r--src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h40
-rw-r--r--src/plugins/renderers/opengl/renderer/rendercommand.cpp40
-rw-r--r--src/plugins/renderers/opengl/renderer/rendercommand_p.h42
-rw-r--r--src/plugins/renderers/opengl/renderer/renderer.cpp118
-rw-r--r--src/plugins/renderers/opengl/renderer/renderer.pri29
-rw-r--r--src/plugins/renderers/opengl/renderer/renderer_p.h43
-rw-r--r--src/plugins/renderers/opengl/renderer/renderview.cpp82
-rw-r--r--src/plugins/renderers/opengl/renderer/renderview_p.h44
-rw-r--r--src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp45
-rw-r--r--src/plugins/renderers/opengl/renderer/renderviewbuilder_p.h40
-rw-r--r--src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp60
-rw-r--r--src/plugins/renderers/opengl/renderer/shaderparameterpack_p.h40
-rw-r--r--src/plugins/renderers/opengl/renderer/shadervariables_p.h40
-rw-r--r--src/plugins/renderers/opengl/textures/gltexture.cpp54
-rw-r--r--src/plugins/renderers/opengl/textures/gltexture_p.h40
-rw-r--r--src/plugins/renderers/opengl/textures/renderbuffer.cpp40
-rw-r--r--src/plugins/renderers/opengl/textures/renderbuffer_p.h40
-rw-r--r--src/plugins/renderers/opengl/textures/textures.pri9
-rw-r--r--src/plugins/renderers/renderers.pro13
-rw-r--r--src/plugins/renderers/rhi/CMakeLists.txt9
-rw-r--r--src/plugins/renderers/rhi/graphicshelpers/graphicshelpers.pri9
-rw-r--r--src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp188
-rw-r--r--src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h54
-rw-r--r--src/plugins/renderers/rhi/io/io.pri8
-rw-r--r--src/plugins/renderers/rhi/io/rhibuffer.cpp45
-rw-r--r--src/plugins/renderers/rhi/io/rhibuffer_p.h40
-rw-r--r--src/plugins/renderers/rhi/main.cpp40
-rw-r--r--src/plugins/renderers/rhi/managers/managers.pri8
-rw-r--r--src/plugins/renderers/rhi/managers/rhihandle_types_p.h40
-rw-r--r--src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp42
-rw-r--r--src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h40
-rw-r--r--src/plugins/renderers/rhi/renderer/commandexecuter.cpp46
-rw-r--r--src/plugins/renderers/rhi/renderer/commandexecuter_p.h42
-rw-r--r--src/plugins/renderers/rhi/renderer/logging.cpp40
-rw-r--r--src/plugins/renderers/rhi/renderer/logging_p.h40
-rw-r--r--src/plugins/renderers/rhi/renderer/pipelineuboset.cpp80
-rw-r--r--src/plugins/renderers/rhi/renderer/pipelineuboset_p.h42
-rw-r--r--src/plugins/renderers/rhi/renderer/rendercommand.cpp46
-rw-r--r--src/plugins/renderers/rhi/renderer/rendercommand_p.h48
-rw-r--r--src/plugins/renderers/rhi/renderer/renderer.cpp308
-rw-r--r--src/plugins/renderers/rhi/renderer/renderer.pri26
-rw-r--r--src/plugins/renderers/rhi/renderer/renderer_p.h45
-rw-r--r--src/plugins/renderers/rhi/renderer/renderview.cpp77
-rw-r--r--src/plugins/renderers/rhi/renderer/renderview_p.h42
-rw-r--r--src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp45
-rw-r--r--src/plugins/renderers/rhi/renderer/renderviewbuilder_p.h40
-rw-r--r--src/plugins/renderers/rhi/renderer/rhigraphicspipeline.cpp40
-rw-r--r--src/plugins/renderers/rhi/renderer/rhigraphicspipeline_p.h42
-rw-r--r--src/plugins/renderers/rhi/renderer/rhirendertarget.cpp40
-rw-r--r--src/plugins/renderers/rhi/renderer/rhirendertarget_p.h55
-rw-r--r--src/plugins/renderers/rhi/renderer/rhishader.cpp163
-rw-r--r--src/plugins/renderers/rhi/renderer/rhishader_p.h59
-rw-r--r--src/plugins/renderers/rhi/renderer/shaderparameterpack.cpp42
-rw-r--r--src/plugins/renderers/rhi/renderer/shaderparameterpack_p.h40
-rw-r--r--src/plugins/renderers/rhi/renderer/shadervariables_p.h40
-rw-r--r--src/plugins/renderers/rhi/rhi.cmake3
-rw-r--r--src/plugins/renderers/rhi/rhi.pri16
-rw-r--r--src/plugins/renderers/rhi/rhi.pro36
-rw-r--r--src/plugins/renderers/rhi/textures/renderbuffer.cpp40
-rw-r--r--src/plugins/renderers/rhi/textures/renderbuffer_p.h40
-rw-r--r--src/plugins/renderers/rhi/textures/texture.cpp82
-rw-r--r--src/plugins/renderers/rhi/textures/texture_p.h40
-rw-r--r--src/plugins/renderers/rhi/textures/textures.pri9
-rw-r--r--src/plugins/renderplugins/CMakeLists.txt3
-rw-r--r--src/plugins/renderplugins/renderplugins.pro2
-rw-r--r--src/plugins/renderplugins/scene2d/CMakeLists.txt3
-rw-r--r--src/plugins/renderplugins/scene2d/main.cpp40
-rw-r--r--src/plugins/renderplugins/scene2d/scene2d.pro16
-rw-r--r--src/plugins/renderplugins/scene2d/scene2dplugin.cpp40
-rw-r--r--src/plugins/renderplugins/scene2d/scene2dplugin.h40
-rw-r--r--src/plugins/sceneparsers/CMakeLists.txt5
-rw-r--r--src/plugins/sceneparsers/assimp/CMakeLists.txt4
-rw-r--r--src/plugins/sceneparsers/assimp/assimp.pro20
-rw-r--r--src/plugins/sceneparsers/assimp/assimphelpers.cpp46
-rw-r--r--src/plugins/sceneparsers/assimp/assimphelpers.h40
-rw-r--r--src/plugins/sceneparsers/assimp/assimpimporter.cpp89
-rw-r--r--src/plugins/sceneparsers/assimp/assimpimporter.h40
-rw-r--r--src/plugins/sceneparsers/assimp/main.cpp40
-rw-r--r--src/plugins/sceneparsers/gltf/CMakeLists.txt3
-rw-r--r--src/plugins/sceneparsers/gltf/gltf.pro16
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.cpp106
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.h42
-rw-r--r--src/plugins/sceneparsers/gltf/gltfio.cpp74
-rw-r--r--src/plugins/sceneparsers/gltf/main.cpp41
-rw-r--r--src/plugins/sceneparsers/gltfexport/CMakeLists.txt3
-rw-r--r--src/plugins/sceneparsers/gltfexport/gltfexport.pro16
-rw-r--r--src/plugins/sceneparsers/gltfexport/gltfexporter.cpp81
-rw-r--r--src/plugins/sceneparsers/gltfexport/gltfexporter.h40
-rw-r--r--src/plugins/sceneparsers/gltfexport/main.cpp40
-rw-r--r--src/plugins/sceneparsers/sceneparsers.pro12
173 files changed, 1134 insertions, 5881 deletions
diff --git a/src/plugins/geometryloaders/.prev_configure.cmake b/src/plugins/geometryloaders/.prev_configure.cmake
index badaaca24..1040fb99e 100644
--- a/src/plugins/geometryloaders/.prev_configure.cmake
+++ b/src/plugins/geometryloaders/.prev_configure.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#### Inputs
diff --git a/src/plugins/geometryloaders/CMakeLists.txt b/src/plugins/geometryloaders/CMakeLists.txt
index d2ccc5ae5..9c493e808 100644
--- a/src/plugins/geometryloaders/CMakeLists.txt
+++ b/src/plugins/geometryloaders/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from geometryloaders.pro.
qt_feature_module_begin(
diff --git a/src/plugins/geometryloaders/configure.cmake b/src/plugins/geometryloaders/configure.cmake
index d6b257fc2..6ecf76aaa 100644
--- a/src/plugins/geometryloaders/configure.cmake
+++ b/src/plugins/geometryloaders/configure.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#### Inputs
# input fbxsdk
diff --git a/src/plugins/geometryloaders/configure.pri b/src/plugins/geometryloaders/configure.pri
deleted file mode 100644
index 1e104f57e..000000000
--- a/src/plugins/geometryloaders/configure.pri
+++ /dev/null
@@ -1,20 +0,0 @@
-defineTest(qtConfLibrary_fbx) {
- libdir =
-
- prefix = $$getenv(FBXSDK)
- !isEmpty(prefix) {
- !qtConfResolvePathIncs($${1}.includedir, $${prefix}/include, $$2): \
- return(false)
- !win32: libdir += $${prefix}/lib
- }
-
- libs = $$getenv(FBXSDK_LIBS)
- isEmpty(libs): \
- libs = $$eval($${1}.libs)
-
- !qtConfResolvePathLibs($${1}.libs, $$libdir, $$libs): \
- return(false)
-
- return(true)
-}
-
diff --git a/src/plugins/geometryloaders/default/CMakeLists.txt b/src/plugins/geometryloaders/default/CMakeLists.txt
index c838a54d9..5143018af 100644
--- a/src/plugins/geometryloaders/default/CMakeLists.txt
+++ b/src/plugins/geometryloaders/default/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from default.pro.
#####################################################################
diff --git a/src/plugins/geometryloaders/default/basegeometryloader.cpp b/src/plugins/geometryloaders/default/basegeometryloader.cpp
index 33e68db82..802548994 100644
--- a/src/plugins/geometryloaders/default/basegeometryloader.cpp
+++ b/src/plugins/geometryloaders/default/basegeometryloader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "basegeometryloader_p.h"
@@ -48,10 +12,11 @@
QT_BEGIN_NAMESPACE
-using namespace Qt3DCore;
namespace Qt3DRender {
+using namespace Qt3DCore;
+
Q_LOGGING_CATEGORY(BaseGeometryLoaderLog, "Qt3D.BaseGeometryLoader", QtWarningMsg)
BaseGeometryLoader::BaseGeometryLoader()
@@ -121,7 +86,7 @@ void BaseGeometryLoader::generateAveragedNormals(const std::vector<QVector3D> &p
void BaseGeometryLoader::generateGeometry()
{
QByteArray bufferBytes;
- const size_t count = m_points.size();
+ const uint count = uint(m_points.size());
const quint32 elementSize = 3 + (hasTextureCoordinates() ? 2 : 0)
+ (hasNormals() ? 3 : 0)
+ (hasTangents() ? 4 : 0);
@@ -201,7 +166,7 @@ void BaseGeometryLoader::generateGeometry()
auto *indexBuffer = new Qt3DCore::QBuffer();
indexBuffer->setData(indexBytes);
- QAttribute *indexAttribute = new QAttribute(indexBuffer, ty, 1, m_indices.size());
+ QAttribute *indexAttribute = new QAttribute(indexBuffer, ty, 1, uint(m_indices.size()));
indexAttribute->setAttributeType(QAttribute::IndexAttribute);
m_geometry->addAttribute(indexAttribute);
}
@@ -280,3 +245,5 @@ void BaseGeometryLoader::center(std::vector<QVector3D> &points)
} // namespace Qt3DRender
QT_END_NAMESPACE
+
+#include "moc_basegeometryloader_p.cpp"
diff --git a/src/plugins/geometryloaders/default/basegeometryloader_p.h b/src/plugins/geometryloaders/default/basegeometryloader_p.h
index d86cd6f97..d041b16ba 100644
--- a/src/plugins/geometryloaders/default/basegeometryloader_p.h
+++ b/src/plugins/geometryloaders/default/basegeometryloader_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_BASEGEOMETRYLOADER_H
#define QT3DRENDER_BASEGEOMETRYLOADER_H
diff --git a/src/plugins/geometryloaders/default/default.pro b/src/plugins/geometryloaders/default/default.pro
deleted file mode 100644
index c126b5844..000000000
--- a/src/plugins/geometryloaders/default/default.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGET = defaultgeometryloader
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private
-
-HEADERS += \
- basegeometryloader_p.h \
-
-SOURCES += \
- main.cpp \
- basegeometryloader.cpp \
- objgeometryloader.cpp \
- plygeometryloader.cpp \
- stlgeometryloader.cpp \
-
-DISTFILES += \
- default.json
-
-PLUGIN_TYPE = geometryloaders
-PLUGIN_CLASS_NAME = DefaultGeometryLoaderPlugin
-load(qt_plugin)
diff --git a/src/plugins/geometryloaders/default/main.cpp b/src/plugins/geometryloaders/default/main.cpp
index ee603821b..18522b2c6 100644
--- a/src/plugins/geometryloaders/default/main.cpp
+++ b/src/plugins/geometryloaders/default/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <Qt3DRender/private/qgeometryloaderfactory_p.h>
diff --git a/src/plugins/geometryloaders/default/objgeometryloader.cpp b/src/plugins/geometryloaders/default/objgeometryloader.cpp
index 8515b2ffa..e741426c1 100644
--- a/src/plugins/geometryloaders/default/objgeometryloader.cpp
+++ b/src/plugins/geometryloaders/default/objgeometryloader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "objgeometryloader.h"
@@ -102,10 +66,19 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh)
if (lineSize > 0 && line[0] != '#') {
if (line[lineSize - 1] == '\n')
--lineSize; // chop newline
+ if (lineSize <= 0)
+ continue;
+
if (line[lineSize - 1] == '\r')
--lineSize; // chop newline also for CRLF format
- while (line[lineSize - 1] == ' ' || line[lineSize - 1] == '\t')
+ if (lineSize <= 0)
+ continue;
+
+ while (lineSize > 0 && (line[lineSize - 1] == ' ' || line[lineSize - 1] == '\t')) {
--lineSize; // chop trailing spaces
+ }
+ if (lineSize <= 0)
+ continue;
const ByteArraySplitter tokens(line, line + lineSize, ' ', Qt::SkipEmptyParts);
@@ -211,7 +184,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh)
// Iterate over the faceIndexMap and pull out pos, texCoord and normal data
// thereby generating unique vertices of data (by OpenGL definition)
- const int vertexCount = faceIndexMap.size();
+ const qsizetype vertexCount = faceIndexMap.size();
const bool hasTexCoords = !texCoords.isEmpty();
const bool hasNormals = !normals.isEmpty();
@@ -236,10 +209,10 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh)
}
// Now iterate over the face indices and lookup the unique vertex index
- const int indexCount = faceIndexVector.size();
+ const qsizetype indexCount = faceIndexVector.size();
m_indices.clear();
m_indices.reserve(indexCount);
- for (const FaceIndices &faceIndices : qAsConst(faceIndexVector)) {
+ for (const FaceIndices &faceIndices : std::as_const(faceIndexVector)) {
const unsigned int i = faceIndexMap.value(faceIndices);
m_indices.push_back(i);
}
diff --git a/src/plugins/geometryloaders/default/objgeometryloader.h b/src/plugins/geometryloaders/default/objgeometryloader.h
index 549a17f6d..40cc4e0bb 100644
--- a/src/plugins/geometryloaders/default/objgeometryloader.h
+++ b/src/plugins/geometryloaders/default/objgeometryloader.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef OBJGEOMETRYLOADER_H
#define OBJGEOMETRYLOADER_H
diff --git a/src/plugins/geometryloaders/default/plygeometryloader.cpp b/src/plugins/geometryloaders/default/plygeometryloader.cpp
index 949adeaee..54585ad75 100644
--- a/src/plugins/geometryloaders/default/plygeometryloader.cpp
+++ b/src/plugins/geometryloaders/default/plygeometryloader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "plygeometryloader.h"
@@ -355,7 +319,7 @@ bool PlyGeometryLoader::parseMesh(QIODevice *ioDev)
break;
}
- for (auto &element : qAsConst(m_elements)) {
+ for (auto &element : std::as_const(m_elements)) {
if (element.type == ElementVertex) {
m_points.reserve(element.count);
diff --git a/src/plugins/geometryloaders/default/plygeometryloader.h b/src/plugins/geometryloaders/default/plygeometryloader.h
index 49c6b858d..71c2f7810 100644
--- a/src/plugins/geometryloaders/default/plygeometryloader.h
+++ b/src/plugins/geometryloaders/default/plygeometryloader.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef PLYGEOMETRYLOADER_H
#define PLYGEOMETRYLOADER_H
diff --git a/src/plugins/geometryloaders/default/stlgeometryloader.cpp b/src/plugins/geometryloaders/default/stlgeometryloader.cpp
index a8083eb32..07e38604d 100644
--- a/src/plugins/geometryloaders/default/stlgeometryloader.cpp
+++ b/src/plugins/geometryloaders/default/stlgeometryloader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "stlgeometryloader.h"
@@ -90,7 +54,7 @@ bool StlGeometryLoader::loadAscii(QIODevice *ioDev)
const float y = tokens.floatAt(2);
const float z = tokens.floatAt(3);
m_points.push_back(QVector3D(x, y, z));
- m_indices.push_back(m_indices.size());
+ m_indices.push_back(uint(m_indices.size()));
}
}
}
diff --git a/src/plugins/geometryloaders/default/stlgeometryloader.h b/src/plugins/geometryloaders/default/stlgeometryloader.h
index c9aa5a6f2..5321bb7d8 100644
--- a/src/plugins/geometryloaders/default/stlgeometryloader.h
+++ b/src/plugins/geometryloaders/default/stlgeometryloader.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef STLGEOMETRYLOADER_H
#define STLGEOMETRYLOADER_H
diff --git a/src/plugins/geometryloaders/fbx/CMakeLists.txt b/src/plugins/geometryloaders/fbx/CMakeLists.txt
index f66f2b76b..b15a99660 100644
--- a/src/plugins/geometryloaders/fbx/CMakeLists.txt
+++ b/src/plugins/geometryloaders/fbx/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from fbx.pro.
#####################################################################
diff --git a/src/plugins/geometryloaders/fbx/fbx.pro b/src/plugins/geometryloaders/fbx/fbx.pro
deleted file mode 100644
index a9c17d4e7..000000000
--- a/src/plugins/geometryloaders/fbx/fbx.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGET = fbxgeometryloader
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private
-
-HEADERS += \
- fbxgeometryloader.h \
-
-SOURCES += \
- main.cpp \
- fbxgeometryloader.cpp \
-
-DISTFILES += \
- fbx.json
-
-include($$OUT_PWD/../qtgeometryloaders-config.pri)
-QMAKE_USE += fbx
-
-PLUGIN_TYPE = geometryloaders
-PLUGIN_CLASS_NAME = fbxGeometryLoaderPlugin
-load(qt_plugin)
diff --git a/src/plugins/geometryloaders/fbx/fbxgeometryloader.cpp b/src/plugins/geometryloaders/fbx/fbxgeometryloader.cpp
index e8b92dc82..a89580f8b 100644
--- a/src/plugins/geometryloaders/fbx/fbxgeometryloader.cpp
+++ b/src/plugins/geometryloaders/fbx/fbxgeometryloader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "fbxgeometryloader.h"
diff --git a/src/plugins/geometryloaders/fbx/fbxgeometryloader.h b/src/plugins/geometryloaders/fbx/fbxgeometryloader.h
index 68ee1f976..8f2ed8cd8 100644
--- a/src/plugins/geometryloaders/fbx/fbxgeometryloader.h
+++ b/src/plugins/geometryloaders/fbx/fbxgeometryloader.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef FBXGEOMETRYLOADER_H
#define FBXGEOMETRYLOADER_H
diff --git a/src/plugins/geometryloaders/fbx/main.cpp b/src/plugins/geometryloaders/fbx/main.cpp
index fd0a61293..1f813388d 100644
--- a/src/plugins/geometryloaders/fbx/main.cpp
+++ b/src/plugins/geometryloaders/fbx/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <Qt3DRender/private/qgeometryloaderfactory_p.h>
diff --git a/src/plugins/geometryloaders/geometryloaders.pro b/src/plugins/geometryloaders/geometryloaders.pro
deleted file mode 100644
index 764c615da..000000000
--- a/src/plugins/geometryloaders/geometryloaders.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-qtConfig(regularexpression) : SUBDIRS += default
-SUBDIRS += gltf
-qtConfig(qt3d-fbxsdk) : SUBDIRS += fbx
diff --git a/src/plugins/geometryloaders/gltf/CMakeLists.txt b/src/plugins/geometryloaders/gltf/CMakeLists.txt
index 8592d4cf8..347be7e56 100644
--- a/src/plugins/geometryloaders/gltf/CMakeLists.txt
+++ b/src/plugins/geometryloaders/gltf/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from gltf.pro.
#####################################################################
diff --git a/src/plugins/geometryloaders/gltf/gltf.pro b/src/plugins/geometryloaders/gltf/gltf.pro
deleted file mode 100644
index 815226b4e..000000000
--- a/src/plugins/geometryloaders/gltf/gltf.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = gltfgeometryloader
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private
-
-HEADERS += \
- gltfgeometryloader.h \
-
-SOURCES += \
- main.cpp \
- gltfgeometryloader.cpp \
-
-DISTFILES += \
- gltf.json
-
-PLUGIN_TYPE = geometryloaders
-PLUGIN_CLASS_NAME = GLTFGeometryLoaderPlugin
-load(qt_plugin)
diff --git a/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp b/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
index 375dda0b0..16d5d7e5d 100644
--- a/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
+++ b/src/plugins/geometryloaders/gltf/gltfgeometryloader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "gltfgeometryloader.h"
@@ -57,10 +21,11 @@ QT_BEGIN_NAMESPACE
static_cast<const wchar_t*>(static_cast<const void*>(string.utf16()))
#endif
-using namespace Qt3DCore;
namespace Qt3DRender {
+using namespace Qt3DCore;
+
Q_LOGGING_CATEGORY(GLTFGeometryLoaderLog, "Qt3D.GLTFGeometryLoader", QtWarningMsg)
#define KEY_ASSET QLatin1String("asset")
@@ -293,7 +258,7 @@ void GLTFGeometryLoader::processJSONBufferV2(const QJsonObject &json)
void GLTFGeometryLoader::processJSONBufferView(const QString &id, const QJsonObject &json)
{
QString bufName = json.value(KEY_BUFFER).toString();
- const auto it = qAsConst(m_gltf1.m_bufferDatas).find(bufName);
+ const auto it = std::as_const(m_gltf1.m_bufferDatas).find(bufName);
if (Q_UNLIKELY(it == m_gltf1.m_bufferDatas.cend())) {
qCWarning(GLTFGeometryLoaderLog, "unknown buffer: %ls processing view: %ls",
qUtf16PrintableImpl(bufName), qUtf16PrintableImpl(id));
@@ -342,15 +307,6 @@ void GLTFGeometryLoader::processJSONBufferViewV2(const QJsonObject &json)
}
const auto bufferData = m_gltf2.m_bufferDatas[bufferIndex];
- int target = json.value(KEY_TARGET).toInt();
- switch (target) {
- case GL_ARRAY_BUFFER:
- case GL_ELEMENT_ARRAY_BUFFER:
- break;
- default:
- return;
- }
-
quint64 offset = 0;
const auto byteOffset = json.value(KEY_BYTE_OFFSET);
if (!byteOffset.isUndefined()) {
@@ -398,7 +354,7 @@ void GLTFGeometryLoader::processJSONMesh(const QString &id, const QJsonObject &j
const QJsonObject attrs = primitiveObject.value(KEY_ATTRIBUTES).toObject();
for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it) {
QString k = it.value().toString();
- const auto accessorIt = qAsConst(m_gltf1.m_accessorDict).find(k);
+ const auto accessorIt = std::as_const(m_gltf1.m_accessorDict).find(k);
if (Q_UNLIKELY(accessorIt == m_gltf1.m_accessorDict.cend())) {
qCWarning(GLTFGeometryLoaderLog, "unknown attribute accessor: %ls on mesh %ls",
qUtf16PrintableImpl(k), qUtf16PrintableImpl(id));
@@ -432,7 +388,7 @@ void GLTFGeometryLoader::processJSONMesh(const QString &id, const QJsonObject &j
const auto indices = primitiveObject.value(KEY_INDICES);
if (!indices.isUndefined()) {
QString k = indices.toString();
- const auto accessorIt = qAsConst(m_gltf1.m_accessorDict).find(k);
+ const auto accessorIt = std::as_const(m_gltf1.m_accessorDict).find(k);
if (Q_UNLIKELY(accessorIt == m_gltf1.m_accessorDict.cend())) {
qCWarning(GLTFGeometryLoaderLog, "unknown index accessor: %ls on mesh %ls",
qUtf16PrintableImpl(k), qUtf16PrintableImpl(id));
@@ -549,7 +505,7 @@ void GLTFGeometryLoader::loadBufferData()
void GLTFGeometryLoader::unloadBufferData()
{
- for (const auto &bufferData : qAsConst(m_gltf1.m_bufferDatas)) {
+ for (const auto &bufferData : std::as_const(m_gltf1.m_bufferDatas)) {
QByteArray *data = bufferData.data;
delete data;
}
@@ -565,7 +521,7 @@ void GLTFGeometryLoader::loadBufferDataV2()
void GLTFGeometryLoader::unloadBufferDataV2()
{
- for (const auto &bufferData : qAsConst(m_gltf2.m_bufferDatas)) {
+ for (const auto &bufferData : std::as_const(m_gltf2.m_bufferDatas)) {
QByteArray *data = bufferData.data;
delete data;
}
@@ -626,3 +582,5 @@ uint GLTFGeometryLoader::accessorDataSizeFromJson(const QString &type)
} // namespace Qt3DRender
QT_END_NAMESPACE
+
+#include "moc_gltfgeometryloader.cpp"
diff --git a/src/plugins/geometryloaders/gltf/gltfgeometryloader.h b/src/plugins/geometryloaders/gltf/gltfgeometryloader.h
index f3a0961ab..d547faf33 100644
--- a/src/plugins/geometryloaders/gltf/gltfgeometryloader.h
+++ b/src/plugins/geometryloaders/gltf/gltfgeometryloader.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GLTFGEOMETRYLOADER_H
#define GLTFGEOMETRYLOADER_H
diff --git a/src/plugins/geometryloaders/gltf/main.cpp b/src/plugins/geometryloaders/gltf/main.cpp
index ee27e1325..8012190d7 100644
--- a/src/plugins/geometryloaders/gltf/main.cpp
+++ b/src/plugins/geometryloaders/gltf/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <Qt3DRender/private/qgeometryloaderfactory_p.h>
diff --git a/src/plugins/renderers/CMakeLists.txt b/src/plugins/renderers/CMakeLists.txt
index 9caeb4153..ef98862dd 100644
--- a/src/plugins/renderers/CMakeLists.txt
+++ b/src/plugins/renderers/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from renderers.pro.
qt_feature_module_begin(
diff --git a/src/plugins/renderers/configure.cmake b/src/plugins/renderers/configure.cmake
index 5d2fbcde5..a157d66da 100644
--- a/src/plugins/renderers/configure.cmake
+++ b/src/plugins/renderers/configure.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#### Inputs
diff --git a/src/plugins/renderers/dummy/CMakeLists.txt b/src/plugins/renderers/dummy/CMakeLists.txt
index 86681e137..85c91b2c1 100644
--- a/src/plugins/renderers/dummy/CMakeLists.txt
+++ b/src/plugins/renderers/dummy/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from dummy.pro.
#####################################################################
diff --git a/src/plugins/renderers/dummy/dummy.pro b/src/plugins/renderers/dummy/dummy.pro
deleted file mode 100644
index e69de29bb..000000000
--- a/src/plugins/renderers/dummy/dummy.pro
+++ /dev/null
diff --git a/src/plugins/renderers/opengl/CMakeLists.txt b/src/plugins/renderers/opengl/CMakeLists.txt
index de485138a..82328d1f9 100644
--- a/src/plugins/renderers/opengl/CMakeLists.txt
+++ b/src/plugins/renderers/opengl/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from opengl.pro.
set(openGLRendererSources graphicshelpers/graphicscontext.cpp graphicshelpers/graphicscontext_p.h
@@ -118,6 +121,9 @@ qt_internal_add_plugin(OpenGLRendererPlugin
Qt::OpenGLPrivate
)
+# QTransform conflicts
+set_target_properties(OpenGLRendererPlugin PROPERTIES UNITY_BUILD OFF)
+
qt_internal_extend_target(OpenGLRendererPlugin CONDITION NOT INTEGRITY
SOURCES
debug/imguirenderer.cpp debug/imguirenderer_p.h
diff --git a/src/plugins/renderers/opengl/debug/debug.pri b/src/plugins/renderers/opengl/debug/debug.pri
deleted file mode 100644
index 38a056f6b..000000000
--- a/src/plugins/renderers/opengl/debug/debug.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDEPATH += $$PWD
-
-include($$QT3D_ROOT/src/3rdparty/imgui/imgui.pri)
-
-HEADERS += \
- $$PWD/imguirenderer_p.h
-
-SOURCES += \
- $$PWD/imguirenderer.cpp
diff --git a/src/plugins/renderers/opengl/debug/imguirenderer.cpp b/src/plugins/renderers/opengl/debug/imguirenderer.cpp
index 744060fcf..e2ea3d203 100644
--- a/src/plugins/renderers/opengl/debug/imguirenderer.cpp
+++ b/src/plugins/renderers/opengl/debug/imguirenderer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*
* Based on https://github.com/seanchas116/qtimgui/
@@ -67,10 +31,8 @@
QT_BEGIN_NAMESPACE
-using namespace Qt3DRender;
-using namespace Render;
-using namespace Render::Debug;
-using namespace Render::OpenGL;
+namespace Qt3DRR = Qt3DRender::Render;
+namespace Qt3DRRD = Qt3DRR::Debug;
namespace {
@@ -102,42 +64,69 @@ namespace {
int vertexToPrimitiveCount(Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType, int numVertices) {
int nPrimitives = 0;
switch (primitiveType) {
- case QGeometryRenderer::Points:
- case QGeometryRenderer::LineLoop: nPrimitives += numVertices; break;
- case QGeometryRenderer::Triangles: nPrimitives += numVertices / 3; break;
- case QGeometryRenderer::Lines: nPrimitives += numVertices / 2; break;
- case QGeometryRenderer::TriangleFan:
- case QGeometryRenderer::TriangleStrip:
- case QGeometryRenderer::LineStrip: nPrimitives += numVertices - 1; break;
- case QGeometryRenderer::TrianglesAdjacency: nPrimitives += numVertices / 6; break;
- case QGeometryRenderer::TriangleStripAdjacency:
- case QGeometryRenderer::LineStripAdjacency: nPrimitives += numVertices / 2 - 1; break;
- case QGeometryRenderer::LinesAdjacency: nPrimitives += numVertices / 4; break;
- case QGeometryRenderer::Patches: nPrimitives += 1;
+ case Qt3DRender::QGeometryRenderer::Points:
+ case Qt3DRender::QGeometryRenderer::LineLoop:
+ nPrimitives += numVertices;
+ break;
+ case Qt3DRender::QGeometryRenderer::Triangles:
+ nPrimitives += numVertices / 3;
+ break;
+ case Qt3DRender::QGeometryRenderer::Lines:
+ nPrimitives += numVertices / 2;
+ break;
+ case Qt3DRender::QGeometryRenderer::TriangleFan:
+ case Qt3DRender::QGeometryRenderer::TriangleStrip:
+ case Qt3DRender::QGeometryRenderer::LineStrip:
+ nPrimitives += numVertices - 1;
+ break;
+ case Qt3DRender::QGeometryRenderer::TrianglesAdjacency:
+ nPrimitives += numVertices / 6;
+ break;
+ case Qt3DRender::QGeometryRenderer::TriangleStripAdjacency:
+ case Qt3DRender::QGeometryRenderer::LineStripAdjacency:
+ nPrimitives += numVertices / 2 - 1;
+ break;
+ case Qt3DRender::QGeometryRenderer::LinesAdjacency:
+ nPrimitives += numVertices / 4;
+ break;
+ case Qt3DRender::QGeometryRenderer::Patches:
+ nPrimitives += 1;
}
return nPrimitives;
}
const char *primitiveTypeName(Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType) {
switch (primitiveType) {
- case QGeometryRenderer::Points: return "Points";
- case QGeometryRenderer::LineLoop: return "LineLoop";
- case QGeometryRenderer::Triangles: return "Triangles";
- case QGeometryRenderer::TrianglesAdjacency: return "TriangleAdjacency";
- case QGeometryRenderer::TriangleFan: return "TriangleFan";
- case QGeometryRenderer::TriangleStrip: return "TriangleStrip";
- case QGeometryRenderer::TriangleStripAdjacency: return "TriangleStringAdjacency";
- case QGeometryRenderer::LineStrip: return "LineStrip";
- case QGeometryRenderer::LineStripAdjacency: return "LineStripAdjacency";
- case QGeometryRenderer::Lines: return "Lines";
- case QGeometryRenderer::LinesAdjacency: return "LinesAdjacency";
- case QGeometryRenderer::Patches: return "Patches";
+ case Qt3DRender::QGeometryRenderer::Points:
+ return "Points";
+ case Qt3DRender::QGeometryRenderer::LineLoop:
+ return "LineLoop";
+ case Qt3DRender::QGeometryRenderer::Triangles:
+ return "Triangles";
+ case Qt3DRender::QGeometryRenderer::TrianglesAdjacency:
+ return "TriangleAdjacency";
+ case Qt3DRender::QGeometryRenderer::TriangleFan:
+ return "TriangleFan";
+ case Qt3DRender::QGeometryRenderer::TriangleStrip:
+ return "TriangleStrip";
+ case Qt3DRender::QGeometryRenderer::TriangleStripAdjacency:
+ return "TriangleStringAdjacency";
+ case Qt3DRender::QGeometryRenderer::LineStrip:
+ return "LineStrip";
+ case Qt3DRender::QGeometryRenderer::LineStripAdjacency:
+ return "LineStripAdjacency";
+ case Qt3DRender::QGeometryRenderer::Lines:
+ return "Lines";
+ case Qt3DRender::QGeometryRenderer::LinesAdjacency:
+ return "LinesAdjacency";
+ case Qt3DRender::QGeometryRenderer::Patches:
+ return "Patches";
}
return "";
}
}
-ImGuiRenderer::ImGuiRenderer(Qt3DRender::Render::OpenGL::Renderer *renderer)
+Qt3DRRD::ImGuiRenderer::ImGuiRenderer(Qt3DRR::OpenGL::Renderer *renderer)
: m_renderer(renderer)
{
ImGui::CreateContext();
@@ -164,9 +153,9 @@ ImGuiRenderer::ImGuiRenderer(Qt3DRender::Render::OpenGL::Renderer *renderer)
m_jobsRange.first = m_jobsRange.second = 0.f;
}
-ImGuiRenderer::~ImGuiRenderer() = default;
+Qt3DRRD::ImGuiRenderer::~ImGuiRenderer() = default;
-void ImGuiRenderer::renderDebugOverlay(const std::vector<RenderView *> &renderViews, const RenderView *renderView, int jobsInLastFrame)
+void Qt3DRRD::ImGuiRenderer::renderDebugOverlay(const std::vector<Qt3DRR::OpenGL::RenderView *> &renderViews, const Qt3DRR::OpenGL::RenderView *renderView, int jobsInLastFrame)
{
if (!newFrame(renderView))
return;
@@ -194,7 +183,7 @@ void ImGuiRenderer::renderDebugOverlay(const std::vector<RenderView *> &renderVi
{
ImGui::Begin("Qt3D Profiling");
char caption[50];
- sprintf(caption, "Avg %.3f ms/frame (%.1f FPS)", static_cast<double>(1000.0f / ImGui::GetIO().Framerate), static_cast<double>(ImGui::GetIO().Framerate));
+ snprintf(caption, sizeof(caption), "Avg %.3f ms/frame (%.1f FPS)", static_cast<double>(1000.0f / ImGui::GetIO().Framerate), static_cast<double>(ImGui::GetIO().Framerate));
ImGui::PlotLines("FPS", m_fpsLog, logIndex + 1, 0, caption, m_fpsRange.first, m_fpsRange.second, ImVec2(0, 80));
ImGui::PlotHistogram("Jobs", m_jobsLog, logIndex + 1, 0, nullptr, m_jobsRange.first, m_jobsRange.second, ImVec2(0, 80));
@@ -204,10 +193,10 @@ void ImGuiRenderer::renderDebugOverlay(const std::vector<RenderView *> &renderVi
QSet<HGeometryRenderer> inUseGeometries;
QSet<Qt3DCore::QNodeId> inUseTextures;
for (int j=0; j<renderViewsCount; j++) {
- RenderView *rv = renderViews.at(j);
+ Qt3DRR::OpenGL::RenderView *rv = renderViews.at(j);
nCommands += rv->commandCount();
- rv->forEachCommand([&] (const RenderCommand &command) {
- if (command.m_type != RenderCommand::Draw)
+ rv->forEachCommand([&](const Qt3DRR::OpenGL::RenderCommand &command) {
+ if (command.m_type != Qt3DRR::OpenGL::RenderCommand::Draw)
return;
nVertices += command.m_primitiveCount;
nPrimitives += vertexToPrimitiveCount(command.m_primitiveType, command.m_primitiveCount);
@@ -312,24 +301,24 @@ void ImGuiRenderer::renderDebugOverlay(const std::vector<RenderView *> &renderVi
renderDrawList(ImGui::GetDrawData());
}
-void ImGuiRenderer::setCapabilities(const QString &capabilities)
+void Qt3DRRD::ImGuiRenderer::setCapabilities(const QString &capabilities)
{
m_capabilities = capabilities.toLatin1();
}
-void ImGuiRenderer::showGLInfo()
+void Qt3DRRD::ImGuiRenderer::showGLInfo()
{
ImGui::Begin("Open GL Details", &m_showGLInfoWindow);
ImGui::Text("%s", m_capabilities.data());
ImGui::End();
}
-void ImGuiRenderer::showRenderDetails(const std::vector<RenderView *> &renderViews)
+void Qt3DRRD::ImGuiRenderer::showRenderDetails(const std::vector<Qt3DRR::OpenGL::RenderView *> &renderViews)
{
ImGui::Begin("Render Views", &m_showRenderDetailsWindow);
int i = 1;
- for (const RenderView *view: renderViews) {
+ for (const Qt3DRR::OpenGL::RenderView *view : renderViews) {
QString label(QLatin1String("View ") + QString::number(i++));
if (ImGui::TreeNode(label.toLatin1().data())) {
ImGui::Text("Viewport: (%.1f, %.1f, %.1f, %.1f)", view->viewport().x(), view->viewport().y(),
@@ -343,7 +332,7 @@ void ImGuiRenderer::showRenderDetails(const std::vector<RenderView *> &renderVie
ImGui::Text("Clear Stencil Value: %d", view->clearStencilValue());
int j = 1;
- view->forEachCommand([&] (const RenderCommand &command) {
+ view->forEachCommand([&](const Qt3DRR::OpenGL::RenderCommand &command) {
GeometryRenderer *rGeometryRenderer = m_renderer->nodeManagers()->data<GeometryRenderer, GeometryRendererManager>(command.m_geometryRenderer);
QString label = QString(QLatin1String("Command %1 {%2}")).arg(QString::number(j++), QString::number(rGeometryRenderer->peerId().id()));
if (ImGui::TreeNode(label.toLatin1().data())) {
@@ -366,7 +355,7 @@ void ImGuiRenderer::showRenderDetails(const std::vector<RenderView *> &renderVie
ImGui::End();
}
-void ImGuiRenderer::renderDrawList(ImDrawData *draw_data)
+void Qt3DRRD::ImGuiRenderer::renderDrawList(ImDrawData *draw_data)
{
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
ImGuiIO& io = ImGui::GetIO();
@@ -463,7 +452,7 @@ void ImGuiRenderer::renderDrawList(ImDrawData *draw_data)
m_funcs->glScissor(last_scissor_box[0], last_scissor_box[1], static_cast<GLsizei>(last_scissor_box[2]), static_cast<GLsizei>(last_scissor_box[3]));
}
-bool ImGuiRenderer::createFontsTexture()
+bool Qt3DRRD::ImGuiRenderer::createFontsTexture()
{
// Build texture atlas
ImGuiIO& io = ImGui::GetIO();
@@ -489,7 +478,7 @@ bool ImGuiRenderer::createFontsTexture()
return true;
}
-bool ImGuiRenderer::createDeviceObjects()
+bool Qt3DRRD::ImGuiRenderer::createDeviceObjects()
{
auto *glContext = m_renderer->submissionContext()->openGLContext();
if (glContext->format().majorVersion() < 3) {
@@ -607,7 +596,7 @@ bool ImGuiRenderer::createDeviceObjects()
return true;
}
-bool ImGuiRenderer::newFrame(const RenderView *renderView)
+bool Qt3DRRD::ImGuiRenderer::newFrame(const Qt3DRR::OpenGL::RenderView *renderView)
{
if (!m_funcs)
m_funcs = m_renderer->submissionContext()->openGLContext()->extraFunctions();
@@ -643,7 +632,7 @@ bool ImGuiRenderer::newFrame(const RenderView *renderView)
return true;
}
-void ImGuiRenderer::onMouseChange(QMouseEvent *event)
+void Qt3DRRD::ImGuiRenderer::onMouseChange(QMouseEvent *event)
{
ImGuiIO& io = ImGui::GetIO();
io.MousePos = ImVec2(event->pos().x(), event->pos().y());
@@ -652,14 +641,14 @@ void ImGuiRenderer::onMouseChange(QMouseEvent *event)
m_mousePressed[2] = event->buttons() & Qt::MiddleButton;
}
-void ImGuiRenderer::onWheel(QWheelEvent *event)
+void Qt3DRRD::ImGuiRenderer::onWheel(QWheelEvent *event)
{
// 5 lines per unit
m_mouseWheelH += event->pixelDelta().x() / (ImGui::GetTextLineHeight());
m_mouseWheel += event->pixelDelta().y() / (5.f * ImGui::GetTextLineHeight());
}
-void ImGuiRenderer::onKeyPressRelease(QKeyEvent *event)
+void Qt3DRRD::ImGuiRenderer::onKeyPressRelease(QKeyEvent *event)
{
ImGuiIO& io = ImGui::GetIO();
if (keyMap.contains(event->key()))
@@ -684,7 +673,7 @@ void ImGuiRenderer::onKeyPressRelease(QKeyEvent *event)
#endif
}
-void ImGuiRenderer::processEvent(QEvent *event)
+void Qt3DRRD::ImGuiRenderer::processEvent(QEvent *event)
{
switch (event->type()) {
case QEvent::MouseMove:
diff --git a/src/plugins/renderers/opengl/debug/imguirenderer_p.h b/src/plugins/renderers/opengl/debug/imguirenderer_p.h
index d70bd3259..50d063189 100644
--- a/src/plugins/renderers/opengl/debug/imguirenderer_p.h
+++ b/src/plugins/renderers/opengl/debug/imguirenderer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3D_RENDER_GL_IMGUIRENDER_H_
#define QT3D_RENDER_GL_IMGUIRENDER_H_
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp
index 287dfffe5..b62cad811 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicscontext_p.h"
@@ -64,9 +28,7 @@
#include <glshader_p.h>
#if !QT_CONFIG(opengles2)
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QtOpenGL/QOpenGLVersionFunctionsFactory>
-#endif
#include <QOpenGLFunctions_2_0>
#include <QOpenGLFunctions_3_2_Core>
#include <QOpenGLFunctions_3_3_Core>
@@ -84,13 +46,9 @@
#include <QSurface>
#include <QWindow>
#include <QOpenGLTexture>
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef QT_OPENGL_LIB
#include <QtOpenGL/QOpenGLDebugLogger>
#endif
-#else
-#include <QOpenGLDebugLogger>
-#endif
QT_BEGIN_NAMESPACE
@@ -394,32 +352,16 @@ GraphicsHelperInterface *GraphicsContext::resolveHighestOpenGLFunctions()
#if !QT_CONFIG(opengles2)
else {
QAbstractOpenGLFunctions *glFunctions = nullptr;
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if ((glFunctions = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_3_Core>()) != nullptr) {
-#else
- if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_4_3_Core>()) != nullptr) {
-#endif
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 4.3";
glHelper = new GraphicsHelperGL4();
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
} else if ((glFunctions = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_3_Core>()) != nullptr) {
-#else
- } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_3_3_Core>()) != nullptr) {
-#endif
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 3.3";
glHelper = new GraphicsHelperGL3_3();
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
} else if ((glFunctions = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_2_Core>()) != nullptr) {
-#else
- } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_3_2_Core>()) != nullptr) {
-#endif
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 3.2";
glHelper = new GraphicsHelperGL3_2();
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
} else if ((glFunctions = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_2_0>()) != nullptr) {
-#else
- } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_2_0>()) != nullptr) {
-#endif
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 2 Helper";
glHelper = new GraphicsHelperGL2();
}
@@ -438,7 +380,7 @@ GraphicsHelperInterface *GraphicsContext::resolveHighestOpenGLFunctions()
qCDebug(Backend) << "Qt3D: Enabling OpenGL debug logging";
m_debugLogger.reset(new QOpenGLDebugLogger);
if (m_debugLogger->initialize()) {
- QObject::connect(m_debugLogger.data(), &QOpenGLDebugLogger::messageLogged, &logOpenGLDebugMessage);
+ QObject::connect(m_debugLogger.data(), &QOpenGLDebugLogger::messageLogged, m_debugLogger.data(), &logOpenGLDebugMessage);
const QString mode = QString::fromLocal8Bit(debugLoggingMode);
m_debugLogger->startLogging(mode.startsWith(QLatin1String("sync"), Qt::CaseInsensitive)
? QOpenGLDebugLogger::SynchronousLogging
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h
index ba474a89b..cdff6fa48 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSCONTEXT_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSCONTEXT_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
index 9853b2b96..accc1e757 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicshelperes2_p.h"
#include <private/attachmentpack_p.h>
@@ -1018,8 +982,7 @@ UniformType GraphicsHelperES2::uniformTypeFromGLType(GLenum type)
case GL_SAMPLER_CUBE:
return UniformType::Sampler;
default:
- Q_UNREACHABLE();
- return UniformType::Float;
+ Q_UNREACHABLE_RETURN(UniformType::Float);
}
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
index dd38b8c3a..5c51cb013 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERES2_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERES2_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
index 8a516c110..75876686c 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 Svenn-Arne Dragly.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 Svenn-Arne Dragly.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicshelperes3_p.h"
#include <private/attachmentpack_p.h>
@@ -263,6 +227,17 @@ void GraphicsHelperES3::drawArraysInstanced(GLenum primitiveType, GLint first, G
instances);
}
+void GraphicsHelperES3::drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance)
+{
+ if (baseInstance != 0)
+ qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 3";
+
+ m_extraFuncs->glDrawArraysInstanced(primitiveType,
+ first,
+ count,
+ instances);
+}
+
void GraphicsHelperES3::readBuffer(GLenum mode)
{
m_extraFuncs->glReadBuffer(mode);
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
index 965e7cab1..d82403d7b 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicshelperes3_1_p.h"
#include <qgraphicsutils_p.h>
@@ -154,7 +118,7 @@ namespace OpenGL {
namespace {
-GLbitfield memoryBarrierGLBitfield(QMemoryBarrier::Operations barriers)
+GLbitfield memoryBarrierGL3Bitfield(QMemoryBarrier::Operations barriers)
{
GLbitfield bits = 0;
@@ -240,7 +204,7 @@ void GraphicsHelperES3_1::dispatchCompute(GLuint wx, GLuint wy, GLuint wz)
void GraphicsHelperES3_1::memoryBarrier(QMemoryBarrier::Operations barriers)
{
- m_extraFuncs->glMemoryBarrier(memoryBarrierGLBitfield(barriers));
+ m_extraFuncs->glMemoryBarrier(memoryBarrierGL3Bitfield(barriers));
}
void GraphicsHelperES3_1::drawArraysIndirect(GLenum mode, void *indirect)
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
index 126be1a3b..fe6d742e1 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_GRAPHICSHELPERES3_1_H
#define QT3DRENDER_RENDER_GRAPHICSHELPERES3_1_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp
index 3eac571a0..ce3f9ac42 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicshelperes3_2_p.h"
#include <QOpenGLExtraFunctions>
@@ -140,7 +104,7 @@ void GraphicsHelperES3_2::setVerticesPerPatch(GLint verticesPerPatch)
void GraphicsHelperES3_2::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex, GLint baseInstance)
{
if (baseInstance != 0)
- qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2";
+ qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 3.2";
m_extraFuncs->glDrawElementsInstancedBaseVertex(primitiveType,
primitiveCount,
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2_p.h
index af289eaf6..403b8c6d1 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERES3_2_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERES3_2_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
index 66c674421..8fc12ca6d 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 Svenn-Arne Dragly.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 Svenn-Arne Dragly.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERES3_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERES3_H
@@ -76,6 +40,7 @@ public:
void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) override;
void drawBuffers(GLsizei n, const int *bufs) override;
void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override;
+ void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override;
void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override;
void readBuffer(GLenum mode) override;
void drawBuffer(GLenum mode) override;
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
index e8213015f..0f7195fbd 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicshelpergl2_p.h"
#if !QT_CONFIG(opengles2)
@@ -882,8 +846,7 @@ UniformType GraphicsHelperGL2::uniformTypeFromGLType(GLenum type)
return UniformType::Sampler;
default:
- Q_UNREACHABLE();
- return UniformType::Float;
+ Q_UNREACHABLE_RETURN(UniformType::Float);
}
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
index 24ddc72f7..6ec59eef2 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL2_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL2_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
index 0eb0a9818..82b9c7542 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicshelpergl3_2_p.h"
@@ -99,7 +63,7 @@ void GraphicsHelperGL3_2::drawElementsInstancedBaseVertexBaseInstance(GLenum pri
GLint baseInstance)
{
if (baseInstance != 0)
- qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2";
+ qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL 3.2";
// glDrawElements OpenGL 3.1 or greater
m_funcs->glDrawElementsInstancedBaseVertex(primitiveType,
@@ -1210,8 +1174,7 @@ UniformType GraphicsHelperGL3_2::uniformTypeFromGLType(GLenum type)
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
return UniformType::Sampler;
default:
- Q_UNREACHABLE();
- return UniformType::Float;
+ Q_UNREACHABLE_RETURN(UniformType::Float);
}
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
index 7cc5c838d..6adaf97e2 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL3_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL3_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
index 370533197..c2802fae0 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicshelpergl3_3_p.h"
@@ -98,7 +62,7 @@ void GraphicsHelperGL3_3::drawElementsInstancedBaseVertexBaseInstance(GLenum pri
GLint baseInstance)
{
if (baseInstance != 0)
- qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL 3";
+ qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL 3.3";
// glDrawElements OpenGL 3.1 or greater
m_funcs->glDrawElementsInstancedBaseVertex(primitiveType,
@@ -1205,8 +1169,7 @@ UniformType GraphicsHelperGL3_3::uniformTypeFromGLType(GLenum type)
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
return UniformType::Sampler;
default:
- Q_UNREACHABLE();
- return UniformType::Float;
+ Q_UNREACHABLE_RETURN(UniformType::Float);
}
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
index c3f94d3d2..ba4f6c76e 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL3_3_P_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL3_3_P_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
index 435ac7a03..c2dff740c 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "graphicshelpergl4_p.h"
@@ -121,7 +85,7 @@ namespace OpenGL {
namespace {
-GLbitfield memoryBarrierGLBitfield(QMemoryBarrier::Operations barriers)
+GLbitfield memoryBarrierGL4Bitfield(QMemoryBarrier::Operations barriers)
{
GLbitfield bits = 0;
@@ -187,16 +151,13 @@ void GraphicsHelperGL4::drawElementsInstancedBaseVertexBaseInstance(GLenum primi
GLint baseVertex,
GLint baseInstance)
{
- if (baseInstance != 0)
- qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2";
-
- // glDrawElements OpenGL 3.1 or greater
- m_funcs->glDrawElementsInstancedBaseVertex(primitiveType,
+ m_funcs->glDrawElementsInstancedBaseVertexBaseInstance(primitiveType,
primitiveCount,
indexType,
indices,
instances,
- baseVertex);
+ baseVertex,
+ baseInstance);
}
void GraphicsHelperGL4::drawArraysInstanced(GLenum primitiveType,
@@ -709,8 +670,7 @@ UniformType GraphicsHelperGL4::uniformTypeFromGLType(GLenum type)
default:
// TO DO: Add support for Doubles and Images
- Q_UNREACHABLE();
- return UniformType::Float;
+ Q_UNREACHABLE_RETURN(UniformType::Float);
}
}
@@ -1346,7 +1306,7 @@ GLint GraphicsHelperGL4::maxClipPlaneCount()
void GraphicsHelperGL4::memoryBarrier(QMemoryBarrier::Operations barriers)
{
- m_funcs->glMemoryBarrier(memoryBarrierGLBitfield(barriers));
+ m_funcs->glMemoryBarrier(memoryBarrierGL4Bitfield(barriers));
}
void GraphicsHelperGL4::enablePrimitiveRestart(int primitiveRestartIndex)
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
index 5941d8a52..a0ca9faa4 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL4_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERGL4_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
index 6bfb363fc..ff9de8c59 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERINTERFACE_H
#define QT3DRENDER_RENDER_OPENGL_GRAPHICSHELPERINTERFACE_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpers.pri b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpers.pri
deleted file mode 100644
index 3cfa445ce..000000000
--- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpers.pri
+++ /dev/null
@@ -1,33 +0,0 @@
-#DEFINES += QT3D_RENDER_ASPECT_OPENGL_DEBUG
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/graphicscontext_p.h \
- $$PWD/graphicshelperinterface_p.h \
- $$PWD/graphicshelperes2_p.h \
- $$PWD/graphicshelperes3_p.h \
- $$PWD/graphicshelperes3_1_p.h \
- $$PWD/graphicshelperes3_2_p.h \
- $$PWD/graphicshelpergl2_p.h \
- $$PWD/graphicshelpergl3_3_p.h \
- $$PWD/graphicshelpergl4_p.h \
- $$PWD/graphicshelpergl3_2_p.h \
- $$PWD/imagesubmissioncontext_p.h \
- $$PWD/submissioncontext_p.h \
- $$PWD/texturesubmissioncontext_p.h \
- $$PWD/qgraphicsutils_p.h
-
-SOURCES += \
- $$PWD/graphicscontext.cpp \
- $$PWD/graphicshelperes2.cpp \
- $$PWD/graphicshelperes3.cpp \
- $$PWD/graphicshelperes3_1.cpp \
- $$PWD/graphicshelperes3_2.cpp \
- $$PWD/graphicshelpergl2.cpp \
- $$PWD/graphicshelpergl3_3.cpp \
- $$PWD/graphicshelpergl4.cpp \
- $$PWD/graphicshelpergl3_2.cpp \
- $$PWD/imagesubmissioncontext.cpp \
- $$PWD/submissioncontext.cpp \
- $$PWD/texturesubmissioncontext.cpp
diff --git a/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp
index f641d6641..99364bac7 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "imagesubmissioncontext_p.h"
#include <Qt3DRender/private/shaderimage_p.h>
@@ -190,8 +154,7 @@ GLenum glImageFormatForShaderImageFormat(QShaderImage::ImageFormat format,
default:
qWarning() << "Cannot map Texture format" << textureFormat << "to a valid Image Format";
- Q_UNREACHABLE();
- return GL_NONE;
+ Q_UNREACHABLE_RETURN(GL_NONE);
}
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h b/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h
index 71e224942..f661c8a33 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/imagesubmissioncontext_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_IMAGESUBMISSIONCONTEXT_P_H
#define QT3DRENDER_RENDER_OPENGL_IMAGESUBMISSIONCONTEXT_P_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h b/src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h
index 411c05d08..d10e9fa0e 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/qgraphicsutils_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_QGRAPHICSUTILS_P_H
#define QT3DRENDER_RENDER_OPENGL_QGRAPHICSUTILS_P_H
@@ -96,12 +60,7 @@ public:
static QVarLengthArray<char, 64> array(16 * byteSize);
memset(array.data(), 0, array.size());
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
switch (v.metaType().id()) {
-#else
- switch (v.type()) {
-#endif
-
// 1 byte
case QMetaType::Bool: {
T data = v.value<bool>();
@@ -336,11 +295,7 @@ public:
}
}
else
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
qWarning() << Q_FUNC_INFO << "QVariant type conversion not handled for " << v.metaType().id();
-#else
- qWarning() << Q_FUNC_INFO << "QVariant type conversion not handled for " << v.type();
-#endif
break;
}
@@ -362,7 +317,7 @@ public:
QVariantList vList = v.toList();
// Handles list of QVariant: usually arrays of float
if (!vList.isEmpty()) {
- for (int i = 0; i < vList.length() && uint(i) * offset < uint(uniformValuesArray.size()); i++) {
+ for (int i = 0; i < vList.size() && uint(i) * offset < uint(uniformValuesArray.size()); i++) {
const char *subBuffer = QGraphicsUtils::bytesFromVariant<T>(vList.at(i));
memcpy(data + i * offset, subBuffer, offset);
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
index 4861390fe..eb1bd78b3 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "submissioncontext_p.h"
@@ -83,13 +47,9 @@
#include <QSurface>
#include <QWindow>
#include <QOpenGLTexture>
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef QT_OPENGL_LIB
#include <QtOpenGL/QOpenGLDebugLogger>
#endif
-#else
-#include <QOpenGLDebugLogger>
-#endif
QT_BEGIN_NAMESPACE
@@ -101,8 +61,6 @@ QT_BEGIN_NAMESPACE
#define GL_DRAW_FRAMEBUFFER 0x8CA9
#endif
-using namespace Qt3DCore;
-
namespace Qt3DRender {
namespace Render {
namespace OpenGL {
@@ -123,14 +81,14 @@ unsigned int nextFreeContextId()
namespace {
-GLBuffer::Type attributeTypeToGLBufferType(QAttribute::AttributeType type)
+GLBuffer::Type attributeTypeToGLBufferType(Qt3DCore::QAttribute::AttributeType type)
{
switch (type) {
- case QAttribute::VertexAttribute:
+ case Qt3DCore::QAttribute::VertexAttribute:
return GLBuffer::ArrayBuffer;
- case QAttribute::IndexAttribute:
+ case Qt3DCore::QAttribute::IndexAttribute:
return GLBuffer::IndexBuffer;
- case QAttribute::DrawIndirectAttribute:
+ case Qt3DCore::QAttribute::DrawIndirectAttribute:
return GLBuffer::DrawIndirectBuffer;
default:
Q_UNREACHABLE();
@@ -376,8 +334,7 @@ GLint glAttachmentPoint(const QRenderTargetOutput::AttachmentPoint &attachmentPo
case QRenderTargetOutput::Stencil:
return GL_STENCIL_ATTACHMENT;
default:
- Q_UNREACHABLE();
- return GL_NONE;
+ Q_UNREACHABLE_RETURN(GL_NONE);
}
}
@@ -487,6 +444,10 @@ bool SubmissionContext::beginDrawing(QSurface *surface)
}
m_boundArrayBuffer = nullptr;
+
+ // Record the default FBO value as there's no guarantee it remains constant over time
+ m_defaultFBO = m_gl->defaultFramebufferObject();
+
return true;
}
@@ -503,7 +464,19 @@ void SubmissionContext::endDrawing(bool swapBuffers)
void SubmissionContext::activateRenderTarget(Qt3DCore::QNodeId renderTargetNodeId, const AttachmentPack &attachments, GLuint defaultFboId)
{
GLuint fboId = defaultFboId; // Default FBO
- if (renderTargetNodeId) {
+ resolveRenderTargetFormat(); // Reset m_renderTargetFormat based on the default FBO
+
+ // check if target buffer is GL_BACK_LEFT or GL_BACK_RIGHT, as they don't need an
+ // own fbo
+ auto allLeftOrRight = std::all_of(attachments.attachments().begin(), attachments.attachments().end(),
+ [](const Attachment& att){
+ return att.m_point == QRenderTargetOutput::Left || att.m_point == QRenderTargetOutput::Right;
+ });
+
+ const bool allAttachmentsAreLeftOrRight = attachments.attachments().size() > 0 && allLeftOrRight;
+ const bool shouldCreateRenderTarget = !allAttachmentsAreLeftOrRight && renderTargetNodeId;
+
+ if (shouldCreateRenderTarget) {
// New RenderTarget
if (!m_renderTargets.contains(renderTargetNodeId)) {
if (m_defaultFBO && fboId == m_defaultFBO) {
@@ -513,9 +486,10 @@ void SubmissionContext::activateRenderTarget(Qt3DCore::QNodeId renderTargetNodeI
fboId = createRenderTarget(renderTargetNodeId, attachments);
}
} else {
- fboId = updateRenderTarget(renderTargetNodeId, attachments, true);
+ fboId = updateRenderTarget(renderTargetNodeId, attachments, true); // Overwrites m_renderTargetFormat based on custom FBO
}
}
+
m_activeFBO = fboId;
m_activeFBONodeId = renderTargetNodeId;
m_glHelper->bindFrameBufferObject(m_activeFBO, GraphicsHelperInterface::FBODraw);
@@ -645,6 +619,7 @@ QImage SubmissionContext::readFramebuffer(const QRect &rect)
QImage::Format imageFormat;
uint stride;
+ // m_renderTargetFormat is set when the current RV FBO is set in activateRenderTarget
/* format value should match GL internalFormat */
GLenum internalFormat = m_renderTargetFormat;
@@ -893,6 +868,9 @@ void SubmissionContext::activateDrawBuffers(const AttachmentPack &attachments)
m_glHelper->drawBuffers(GLsizei(activeDrawBuffers.size()), activeDrawBuffers.data());
}
}
+ else if (activeDrawBuffers.size() == 1){
+ m_glHelper->drawBuffer(activeDrawBuffers.at(0));
+ }
} else {
qCWarning(Backend) << "FBO incomplete";
}
@@ -1262,6 +1240,10 @@ bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack, GLShad
}
}
+ // Set the pinned images of the previous material
+ // to pinable so that we should easily find an available image unit
+ m_imageContext.deactivateImages();
+
// Fill Image Uniform Value with proper image units
// so that they can be applied as regular uniforms in a second step
for (size_t i = 0; i < parameterPack.images().size(); ++i) {
@@ -1526,7 +1508,7 @@ void SubmissionContext::uploadDataToGLBuffer(Buffer *buffer, GLBuffer *b, bool r
// We have a partial update
if (update->offset >= 0) {
//accumulate sequential updates as single one
- int bufferSize = update->data.size();
+ qsizetype bufferSize = update->data.size();
auto it2 = it + 1;
while ((it2 != updates.end())
&& (it2->offset - update->offset == bufferSize)) {
@@ -1546,7 +1528,7 @@ void SubmissionContext::uploadDataToGLBuffer(Buffer *buffer, GLBuffer *b, bool r
// We have an update that was done by calling QBuffer::setData
// which is used to resize or entirely clear the buffer
// Note: we use the buffer data directly in that case
- const int bufferSize = buffer->data().size();
+ const qsizetype bufferSize = buffer->data().size();
b->allocate(this, bufferSize, false); // orphan the buffer
b->allocate(this, buffer->data().constData(), bufferSize, false);
}
diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h
index 5cbfe540d..36ee8ab8e 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_SUBMISSIONCONTEXT_H
#define QT3DRENDER_RENDER_OPENGL_SUBMISSIONCONTEXT_H
diff --git a/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
index 1650f8563..828f19cfa 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "texturesubmissioncontext_p.h"
diff --git a/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h b/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h
index 70cc44c21..a6c71f934 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h
+++ b/src/plugins/renderers/opengl/graphicshelpers/texturesubmissioncontext_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_TEXTURESUBMISSIONCONTEXT_H
#define QT3DRENDER_RENDER_OPENGL_TEXTURESUBMISSIONCONTEXT_H
diff --git a/src/plugins/renderers/opengl/io/glbuffer.cpp b/src/plugins/renderers/opengl/io/glbuffer.cpp
index 27f005f01..94906affd 100644
--- a/src/plugins/renderers/opengl/io/glbuffer.cpp
+++ b/src/plugins/renderers/opengl/io/glbuffer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "glbuffer_p.h"
#include <graphicscontext_p.h>
diff --git a/src/plugins/renderers/opengl/io/glbuffer_p.h b/src/plugins/renderers/opengl/io/glbuffer_p.h
index 6a2daa287..210b29252 100644
--- a/src/plugins/renderers/opengl/io/glbuffer_p.h
+++ b/src/plugins/renderers/opengl/io/glbuffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GLBUFFER_P_H
#define QT3DRENDER_RENDER_OPENGL_GLBUFFER_P_H
diff --git a/src/plugins/renderers/opengl/io/io.pri b/src/plugins/renderers/opengl/io/io.pri
deleted file mode 100644
index 462978c4d..000000000
--- a/src/plugins/renderers/opengl/io/io.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDEPATH += $$PWD
-
-SOURCES += \
- $$PWD/glbuffer.cpp
-
-HEADERS += \
- $$PWD/glbuffer_p.h
-
diff --git a/src/plugins/renderers/opengl/main.cpp b/src/plugins/renderers/opengl/main.cpp
index 7f982ef8e..35414f6cf 100644
--- a/src/plugins/renderers/opengl/main.cpp
+++ b/src/plugins/renderers/opengl/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <Qt3DRender/private/qrendererplugin_p.h>
#include <renderer_p.h>
diff --git a/src/plugins/renderers/opengl/managers/gl_handle_types_p.h b/src/plugins/renderers/opengl/managers/gl_handle_types_p.h
index 98af4d3b8..298b7e02b 100644
--- a/src/plugins/renderers/opengl/managers/gl_handle_types_p.h
+++ b/src/plugins/renderers/opengl/managers/gl_handle_types_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_HANDLE_TYPES_P_H
#define QT3DRENDER_RENDER_OPENGL_HANDLE_TYPES_P_H
diff --git a/src/plugins/renderers/opengl/managers/glresourcemanagers.cpp b/src/plugins/renderers/opengl/managers/glresourcemanagers.cpp
index e8fd893ee..a57e66e94 100644
--- a/src/plugins/renderers/opengl/managers/glresourcemanagers.cpp
+++ b/src/plugins/renderers/opengl/managers/glresourcemanagers.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "glresourcemanagers_p.h"
diff --git a/src/plugins/renderers/opengl/managers/glresourcemanagers_p.h b/src/plugins/renderers/opengl/managers/glresourcemanagers_p.h
index f6dc3e2d1..588b26362 100644
--- a/src/plugins/renderers/opengl/managers/glresourcemanagers_p.h
+++ b/src/plugins/renderers/opengl/managers/glresourcemanagers_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GLRESOURCEMANAGERS_P_H
#define QT3DRENDER_RENDER_OPENGL_GLRESOURCEMANAGERS_P_H
diff --git a/src/plugins/renderers/opengl/managers/managers.pri b/src/plugins/renderers/opengl/managers/managers.pri
deleted file mode 100644
index 97a4c2c45..000000000
--- a/src/plugins/renderers/opengl/managers/managers.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/gl_handle_types_p.h \
- $$PWD/glresourcemanagers_p.h
-
-SOURCES += \
- $$PWD/glresourcemanagers.cpp
diff --git a/src/plugins/renderers/opengl/opengl.cmake b/src/plugins/renderers/opengl/opengl.cmake
index 2eb35f6d9..1345a653b 100644
--- a/src/plugins/renderers/opengl/opengl.cmake
+++ b/src/plugins/renderers/opengl/opengl.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
function(qt3d_setup_opengl_renderer_target target)
set(glplugindir ${PROJECT_SOURCE_DIR}/src/plugins/renderers/opengl)
diff --git a/src/plugins/renderers/opengl/opengl.pri b/src/plugins/renderers/opengl/opengl.pri
deleted file mode 100644
index 4308992e5..000000000
--- a/src/plugins/renderers/opengl/opengl.pri
+++ /dev/null
@@ -1,41 +0,0 @@
-QT += core-private gui-private 3dcore 3dcore-private 3drender 3drender-private opengl-private
-
-CONFIG += c++17
-
-# Qt3D is free of Q_FOREACH - make sure it stays that way:
-DEFINES += QT_NO_FOREACH
-DEFINES += BUILD_QT3D_MODULE
-
-# For Q_AUTOTEST_EXPORT to work
-DEFINES += QT_BUILDING_QT
-
-DISTFILES += \
- openglrenderer.json
-
-include (renderer/renderer.pri)
-include (io/io.pri)
-include (textures/textures.pri)
-include (graphicshelpers/graphicshelpers.pri)
-include (managers/managers.pri)
-
-!integrity: include (debug/debug.pri)
-
-INCLUDEPATH += $$PWD
-
-# Qt3D is free of Q_FOREACH - make sure it stays that way:
-DEFINES += QT_NO_FOREACH
-
-gcov {
- QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
- QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
-}
-
-qtConfig(qt3d-simd-avx2) {
- CONFIG += simd
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2
-}
-
-qtConfig(qt3d-simd-sse2):!qtConfig(qt3d-simd-avx2) {
- CONFIG += simd
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE2
-}
diff --git a/src/plugins/renderers/opengl/opengl.pro b/src/plugins/renderers/opengl/opengl.pro
deleted file mode 100644
index f098513e8..000000000
--- a/src/plugins/renderers/opengl/opengl.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET = openglrenderer
-
-# We use QT_AUTOTEST_EXPORT to test the plug-ins, which needs QT_BUILDING_QT
-DEFINES += QT_BUILDING_QT
-
-include(opengl.pri)
-
-SOURCES += \
- main.cpp
-
-PLUGIN_TYPE = renderers
-PLUGIN_CLASS_NAME = OpenGLRendererPlugin
-load(qt_plugin)
diff --git a/src/plugins/renderers/opengl/renderer/commandexecuter.cpp b/src/plugins/renderers/opengl/renderer/commandexecuter.cpp
index edc492826..27697142f 100644
--- a/src/plugins/renderers/opengl/renderer/commandexecuter.cpp
+++ b/src/plugins/renderers/opengl/renderer/commandexecuter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "commandexecuter_p.h"
@@ -306,7 +270,7 @@ void CommandExecuter::performAsynchronousCommandExecution(const std::vector<Rend
QVariant CommandExecuter::executeCommand(const QStringList &args)
{
// Note: The replies will be deleted by the AspectCommandDebugger
- if (args.length() > 0 &&
+ if (args.size() > 0 &&
(args.first() == QLatin1String("glinfo") ||
args.first() == QLatin1String("rendercommands"))) {
auto reply = new Qt3DCore::Debug::AsynchronousCommandReply(args.first());
diff --git a/src/plugins/renderers/opengl/renderer/commandexecuter_p.h b/src/plugins/renderers/opengl/renderer/commandexecuter_p.h
index dd1aa813a..3389d3376 100644
--- a/src/plugins/renderers/opengl/renderer/commandexecuter_p.h
+++ b/src/plugins/renderers/opengl/renderer/commandexecuter_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_DEBUG_COMMANDEXECUTER_H
#define QT3DRENDER_DEBUG_COMMANDEXECUTER_H
diff --git a/src/plugins/renderers/opengl/renderer/frameprofiler_p.h b/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
index 99d544da2..11da771fb 100644
--- a/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
+++ b/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_FRAMEPROFILER_P_H
#define QT3DRENDER_RENDER_FRAMEPROFILER_P_H
@@ -157,8 +121,8 @@ public:
Qt3DCore::QSystemInformationServicePrivate *dservice = Qt3DCore::QSystemInformationServicePrivate::get(m_service);
- int j = 0;
- for (int i = 0, m = m_recordings.size(); i < m; ++i) {
+ qsizetype j = 0;
+ for (qsizetype i = 0, m = m_recordings.size(); i < m; ++i) {
const GLRecording rec = m_recordings.at(i);
Qt3DCore::QSystemInformationServicePrivate::JobRunStats glRecordingStat;
diff --git a/src/plugins/renderers/opengl/renderer/glfence_p.h b/src/plugins/renderers/opengl/renderer/glfence_p.h
index 366065048..13db95a80 100644
--- a/src/plugins/renderers/opengl/renderer/glfence_p.h
+++ b/src/plugins/renderers/opengl/renderer/glfence_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GLFENCE_P_H
#define GLFENCE_P_H
diff --git a/src/plugins/renderers/opengl/renderer/gllights.cpp b/src/plugins/renderers/opengl/renderer/gllights.cpp
index c87fd766b..071d43b4f 100644
--- a/src/plugins/renderers/opengl/renderer/gllights.cpp
+++ b/src/plugins/renderers/opengl/renderer/gllights.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <Qt3DRender/private/stringtoint_p.h>
#include "gllights_p.h"
diff --git a/src/plugins/renderers/opengl/renderer/gllights_p.h b/src/plugins/renderers/opengl/renderer/gllights_p.h
index 90fa91588..56c29bc73 100644
--- a/src/plugins/renderers/opengl/renderer/gllights_p.h
+++ b/src/plugins/renderers/opengl/renderer/gllights_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GLLIGHTS_P_H
#define QT3DRENDER_RENDER_OPENGL_GLLIGHTS_P_H
diff --git a/src/plugins/renderers/opengl/renderer/glshader.cpp b/src/plugins/renderers/opengl/renderer/glshader.cpp
index ce0a9deb0..fdd2a710c 100644
--- a/src/plugins/renderers/opengl/renderer/glshader.cpp
+++ b/src/plugins/renderers/opengl/renderer/glshader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "glshader_p.h"
#include <QMutexLocker>
@@ -115,6 +79,7 @@ void GLShader::setGraphicsContext(GraphicsContext *context)
if (m_graphicsContext) {
m_contextConnection = QObject::connect(m_graphicsContext->openGLContext(),
&QOpenGLContext::aboutToBeDestroyed,
+ m_graphicsContext->openGLContext(),
[this] { setGraphicsContext(nullptr); });
}
}
@@ -236,7 +201,7 @@ void GLShader::prepareUniforms(ShaderParameterPack &pack)
auto it = values.keys.cbegin();
const auto end = values.keys.cend();
- const int shaderUniformsCount = m_uniforms.size();
+ const int shaderUniformsCount = int(m_uniforms.size());
const auto uIt = m_uniforms.cbegin();
while (it != end) {
@@ -325,7 +290,7 @@ void GLShader::initializeUniforms(const std::vector<ShaderUniform> &uniformsDesc
}
m_uniformBlockIndexToShaderUniforms.insert(-1, activeUniformsInDefaultBlock);
- m_parameterPackSize += m_standardUniformNamesIds.size() + m_lightUniformsNamesIds.size() + m_uniformsNamesIds.size();
+ m_parameterPackSize += int(m_standardUniformNamesIds.size()) + int(m_lightUniformsNamesIds.size()) + int(m_uniformsNamesIds.size());
m_hasActiveVariables |= (m_parameterPackSize > 0);
// Sort by ascending order to make contains check faster
@@ -343,7 +308,7 @@ void GLShader::initializeAttributes(const std::vector<ShaderAttribute> &attribut
m_attributes = attributesDescription;
m_attributesNames.resize(attributesDescription.size());
m_attributeNamesIds.resize(attributesDescription.size());
- for (int i = 0, m = attributesDescription.size(); i < m; i++) {
+ for (int i = 0, m = int(attributesDescription.size()); i < m; i++) {
m_attributesNames[i] = attributesDescription[i].m_name;
m_attributes[i].m_nameId = StringToInt::lookupId(m_attributesNames[i]);
m_attributeNamesIds[i] = m_attributes[i].m_nameId;
@@ -357,7 +322,7 @@ void GLShader::initializeUniformBlocks(const std::vector<ShaderUniformBlock> &un
m_uniformBlocks = uniformBlockDescription;
m_uniformBlockNames.resize(uniformBlockDescription.size());
m_uniformBlockNamesIds.resize(uniformBlockDescription.size());
- for (int i = 0, m = uniformBlockDescription.size(); i < m; ++i) {
+ for (int i = 0, m = int(uniformBlockDescription.size()); i < m; ++i) {
m_uniformBlockNames[i] = m_uniformBlocks[i].m_name;
m_uniformBlockNamesIds[i] = StringToInt::lookupId(m_uniformBlockNames[i]);
m_uniformBlocks[i].m_nameId = m_uniformBlockNamesIds[i];
@@ -386,7 +351,7 @@ void GLShader::initializeUniformBlocks(const std::vector<ShaderUniformBlock> &un
m_uniformBlockIndexToShaderUniforms.insert(uniformBlockDescription[i].m_index, activeUniformsInBlock);
}
- m_parameterPackSize += m_uniformsNamesIds.size();
+ m_parameterPackSize += int(m_uniformsNamesIds.size());
m_hasActiveVariables |= (m_parameterPackSize > 0);
// Sort by ascending order to make contains check faster
@@ -399,14 +364,14 @@ void GLShader::initializeShaderStorageBlocks(const std::vector<ShaderStorageBloc
m_shaderStorageBlockNames.resize(shaderStorageBlockDescription.size());
m_shaderStorageBlockNamesIds.resize(shaderStorageBlockDescription.size());
- for (int i = 0, m = shaderStorageBlockDescription.size(); i < m; ++i) {
+ for (int i = 0, m = int(shaderStorageBlockDescription.size()); i < m; ++i) {
m_shaderStorageBlockNames[i] = m_shaderStorageBlocks[i].m_name;
m_shaderStorageBlockNamesIds[i] = StringToInt::lookupId(m_shaderStorageBlockNames[i]);
m_shaderStorageBlocks[i].m_nameId =m_shaderStorageBlockNamesIds[i];
qCDebug(Shaders) << "Initializing Shader Storage Block {" << m_shaderStorageBlockNames[i] << "}";
}
- m_parameterPackSize += m_shaderStorageBlockNamesIds.size();
+ m_parameterPackSize += int(m_shaderStorageBlockNamesIds.size());
m_hasActiveVariables |= (m_parameterPackSize > 0);
// Sort by ascending order to make contains check faster
diff --git a/src/plugins/renderers/opengl/renderer/glshader_p.h b/src/plugins/renderers/opengl/renderer/glshader_p.h
index 7cc34bd9c..091d8c2b7 100644
--- a/src/plugins/renderers/opengl/renderer/glshader_p.h
+++ b/src/plugins/renderers/opengl/renderer/glshader_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GLSHADER_P_H
#define QT3DRENDER_RENDER_OPENGL_GLSHADER_P_H
diff --git a/src/plugins/renderers/opengl/renderer/logging.cpp b/src/plugins/renderers/opengl/renderer/logging.cpp
index 0d6ef1211..6ab79cd5a 100644
--- a/src/plugins/renderers/opengl/renderer/logging.cpp
+++ b/src/plugins/renderers/opengl/renderer/logging.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "logging_p.h"
diff --git a/src/plugins/renderers/opengl/renderer/logging_p.h b/src/plugins/renderers/opengl/renderer/logging_p.h
index 69c125195..b42e55cfd 100644
--- a/src/plugins/renderers/opengl/renderer/logging_p.h
+++ b/src/plugins/renderers/opengl/renderer/logging_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_RENDERLOGGING_P_H
#define QT3DRENDER_RENDER_OPENGL_RENDERLOGGING_P_H
diff --git a/src/plugins/renderers/opengl/renderer/openglvertexarrayobject.cpp b/src/plugins/renderers/opengl/renderer/openglvertexarrayobject.cpp
index 45779541e..6f3f7b259 100644
--- a/src/plugins/renderers/opengl/renderer/openglvertexarrayobject.cpp
+++ b/src/plugins/renderers/opengl/renderer/openglvertexarrayobject.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "openglvertexarrayobject_p.h"
#include <submissioncontext_p.h>
@@ -152,9 +116,10 @@ void OpenGLVertexArrayObject::saveVertexAttribute(const SubmissionContext::VAOVe
// Remove any vertexAttribute already at location
m_vertexAttributes.erase(std::remove_if(m_vertexAttributes.begin(),
m_vertexAttributes.end(),
- [attr] (const SubmissionContext::VAOVertexAttribute &a) {
- return a.location == attr.location;
- }));
+ [attr](const SubmissionContext::VAOVertexAttribute &a) {
+ return a.location == attr.location;
+ }),
+ m_vertexAttributes.end());
m_vertexAttributes.push_back(attr);
}
diff --git a/src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h b/src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h
index f2d690e6d..80e9eee34 100644
--- a/src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h
+++ b/src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_OPENGLVERTEXARRAYOBJECT_H
#define QT3DRENDER_RENDER_OPENGL_OPENGLVERTEXARRAYOBJECT_H
diff --git a/src/plugins/renderers/opengl/renderer/rendercommand.cpp b/src/plugins/renderers/opengl/renderer/rendercommand.cpp
index d4da1a41b..8739ddfdb 100644
--- a/src/plugins/renderers/opengl/renderer/rendercommand.cpp
+++ b/src/plugins/renderers/opengl/renderer/rendercommand.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "rendercommand_p.h"
diff --git a/src/plugins/renderers/opengl/renderer/rendercommand_p.h b/src/plugins/renderers/opengl/renderer/rendercommand_p.h
index 09ed04855..e8b056c26 100644
--- a/src/plugins/renderers/opengl/renderer/rendercommand_p.h
+++ b/src/plugins/renderers/opengl/renderer/rendercommand_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_RENDERCOMMAND_H
#define QT3DRENDER_RENDER_OPENGL_RENDERCOMMAND_H
diff --git a/src/plugins/renderers/opengl/renderer/renderer.cpp b/src/plugins/renderers/opengl/renderer/renderer.cpp
index aaec6ad7b..fa2d27486 100644
--- a/src/plugins/renderers/opengl/renderer/renderer.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderer.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "renderer_p.h"
@@ -126,8 +90,6 @@
QT_BEGIN_NAMESPACE
-using namespace Qt3DCore;
-
namespace Qt3DRender {
namespace Render {
namespace OpenGL {
@@ -358,7 +320,7 @@ void Renderer::setNodeManagers(NodeManagers *managers)
m_computableEntityFilterJob->setManager(m_nodesManager->renderNodesManager());
}
-void Renderer::setServices(QServiceLocator *services)
+void Renderer::setServices(Qt3DCore::QServiceLocator *services)
{
m_services = services;
@@ -475,12 +437,12 @@ void Renderer::initialize()
qCWarning(Backend) << Q_FUNC_INFO << "OpenGL context creation failed";
m_ownedContext = true;
- QObject::connect(m_glContext, &QOpenGLContext::aboutToBeDestroyed,
+ QObject::connect(m_glContext, &QOpenGLContext::aboutToBeDestroyed, m_glContext,
[this] { m_frameProfiler.reset(); });
} else {
// Context is not owned by us, so we need to know if it gets destroyed
m_contextConnection = QObject::connect(m_glContext, &QOpenGLContext::aboutToBeDestroyed,
- [this] { releaseGraphicsResources(); });
+ m_glContext, [this] { releaseGraphicsResources(); });
}
qCDebug(Backend) << "Qt3D shared context:" << m_glContext->shareContext();
@@ -714,12 +676,12 @@ void Renderer::render(bool swapBuffers)
// RenderQueue is complete (but that means it may be of size 0)
if (!queueIsEmpty) {
- QTaskLogger submissionStatsPart1(m_services->systemInformation(),
- {JobTypes::FrameSubmissionPart1, 0},
- QTaskLogger::Submission);
- QTaskLogger submissionStatsPart2(m_services->systemInformation(),
- {JobTypes::FrameSubmissionPart2, 0},
- QTaskLogger::Submission);
+ Qt3DCore::QTaskLogger submissionStatsPart1(m_services->systemInformation(),
+ { JobTypes::FrameSubmissionPart1, 0 },
+ Qt3DCore::QTaskLogger::Submission);
+ Qt3DCore::QTaskLogger submissionStatsPart2(m_services->systemInformation(),
+ { JobTypes::FrameSubmissionPart2, 0 },
+ Qt3DCore::QTaskLogger::Submission);
{ // Scoped to destroy surfaceLock
QSurface *surface = nullptr;
for (const RenderView *rv: renderViews) {
@@ -1015,10 +977,10 @@ void Renderer::lookForDirtyTextures()
const std::vector<HTexture> &activeTextureHandles = textureManager->activeHandles();
for (const HTexture &handle: activeTextureHandles) {
Texture *texture = textureManager->data(handle);
- const QNodeIdVector imageIds = texture->textureImageIds();
+ const Qt3DCore::QNodeIdVector imageIds = texture->textureImageIds();
// Does the texture reference any of the dirty texture images?
- for (const QNodeId &imageId: imageIds) {
+ for (const Qt3DCore::QNodeId &imageId : imageIds) {
if (dirtyImageIds.contains(imageId)) {
texture->addDirtyFlag(Texture::DirtyImageGenerators);
break;
@@ -1046,7 +1008,7 @@ void Renderer::reloadDirtyShaders()
// If api of the renderer matches the one from the technique
if (technique->isCompatibleWithRenderer()) {
const auto passIds = technique->renderPasses();
- for (const QNodeId &passId : passIds) {
+ for (const Qt3DCore::QNodeId &passId : passIds) {
RenderPass *renderPass = m_nodesManager->renderPassManager()->lookupResource(passId);
HShader shaderHandle = m_nodesManager->shaderManager()->lookupHandle(renderPass->shaderProgram());
Shader *shader = m_nodesManager->shaderManager()->data(shaderHandle);
@@ -1100,13 +1062,16 @@ void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
const std::vector<HShader> &activeShaders = m_nodesManager->shaderManager()->activeHandles();
for (const HShader &handle :activeShaders) {
Shader *s = m_nodesManager->shaderManager()->data(handle);
+ if (!s)
+ continue;
+
if (s->requiresFrontendSync()) {
QShaderProgram *frontend = static_cast<decltype(frontend)>(manager->lookupNode(s->peerId()));
// Could happen as a backend shader might live beyong the frontend
// the time needed to destroy the GLShader assoicated with it.
if (!frontend)
continue;
- QShaderProgramPrivate *dFrontend = static_cast<decltype(dFrontend)>(QNodePrivate::get(frontend));
+ QShaderProgramPrivate *dFrontend = static_cast<decltype(dFrontend)>(Qt3DCore::QNodePrivate::get(frontend));
s->unsetRequiresFrontendSync();
dFrontend->setStatus(s->status());
dFrontend->setLog(s->log());
@@ -1117,7 +1082,7 @@ void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
const std::vector<ShaderBuilderUpdate> shaderBuilderUpdates = Qt3DCore::moveAndClear(m_shaderBuilderUpdates);
for (const ShaderBuilderUpdate &update : shaderBuilderUpdates) {
QShaderProgramBuilder *builder = static_cast<decltype(builder)>(manager->lookupNode(update.builderId));
- QShaderProgramBuilderPrivate *dBuilder = static_cast<decltype(dBuilder)>(QNodePrivate::get(builder));
+ QShaderProgramBuilderPrivate *dBuilder = static_cast<decltype(dBuilder)>(Qt3DCore::QNodePrivate::get(builder));
dBuilder->setShaderCode(update.shaderCode, update.shaderType);
}
}
@@ -1149,7 +1114,7 @@ void Renderer::sendTextureChangesToFrontend(Qt3DCore::QAspectManager *manager)
texture->setFormat(properties.format);
texture->blockNotifications(blocked);
- QAbstractTexturePrivate *dTexture = static_cast<QAbstractTexturePrivate *>(QNodePrivate::get(texture));
+ QAbstractTexturePrivate *dTexture = static_cast<QAbstractTexturePrivate *>(Qt3DCore::QNodePrivate::get(texture));
dTexture->setStatus(properties.status);
dTexture->setHandleType(pair.first.handleType);
@@ -1168,7 +1133,7 @@ void Renderer::sendSetFenceHandlesToFrontend(Qt3DCore::QAspectManager *manager)
if (fgNode != nullptr) { // Node could have been deleted before we got a chance to notify it
Q_ASSERT(fgNode->nodeType() == FrameGraphNode::SetFence);
QSetFence *frontend = static_cast<decltype(frontend)>(manager->lookupNode(fgNode->peerId()));
- QSetFencePrivate *dFrontend = static_cast<decltype(dFrontend)>(QNodePrivate::get(frontend));
+ QSetFencePrivate *dFrontend = static_cast<decltype(dFrontend)>(Qt3DCore::QNodePrivate::get(frontend));
dFrontend->setHandleType(QSetFence::OpenGLFenceId);
dFrontend->setHandle(QVariant::fromValue(pair.second));
}
@@ -1300,7 +1265,7 @@ void Renderer::updateGLResources()
// We want to upload textures data at this point as the SubmissionThread and
// AspectThread are locked ensuring no races between Texture/TextureImage and
// GLTexture
- QNodeIdVector updatedTexturesForFrame;
+ Qt3DCore::QNodeIdVector updatedTexturesForFrame;
if (m_submissionContext != nullptr) {
GLTextureManager *glTextureManager = m_glResourceManagers->glTextureManager();
const std::vector<HGLTexture> &glTextureHandles = glTextureManager->activeHandles();
@@ -1314,7 +1279,7 @@ void Renderer::updateGLResources()
// GLTexture creation provides us width/height/format ... information
// for textures which had not initially specified these information (TargetAutomatic...)
// Gather these information and store them to be distributed by a change next frame
- const QNodeIdVector referenceTextureIds = { glTextureManager->texNodeIdForGLTexture.value(glTexture) };
+ const Qt3DCore::QNodeIdVector referenceTextureIds = { glTextureManager->texNodeIdForGLTexture.value(glTexture) };
// Store properties and referenceTextureIds
if (info.wasUpdated) {
Texture::TextureUpdateInfo updateInfo;
@@ -1340,7 +1305,7 @@ void Renderer::updateGLResources()
// Remove destroyed FBOs
{
- const QNodeIdVector destroyedRenderTargetIds = m_nodesManager->renderTargetManager()->takeRenderTargetIdsToCleanup();
+ const Qt3DCore::QNodeIdVector destroyedRenderTargetIds = m_nodesManager->renderTargetManager()->takeRenderTargetIdsToCleanup();
for (const Qt3DCore::QNodeId &renderTargetId : destroyedRenderTargetIds)
m_submissionContext->releaseRenderTarget(renderTargetId);
}
@@ -1382,11 +1347,11 @@ void Renderer::updateTexture(Texture *texture)
// Will make the texture requestUpload
if (dirtyFlags.testFlag(Texture::DirtyImageGenerators)) {
- const QNodeIdVector textureImageIds = texture->textureImageIds();
+ const Qt3DCore::QNodeIdVector textureImageIds = texture->textureImageIds();
std::vector<GLTexture::Image> images;
images.reserve(textureImageIds.size());
// TODO: Move this into GLTexture directly
- for (const QNodeId &textureImageId : textureImageIds) {
+ for (const Qt3DCore::QNodeId &textureImageId : textureImageIds) {
const TextureImage *img = m_nodesManager->textureImageManager()->lookupResource(textureImageId);
if (img == nullptr) {
qWarning() << Q_FUNC_INFO << "invalid TextureImage handle";
@@ -1642,7 +1607,8 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const std::vector
Render::RenderCapture *renderCapture =
static_cast<Render::RenderCapture*>(m_nodesManager->frameGraphManager()->lookupNode(renderView->renderCaptureNodeId()));
renderCapture->addRenderCapture(request.captureId, image);
- const QNodeId renderCaptureId = renderView->renderCaptureNodeId();
+ const Qt3DCore::QNodeId renderCaptureId = renderView->renderCaptureNodeId();
+ QMutexLocker lock(&m_pendingRenderCaptureSendRequestsMutex);
if (!Qt3DCore::contains(m_pendingRenderCaptureSendRequests, renderCaptureId))
m_pendingRenderCaptureSendRequests.push_back(renderView->renderCaptureNodeId());
}
@@ -1653,8 +1619,8 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const std::vector
// Perform BlitFramebuffer operations
if (renderView->hasBlitFramebufferInfo()) {
const auto &blitFramebufferInfo = renderView->blitFrameBufferInfo();
- const QNodeId inputTargetId = blitFramebufferInfo.sourceRenderTargetId;
- const QNodeId outputTargetId = blitFramebufferInfo.destinationRenderTargetId;
+ const Qt3DCore::QNodeId inputTargetId = blitFramebufferInfo.sourceRenderTargetId;
+ const Qt3DCore::QNodeId outputTargetId = blitFramebufferInfo.destinationRenderTargetId;
const QRect inputRect = blitFramebufferInfo.sourceRect;
const QRect outputRect = blitFramebufferInfo.destinationRect;
const QRenderTargetOutput::AttachmentPoint inputAttachmentPoint = blitFramebufferInfo.sourceAttachmentPoint;
@@ -1753,7 +1719,9 @@ void Renderer::jobsDone(Qt3DCore::QAspectManager *manager)
// called in main thread once all jobs are done running
// sync captured renders to frontend
+ QMutexLocker lock(&m_pendingRenderCaptureSendRequestsMutex);
const std::vector<Qt3DCore::QNodeId> pendingCaptureIds = Qt3DCore::moveAndClear(m_pendingRenderCaptureSendRequests);
+ lock.unlock();
for (const Qt3DCore::QNodeId &id : pendingCaptureIds) {
auto *backend = static_cast<Qt3DRender::Render::RenderCapture *>
(m_nodesManager->frameGraphManager()->lookupNode(id));
@@ -1791,7 +1759,7 @@ bool Renderer::processKeyEvent(QObject *object, QKeyEvent *event)
}
// Jobs we may have to run even if no rendering will happen
-std::vector<QAspectJobPtr> Renderer::preRenderingJobs()
+std::vector<Qt3DCore::QAspectJobPtr> Renderer::preRenderingJobs()
{
if (m_sendBufferCaptureJob->hasRequests())
return {m_sendBufferCaptureJob};
@@ -1804,10 +1772,10 @@ std::vector<QAspectJobPtr> Renderer::preRenderingJobs()
// for the rendering of the scene
std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
{
- std::vector<QAspectJobPtr> renderBinJobs;
+ std::vector<Qt3DCore::QAspectJobPtr> renderBinJobs;
// Remove previous dependencies
- m_cleanupJob->removeDependency(QWeakPointer<QAspectJob>());
+ m_cleanupJob->removeDependency(QWeakPointer<Qt3DCore::QAspectJob>());
const bool dirtyParametersForCurrentFrame = m_dirtyBits.marked & AbstractRenderer::ParameterDirty;
const BackendNodeDirtySet dirtyBitsForFrame = m_dirtyBits.marked | m_dirtyBits.remaining;
@@ -1878,7 +1846,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
m_updatedDisableSubtreeEnablers.push_back(node->peerId());
}
- int idealThreadCount = QAspectJobManager::idealThreadCount();
+ int idealThreadCount = Qt3DCore::QAspectJobManager::idealThreadCount();
const size_t fgBranchCount = m_frameGraphLeaves.size();
if (fgBranchCount > 1) {
@@ -1933,7 +1901,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
return renderBinJobs;
}
-QAbstractFrameAdvanceService *Renderer::frameAdvanceService() const
+Qt3DCore::QAbstractFrameAdvanceService *Renderer::frameAdvanceService() const
{
return static_cast<Qt3DCore::QAbstractFrameAdvanceService *>(m_vsyncFrameAdvanceService.data());
}
@@ -2169,7 +2137,7 @@ bool Renderer::updateVAOWithAttributes(Geometry *geometry,
m_dirtyAttributes.reserve(m_dirtyAttributes.size() + geometry->attributes().size());
const auto attributeIds = geometry->attributes();
- for (QNodeId attributeId : attributeIds) {
+ for (Qt3DCore::QNodeId attributeId : attributeIds) {
// TO DO: Improvement we could store handles and use the non locking policy on the attributeManager
Attribute *attribute = m_nodesManager->attributeManager()->lookupResource(attributeId);
@@ -2185,7 +2153,7 @@ bool Renderer::updateVAOWithAttributes(Geometry *geometry,
// Index Attribute
bool attributeWasDirty = false;
- if (attribute->attributeType() == QAttribute::IndexAttribute) {
+ if (attribute->attributeType() == Qt3DCore::QAttribute::IndexAttribute) {
if ((attributeWasDirty = attribute->isDirty()) == true || forceUpdate)
m_submissionContext->specifyIndices(buffer);
// Vertex Attribute
@@ -2226,16 +2194,14 @@ bool Renderer::requiresVAOAttributeUpdate(Geometry *geometry,
{
const auto attributeIds = geometry->attributes();
- for (QNodeId attributeId : attributeIds) {
+ for (Qt3DCore::QNodeId attributeId : attributeIds) {
// TO DO: Improvement we could store handles and use the non locking policy on the attributeManager
Attribute *attribute = m_nodesManager->attributeManager()->lookupResource(attributeId);
if (attribute == nullptr)
continue;
- if ((attribute->attributeType() == QAttribute::IndexAttribute && attribute->isDirty()) ||
- (Qt3DCore::contains(command->m_activeAttributes, attribute->nameId()) &&
- attribute->isDirty()))
+ if ((attribute->attributeType() == Qt3DCore::QAttribute::IndexAttribute && attribute->isDirty()) || (Qt3DCore::contains(command->m_activeAttributes, attribute->nameId()) && attribute->isDirty()))
return true;
}
return false;
diff --git a/src/plugins/renderers/opengl/renderer/renderer.pri b/src/plugins/renderers/opengl/renderer/renderer.pri
deleted file mode 100644
index 5d0296523..000000000
--- a/src/plugins/renderers/opengl/renderer/renderer.pri
+++ /dev/null
@@ -1,29 +0,0 @@
-INCLUDEPATH += $$PWD
-
-SOURCES += \
- $$PWD/gllights.cpp \
- $$PWD/openglvertexarrayobject.cpp \
- $$PWD/rendercommand.cpp \
- $$PWD/renderer.cpp \
- $$PWD/renderview.cpp \
- $$PWD/renderviewbuilder.cpp \
- $$PWD/shaderparameterpack.cpp \
- $$PWD/glshader.cpp \
- $$PWD/logging.cpp \
- $$PWD/commandexecuter.cpp
-
-HEADERS += \
- $$PWD/gllights_p.h \
- $$PWD/openglvertexarrayobject_p.h \
- $$PWD/rendercommand_p.h \
- $$PWD/renderer_p.h \
- $$PWD/renderview_p.h \
- $$PWD/renderviewbuilder_p.h \
- $$PWD/shaderparameterpack_p.h \
- $$PWD/shadervariables_p.h \
- $$PWD/glshader_p.h \
- $$PWD/glfence_p.h \
- $$PWD/logging_p.h \
- $$PWD/commandexecuter_p.h \
- $$PWD/frameprofiler_p.h
-
diff --git a/src/plugins/renderers/opengl/renderer/renderer_p.h b/src/plugins/renderers/opengl/renderer/renderer_p.h
index 78dfbe2a5..58b55cc0b 100644
--- a/src/plugins/renderers/opengl/renderer/renderer_p.h
+++ b/src/plugins/renderers/opengl/renderer/renderer_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_RENDERER_H
#define QT3DRENDER_RENDER_OPENGL_RENDERER_H
@@ -359,6 +323,7 @@ private:
RenderableEntityFilterPtr m_renderableEntityFilterJob;
ComputableEntityFilterPtr m_computableEntityFilterJob;
+ QMutex m_pendingRenderCaptureSendRequestsMutex;
std::vector<Qt3DCore::QNodeId> m_pendingRenderCaptureSendRequests;
void performDraw(const RenderCommand *command);
diff --git a/src/plugins/renderers/opengl/renderer/renderview.cpp b/src/plugins/renderers/opengl/renderer/renderview.cpp
index 055e19b7a..8cd22eaa2 100644
--- a/src/plugins/renderers/opengl/renderer/renderview.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderview.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "renderview_p.h"
#include <Qt3DRender/qmaterial.h>
@@ -238,8 +202,7 @@ UniformValue RenderView::standardUniformValue(RenderView::StandardUniform standa
case YUpInFBO:
return UniformValue(0.0f);
default:
- Q_UNREACHABLE();
- return UniformValue();
+ Q_UNREACHABLE_RETURN(UniformValue());
}
}
@@ -489,8 +452,7 @@ struct AdjacentSubRangeFinder
{
static bool adjacentSubRange(const RenderCommand &, const RenderCommand &)
{
- Q_UNREACHABLE();
- return false;
+ Q_UNREACHABLE_RETURN(false);
}
};
@@ -677,6 +639,10 @@ struct SubRangeSorter<QSortPolicy::Texture>
return identicalTextureCount < smallestVector.size();
});
+#else
+ Q_UNUSED(view);
+ Q_UNUSED(begin);
+ Q_UNUSED(end);
#endif
}
};
@@ -699,8 +665,7 @@ int findSubRange(const EntityRenderCommandDataView *view,
case QSortPolicy::Uniform:
return end;
default:
- Q_UNREACHABLE();
- return end;
+ Q_UNREACHABLE_RETURN(end);
}
}
@@ -1112,8 +1077,16 @@ void RenderView::updateRenderCommand(const EntityRenderCommandDataSubView &subVi
void RenderView::updateMatrices()
{
if (m_renderCameraNode && m_renderCameraLens && m_renderCameraLens->isEnabled()) {
- const Matrix4x4 cameraWorld = *(m_renderCameraNode->worldTransform());
- setViewMatrix(m_renderCameraLens->viewMatrix(cameraWorld));
+ auto transform = m_renderCameraNode->renderComponent<Transform>();
+ if (m_renderCameraNode->isParentLessTransform() && transform && transform->hasViewMatrix()) {
+ // optimization: if the entity is a QCamera and it doesn't have a parent with a transform component,
+ // then we use the frontend version of the viewMatrix to avoid extra calculations that may introduce
+ // rounding errors
+ setViewMatrix(transform->viewMatrix());
+ } else {
+ const Matrix4x4 cameraWorld = *(m_renderCameraNode->worldTransform());
+ setViewMatrix(m_renderCameraLens->viewMatrix(cameraWorld));
+ }
setViewProjectionMatrix(m_renderCameraLens->projection() * viewMatrix());
//To get the eyePosition of the camera, we need to use the inverse of the
@@ -1210,11 +1183,11 @@ void RenderView::setShaderStorageValue(ShaderParameterPack &uniformPack,
}
void RenderView::setDefaultUniformBlockShaderDataValue(ShaderParameterPack &uniformPack,
- const GLShader *shader,
+ const std::vector<int> &uniformsNamesIds,
ShaderData *shaderData,
const QString &structName) const
{
- UniformBlockValueBuilder builder(shader->uniformsNamesIds(),
+ UniformBlockValueBuilder builder(uniformsNamesIds,
m_manager->shaderDataManager(),
m_manager->textureManager(),
m_viewMatrix);
@@ -1258,7 +1231,7 @@ void RenderView::applyParameter(const Parameter *param,
if (uniformValue.valueType() == UniformValue::NodeId &&
(shaderData = m_manager->shaderDataManager()->lookupResource(*uniformValue.constData<Qt3DCore::QNodeId>())) != nullptr) {
// Try to check if we have a struct or array matching a QShaderData parameter
- setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, StringToInt::lookupString(nameId));
+ setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader->uniformsNamesIds(), shaderData, StringToInt::lookupString(nameId));
}
break;
}
@@ -1382,7 +1355,7 @@ void RenderView::updateLightUniforms(RenderCommand *command, const Entity *entit
break;
const Entity *lightEntity = lightSource.entity;
const Matrix4x4 lightWorldTransform = *(lightEntity->worldTransform());
- const Vector3D worldPos = lightWorldTransform * Vector3D(0.0f, 0.0f, 0.0f);
+ const Vector3D worldPos = lightWorldTransform.map(Vector3D(0.0f, 0.0f, 0.0f));
for (Light *light : lightSource.lights) {
if (!light->isEnabled())
continue;
@@ -1414,8 +1387,8 @@ void RenderView::updateLightUniforms(RenderCommand *command, const Entity *entit
if (worldTransform)
shaderData->updateWorldTransform(*worldTransform);
- setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, GLLights::LIGHT_STRUCT_NAMES[lightIdx]);
- setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, GLLights::LIGHT_STRUCT_UNROLL_NAMES[lightIdx]);
+ setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader->lightUniformsNamesIds(), shaderData, GLLights::LIGHT_STRUCT_NAMES[lightIdx]);
+ setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader->lightUniformsNamesIds(), shaderData, GLLights::LIGHT_STRUCT_UNROLL_NAMES[lightIdx]);
++lightIdx;
}
}
@@ -1448,7 +1421,8 @@ void RenderView::updateLightUniforms(RenderCommand *command, const Entity *entit
if (m_environmentLight && m_environmentLight->isEnabled()) {
ShaderData *shaderData = m_manager->shaderDataManager()->lookupResource(m_environmentLight->shaderData());
if (shaderData) {
- setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, QStringLiteral("envLight"));
+ // EnvLight isn't part of the light uniform name ids
+ setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader->uniformsNamesIds(), shaderData, QStringLiteral("envLight"));
auto irr =
shaderData->properties()["irradiance"].value.value<Qt3DCore::QNodeId>();
auto spec =
diff --git a/src/plugins/renderers/opengl/renderer/renderview_p.h b/src/plugins/renderers/opengl/renderer/renderview_p.h
index d67a04b8c..ceae71501 100644
--- a/src/plugins/renderers/opengl/renderer/renderview_p.h
+++ b/src/plugins/renderers/opengl/renderer/renderview_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_RENDERVIEW_H
#define QT3DRENDER_RENDER_OPENGL_RENDERVIEW_H
@@ -392,7 +356,7 @@ private:
const ShaderStorageBlock &block,
const UniformValue &value) const;
void setDefaultUniformBlockShaderDataValue(ShaderParameterPack &uniformPack,
- const GLShader *shader,
+ const std::vector<int> &uniformsNamesIds,
ShaderData *shaderData,
const QString &structName) const;
void applyParameter(const Parameter *param,
diff --git a/src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp b/src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp
index d21c205c3..7f7829b40 100644
--- a/src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "renderviewbuilder_p.h"
#include <Qt3DRender/private/qrenderaspect_p.h>
#include <Qt3DRender/private/rendersyncjobs_p.h>
-
-#include <QThread>
+#include <Qt3DCore/private/qaspectjobmanager_p.h>
QT_BEGIN_NAMESPACE
@@ -90,7 +53,7 @@ RenderViewBuilder::RenderViewBuilder(Render::FrameGraphNode *leafNode, int rende
// In some cases having less jobs is better (especially on fast cpus where
// splitting just adds more overhead). Ideally, we should try to set the value
// depending on the platform/CPU/nbr of cores
- m_optimalParallelJobCount = QThread::idealThreadCount();
+ m_optimalParallelJobCount = Qt3DCore::QAspectJobManager::idealThreadCount();
}
RenderViewInitializerJobPtr RenderViewBuilder::renderViewJob() const
diff --git a/src/plugins/renderers/opengl/renderer/renderviewbuilder_p.h b/src/plugins/renderers/opengl/renderer/renderviewbuilder_p.h
index acf4f9892..39b9509ef 100644
--- a/src/plugins/renderers/opengl/renderer/renderviewbuilder_p.h
+++ b/src/plugins/renderers/opengl/renderer/renderviewbuilder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_RENDERVIEWBUILDER_H
#define QT3DRENDER_RENDER_OPENGL_RENDERVIEWBUILDER_H
diff --git a/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp b/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
index 6eaaaa84a..683d04d8d 100644
--- a/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
+++ b/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "shaderparameterpack_p.h"
@@ -98,12 +62,28 @@ void ShaderParameterPack::setImage(const int glslNameId, int uniformArrayIndex,
// Contains Uniform Block Index and QNodeId of the ShaderData (UBO)
void ShaderParameterPack::setUniformBuffer(BlockToUBO blockToUBO)
{
- m_uniformBuffers.push_back(std::move(blockToUBO));
+ const auto uEnd = m_uniformBuffers.end();
+ auto it = std::find_if(m_uniformBuffers.begin(), uEnd, [&] (const BlockToUBO &block) {
+ return blockToUBO.m_blockIndex == block.m_blockIndex;
+ });
+
+ if (it == uEnd)
+ m_uniformBuffers.push_back(std::move(blockToUBO));
+ else
+ *it = std::move(blockToUBO);
}
void ShaderParameterPack::setShaderStorageBuffer(BlockToSSBO blockToSSBO)
{
- m_shaderStorageBuffers.push_back(std::move(blockToSSBO));
+ const auto uEnd = m_shaderStorageBuffers.end();
+ auto it = std::find_if(m_shaderStorageBuffers.begin(), uEnd, [&] (const BlockToSSBO &block) {
+ return blockToSSBO.m_blockIndex == block.m_blockIndex;
+ });
+
+ if (it == uEnd)
+ m_shaderStorageBuffers.push_back(std::move(blockToSSBO));
+ else
+ *it = std::move(blockToSSBO);
}
void ShaderParameterPack::setSubmissionUniformIndex(const int uniformIdx)
diff --git a/src/plugins/renderers/opengl/renderer/shaderparameterpack_p.h b/src/plugins/renderers/opengl/renderer/shaderparameterpack_p.h
index 0825c9c47..f963aacb0 100644
--- a/src/plugins/renderers/opengl/renderer/shaderparameterpack_p.h
+++ b/src/plugins/renderers/opengl/renderer/shaderparameterpack_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_SHADERPARAMETERPACK_P_H
#define QT3DRENDER_RENDER_OPENGL_SHADERPARAMETERPACK_P_H
diff --git a/src/plugins/renderers/opengl/renderer/shadervariables_p.h b/src/plugins/renderers/opengl/renderer/shadervariables_p.h
index 5dc50fccb..6fd0fdff0 100644
--- a/src/plugins/renderers/opengl/renderer/shadervariables_p.h
+++ b/src/plugins/renderers/opengl/renderer/shadervariables_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_SHADERVARIABLES_P_H
#define QT3DRENDER_RENDER_OPENGL_SHADERVARIABLES_P_H
diff --git a/src/plugins/renderers/opengl/textures/gltexture.cpp b/src/plugins/renderers/opengl/textures/gltexture.cpp
index 88d6e1853..7f358b0e3 100644
--- a/src/plugins/renderers/opengl/textures/gltexture.cpp
+++ b/src/plugins/renderers/opengl/textures/gltexture.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtCore/qhash.h>
#include "gltexture_p.h"
@@ -45,9 +9,7 @@
#include <private/qopengltexturehelper_p.h>
#include <QDebug>
#include <QOpenGLFunctions>
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QtOpenGL/QOpenGLVersionFunctionsFactory>
-#endif
#include <QOpenGLTexture>
#include <QOpenGLPixelTransferOptions>
#include <Qt3DRender/qtexture.h>
@@ -66,8 +28,6 @@
QT_BEGIN_NAMESPACE
-using namespace Qt3DCore;
-
namespace Qt3DRender {
namespace Render {
namespace OpenGL {
@@ -197,7 +157,7 @@ bool GLTexture::loadTextureDataFromGenerator()
void GLTexture::loadTextureDataFromImages()
{
int maxMipLevel = 0;
- for (const Image &img : qAsConst(m_images)) {
+ for (const Image &img : std::as_const(m_images)) {
const QTextureImageDataPtr imgData = img.generator->operator()();
// imgData may be null in the following cases:
// - Texture is created with TextureImages which have yet to be
@@ -692,11 +652,7 @@ void GLTexture::introspectPropertiesFromSharedTextureId()
if (ctxGLVersion.first > 4 || (ctxGLVersion.first == 4 && ctxGLVersion.second >= 5)) {
// Only for GL 4.5+
#ifdef GL_TEXTURE_TARGET
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QOpenGLFunctions_4_5_Core *gl5 = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_5_Core>();
-#else
- QOpenGLFunctions_4_5_Core *gl5 = ctx->versionFunctions<QOpenGLFunctions_4_5_Core>();
-#endif
if (gl5 != nullptr)
gl5->glGetTextureParameteriv(m_sharedTextureId, GL_TEXTURE_TARGET, reinterpret_cast<int *>(&m_properties.target));
#endif
@@ -768,11 +724,7 @@ void GLTexture::introspectPropertiesFromSharedTextureId()
#if !QT_CONFIG(opengles2)
// Try to retrieve dimensions (not available on ES 2.0)
if (!ctx->isOpenGLES()) {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QOpenGLFunctions_3_1 *gl3 = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_1>();
-#else
- QOpenGLFunctions_3_1 *gl3 = ctx->versionFunctions<QOpenGLFunctions_3_1>();
-#endif
if (!gl3) {
qWarning() << "Failed to retrieve shared texture dimensions";
return;
diff --git a/src/plugins/renderers/opengl/textures/gltexture_p.h b/src/plugins/renderers/opengl/textures/gltexture_p.h
index 7a6564831..ec0a80ce6 100644
--- a/src/plugins/renderers/opengl/textures/gltexture_p.h
+++ b/src/plugins/renderers/opengl/textures/gltexture_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_GLTEXTURE_H
#define QT3DRENDER_RENDER_OPENGL_GLTEXTURE_H
diff --git a/src/plugins/renderers/opengl/textures/renderbuffer.cpp b/src/plugins/renderers/opengl/textures/renderbuffer.cpp
index a8cd57515..43b13d666 100644
--- a/src/plugins/renderers/opengl/textures/renderbuffer.cpp
+++ b/src/plugins/renderers/opengl/textures/renderbuffer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "renderbuffer_p.h"
#include <QOpenGLContext>
diff --git a/src/plugins/renderers/opengl/textures/renderbuffer_p.h b/src/plugins/renderers/opengl/textures/renderbuffer_p.h
index e14716320..ad87a06ac 100644
--- a/src/plugins/renderers/opengl/textures/renderbuffer_p.h
+++ b/src/plugins/renderers/opengl/textures/renderbuffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_OPENGL_RENDERBUFFER_P_H
#define QT3DRENDER_RENDER_OPENGL_RENDERBUFFER_P_H
diff --git a/src/plugins/renderers/opengl/textures/textures.pri b/src/plugins/renderers/opengl/textures/textures.pri
deleted file mode 100644
index e17abfbb3..000000000
--- a/src/plugins/renderers/opengl/textures/textures.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDEPATH += $$PWD
-
-SOURCES += \
- $$PWD/gltexture.cpp \
- $$PWD/renderbuffer.cpp
-
-HEADERS += \
- $$PWD/gltexture_p.h \
- $$PWD/renderbuffer_p.h
diff --git a/src/plugins/renderers/renderers.pro b/src/plugins/renderers/renderers.pro
deleted file mode 100644
index f5399ce84..000000000
--- a/src/plugins/renderers/renderers.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = subdirs
-
-# OpenGL renderer
-include($$OUT_PWD/../../render/qt3drender-config.pri)
-QT_FOR_CONFIG += 3drender-private
-
-#SUBDIRS += dummy
-
-qtConfig(qt3d-opengl-renderer): SUBDIRS += opengl
-
-qtConfig(qt3d-rhi-renderer): {
- qtHaveModule(shadertools): SUBDIRS += rhi
-}
diff --git a/src/plugins/renderers/rhi/CMakeLists.txt b/src/plugins/renderers/rhi/CMakeLists.txt
index f2a9a485b..9e0699a8d 100644
--- a/src/plugins/renderers/rhi/CMakeLists.txt
+++ b/src/plugins/renderers/rhi/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from rhi.pro.
set(rhiRendererSources graphicshelpers/submissioncontext.cpp graphicshelpers/submissioncontext_p.h
@@ -20,8 +23,6 @@ set(rhiRendererSources graphicshelpers/submissioncontext.cpp graphicshelpers/sub
textures/texture.cpp textures/texture_p.h
)
-find_package(Qt6 REQUIRED COMPONENTS ShaderTools)
-
#####################################################################
## Static library used for Unit Tests:
#####################################################################
@@ -55,7 +56,6 @@ if(QT_FEATURE_private_tests)
target_compile_definitions(RhiRendererLib PRIVATE
BUILD_QT3D_MODULE
QT_BUILDING_QT
- QT_NO_FOREACH
)
endif()
@@ -94,6 +94,9 @@ qt_internal_add_plugin(RhiRendererPlugin
Qt::ShaderToolsPrivate
)
+# QTransform conflicts
+set_target_properties(RhiRendererPlugin PROPERTIES UNITY_BUILD OFF)
+
#### Keys ignored in scope 1:.:.:rhi.pro:<TRUE>:
# DISTFILES = "rhirenderer.json"
diff --git a/src/plugins/renderers/rhi/graphicshelpers/graphicshelpers.pri b/src/plugins/renderers/rhi/graphicshelpers/graphicshelpers.pri
deleted file mode 100644
index e156d3ce5..000000000
--- a/src/plugins/renderers/rhi/graphicshelpers/graphicshelpers.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-#DEFINES += QT3D_RENDER_ASPECT_OPENGL_DEBUG
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/submissioncontext_p.h
-
-SOURCES += \
- $$PWD/submissioncontext.cpp
diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
index 6d62a6e51..f0dcb044f 100644
--- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "submissioncontext_p.h"
@@ -62,7 +26,9 @@
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/attachmentpack_p.h>
#include <Qt3DRender/private/stringtoint_p.h>
-#include <Qt3DRender/private/vulkaninstance_p.h>
+#if QT_CONFIG(qt3d_vulkan) && QT_CONFIG(vulkan)
+# include <Qt3DRender/private/vulkaninstance_p.h>
+#endif
#include <QGuiApplication>
#include <texture_p.h>
#include <rendercommand_p.h>
@@ -75,46 +41,17 @@
#include <private/qdebug_p.h>
#include <QSurface>
#include <QWindow>
-#include <QtShaderTools/private/qshaderbaker_p.h>
-
-#ifdef Q_OS_WIN
-#include <QtGui/private/qrhid3d11_p.h>
-#endif
-
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
-#include <QtGui/private/qrhimetal_p.h>
-#endif
-
-#ifndef QT_NO_OPENGL
-#include <QtGui/private/qrhigles2_p.h>
-#endif
+#include <rhi/qrhi.h>
+#include <rhi/qshaderbaker.h>
-#if QT_CONFIG(qt3d_vulkan)
-#include <QtGui/private/qrhivulkan_p.h>
-#endif
#include <bitset>
QT_BEGIN_NAMESPACE
-using namespace Qt3DCore;
-
namespace Qt3DRender {
namespace Render {
namespace Rhi {
-static QHash<unsigned int, SubmissionContext *> static_contexts;
-
-unsigned int nextFreeContextId() noexcept
-{
- for (unsigned int i = 0; i < 0xffff; ++i) {
- if (!static_contexts.contains(i))
- return i;
- }
-
- qFatal("Couldn't find free context ID");
- return 0;
-}
-
namespace {
//RHIBuffer::Type attributeTypeToGLBufferType(QAttribute::AttributeType type) noexcept
@@ -476,6 +413,13 @@ void applyStateHelper(const StencilMask *state, QRhiGraphicsPipeline *gp) noexce
gp->setStencilReadMask(std::get<1>(values));
}
+void applyStateHelper(const LineWidth *state, QRhiGraphicsPipeline *gp) noexcept
+{
+ const auto values = state->values();
+ gp->setLineWidth(std::get<0>(values));
+ // no GL_LINE_SMOOTH equivalent on RHI
+}
+
static QShader::Stage rhiShaderStage(QShaderProgram::ShaderType type) noexcept
{
switch (type) {
@@ -499,15 +443,11 @@ static QShader::Stage rhiShaderStage(QShaderProgram::ShaderType type) noexcept
} // anonymous
SubmissionContext::SubmissionContext()
- : m_ownsRhiCtx(false),
+ : m_initialized(false),
+ m_ownsRhiCtx(false),
m_drivenExternally(false),
- m_id(nextFreeContextId()),
- m_surface(nullptr),
- m_renderTargetFormat(QAbstractTexture::NoFormat),
m_material(nullptr),
m_renderer(nullptr),
- m_uboTempArray(QByteArray(1024, 0)),
- m_initialized(false),
m_rhi(nullptr),
m_currentSwapChain(nullptr),
m_currentRenderPassDescriptor(nullptr),
@@ -518,7 +458,6 @@ SubmissionContext::SubmissionContext()
m_fallbackSurface(nullptr)
#endif
{
- static_contexts[m_id] = this;
m_contextInfo.m_api = QGraphicsApiFilter::RHI;
// We set those version numbers because QShaderGenerator wants major > 0
@@ -529,9 +468,6 @@ SubmissionContext::SubmissionContext()
SubmissionContext::~SubmissionContext()
{
releaseResources();
-
- Q_ASSERT(static_contexts[m_id] == this);
- static_contexts.remove(m_id);
}
void SubmissionContext::initialize()
@@ -578,7 +514,7 @@ void SubmissionContext::initialize()
QRhi::Flags rhiFlags = QRhi::EnableDebugMarkers;
-#if QT_CONFIG(qt3d_vulkan)
+#if QT_CONFIG(qt3d_vulkan) && QT_CONFIG(vulkan)
if (requestedApi == Qt3DRender::API::Vulkan) {
QRhiVulkanInitParams params;
params.inst = &Qt3DRender::staticVulkanInstance();
@@ -645,8 +581,6 @@ bool SubmissionContext::beginDrawing(QSurface *surface)
{
Q_ASSERT(surface);
- m_surface = surface;
-
Q_ASSERT(isInitialized());
// In the Scene3D case it does not make sense to create SwapChains as we
@@ -661,7 +595,7 @@ bool SubmissionContext::beginDrawing(QSurface *surface)
QRhiSwapChain *swapChain = swapChainInfo->swapChain;
// Resize swapchain if needed
- if (m_surface->size() != swapChain->currentPixelSize()) {
+ if (surface->size() != swapChain->currentPixelSize()) {
bool couldRebuild = swapChain->createOrResize();
if (!couldRebuild)
return false;
@@ -838,6 +772,11 @@ void SubmissionContext::releaseResources()
m_renderBufferHash.clear();
RHI_UNIMPLEMENTED;
+ if (m_currentUpdates) {
+ m_currentUpdates->release();
+ m_currentUpdates = nullptr;
+ }
+
// Free RHI resources
{
qCDebug(Backend) << Q_FUNC_INFO;
@@ -1308,7 +1247,7 @@ void SubmissionContext::uploadDataToRHIBuffer(Buffer *buffer, RHIBuffer *b)
// We have a partial update
if (update->offset >= 0) {
// accumulate sequential updates as single one
- int bufferSize = update->data.size();
+ qsizetype bufferSize = update->data.size();
auto it2 = it + 1;
while ((it2 != updates.end()) && (it2->offset - update->offset == bufferSize)) {
bufferSize += it2->data.size();
@@ -1390,7 +1329,7 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
"\\s*,\\s*std140.*)\\)\\s*uniform\\s*([a-zA-Z0-9_]+)"));
auto replaceBinding = [&bindings, &assignedBindings](
- int &offset, QRegularExpressionMatch &match, QString &code,
+ qsizetype &offset, QRegularExpressionMatch &match, QString &code,
int indexCapture, int variableCapture) noexcept {
int index = match.captured(indexCapture).toInt();
QByteArray variable = match.captured(variableCapture).toUtf8();
@@ -1404,9 +1343,9 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
return;
}
- const int indexStartOffset = match.capturedStart(indexCapture);
- const int indexEndOffset = match.capturedEnd(indexCapture);
- const int indexLength = indexEndOffset - indexStartOffset;
+ const qsizetype indexStartOffset = match.capturedStart(indexCapture);
+ const qsizetype indexEndOffset = match.capturedEnd(indexCapture);
+ const qsizetype indexLength = indexEndOffset - indexStartOffset;
code.replace(indexStartOffset, indexLength, QByteArray::number(index));
}
@@ -1414,9 +1353,9 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
bindings.emplace(std::move(variable), index);
} else {
int indexToUse = it->second;
- const int indexStartOffset = match.capturedStart(indexCapture);
- const int indexEndOffset = match.capturedEnd(indexCapture);
- const int indexLength = indexEndOffset - indexStartOffset;
+ const qsizetype indexStartOffset = match.capturedStart(indexCapture);
+ const qsizetype indexEndOffset = match.capturedEnd(indexCapture);
+ const qsizetype indexLength = indexEndOffset - indexStartOffset;
code.replace(indexStartOffset, indexLength, QByteArray::number(indexToUse));
}
// This may fail in the case where the replaced offset is an incredibly long number,
@@ -1429,7 +1368,7 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
QString shaderString = shaderCode;
// Regex for the sampler variables
- int offset = 0;
+ qsizetype offset = 0;
auto match = samplerRegex.match(shaderString, offset);
while (match.hasMatch()) {
const int indexCapture = 1;
@@ -1454,26 +1393,45 @@ void preprocessRHIShader(std::vector<QByteArray> &shaderCodes)
}
}
-int glslVersionForFormat(const QSurfaceFormat &format) noexcept
+QShaderVersion glslVersionForFormat(const QSurfaceFormat &format) noexcept
{
const int major = format.majorVersion();
const int minor = format.minorVersion();
-
- static const QHash<std::pair<int, int>, int> glVersionToGLSLVersion = {
- { { 4, 6 }, 460 }, { { 4, 5 }, 450 }, { { 4, 4 }, 440 }, { { 4, 3 }, 430 },
- { { 4, 2 }, 420 }, { { 4, 1 }, 410 }, { { 4, 0 }, 400 }, { { 3, 3 }, 330 },
- { { 3, 2 }, 150 }, { { 3, 2 }, 120 }, { { 3, 1 }, 120 },
- };
-
- const auto it = glVersionToGLSLVersion.find({ major, minor });
- if (it == glVersionToGLSLVersion.end()) {
- if (major < 3) {
- return 120;
+ const auto type = format.renderableType();
+
+ if (type != QSurfaceFormat::OpenGLES) {
+ static const QHash<std::pair<int, int>, int> glVersionToGLSLVersion = {
+ { { 4, 6 }, 460 }, { { 4, 5 }, 450 }, { { 4, 4 }, 440 }, { { 4, 3 }, 430 },
+ { { 4, 2 }, 420 }, { { 4, 1 }, 410 }, { { 4, 0 }, 400 }, { { 3, 3 }, 330 },
+ { { 3, 2 }, 150 }, { { 3, 2 }, 120 }, { { 3, 1 }, 120 },
+ };
+
+ const auto it = glVersionToGLSLVersion.find({ major, minor });
+ if (it == glVersionToGLSLVersion.end()) {
+ if (major < 3) {
+ return 120;
+ } else {
+ return major * 100 + minor * 10;
+ }
} else {
- return major * 100 + minor * 10;
+ return *it;
+ }
+ }
+ else {
+ static const QHash<std::pair<int, int>, int> glVersionToGLSLVersion = {
+ { { 3, 2 }, 320 }, { { 3, 1 }, 310 }, { { 3, 0 }, 300 },
+ };
+
+ const auto it = glVersionToGLSLVersion.find({ major, minor });
+ if (it == glVersionToGLSLVersion.end()) {
+ if (major < 3) {
+ return {100, QShaderVersion::GlslEs};
+ } else {
+ return {major * 100 + minor * 10, QShaderVersion::GlslEs};
+ }
+ } else {
+ return {*it, QShaderVersion::GlslEs};
}
- } else {
- return *it;
}
}
}
@@ -1559,12 +1517,14 @@ void SubmissionContext::loadShader(Shader *shaderNode, ShaderManager *shaderMana
const std::vector<Qt3DCore::QNodeId> &sharedShaderIds =
rhiShaderManager->shaderIdsForProgram(rhiShader);
if (sharedShaderIds.size() == 1) {
- // Shader in the cache hasn't been loaded yet
- // We want a copy of the QByteArray as preprocessRHIShader will
- // modify them
- std::vector<QByteArray> shaderCodes = shaderNode->shaderCode();
- preprocessRHIShader(shaderCodes);
- rhiShader->setShaderCode(shaderCodes);
+ {
+ // Shader in the cache hasn't been loaded yet
+ // We want a copy of the QByteArray as preprocessRHIShader will
+ // modify them
+ std::vector<QByteArray> shaderCodes = shaderNode->shaderCode();
+ preprocessRHIShader(shaderCodes);
+ rhiShader->setShaderCode(std::move(shaderCodes));
+ }
const ShaderCreationInfo loadResult = createShaderProgram(rhiShader);
shaderNode->setStatus(loadResult.linkSucceeded ? QShaderProgram::Ready
diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h
index f48c11234..bb639ccfc 100644
--- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h
+++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_SUBMISSIONCONTEXT_H
#define QT3DRENDER_RENDER_RHI_SUBMISSIONCONTEXT_H
@@ -63,8 +27,8 @@
#include <shadervariables_p.h>
#include <rhihandle_types_p.h>
#include <QSurface>
-#include <QtGui/private/qrhi_p.h>
#include <QOffscreenSurface>
+#include <rhi/qrhi.h>
QT_BEGIN_NAMESPACE
@@ -207,23 +171,15 @@ private:
// States
void applyState(const StateVariant &state, QRhiGraphicsPipeline *graphicsPipeline);
+ bool m_initialized;
bool m_ownsRhiCtx;
bool m_drivenExternally;
- const unsigned int m_id;
- QSurface *m_surface;
- QSize m_surfaceSize;
QHash<Qt3DCore::QNodeId, HRHIBuffer> m_renderBufferHash;
- QHash<Qt3DCore::QNodeId, GLuint> m_renderTargets;
- QHash<GLuint, QSize> m_renderTargetsSize;
- QAbstractTexture::TextureFormat m_renderTargetFormat;
Material *m_material;
Renderer *m_renderer;
- QByteArray m_uboTempArray;
-
- bool m_initialized;
GraphicsApiFilterData m_contextInfo;
diff --git a/src/plugins/renderers/rhi/io/io.pri b/src/plugins/renderers/rhi/io/io.pri
deleted file mode 100644
index bac06ba95..000000000
--- a/src/plugins/renderers/rhi/io/io.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDEPATH += $$PWD
-
-SOURCES += \
- $$PWD/rhibuffer.cpp
-
-HEADERS += \
- $$PWD/rhibuffer_p.h
-
diff --git a/src/plugins/renderers/rhi/io/rhibuffer.cpp b/src/plugins/renderers/rhi/io/rhibuffer.cpp
index f20d3c4d1..9607e8c32 100644
--- a/src/plugins/renderers/rhi/io/rhibuffer.cpp
+++ b/src/plugins/renderers/rhi/io/rhibuffer.cpp
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "rhibuffer_p.h"
#include <submissioncontext_p.h>
-#include <QtGui/private/qrhi_p.h>
+#include <rhi/qrhi.h>
+
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
@@ -86,7 +51,7 @@ bool RHIBuffer::bind(SubmissionContext *ctx, Type t)
return bool(m_rhiBuffer);
const auto uploadMethod = m_dynamic ? &QRhiResourceUpdateBatch::updateDynamicBuffer
- : qOverload<QRhiBuffer *, int, int, const void *>(
+ : qOverload<QRhiBuffer *, quint32, quint32, const void *>(
&QRhiResourceUpdateBatch::uploadStaticBuffer);
if (!m_rhiBuffer) {
if (m_allocSize <= 0)
diff --git a/src/plugins/renderers/rhi/io/rhibuffer_p.h b/src/plugins/renderers/rhi/io/rhibuffer_p.h
index 52023332b..383363081 100644
--- a/src/plugins/renderers/rhi/io/rhibuffer_p.h
+++ b/src/plugins/renderers/rhi/io/rhibuffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RHIBUFFER_P_H
#define QT3DRENDER_RENDER_RHI_RHIBUFFER_P_H
diff --git a/src/plugins/renderers/rhi/main.cpp b/src/plugins/renderers/rhi/main.cpp
index 174b385de..13ff951b8 100644
--- a/src/plugins/renderers/rhi/main.cpp
+++ b/src/plugins/renderers/rhi/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <Qt3DRender/private/qrendererplugin_p.h>
#include <renderer_p.h>
diff --git a/src/plugins/renderers/rhi/managers/managers.pri b/src/plugins/renderers/rhi/managers/managers.pri
deleted file mode 100644
index de3f29b30..000000000
--- a/src/plugins/renderers/rhi/managers/managers.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/rhihandle_types_p.h \
- $$PWD/rhiresourcemanagers_p.h
-
-SOURCES += \
- $$PWD/rhiresourcemanagers.cpp
diff --git a/src/plugins/renderers/rhi/managers/rhihandle_types_p.h b/src/plugins/renderers/rhi/managers/rhihandle_types_p.h
index 8ae440e6d..5659db2a6 100644
--- a/src/plugins/renderers/rhi/managers/rhihandle_types_p.h
+++ b/src/plugins/renderers/rhi/managers/rhihandle_types_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RHIHANDLE_TYPES_P_H
#define QT3DRENDER_RENDER_RHI_RHIHANDLE_TYPES_P_H
diff --git a/src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp b/src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp
index 5be374aa2..bd7ebce0b 100644
--- a/src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp
+++ b/src/plugins/renderers/rhi/managers/rhiresourcemanagers.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "rhiresourcemanagers_p.h"
@@ -81,7 +45,7 @@ void RHIResourceManagers::releaseAllResources()
releaseAll(m_rhiTextureManager);
releaseAll(m_rhiBufferManager);
- // releaseAll(m_rhiShaderManager);
+ qDeleteAll(m_rhiShaderManager->takeActiveResources());
releaseAll(m_rhiRenderTargetManager);
releaseAll(m_rhiGraphicsPipelineManager);
releaseAll(m_rhiComputePipelineManager);
diff --git a/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h b/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h
index 0e15afe91..85c01a09e 100644
--- a/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h
+++ b/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RHIRESOURCEMANAGERS_P_H
#define QT3DRENDER_RENDER_RHI_RHIRESOURCEMANAGERS_P_H
diff --git a/src/plugins/renderers/rhi/renderer/commandexecuter.cpp b/src/plugins/renderers/rhi/renderer/commandexecuter.cpp
index 359e377bc..eaceb270a 100644
--- a/src/plugins/renderers/rhi/renderer/commandexecuter.cpp
+++ b/src/plugins/renderers/rhi/renderer/commandexecuter.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "commandexecuter_p.h"
@@ -304,7 +268,9 @@ QJsonObject parameterPackToJson(const Render::Rhi::ShaderParameterPack &pack) no
} // anonymous
-CommandExecuter::CommandExecuter(Render::Rhi::Renderer *renderer) : m_renderer(renderer) { }
+CommandExecuter::CommandExecuter(Render::Rhi::Renderer *renderer) : m_renderer(renderer) {
+ Q_UNUSED(m_renderer)
+}
// Render thread
void CommandExecuter::performAsynchronousCommandExecution(
diff --git a/src/plugins/renderers/rhi/renderer/commandexecuter_p.h b/src/plugins/renderers/rhi/renderer/commandexecuter_p.h
index e683253a7..1ee60afe3 100644
--- a/src/plugins/renderers/rhi/renderer/commandexecuter_p.h
+++ b/src/plugins/renderers/rhi/renderer/commandexecuter_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_DEBUG_COMMANDEXECUTER_H
#define QT3DRENDER_DEBUG_COMMANDEXECUTER_H
diff --git a/src/plugins/renderers/rhi/renderer/logging.cpp b/src/plugins/renderers/rhi/renderer/logging.cpp
index 1aaa68208..265a48bca 100644
--- a/src/plugins/renderers/rhi/renderer/logging.cpp
+++ b/src/plugins/renderers/rhi/renderer/logging.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "logging_p.h"
diff --git a/src/plugins/renderers/rhi/renderer/logging_p.h b/src/plugins/renderers/rhi/renderer/logging_p.h
index 45d63978d..295181685 100644
--- a/src/plugins/renderers/rhi/renderer/logging_p.h
+++ b/src/plugins/renderers/rhi/renderer/logging_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RENDERLOGGING_P_H
#define QT3DRENDER_RENDER_RHI_RENDERLOGGING_P_H
diff --git a/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp b/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp
index ce53de1ab..8cffaac4f 100644
--- a/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp
+++ b/src/plugins/renderers/rhi/renderer/pipelineuboset.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "pipelineuboset_p.h"
#include <rendercommand_p.h>
@@ -46,7 +10,7 @@
#include <rhigraphicspipeline_p.h>
#include <rhiresourcemanagers_p.h>
#include <submissioncontext_p.h>
-#include <QtGui/private/qrhi_p.h>
+#include <rhi/qrhi.h>
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/buffermanager_p.h>
#include <Qt3DRender/private/stringtoint_p.h>
@@ -220,14 +184,14 @@ std::vector<QRhiCommandBuffer::DynamicOffset> PipelineUBOSet::offsets(const Rend
const size_t dToCmd = distanceToCommand(cmd);
{
// Compute offset relative to the select UBO in the subset
- const size_t localOffset = m_commandsUBO.localOffsetInBufferForCommand(dToCmd);
- offsets.push_back({1, localOffset});
+ const auto localOffset = m_commandsUBO.localOffsetInBufferForCommand(dToCmd);
+ offsets.push_back({1, quint32(localOffset)});
}
for (const MultiUBOBufferWithBindingAndBlockSize &materialUBO : m_materialsUBOs) {
// Compute offset relative to the select UBO in the subset
const size_t localOffset = materialUBO.localOffsetInBufferForCommand(dToCmd);
- offsets.push_back({materialUBO.binding, localOffset});
+ offsets.push_back({materialUBO.binding, quint32(localOffset)});
}
return offsets;
@@ -279,7 +243,7 @@ std::vector<QRhiShaderResourceBinding> PipelineUBOSet::resourceBindings(const Re
{
RHITextureManager *textureManager = m_resourceManagers->rhiTextureManager();
RHIShader *shader = command.m_rhiShader;
- const QRhiShaderResourceBinding::StageFlags stages = QRhiShaderResourceBinding::VertexStage|QRhiShaderResourceBinding::FragmentStage;
+ const QRhiShaderResourceBinding::StageFlags stages = QRhiShaderResourceBinding::ComputeStage|QRhiShaderResourceBinding::VertexStage|QRhiShaderResourceBinding::FragmentStage;
std::vector<QRhiShaderResourceBinding> bindings = {
QRhiShaderResourceBinding::uniformBuffer(0, stages, m_rvUBO.buffer->rhiBuffer()),
};
@@ -359,9 +323,10 @@ std::vector<QRhiShaderResourceBinding> PipelineUBOSet::resourceBindings(const Re
for (const BlockToSSBO &ssbo : command.m_parameterPack.shaderStorageBuffers()) {
RHIBuffer *buffer = m_resourceManagers->rhiBufferManager()->lookupResource(ssbo.m_bufferID);
if (buffer) {
+ Q_ASSERT(stages & QRhiShaderResourceBinding::ComputeStage);
bindings.push_back(QRhiShaderResourceBinding::bufferLoadStore(
ssbo.m_bindingIndex,
- stages|QRhiShaderResourceBinding::ComputeStage,
+ stages,
buffer->rhiBuffer()));
}
}
@@ -618,31 +583,36 @@ void PipelineUBOSet::uploadUBOsForCommand(const RenderCommand &command,
if (ubo == nullptr)
continue;
- for (const RHIShader::UBO_Member &member : qAsConst(uboBlock.members)) {
+ for (const RHIShader::UBO_Member &member : std::as_const(uboBlock.members)) {
const QShaderDescription::BlockVariable &blockVariable = member.blockVariable;
+
+ // Array
if (!blockVariable.arrayDims.empty()) {
- if (!blockVariable.structMembers.empty()) {
- const int arr0 = blockVariable.arrayDims[0];
- for (int i = 0; i < arr0; i++) {
- for (const RHIShader::UBO_Member &structMember : member.structMembers) {
+ if (!blockVariable.structMembers.empty()) { // Array of structs
+ // we treat structMembers as arrayMembers when we are dealing with an array of structs´
+ const size_t arr0 = size_t(blockVariable.arrayDims[0]);
+ const size_t m = std::max(arr0, member.structMembers.size());
+ for (size_t i = 0; i < m; ++i) {
+ const RHIShader::UBO_Member &arrayMember = member.structMembers[i];
+ for (const RHIShader::UBO_Member &arrayStructMember : arrayMember.structMembers) {
uploadUniform(uniforms, ubo,
- structMember,
+ arrayStructMember,
distanceToCommand,
- i * blockVariable.size / arr0);
+ int(i * blockVariable.size / arr0));
}
}
- } else {
+ } else { // Array of scalars
uploadUniform(uniforms, ubo,
member, distanceToCommand);
}
} else {
- if (!blockVariable.structMembers.empty()) {
+ if (!blockVariable.structMembers.empty()) { // Struct
for (const RHIShader::UBO_Member &structMember : member.structMembers) {
uploadUniform(uniforms, ubo,
structMember,
distanceToCommand);
}
- } else {
+ } else { // Scalar
uploadUniform(uniforms, ubo,
member, distanceToCommand);
}
@@ -692,7 +662,7 @@ void PipelineUBOSet::uploadUBOsForCommand(const RenderCommand &command,
continue;
// Upload ShaderData property that match members of each UBO block instance
- for (const RHIShader::UBO_Member &uboInstance : qAsConst(block->members)) {
+ for (const RHIShader::UBO_Member &uboInstance : std::as_const(block->members)) {
uploadShaderDataProperty(shaderData, materialsUBO,
uboInstance, distanceToCommand);
}
diff --git a/src/plugins/renderers/rhi/renderer/pipelineuboset_p.h b/src/plugins/renderers/rhi/renderer/pipelineuboset_p.h
index e3902a5c6..55c3bbb60 100644
--- a/src/plugins/renderers/rhi/renderer/pipelineuboset_p.h
+++ b/src/plugins/renderers/rhi/renderer/pipelineuboset_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_PIPELINEUBOSET_H
#define QT3DRENDER_RENDER_RHI_PIPELINEUBOSET_H
@@ -52,7 +16,7 @@
//
#include <rhihandle_types_p.h>
-#include <private/qrhi_p.h>
+#include <rhi/qrhi.h>
#include <shadervariables_p.h>
#include <rhishader_p.h>
diff --git a/src/plugins/renderers/rhi/renderer/rendercommand.cpp b/src/plugins/renderers/rhi/renderer/rendercommand.cpp
index 06fb3bec0..e9ef1e99b 100644
--- a/src/plugins/renderers/rhi/renderer/rendercommand.cpp
+++ b/src/plugins/renderers/rhi/renderer/rendercommand.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "rendercommand_p.h"
#include "rhigraphicspipeline_p.h"
@@ -95,6 +59,12 @@ RenderCommand::RenderCommand()
m_workGroups[2] = 0;
}
+RenderCommand::~RenderCommand()
+{
+ if (shaderResourceBindings)
+ shaderResourceBindings->deleteLater();
+}
+
bool RenderCommand::isValid() const noexcept
{
return m_isValid && m_rhiShader && pipeline.isValid();
diff --git a/src/plugins/renderers/rhi/renderer/rendercommand_p.h b/src/plugins/renderers/rhi/renderer/rendercommand_p.h
index 9e2585588..392650385 100644
--- a/src/plugins/renderers/rhi/renderer/rendercommand_p.h
+++ b/src/plugins/renderers/rhi/renderer/rendercommand_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RENDERCOMMAND_H
#define QT3DRENDER_RENDER_RHI_RENDERCOMMAND_H
@@ -62,7 +26,7 @@
#include <QOpenGLShaderProgram>
#include <QOpenGLTexture>
#include <QMatrix4x4>
-#include <QtGui/private/qrhi_p.h>
+#include <rhi/qrhi.h>
#include <Qt3DCore/qattribute.h>
#include <variant>
@@ -93,8 +57,9 @@ struct CommandUBO
float mvp[16];
float inverseModelViewProjectionMatrix[16];
float modelViewNormalMatrix[12];
+ float skinningPalette[100 * 16];
};
-static_assert(sizeof(CommandUBO) == 6 * (16 * sizeof(float)) + 2 * (12 * sizeof(float)),
+static_assert(sizeof(CommandUBO) == 6 * (16 * sizeof(float)) + 2 * (12 * sizeof(float)) + 100 * (16 * sizeof(float)),
"UBO doesn't match std140");
struct Q_AUTOTEST_EXPORT AttributeInfo
@@ -113,6 +78,7 @@ class Q_AUTOTEST_EXPORT RenderCommand
{
public:
RenderCommand();
+ ~RenderCommand();
bool isValid() const noexcept;
diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp
index 7774c91fe..4a25bb464 100644
--- a/src/plugins/renderers/rhi/renderer/renderer.cpp
+++ b/src/plugins/renderers/rhi/renderer/renderer.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "renderer_p.h"
#include "rhirendertarget_p.h"
@@ -129,8 +93,6 @@
QT_BEGIN_NAMESPACE
-using namespace Qt3DCore;
-
namespace Qt3DRender {
namespace Render {
namespace Rhi {
@@ -372,7 +334,7 @@ void Renderer::setNodeManagers(NodeManagers *managers)
m_computableEntityFilterJob->setManager(m_nodesManager->renderNodesManager());
}
-void Renderer::setServices(QServiceLocator *services)
+void Renderer::setServices(Qt3DCore::QServiceLocator *services)
{
m_services = services;
@@ -649,12 +611,12 @@ void Renderer::render(bool swapBuffers)
// RenderQueue is complete (but that means it may be of size 0)
if (!queueIsEmpty) {
- QTaskLogger submissionStatsPart1(m_services->systemInformation(),
- { JobTypes::FrameSubmissionPart1, 0 },
- QTaskLogger::Submission);
- QTaskLogger submissionStatsPart2(m_services->systemInformation(),
- { JobTypes::FrameSubmissionPart2, 0 },
- QTaskLogger::Submission);
+ Qt3DCore::QTaskLogger submissionStatsPart1(m_services->systemInformation(),
+ { JobTypes::FrameSubmissionPart1, 0 },
+ Qt3DCore::QTaskLogger::Submission);
+ Qt3DCore::QTaskLogger submissionStatsPart2(m_services->systemInformation(),
+ { JobTypes::FrameSubmissionPart2, 0 },
+ Qt3DCore::QTaskLogger::Submission);
std::vector<RHIPassInfo> rhiPassesInfo;
@@ -795,8 +757,8 @@ QSurfaceFormat Renderer::format()
namespace {
std::optional<QRhiVertexInputAttribute::Format> rhiAttributeType(Attribute *attr) {
switch (attr->vertexBaseType()) {
- case QAttribute::Byte:
- case QAttribute::UnsignedByte: {
+ case Qt3DCore::QAttribute::Byte:
+ case Qt3DCore::QAttribute::UnsignedByte: {
if (attr->vertexSize() == 1)
return QRhiVertexInputAttribute::UNormByte;
if (attr->vertexSize() == 2)
@@ -805,7 +767,18 @@ std::optional<QRhiVertexInputAttribute::Format> rhiAttributeType(Attribute *attr
return QRhiVertexInputAttribute::UNormByte4;
break;
}
- case QAttribute::UnsignedInt: {
+ case Qt3DCore::QAttribute::Int: {
+ if (attr->vertexSize() == 1)
+ return QRhiVertexInputAttribute::SInt;
+ if (attr->vertexSize() == 2)
+ return QRhiVertexInputAttribute::SInt2;
+ if (attr->vertexSize() == 3)
+ return QRhiVertexInputAttribute::SInt3;
+ if (attr->vertexSize() == 4)
+ return QRhiVertexInputAttribute::SInt4;
+ break;
+ }
+ case Qt3DCore::QAttribute::UnsignedInt: {
if (attr->vertexSize() == 1)
return QRhiVertexInputAttribute::UInt;
if (attr->vertexSize() == 2)
@@ -816,7 +789,18 @@ std::optional<QRhiVertexInputAttribute::Format> rhiAttributeType(Attribute *attr
return QRhiVertexInputAttribute::UInt4;
break;
}
- case QAttribute::Float: {
+ case Qt3DCore::QAttribute::HalfFloat: {
+ if (attr->vertexSize() == 1)
+ return QRhiVertexInputAttribute::Half;
+ if (attr->vertexSize() == 2)
+ return QRhiVertexInputAttribute::Half2;
+ if (attr->vertexSize() == 3)
+ return QRhiVertexInputAttribute::Half3;
+ if (attr->vertexSize() >= 4)
+ return QRhiVertexInputAttribute::Half4;
+ break;
+ }
+ case Qt3DCore::QAttribute::Float: {
if (attr->vertexSize() == 1)
return QRhiVertexInputAttribute::Float;
if (attr->vertexSize() == 2)
@@ -1179,16 +1163,24 @@ void Renderer::createRenderTarget(RenderTarget *target)
}
};
+ RHIRenderTarget::BackBuffer backBuffer = RHIRenderTarget::BackBuffer::None;
+
// Look up attachments to populate the RT description
// Attachments are sorted by attachment point (Color0 is first)
for (const Attachment &attachment : pack.attachments()) {
+
+ if (attachment.m_point == QRenderTargetOutput::Left || attachment.m_point == QRenderTargetOutput::Right) {
+ backBuffer = attachment.m_point == QRenderTargetOutput::Left ? RHIRenderTarget::BackBuffer::Left : RHIRenderTarget::BackBuffer::Right;
+ break;
+ }
+
RHITexture *tex = texman->lookupResource(attachment.m_textureUuid);
if (tex && tex->getRhiTexture()) {
-
auto rhiTex = tex->getRhiTexture();
if (!rhiTex->flags().testFlag(QRhiTexture::RenderTarget) ||
!rhiTex->flags().testFlag(QRhiTexture::UsedAsTransferSource)) {
// UsedAsTransferSource is required if we ever want to read back from the texture
+ rhiTex->destroy();
rhiTex->setFlags(rhiTex->flags() | QRhiTexture::RenderTarget|QRhiTexture::UsedAsTransferSource);
rhiTex->create();
}
@@ -1221,6 +1213,12 @@ void Renderer::createRenderTarget(RenderTarget *target)
}
}
+ rhiTarget->backBuffer = backBuffer;
+ // If we are targeting one of the back buffers directly, don't create an offscreen RT
+ if (backBuffer != RHIRenderTarget::BackBuffer::None)
+ return;
+
+ // Otherwise, create QRhiRenderBuffer and associated resources
if (targetSize.width() <= 0 || targetSize.height() <= 0) {
cleanAllocatedResources();
return;
@@ -1270,6 +1268,12 @@ bool Renderer::setupRenderTarget(RenderView *rv,
const auto &managers = *nodeManagers();
auto &renderTargetManager = *managers.renderTargetManager();
+ auto useSwapchainForPipeline = [&]() {
+ Q_ASSERT(swapchain);
+ rhiPipeline->setRenderPassDescriptor(swapchain->renderPassDescriptor());
+ rhiPipeline->setSampleCount(swapchain->sampleCount());
+ };
+
auto *renderTarget = renderTargetManager.lookupResource(rv->renderTargetId());
if (renderTarget) {
// Render to texture
@@ -1277,14 +1281,25 @@ bool Renderer::setupRenderTarget(RenderView *rv,
RHIRenderTargetManager *rhiRenderTargetManager = m_RHIResourceManagers->rhiRenderTargetManager();
RHIRenderTarget *rhiTarget = rhiRenderTargetManager->lookupResource(renderTargetId);
- if (!rhiTarget || !rhiTarget->renderTarget) {
+ if (!rhiTarget) {
qWarning(Backend) << "Invalid RenderTarget " << renderTargetId << " for Pipeline";
return false;
}
- rhiPipeline->setRenderPassDescriptor(rhiTarget->renderPassDescriptor);
- rhiPipeline->setSampleCount(rhiTarget->renderTarget->sampleCount());
+ // The RenderTarget we reference might actually be referencing a swapchain back buffer
+ if (rhiTarget->backBuffer != RHIRenderTarget::BackBuffer::None) {
+ // Render to the default framebuffer on our swapchain
+ useSwapchainForPipeline();
+ } else {
+ if (!rhiTarget->renderTarget) {
+ qWarning(Backend) << "Invalid RenderTarget " << renderTargetId << " for Pipeline";
+ return false;
+ }
+ rhiPipeline->setRenderPassDescriptor(rhiTarget->renderPassDescriptor);
+ rhiPipeline->setSampleCount(rhiTarget->renderTarget->sampleCount());
+ }
return true;
+
} else if (m_submissionContext->defaultRenderTarget()) {
// Use default RenderTarget if set Default FBO set by Scene3D
QRhiRenderTarget *defaultTarget = m_submissionContext->defaultRenderTarget();;
@@ -1292,10 +1307,8 @@ bool Renderer::setupRenderTarget(RenderView *rv,
rhiPipeline->setSampleCount(defaultTarget->sampleCount());
return true;
} else {
- Q_ASSERT(swapchain);
// Render to the default framebuffer on our swapchain
- rhiPipeline->setRenderPassDescriptor(swapchain->renderPassDescriptor());
- rhiPipeline->setSampleCount(swapchain->sampleCount());
+ useSwapchainForPipeline();
return true;
}
}
@@ -1422,11 +1435,11 @@ Renderer::prepareCommandsSubmission(const std::vector<RenderView *> &renderViews
// Note: we cannot do it in the loop above as we want to be sure that all
// the VAO which reference the geometry/attributes are properly updated
RHI_UNIMPLEMENTED;
- for (Attribute *attribute : qAsConst(m_dirtyAttributes))
+ for (Attribute *attribute : std::as_const(m_dirtyAttributes))
attribute->unsetDirty();
m_dirtyAttributes.clear();
- for (Geometry *geometry : qAsConst(m_dirtyGeometry))
+ for (Geometry *geometry : std::as_const(m_dirtyGeometry))
geometry->unsetDirty();
m_dirtyGeometry.clear();
@@ -1478,10 +1491,10 @@ void Renderer::lookForDirtyTextures()
const std::vector<HTexture> &activeTextureHandles = textureManager->activeHandles();
for (const HTexture &handle : activeTextureHandles) {
Texture *texture = textureManager->data(handle);
- const QNodeIdVector imageIds = texture->textureImageIds();
+ const Qt3DCore::QNodeIdVector imageIds = texture->textureImageIds();
// Does the texture reference any of the dirty texture images?
- for (const QNodeId &imageId : imageIds) {
+ for (const Qt3DCore::QNodeId &imageId : imageIds) {
if (dirtyImageIds.contains(imageId)) {
texture->addDirtyFlag(Texture::DirtyImageGenerators);
break;
@@ -1511,7 +1524,7 @@ void Renderer::reloadDirtyShaders()
// If api of the renderer matches the one from the technique
if (technique->isCompatibleWithRenderer()) {
const auto passIds = technique->renderPasses();
- for (const QNodeId &passId : passIds) {
+ for (const Qt3DCore::QNodeId &passId : passIds) {
RenderPass *renderPass =
m_nodesManager->renderPassManager()->lookupResource(passId);
HShader shaderHandle =
@@ -1564,12 +1577,15 @@ void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
const std::vector<HShader> &activeShaders = m_nodesManager->shaderManager()->activeHandles();
for (const HShader &handle : activeShaders) {
Shader *s = m_nodesManager->shaderManager()->data(handle);
+ if (!s)
+ continue;
+
if (s->requiresFrontendSync()) {
QShaderProgram *frontend =
static_cast<decltype(frontend)>(manager->lookupNode(s->peerId()));
if (frontend) {
QShaderProgramPrivate *dFrontend =
- static_cast<decltype(dFrontend)>(QNodePrivate::get(frontend));
+ static_cast<decltype(dFrontend)>(Qt3DCore::QNodePrivate::get(frontend));
dFrontend->setStatus(s->status());
dFrontend->setLog(s->log());
s->unsetRequiresFrontendSync();
@@ -1581,8 +1597,11 @@ void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
for (const ShaderBuilderUpdate &update : m_shaderBuilderUpdates) {
QShaderProgramBuilder *builder =
static_cast<decltype(builder)>(manager->lookupNode(update.builderId));
+ if (!builder)
+ continue;
+
QShaderProgramBuilderPrivate *dBuilder =
- static_cast<decltype(dBuilder)>(QNodePrivate::get(builder));
+ static_cast<decltype(dBuilder)>(Qt3DCore::QNodePrivate::get(builder));
dBuilder->setShaderCode(update.shaderCode, update.shaderType);
}
m_shaderBuilderUpdates.clear();
@@ -1618,8 +1637,7 @@ void Renderer::sendTextureChangesToFrontend(Qt3DCore::QAspectManager *manager)
texture->blockNotifications(blocked);
QAbstractTexturePrivate *dTexture =
- static_cast<QAbstractTexturePrivate *>(QNodePrivate::get(texture));
-
+ static_cast<QAbstractTexturePrivate *>(Qt3DCore::QNodePrivate::get(texture));
dTexture->setStatus(properties.status);
dTexture->setHandleType(pair.first.handleType);
dTexture->setHandle(pair.first.handle);
@@ -1657,7 +1675,7 @@ bool Renderer::prepareGeometryInputBindings(const Geometry *geometry, const RHIS
QHash<int, int> &attributeNameToBinding)
{
// shader requires no attributes
- if (shader->attributes().size() == 0)
+ if (shader->attributes().empty())
return true;
// QRhiVertexInputBinding -> specifies the stride of an attribute,
@@ -1679,7 +1697,7 @@ bool Renderer::prepareGeometryInputBindings(const Geometry *geometry, const RHIS
for (Qt3DCore::QNodeId attribute_id : attributesIds) {
Attribute *attrib = m_nodesManager->attributeManager()->lookupResource(attribute_id);
- if (attrib->attributeType() != QAttribute::VertexAttribute)
+ if (attrib->attributeType() != Qt3DCore::QAttribute::VertexAttribute)
continue;
const int location = locationForAttribute(attrib, shader);
// In case the shader doesn't use the attribute, we would get no
@@ -1693,20 +1711,20 @@ bool Renderer::prepareGeometryInputBindings(const Geometry *geometry, const RHIS
? QRhiVertexInputBinding::PerInstance
: QRhiVertexInputBinding::PerVertex;
- auto getAttributeByteSize = [] (const QAttribute::VertexBaseType type) {
+ auto getAttributeByteSize = [](const Qt3DCore::QAttribute::VertexBaseType type) {
switch (type) {
- case QAttribute::Byte:
- case QAttribute::UnsignedByte:
+ case Qt3DCore::QAttribute::Byte:
+ case Qt3DCore::QAttribute::UnsignedByte:
return 1;
- case QAttribute::Short:
- case QAttribute::UnsignedShort:
- case QAttribute::HalfFloat:
+ case Qt3DCore::QAttribute::Short:
+ case Qt3DCore::QAttribute::UnsignedShort:
+ case Qt3DCore::QAttribute::HalfFloat:
return 2;
- case QAttribute::Int:
- case QAttribute::UnsignedInt:
- case QAttribute::Float:
+ case Qt3DCore::QAttribute::Int:
+ case Qt3DCore::QAttribute::UnsignedInt:
+ case Qt3DCore::QAttribute::Float:
return 4;
- case QAttribute::Double:
+ case Qt3DCore::QAttribute::Double:
return 8;
}
return 0;
@@ -1773,7 +1791,7 @@ bool Renderer::prepareGeometryInputBindings(const Geometry *geometry, const RHIS
//*/
inputBindings[i] = QRhiVertexInputBinding{ binding.stride, binding.classification,
- int(binding.attributeDivisor) };
+ binding.attributeDivisor };
}
return true;
@@ -1834,6 +1852,12 @@ void Renderer::updateResources()
}
}
+ std::vector<RHITexture *> updatedRHITextures;
+
+ // Create/Update textures. We record the update info to later fill
+ // m_updatedTextureProperties once we are use the RHITextures have been
+ // fully created (as creating the RenderTargets below could change existing
+ // RHITextures)
{
const std::vector<HTexture> activeTextureHandles = Qt3DCore::moveAndClear(m_dirtyTextures);
for (const HTexture &handle : activeTextureHandles) {
@@ -1852,31 +1876,29 @@ void Renderer::updateResources()
// RHITexture
if (m_submissionContext != nullptr) {
RHITextureManager *rhiTextureManager = m_RHIResourceManagers->rhiTextureManager();
- const std::vector<HRHITexture> &glTextureHandles = rhiTextureManager->activeHandles();
+ const std::vector<HRHITexture> &rhiTextureHandles = rhiTextureManager->activeHandles();
// Upload texture data
- for (const HRHITexture &glTextureHandle : glTextureHandles) {
+ for (const HRHITexture &rhiTextureHandle : rhiTextureHandles) {
RHI_UNIMPLEMENTED;
- RHITexture *glTexture = rhiTextureManager->data(glTextureHandle);
+ RHITexture *rhiTexture = rhiTextureManager->data(rhiTextureHandle);
- // We create/update the actual GL texture using the GL context at this point
+ // We create/update the actual RHI texture using the RHI context at this point
const RHITexture::TextureUpdateInfo info =
- glTexture->createOrUpdateRhiTexture(m_submissionContext.data());
-
- // RHITexture creation provides us width/height/format ... information
- // for textures which had not initially specified these information
- // (TargetAutomatic...) Gather these information and store them to be distributed by
- // a change next frame
- const QNodeIdVector referenceTextureIds = {
- rhiTextureManager->texNodeIdForRHITexture.value(glTexture)
- };
- // Store properties and referenceTextureIds
+ rhiTexture->createOrUpdateRhiTexture(m_submissionContext.data());
+
if (info.wasUpdated) {
+ // RHITexture creation provides us width/height/format ... information
+ // for textures which had not initially specified these information
+ // (TargetAutomatic...) Gather these information and store them to be distributed by
+ // a change next frame
+ const Qt3DCore::QNodeIdVector referenceTextureIds = { rhiTextureManager->texNodeIdForRHITexture.value(rhiTexture) };
+ // Store properties and referenceTextureIds
Texture::TextureUpdateInfo updateInfo;
updateInfo.properties = info.properties;
- updateInfo.handleType = QAbstractTexture::OpenGLTextureId;
- // updateInfo.handle = info.texture ?
- // QVariant(info.texture->textureId()) : QVariant();
+ // Record texture updates to notify frontend (we are sure at this stage
+ // that the internal QRHITexture won't be updated further for this frame
m_updatedTextureProperties.push_back({ updateInfo, referenceTextureIds });
+ updatedRHITextures.push_back(rhiTexture);
}
}
}
@@ -1890,6 +1912,10 @@ void Renderer::updateResources()
// -> attachments added/removed
// -> attachments textures updated (new dimensions, format ...)
// -> destroy pipelines associated with dirty renderTargets
+
+ // Note: we might end up recreating some of the internal textures when
+ // creating the RenderTarget as those might have been created above without
+ // the proper RenderTarget/TransformSource flags
{
RHIRenderTargetManager *rhiRenderTargetManager = m_RHIResourceManagers->rhiRenderTargetManager();
RenderTargetManager *renderTargetManager = m_nodesManager->renderTargetManager();
@@ -1930,6 +1956,22 @@ void Renderer::updateResources()
}
}
+
+ // Note: we can only retrieve the internal QRhiResource handle to set on
+ // the frontend nodes after we are sure we are no going to modify the
+ // QRhiTextures (which happens when we create the Textures or the
+ // RenderTargets)
+ {
+ for (size_t i = 0, m = m_updatedTextureProperties.size(); i < m; ++i) {
+ auto &updateInfoPair = m_updatedTextureProperties[i];
+ RHITexture *rhiTexture = updatedRHITextures[i];
+ QRhiTexture *qRhiTexture = rhiTexture->getRhiTexture();
+ Texture::TextureUpdateInfo &updateInfo = updateInfoPair.first;
+ updateInfo.handleType = QAbstractTexture::RHITextureId;
+ updateInfo.handle = qRhiTexture ? QVariant(qRhiTexture->nativeTexture().object) : QVariant();
+ }
+ }
+
// Record list of buffer that might need uploading
lookForDownloadableBuffers();
}
@@ -1971,11 +2013,11 @@ void Renderer::updateTexture(Texture *texture)
// Will make the texture requestUpload
if (dirtyFlags.testFlag(Texture::DirtyImageGenerators)) {
- const QNodeIdVector textureImageIds = texture->textureImageIds();
+ const Qt3DCore::QNodeIdVector textureImageIds = texture->textureImageIds();
std::vector<RHITexture::Image> images;
images.reserve(textureImageIds.size());
// TODO: Move this into RHITexture directly
- for (const QNodeId &textureImageId : textureImageIds) {
+ for (const Qt3DCore::QNodeId &textureImageId : textureImageIds) {
const TextureImage *img =
m_nodesManager->textureImageManager()->lookupResource(textureImageId);
if (img == nullptr) {
@@ -2199,16 +2241,18 @@ void Renderer::jobsDone(Qt3DCore::QAspectManager *manager)
// called in main thread once all jobs are done running
// sync captured renders to frontend
+ QMutexLocker lock(&m_pendingRenderCaptureSendRequestsMutex);
const std::vector<Qt3DCore::QNodeId> pendingCaptureIds =
Qt3DCore::moveAndClear(m_pendingRenderCaptureSendRequests);
- for (const Qt3DCore::QNodeId &id : qAsConst(pendingCaptureIds)) {
+ lock.unlock();
+ for (const Qt3DCore::QNodeId &id : std::as_const(pendingCaptureIds)) {
auto *backend = static_cast<Qt3DRender::Render::RenderCapture *>(
m_nodesManager->frameGraphManager()->lookupNode(id));
backend->syncRenderCapturesToFrontend(manager);
}
// Do we need to notify any texture about property changes?
- if (m_updatedTextureProperties.size() > 0)
+ if (!m_updatedTextureProperties.empty())
sendTextureChangesToFrontend(manager);
sendDisablesToFrontend(manager);
@@ -2229,7 +2273,7 @@ bool Renderer::processKeyEvent(QObject *object, QKeyEvent *event)
}
// Jobs we may have to run even if no rendering will happen
-std::vector<QAspectJobPtr> Renderer::preRenderingJobs()
+std::vector<Qt3DCore::QAspectJobPtr> Renderer::preRenderingJobs()
{
if (m_sendBufferCaptureJob->hasRequests())
return { m_sendBufferCaptureJob };
@@ -2243,10 +2287,10 @@ std::vector<QAspectJobPtr> Renderer::preRenderingJobs()
// for the rendering of the scene
std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
{
- std::vector<QAspectJobPtr> renderBinJobs;
+ std::vector<Qt3DCore::QAspectJobPtr> renderBinJobs;
// Remove previous dependencies
- m_cleanupJob->removeDependency(QWeakPointer<QAspectJob>());
+ m_cleanupJob->removeDependency(QWeakPointer<Qt3DCore::QAspectJob>());
const bool dirtyParametersForCurrentFrame = m_dirtyBits.marked & AbstractRenderer::ParameterDirty;
const BackendNodeDirtySet dirtyBitsForFrame = m_dirtyBits.marked | m_dirtyBits.remaining;
@@ -2320,7 +2364,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
m_updatedDisableSubtreeEnablers.push_back(node->peerId());
}
- int idealThreadCount = QAspectJobManager::idealThreadCount();
+ int idealThreadCount = Qt3DCore::QAspectJobManager::idealThreadCount();
const size_t fgBranchCount = m_frameGraphLeaves.size();
if (fgBranchCount > 1) {
@@ -2384,7 +2428,7 @@ std::vector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
return renderBinJobs;
}
-QAbstractFrameAdvanceService *Renderer::frameAdvanceService() const
+Qt3DCore::QAbstractFrameAdvanceService *Renderer::frameAdvanceService() const
{
return static_cast<Qt3DCore::QAbstractFrameAdvanceService *>(m_vsyncFrameAdvanceService.data());
}
@@ -2409,12 +2453,12 @@ bool Renderer::performCompute(QRhiCommandBuffer *cb, RenderCommand &command)
return true;
}
-static auto rhiIndexFormat(QAttribute::VertexBaseType type)
+static auto rhiIndexFormat(Qt3DCore::QAttribute::VertexBaseType type)
{
switch (type) {
- case QAttribute::VertexBaseType ::UnsignedShort:
+ case Qt3DCore::QAttribute::VertexBaseType ::UnsignedShort:
return QRhiCommandBuffer::IndexUInt16;
- case QAttribute::VertexBaseType ::UnsignedInt:
+ case Qt3DCore::QAttribute::VertexBaseType ::UnsignedInt:
return QRhiCommandBuffer::IndexUInt32;
default:
std::abort();
@@ -2486,7 +2530,7 @@ bool Renderer::uploadBuffersForCommand(RHIGraphicsPipeline* graphicsPipeline, Re
Buffer *buffer = m_nodesManager->bufferManager()->lookupResource(attrib->bufferId());
RHIBuffer *hbuf = m_RHIResourceManagers->rhiBufferManager()->lookupResource(buffer->peerId());
switch (attrib->attributeType()) {
- case QAttribute::VertexAttribute: {
+ case Qt3DCore::QAttribute::VertexAttribute: {
if (!hbuf->bind(&*m_submissionContext, RHIBuffer::Type((int)RHIBuffer::Type::ArrayBuffer | (int)RHIBuffer::Type::ShaderStorageBuffer)))
return false;
assert(hbuf->rhiBuffer());
@@ -2499,7 +2543,7 @@ bool Renderer::uploadBuffersForCommand(RHIGraphicsPipeline* graphicsPipeline, Re
command.vertex_input[bindingIndex] = { hbuf->rhiBuffer(), 0 };
break;
}
- case QAttribute::IndexAttribute: {
+ case Qt3DCore::QAttribute::IndexAttribute: {
if (!hbuf->bind(&*m_submissionContext, RHIBuffer::Type::IndexBuffer))
return false;
assert(hbuf->rhiBuffer());
@@ -2508,7 +2552,7 @@ bool Renderer::uploadBuffersForCommand(RHIGraphicsPipeline* graphicsPipeline, Re
command.indexAttribute = attrib;
break;
}
- case QAttribute::DrawIndirectAttribute:
+ case Qt3DCore::QAttribute::DrawIndirectAttribute:
RHI_UNIMPLEMENTED;
break;
}
@@ -2647,12 +2691,19 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
auto &renderTargetManager = *managers.rhiRenderTargetManager();
auto *renderTarget = renderTargetManager.lookupResource(passInfo.renderTargetId);
- if (renderTarget)
- rhiRenderTarget = renderTarget->renderTarget;
- else if (m_submissionContext->defaultRenderTarget())
+ if (renderTarget) {
+ // Is our RenderTarget targeting offscreen attachments?
+ if (renderTarget->backBuffer == RHIRenderTarget::BackBuffer::None)
+ rhiRenderTarget = renderTarget->renderTarget;
+ else // Or one of the back buffers?
+ rhiRenderTarget = m_submissionContext->currentSwapChain()->currentFrameRenderTarget(renderTarget->backBuffer == RHIRenderTarget::BackBuffer::Left
+ ? QRhiSwapChain::LeftBuffer
+ : QRhiSwapChain::RightBuffer);
+ } else if (m_submissionContext->defaultRenderTarget()) {
rhiRenderTarget = m_submissionContext->defaultRenderTarget();
- else
+ } else {
rhiRenderTarget = m_submissionContext->currentSwapChain()->currentFrameRenderTarget();
+ }
}
auto executeDrawRenderView = [&] (RenderView* rv) {
@@ -2712,7 +2763,6 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
// All the RVs in the current passinfo target the same RenderTarget
// A single beginPass should take place, unless Computes RVs are intermingled
- QRhiResourceUpdateBatch *inPassUpdates = nullptr;
static const bool supportsCompute = m_submissionContext->rhi()->isFeatureSupported(QRhi::Compute);
// Per Pass Global States
@@ -2720,7 +2770,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
if (rv->isCompute()) {
// If we were running draw calls we stop the draw pass
if (inDraw) {
- cb->endPass();
+ cb->endPass(m_submissionContext->m_currentUpdates);
m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch();
inDraw = false;
}
@@ -2730,6 +2780,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
if (supportsCompute) {
if (!inCompute) {
cb->beginComputePass(m_submissionContext->m_currentUpdates);
+ m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch();
inCompute = true;
}
executeComputeRenderView(rv);
@@ -2739,7 +2790,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
} else {
// Same logic than above but reversed
if (inCompute) {
- cb->endComputePass();
+ cb->endComputePass(m_submissionContext->m_currentUpdates);
m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch();
inCompute = false;
}
@@ -2751,6 +2802,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
continue;
}
cb->beginPass(rhiRenderTarget, clearColor, clearDepthStencil, m_submissionContext->m_currentUpdates);
+ m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch();
inDraw = true;
}
@@ -2759,7 +2811,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
const Qt3DCore::QNodeId renderCaptureId = rv->renderCaptureNodeId();
if (!renderCaptureId.isNull()) {
const QRenderCaptureRequest request = rv->renderCaptureRequest();
- QRhiRenderTarget *rhiTarget = nullptr;
+ QRhiRenderTarget *rhiTarget = m_submissionContext->defaultRenderTarget();
RHIRenderTarget *target = nullptr;
if (rv->renderTargetId()) {
@@ -2774,20 +2826,21 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
QRect rect(QPoint(0, 0), size);
if (!request.rect.isEmpty())
rect = rect.intersected(request.rect);
- QImage image;
if (!rect.isEmpty()) {
// Bind fbo as read framebuffer
QRhiReadbackResult *readBackResult = new QRhiReadbackResult;
readBackResult->completed = [this, readBackResult, renderCaptureId, request] () {
const QImage::Format fmt = QImage::Format_RGBA8888_Premultiplied; // fits QRhiTexture::RGBA8
const uchar *p = reinterpret_cast<const uchar *>(readBackResult->data.constData());
- const QImage image(p, readBackResult->pixelSize.width(), readBackResult->pixelSize.height(), fmt);
+ const QImage image(p, readBackResult->pixelSize.width(), readBackResult->pixelSize.height(), fmt, [] (void *ptr) {
+ delete static_cast<QRhiReadbackResult *>(ptr);
+ }, readBackResult);
Render::RenderCapture *renderCapture = static_cast<Render::RenderCapture*>(m_nodesManager->frameGraphManager()->lookupNode(renderCaptureId));
renderCapture->addRenderCapture(request.captureId, image);
+ QMutexLocker lock(&m_pendingRenderCaptureSendRequestsMutex);
if (!Qt3DCore::contains(m_pendingRenderCaptureSendRequests, renderCaptureId))
m_pendingRenderCaptureSendRequests.push_back(renderCaptureId);
- delete readBackResult;
};
QRhiReadbackDescription readbackDesc;
@@ -2798,8 +2851,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
const QRhiColorAttachment *color0Att = desc.colorAttachmentAt(0);
readbackDesc.setTexture(color0Att->texture());
}
- inPassUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch();
- inPassUpdates->readBackTexture(readbackDesc, readBackResult);
+ m_submissionContext->m_currentUpdates->readBackTexture(readbackDesc, readBackResult);
} else {
qCWarning(Backend) << "Requested capture rectangle is outside framebuffer";
}
@@ -2811,9 +2863,9 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo)
}
if (Q_LIKELY(inDraw))
- cb->endPass(inPassUpdates);
+ cb->endPass(m_submissionContext->m_currentUpdates);
else if (inCompute)
- cb->endComputePass();
+ cb->endComputePass(m_submissionContext->m_currentUpdates);
m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch();
diff --git a/src/plugins/renderers/rhi/renderer/renderer.pri b/src/plugins/renderers/rhi/renderer/renderer.pri
deleted file mode 100644
index 761a6ce9b..000000000
--- a/src/plugins/renderers/rhi/renderer/renderer.pri
+++ /dev/null
@@ -1,26 +0,0 @@
-INCLUDEPATH += $$PWD
-
-SOURCES += \
- $$PWD/rendercommand.cpp \
- $$PWD/renderer.cpp \
- $$PWD/renderview.cpp \
- $$PWD/renderviewbuilder.cpp \
- $$PWD/rhigraphicspipeline.cpp \
- $$PWD/rhishader.cpp \
- $$PWD/shaderparameterpack.cpp \
- $$PWD/logging.cpp \
- $$PWD/commandexecuter.cpp \
- $$PWD/pipelineuboset.cpp
-
-HEADERS += \
- $$PWD/rendercommand_p.h \
- $$PWD/renderer_p.h \
- $$PWD/renderview_p.h \
- $$PWD/renderviewbuilder_p.h \
- $$PWD/rhigraphicspipeline_p.h \
- $$PWD/rhishader_p.h \
- $$PWD/shaderparameterpack_p.h \
- $$PWD/shadervariables_p.h \
- $$PWD/logging_p.h \
- $$PWD/commandexecuter_p.h \
- $$PWD/pipelineuboset_p.h
diff --git a/src/plugins/renderers/rhi/renderer/renderer_p.h b/src/plugins/renderers/rhi/renderer/renderer_p.h
index 1c89bd52b..6f4590ef5 100644
--- a/src/plugins/renderers/rhi/renderer/renderer_p.h
+++ b/src/plugins/renderers/rhi/renderer/renderer_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RENDERER_H
#define QT3DRENDER_RENDER_RHI_RENDERER_H
@@ -73,7 +37,7 @@
#include <Qt3DRender/private/renderercache_p.h>
#include <Qt3DRender/private/renderviewinitializerjob_p.h>
-#include <QtGui/private/qrhi_p.h>
+#include <rhi/qrhi.h>
#include <shaderparameterpack_p.h>
#include <logging_p.h>
@@ -360,6 +324,7 @@ private:
RenderableEntityFilterPtr m_renderableEntityFilterJob;
ComputableEntityFilterPtr m_computableEntityFilterJob;
+ QMutex m_pendingRenderCaptureSendRequestsMutex;
std::vector<Qt3DCore::QNodeId> m_pendingRenderCaptureSendRequests;
SynchronizerJobPtr m_bufferGathererJob;
diff --git a/src/plugins/renderers/rhi/renderer/renderview.cpp b/src/plugins/renderers/rhi/renderer/renderview.cpp
index cf8d27871..c8ae4e7f1 100644
--- a/src/plugins/renderers/rhi/renderer/renderview.cpp
+++ b/src/plugins/renderers/rhi/renderer/renderview.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "renderview_p.h"
#include <Qt3DRender/qmaterial.h>
@@ -417,8 +381,7 @@ struct AdjacentSubRangeFinder
{
static bool adjacentSubRange(const RenderCommand &, const RenderCommand &)
{
- Q_UNREACHABLE();
- return false;
+ Q_UNREACHABLE_RETURN(false);
}
};
@@ -605,6 +568,10 @@ struct SubRangeSorter<QSortPolicy::Texture>
return identicalTextureCount < smallestVector.size();
});
+#else
+ Q_UNUSED(view);
+ Q_UNUSED(begin);
+ Q_UNUSED(end);
#endif
}
};
@@ -627,8 +594,7 @@ int findSubRange(const EntityRenderCommandDataView *view,
case QSortPolicy::Uniform:
return end;
default:
- Q_UNREACHABLE();
- return end;
+ Q_UNREACHABLE_RETURN(end);
}
}
@@ -641,7 +607,7 @@ void sortByMaterial(EntityRenderCommandDataView *view, int begin, const int end)
while (begin != end) {
if (begin + 1 < rangeEnd) {
std::stable_sort(commandIndices.begin() + begin + 1, commandIndices.begin() + rangeEnd,
- [&commands] (const int &iA, const int &iB) {
+ [&commands] (const size_t &iA, const size_t &iB) {
const RenderCommand &a = commands[iA];
const RenderCommand &b = commands[iB];
return a.m_material.handle() < b.m_material.handle();
@@ -1198,6 +1164,13 @@ void RenderView::updateRenderCommand(const EntityRenderCommandDataSubView &subVi
memcpy(&command.m_commandUBO.inverseModelViewProjectionMatrix,
&inverseModelViewProjection, sizeof(Matrix4x4));
copyNormalMatrix(command.m_commandUBO.modelViewNormalMatrix, modelViewNormalMatrix.constData());
+
+ const Armature *armature = entity->renderComponent<Armature>();
+ if (armature) {
+ const UniformValue &skinningPalette = armature->skinningPaletteUniform();
+ memcpy(&command.m_commandUBO.skinningPalette, skinningPalette.constData<float>(),
+ qMin<size_t>(skinningPalette.byteSize(), 100 * 16 * sizeof(float)));
+ }
}
});
}
@@ -1206,8 +1179,16 @@ void RenderView::updateMatrices()
{
if (m_renderCameraNode && m_renderCameraLens
&& m_renderCameraLens->isEnabled()) {
- const Matrix4x4 cameraWorld = *(m_renderCameraNode->worldTransform());
- setViewMatrix(m_renderCameraLens->viewMatrix(cameraWorld));
+ auto transform = m_renderCameraNode->renderComponent<Transform>();
+ if (m_renderCameraNode->isParentLessTransform() && transform && transform->hasViewMatrix()) {
+ // optimization: if the entity is a QCamera and it doesn't have a parent with a transform component,
+ // then we use the frontend version of the viewMatrix to avoid extra calculations that may introduce
+ // rounding errors
+ setViewMatrix(transform->viewMatrix());
+ } else {
+ const Matrix4x4 cameraWorld = *(m_renderCameraNode->worldTransform());
+ setViewMatrix(m_renderCameraLens->viewMatrix(cameraWorld));
+ }
setViewProjectionMatrix(m_renderCameraLens->projection() * viewMatrix());
// To get the eyePosition of the camera, we need to use the inverse of the
@@ -1410,7 +1391,7 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, ParameterInfoList
// only update values of uniforms that have changed
// If parameters add been added/removed, the command would have been rebuild
// and the parameter pack would be empty
- const bool updateUniformsOnly = command->m_parameterPack.submissionUniformIndices().size() > 0;
+ const bool updateUniformsOnly = !command->m_parameterPack.submissionUniformIndices().empty();
if (!updateUniformsOnly) {
// Builds the QUniformPack, sets shader standard uniforms and store attributes name / glname
@@ -1465,7 +1446,7 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, ParameterInfoList
break;
const Entity *lightEntity = lightSource.entity;
const Matrix4x4 lightWorldTransform = *(lightEntity->worldTransform());
- const Vector3D worldPos = lightWorldTransform * Vector3D(0.0f, 0.0f, 0.0f);
+ const Vector3D worldPos = lightWorldTransform.map(Vector3D(0.0f, 0.0f, 0.0f));
for (Light *light : lightSource.lights) {
if (!light->isEnabled())
continue;
diff --git a/src/plugins/renderers/rhi/renderer/renderview_p.h b/src/plugins/renderers/rhi/renderer/renderview_p.h
index 6c8ea7541..5ef63f4be 100644
--- a/src/plugins/renderers/rhi/renderer/renderview_p.h
+++ b/src/plugins/renderers/rhi/renderer/renderview_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RENDERVIEW_H
#define QT3DRENDER_RENDER_RHI_RENDERVIEW_H
diff --git a/src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp b/src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp
index 832f550eb..035848e13 100644
--- a/src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp
+++ b/src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp
@@ -1,46 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "renderviewbuilder_p.h"
#include <Qt3DRender/private/qrenderaspect_p.h>
-
-#include <QThread>
+#include <Qt3DCore/private/qaspectjobmanager_p.h>
QT_BEGIN_NAMESPACE
@@ -63,7 +26,7 @@ RenderViewBuilder::RenderViewBuilder(Render::FrameGraphNode *leafNode, int rende
// In some cases having less jobs is better (especially on fast cpus where
// splitting just adds more overhead). Ideally, we should try to set the value
// depending on the platform/CPU/nbr of cores
- m_optimalParallelJobCount = QThread::idealThreadCount();
+ m_optimalParallelJobCount = Qt3DCore::QAspectJobManager::idealThreadCount();
}
RenderViewInitializerJobPtr RenderViewBuilder::renderViewJob() const
diff --git a/src/plugins/renderers/rhi/renderer/renderviewbuilder_p.h b/src/plugins/renderers/rhi/renderer/renderviewbuilder_p.h
index f7c4f606c..eb7484d15 100644
--- a/src/plugins/renderers/rhi/renderer/renderviewbuilder_p.h
+++ b/src/plugins/renderers/rhi/renderer/renderviewbuilder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RENDERVIEWBUILDER_H
#define QT3DRENDER_RENDER_RHI_RENDERVIEWBUILDER_H
diff --git a/src/plugins/renderers/rhi/renderer/rhigraphicspipeline.cpp b/src/plugins/renderers/rhi/renderer/rhigraphicspipeline.cpp
index 824609b7f..feec0aceb 100644
--- a/src/plugins/renderers/rhi/renderer/rhigraphicspipeline.cpp
+++ b/src/plugins/renderers/rhi/renderer/rhigraphicspipeline.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "rhigraphicspipeline_p.h"
diff --git a/src/plugins/renderers/rhi/renderer/rhigraphicspipeline_p.h b/src/plugins/renderers/rhi/renderer/rhigraphicspipeline_p.h
index ff619c56d..020d4583a 100644
--- a/src/plugins/renderers/rhi/renderer/rhigraphicspipeline_p.h
+++ b/src/plugins/renderers/rhi/renderer/rhigraphicspipeline_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RHIGRAPHICSPIPELINE_H
#define QT3DRENDER_RENDER_RHI_RHIGRAPHICSPIPELINE_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <private/qrhi_p.h>
+#include <rhi/qrhi.h>
#include <rhihandle_types_p.h>
#include <pipelineuboset_p.h>
#include <Qt3DCore/qnodeid.h>
diff --git a/src/plugins/renderers/rhi/renderer/rhirendertarget.cpp b/src/plugins/renderers/rhi/renderer/rhirendertarget.cpp
index c7f4d0720..db11f5f88 100644
--- a/src/plugins/renderers/rhi/renderer/rhirendertarget.cpp
+++ b/src/plugins/renderers/rhi/renderer/rhirendertarget.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "rhirendertarget_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/renderers/rhi/renderer/rhirendertarget_p.h b/src/plugins/renderers/rhi/renderer/rhirendertarget_p.h
index 74a85196d..f699db687 100644
--- a/src/plugins/renderers/rhi/renderer/rhirendertarget_p.h
+++ b/src/plugins/renderers/rhi/renderer/rhirendertarget_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RHIRENDERTARGET_H
#define QT3DRENDER_RENDER_RHI_RHIRENDERTARGET_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <private/qrhi_p.h>
+#include <rhi/qrhi.h>
#include <rhihandle_types_p.h>
#include <private/attachmentpack_p.h>
@@ -66,9 +30,16 @@ struct RHIRenderTarget {
// Note: only used when rendering to a FBO
// as we don't want to remove the default framebuffer's rendertarget
// TODO: at some point separate render target and graphics pipeline as the former can be reused
- QRhiRenderTarget *renderTarget{};
- QRhiRenderPassDescriptor *renderPassDescriptor{};
- QRhiRenderBuffer *depthStencilBuffer{};
+ QRhiRenderTarget *renderTarget{ nullptr };
+ QRhiRenderPassDescriptor *renderPassDescriptor{ nullptr };
+ QRhiRenderBuffer *depthStencilBuffer{ nullptr };
+
+ enum class BackBuffer {
+ None,
+ Left,
+ Right,
+ };
+ BackBuffer backBuffer{ BackBuffer::None };
~RHIRenderTarget();
void cleanup();
diff --git a/src/plugins/renderers/rhi/renderer/rhishader.cpp b/src/plugins/renderers/rhi/renderer/rhishader.cpp
index 5684e27ce..5c170346f 100644
--- a/src/plugins/renderers/rhi/renderer/rhishader.cpp
+++ b/src/plugins/renderers/rhi/renderer/rhishader.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "rhishader_p.h"
#include <QMutexLocker>
@@ -332,7 +296,14 @@ void RHIShader::recordAllUniforms(UBO_Member &uboMember,
// We iterate through all the [l][n][m] by building [0][0][0] and incrementing
forEachArrayAccessor(member.arrayDims, [&](const QString &str) {
// "foo.bar[1][2]"
- m_unqualifiedUniformNames << (fullMemberName + str);
+ const QString unqualifiedMemberName = (fullMemberName + str);
+ m_unqualifiedUniformNames << unqualifiedMemberName;
+
+ // Record as an individual uniform
+ m_uniformsNames.push_back(unqualifiedMemberName);
+ const int nameId = StringToInt::lookupId(unqualifiedMemberName);
+ m_uniformsNamesIds.push_back(nameId);
+
// Question : does it make sense to also record foo[0], foo[0][0], etc...
// if there are e.g. 3 dimensions ?
});
@@ -344,20 +315,29 @@ void RHIShader::recordAllUniforms(UBO_Member &uboMember,
m_structNamesIds.push_back(StringToInt::lookupId(m_structNames.back()));
});
- // Record the struct members
- for (const QShaderDescription::BlockVariable& bv : member.structMembers) {
- forEachArrayAccessor(member.arrayDims, [&] (const QString& str) {
+ // Record the array times the struct members => entry[i].struct_member
+ forEachArrayAccessor(member.arrayDims, [&] (const QString& str) {
+ UBO_Member arrayMember {StringToInt::lookupId(fullMemberName + str), {}, {}};
+ // Record all struct member into the array member[i]
+ for (const QShaderDescription::BlockVariable& bv : member.structMembers) {
//recordAllUniforms("baz", "foo.bar[1][2].")
const QString structMemberNamePrefix = fullMemberName + str + QLatin1Char('.');
UBO_Member innerMember {StringToInt::lookupId(structMemberNamePrefix), bv, {}};
recordAllUniforms(innerMember, structMemberNamePrefix);
- uboMember.structMembers.push_back(innerMember);
- });
- }
+ arrayMember.structMembers.push_back(innerMember);
+ }
+ // When dealing with an array of structs, we treat structMembers as arrayMembers
+ uboMember.structMembers.push_back(arrayMember);
+ });
} else {
// Final member (not array or struct)
// Replace nameId with final nameId name
uboMember.nameId = StringToInt::lookupId(fullMemberName);
+
+ // Record as an individual uniform
+ m_uniformsNames.push_back(fullMemberName);
+ const int nameId = StringToInt::lookupId(fullMemberName);
+ m_uniformsNamesIds.push_back(nameId);
}
}
@@ -370,7 +350,7 @@ bool isGeneratedUBOName(const QByteArray& arr)
return false;
if (!arr.startsWith('_'))
return false;
- for (int i = 1, N = arr.size(); i < N; i++) {
+ for (qsizetype i = 1, N = arr.size(); i < N; i++) {
if (arr[i] < '0' || arr[i] > '9')
return false;
}
@@ -454,7 +434,7 @@ void RHIShader::introspect()
std::vector<UBO_Member> uboMembers;
uboMembers.reserve(ubo.members.size());
- for (const QShaderDescription::BlockVariable &member : qAsConst(ubo.members)) {
+ for (const QShaderDescription::BlockVariable &member : std::as_const(ubo.members)) {
m_uniformsNames.push_back(member.name);
const int nameId = StringToInt::lookupId(member.name);
m_uniformsNamesIds.push_back(nameId);
@@ -492,7 +472,7 @@ QHash<QString, ShaderUniform> RHIShader::activeUniformsForUniformBlock(int block
ShaderUniformBlock RHIShader::uniformBlockForBlockIndex(int blockIndex) const noexcept
{
- for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
if (m_uniformBlocks[i].m_index == blockIndex) {
return m_uniformBlocks[i];
}
@@ -502,7 +482,7 @@ ShaderUniformBlock RHIShader::uniformBlockForBlockIndex(int blockIndex) const no
ShaderUniformBlock RHIShader::uniformBlockForBlockNameId(int blockNameId) const noexcept
{
- for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
if (m_uniformBlocks[i].m_nameId == blockNameId) {
return m_uniformBlocks[i];
}
@@ -512,7 +492,7 @@ ShaderUniformBlock RHIShader::uniformBlockForBlockNameId(int blockNameId) const
ShaderUniformBlock RHIShader::uniformBlockForBlockName(const QString &blockName) const noexcept
{
- for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
if (m_uniformBlocks[i].m_name == blockName) {
return m_uniformBlocks[i];
}
@@ -539,7 +519,7 @@ ShaderUniformBlock RHIShader::uniformBlockForInstanceNameId(int instanceNameId)
ShaderStorageBlock RHIShader::storageBlockForBlockIndex(int blockIndex) const noexcept
{
- for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
if (m_shaderStorageBlocks[i].m_index == blockIndex)
return m_shaderStorageBlocks[i];
}
@@ -548,7 +528,7 @@ ShaderStorageBlock RHIShader::storageBlockForBlockIndex(int blockIndex) const no
ShaderStorageBlock RHIShader::storageBlockForBlockNameId(int blockNameId) const noexcept
{
- for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
if (m_shaderStorageBlocks[i].m_nameId == blockNameId)
return m_shaderStorageBlocks[i];
}
@@ -557,7 +537,7 @@ ShaderStorageBlock RHIShader::storageBlockForBlockNameId(int blockNameId) const
ShaderStorageBlock RHIShader::storageBlockForBlockName(const QString &blockName) const noexcept
{
- for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
if (m_shaderStorageBlocks[i].m_name == blockName)
return m_shaderStorageBlocks[i];
}
@@ -586,72 +566,71 @@ bool RHIShader::hasActiveVariables() const noexcept
|| !m_uniformBlockNamesIds.empty() || !m_shaderStorageBlockNamesIds.empty();
}
-void RHIShader::setShaderCode(const std::vector<QByteArray> &shaderCode)
+void RHIShader::setShaderCode(std::vector<QByteArray> shaderCode)
{
- m_shaderCode.clear();
- Qt3DCore::append(m_shaderCode, shaderCode);
+ m_shaderCode = std::move(shaderCode);
}
-void RHIShader::setFragOutputs(const QHash<QString, int> &fragOutputs)
+void RHIShader::setFragOutputs(QHash<QString, int> fragOutputs)
{
{
QMutexLocker lock(&m_mutex);
- m_fragOutputs = fragOutputs;
+ m_fragOutputs = std::move(fragOutputs);
}
// updateDNA();
}
-const QHash<QString, int> RHIShader::fragOutputs() const
+const QHash<QString, int> &RHIShader::fragOutputs() const
{
QMutexLocker lock(&m_mutex);
return m_fragOutputs;
}
-void RHIShader::initializeAttributes(const std::vector<ShaderAttribute> &attributesDescription)
+void RHIShader::initializeAttributes(std::vector<ShaderAttribute> attributesDescription)
{
- m_attributes = attributesDescription;
- m_attributesNames.resize(attributesDescription.size());
- m_attributeNamesIds.resize(attributesDescription.size());
- for (int i = 0, m = attributesDescription.size(); i < m; i++) {
- m_attributesNames[i] = attributesDescription[i].m_name;
+ m_attributes = std::move(attributesDescription);
+ m_attributesNames.resize(m_attributes.size());
+ m_attributeNamesIds.resize(m_attributes.size());
+ for (size_t i = 0, m = m_attributes.size(); i < m; i++) {
+ m_attributesNames[i] = m_attributes[i].m_name;
m_attributes[i].m_nameId = StringToInt::lookupId(m_attributesNames[i]);
m_attributeNamesIds[i] = m_attributes[i].m_nameId;
- qCDebug(Shaders) << "Active Attribute " << attributesDescription[i].m_name;
+ qCDebug(Shaders) << "Active Attribute " << m_attributes[i].m_name;
}
}
-void RHIShader::initializeSamplers(const std::vector<ShaderAttribute> &samplersDescription)
+void RHIShader::initializeSamplers(std::vector<ShaderAttribute> samplersDescription)
{
- m_samplers = samplersDescription;
- m_samplerNames.resize(samplersDescription.size());
- m_samplerIds.resize(samplersDescription.size());
- for (int i = 0, m = samplersDescription.size(); i < m; i++) {
- m_samplerNames[i] = samplersDescription[i].m_name;
+ m_samplers = std::move(samplersDescription);
+ m_samplerNames.resize(m_samplers.size());
+ m_samplerIds.resize(m_samplers.size());
+ for (size_t i = 0, m = m_samplers.size(); i < m; i++) {
+ m_samplerNames[i] = m_samplers[i].m_name;
m_samplers[i].m_nameId = StringToInt::lookupId(m_samplerNames[i]);
m_samplerIds[i] = m_samplers[i].m_nameId;
- qCDebug(Shaders) << "Active sampler " << samplersDescription[i].m_name;
+ qCDebug(Shaders) << "Active sampler " << m_samplers[i].m_name;
}
}
-void RHIShader::initializeImages(const std::vector<ShaderAttribute> &imagesDescription)
+void RHIShader::initializeImages(std::vector<ShaderAttribute> imagesDescription)
{
- m_images = imagesDescription;
- m_imageNames.resize(imagesDescription.size());
- m_imageIds.resize(imagesDescription.size());
- for (int i = 0, m = imagesDescription.size(); i < m; i++) {
- m_imageNames[i] = imagesDescription[i].m_name;
+ m_images = std::move(imagesDescription);
+ m_imageNames.resize(m_images.size());
+ m_imageIds.resize(m_images.size());
+ for (size_t i = 0, m = m_images.size(); i < m; i++) {
+ m_imageNames[i] = m_images[i].m_name;
m_images[i].m_nameId = StringToInt::lookupId(m_imageNames[i]);
m_imageIds[i] = m_images[i].m_nameId;
- qCDebug(Shaders) << "Active image " << imagesDescription[i].m_name;
+ qCDebug(Shaders) << "Active image " << m_images[i].m_name;
}
}
-void RHIShader::initializeUniformBlocks(const std::vector<ShaderUniformBlock> &uniformBlockDescription)
+void RHIShader::initializeUniformBlocks(std::vector<ShaderUniformBlock> uniformBlockDescription)
{
- m_uniformBlocks = uniformBlockDescription;
- m_uniformBlockNames.resize(uniformBlockDescription.size());
- m_uniformBlockNamesIds.resize(uniformBlockDescription.size());
- for (int i = 0, m = uniformBlockDescription.size(); i < m; ++i) {
+ m_uniformBlocks = std::move(uniformBlockDescription);
+ m_uniformBlockNames.resize(m_uniformBlocks.size());
+ m_uniformBlockNamesIds.resize(m_uniformBlocks.size());
+ for (size_t i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
m_uniformBlockNames[i] = m_uniformBlocks[i].m_name;
m_uniformBlockNamesIds[i] = StringToInt::lookupId(m_uniformBlockNames[i]);
m_uniformBlocks[i].m_nameId = m_uniformBlockNamesIds[i];
@@ -667,7 +646,7 @@ void RHIShader::initializeUniformBlocks(const std::vector<ShaderUniformBlock> &u
QHash<QString, ShaderUniform> activeUniformsInBlock;
while (uniformsIt != uniformsEnd && uniformNamesIt != uniformNamesEnd) {
- if (uniformsIt->m_blockIndex == uniformBlockDescription[i].m_index) {
+ if (uniformsIt->m_blockIndex == m_uniformBlocks[i].m_index) {
QString uniformName = *uniformNamesIt;
if (!m_uniformBlockNames[i].isEmpty()
&& !uniformName.startsWith(m_uniformBlockNames[i]))
@@ -680,19 +659,19 @@ void RHIShader::initializeUniformBlocks(const std::vector<ShaderUniformBlock> &u
++uniformsIt;
++uniformNamesIt;
}
- m_uniformBlockIndexToShaderUniforms.insert(uniformBlockDescription[i].m_index,
+ m_uniformBlockIndexToShaderUniforms.insert(m_uniformBlocks[i].m_index,
activeUniformsInBlock);
}
}
void RHIShader::initializeShaderStorageBlocks(
- const std::vector<ShaderStorageBlock> &shaderStorageBlockDescription)
+ std::vector<ShaderStorageBlock> shaderStorageBlockDescription)
{
- m_shaderStorageBlocks = shaderStorageBlockDescription;
- m_shaderStorageBlockNames.resize(shaderStorageBlockDescription.size());
- m_shaderStorageBlockNamesIds.resize(shaderStorageBlockDescription.size());
+ m_shaderStorageBlocks = std::move(shaderStorageBlockDescription);
+ m_shaderStorageBlockNames.resize(m_shaderStorageBlocks.size());
+ m_shaderStorageBlockNamesIds.resize(m_shaderStorageBlocks.size());
- for (int i = 0, m = shaderStorageBlockDescription.size(); i < m; ++i) {
+ for (size_t i = 0, m = m_shaderStorageBlocks.size(); i < m; ++i) {
m_shaderStorageBlockNames[i] = m_shaderStorageBlocks[i].m_name;
m_shaderStorageBlockNamesIds[i] = StringToInt::lookupId(m_shaderStorageBlockNames[i]);
m_shaderStorageBlocks[i].m_nameId = m_shaderStorageBlockNamesIds[i];
diff --git a/src/plugins/renderers/rhi/renderer/rhishader_p.h b/src/plugins/renderers/rhi/renderer/rhishader_p.h
index d23c85938..f566f03ae 100644
--- a/src/plugins/renderers/rhi/renderer/rhishader_p.h
+++ b/src/plugins/renderers/rhi/renderer/rhishader_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_GLSHADER_P_H
#define QT3DRENDER_RENDER_RHI_GLSHADER_P_H
@@ -56,7 +20,7 @@
#include <Qt3DRender/qshaderprogram.h>
#include <QMutex>
#include <QtGui/private/qshader_p.h>
-#include <QtGui/private/qrhi_p.h>
+#include <rhi/qrhi.h>
QT_BEGIN_NAMESPACE
@@ -88,8 +52,8 @@ public:
bool isLoaded() const { return m_isLoaded; }
void setLoaded(bool loaded) { m_isLoaded = loaded; }
- void setFragOutputs(const QHash<QString, int> &fragOutputs);
- const QHash<QString, int> fragOutputs() const;
+ void setFragOutputs(QHash<QString, int> fragOutputs);
+ const QHash<QString, int> &fragOutputs() const;
inline const std::vector<int> &uniformsNamesIds() const { return m_uniformsNamesIds; }
inline const std::vector<int> &standardUniformNameIds() const { return m_standardUniformNamesIds; }
@@ -130,7 +94,7 @@ public:
bool hasUniform(int nameId) const noexcept;
bool hasActiveVariables() const noexcept;
- void setShaderCode(const std::vector<QByteArray> &shaderCode);
+ void setShaderCode(std::vector<QByteArray> shaderCode);
const std::vector<QByteArray> &shaderCode() const;
const QShader &shaderStage(QShader::Stage stage) const noexcept { return m_stages[stage]; }
@@ -182,12 +146,11 @@ private:
// Private so that only SubmissionContext can call it
friend class SubmissionContext;
- void initializeAttributes(const std::vector<ShaderAttribute> &attributesDescription);
- void initializeUniformBlocks(const std::vector<ShaderUniformBlock> &uniformBlockDescription);
- void
- initializeShaderStorageBlocks(const std::vector<ShaderStorageBlock> &shaderStorageBlockDescription);
- void initializeSamplers(const std::vector<ShaderAttribute> &samplerDescription);
- void initializeImages(const std::vector<ShaderAttribute> &imageDescription);
+ void initializeAttributes(std::vector<Qt3DRender::Render::Rhi::ShaderAttribute> attributesDescription);
+ void initializeUniformBlocks(std::vector<ShaderUniformBlock> uniformBlockDescription);
+ void initializeShaderStorageBlocks(std::vector<ShaderStorageBlock> shaderStorageBlockDescription);
+ void initializeSamplers(std::vector<ShaderAttribute> samplerDescription);
+ void initializeImages(std::vector<ShaderAttribute> imageDescription);
void recordAllUniforms(UBO_Member &uboMember, QString parentName);
std::vector<UBO_Block> m_uboBlocks;
diff --git a/src/plugins/renderers/rhi/renderer/shaderparameterpack.cpp b/src/plugins/renderers/rhi/renderer/shaderparameterpack.cpp
index 46f6480e4..c07769afc 100644
--- a/src/plugins/renderers/rhi/renderer/shaderparameterpack.cpp
+++ b/src/plugins/renderers/rhi/renderer/shaderparameterpack.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "shaderparameterpack_p.h"
@@ -86,7 +50,7 @@ void ShaderParameterPack::setTexture(const int glslNameId, int uniformArrayIndex
void ShaderParameterPack::setImage(const int glslNameId, int uniformArrayIndex, Qt3DCore::QNodeId id)
{
- for (int i=0, m = m_images.size(); i < m; ++i) {
+ for (size_t i=0, m = m_images.size(); i < m; ++i) {
if (m_images[i].glslNameId != glslNameId || m_images[i].uniformArrayIndex != uniformArrayIndex)
continue;
diff --git a/src/plugins/renderers/rhi/renderer/shaderparameterpack_p.h b/src/plugins/renderers/rhi/renderer/shaderparameterpack_p.h
index c69a33f17..be110828f 100644
--- a/src/plugins/renderers/rhi/renderer/shaderparameterpack_p.h
+++ b/src/plugins/renderers/rhi/renderer/shaderparameterpack_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_SHADERPARAMETERPACK_P_H
#define QT3DRENDER_RENDER_RHI_SHADERPARAMETERPACK_P_H
diff --git a/src/plugins/renderers/rhi/renderer/shadervariables_p.h b/src/plugins/renderers/rhi/renderer/shadervariables_p.h
index bb8d205b5..de4f5207e 100644
--- a/src/plugins/renderers/rhi/renderer/shadervariables_p.h
+++ b/src/plugins/renderers/rhi/renderer/shadervariables_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_SHADERVARIABLES_P_H
#define QT3DRENDER_RENDER_RHI_SHADERVARIABLES_P_H
diff --git a/src/plugins/renderers/rhi/rhi.cmake b/src/plugins/renderers/rhi/rhi.cmake
index 292cb0103..737f3d96f 100644
--- a/src/plugins/renderers/rhi/rhi.cmake
+++ b/src/plugins/renderers/rhi/rhi.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
function(qt3d_setup_rhi_renderer_target target)
set(rhiplugindir ${PROJECT_SOURCE_DIR}/src/plugins/renderers/rhi)
diff --git a/src/plugins/renderers/rhi/rhi.pri b/src/plugins/renderers/rhi/rhi.pri
deleted file mode 100644
index 5fdb77c00..000000000
--- a/src/plugins/renderers/rhi/rhi.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-
-include (renderer/renderer.pri)
-include (io/io.pri)
-include (textures/textures.pri)
-include (graphicshelpers/graphicshelpers.pri)
-include (managers/managers.pri)
-
-INCLUDEPATH += $$PWD
-
-# Qt3D is free of Q_FOREACH - make sure it stays that way:
-DEFINES += QT_NO_FOREACH
-
-gcov {
- QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
- QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
-}
diff --git a/src/plugins/renderers/rhi/rhi.pro b/src/plugins/renderers/rhi/rhi.pro
deleted file mode 100644
index a767223f4..000000000
--- a/src/plugins/renderers/rhi/rhi.pro
+++ /dev/null
@@ -1,36 +0,0 @@
-TARGET = rhirenderer
-
-PLUGIN_TYPE = renderers
-PLUGIN_CLASS_NAME = RhiRendererPlugin
-load(qt_plugin)
-
-QT += core-private gui-private 3dcore 3dcore-private 3drender 3drender-private
-
-greaterThan(QT_MAJOR_VERSION, 5) {
- QT += shadertools shadertools-private
-}
-
-# Qt3D is free of Q_FOREACH - make sure it stays that way:
-DEFINES += QT_NO_FOREACH
-
-# We use QT_AUTOTEST_EXPORT to test the plug-ins, which needs QT_BUILDING_QT
-DEFINES += QT_BUILDING_QT
-
-SOURCES += \
- main.cpp
-
-DISTFILES += \
- rhirenderer.json
-
-include(rhi.pri)
-
-qtConfig(qt3d-simd-avx2) {
- CONFIG += simd
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2
-}
-
-qtConfig(qt3d-simd-sse2):!qtConfig(qt3d-simd-avx2) {
- CONFIG += simd
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE2
-}
-
diff --git a/src/plugins/renderers/rhi/textures/renderbuffer.cpp b/src/plugins/renderers/rhi/textures/renderbuffer.cpp
index 9dd28ad50..cdf4b2b02 100644
--- a/src/plugins/renderers/rhi/textures/renderbuffer.cpp
+++ b/src/plugins/renderers/rhi/textures/renderbuffer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "renderbuffer_p.h"
#include <QtGui/QOpenGLContext>
diff --git a/src/plugins/renderers/rhi/textures/renderbuffer_p.h b/src/plugins/renderers/rhi/textures/renderbuffer_p.h
index 48ad7453d..9187ec624 100644
--- a/src/plugins/renderers/rhi/textures/renderbuffer_p.h
+++ b/src/plugins/renderers/rhi/textures/renderbuffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_RENDERBUFFER_P_H
#define QT3DRENDER_RENDER_RHI_RENDERBUFFER_P_H
diff --git a/src/plugins/renderers/rhi/textures/texture.cpp b/src/plugins/renderers/rhi/textures/texture.cpp
index 4d99acc52..4561aa936 100644
--- a/src/plugins/renderers/rhi/textures/texture.cpp
+++ b/src/plugins/renderers/rhi/textures/texture.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtCore/qhash.h>
#include "texture_p.h"
#include <private/qdebug_p.h>
-#include <private/qrhi_p.h>
+#include <rhi/qrhi.h>
#include <QDebug>
#include <Qt3DCore/private/vector_helper_p.h>
#include <Qt3DRender/qtexture.h>
@@ -55,8 +19,6 @@
QT_BEGIN_NAMESPACE
-using namespace Qt3DCore;
-
namespace Qt3DRender {
namespace Render {
namespace Rhi {
@@ -122,8 +84,7 @@ QRhiTexture::Format rhiFormatFromTextureFormat(QAbstractTexture::TextureFormat f
return QRhiTexture::D24;
default:
qDebug() << "Unhandled texture format:" << format;
- Q_UNREACHABLE();
- return QRhiTexture::UnknownFormat;
+ Q_UNREACHABLE_RETURN(QRhiTexture::UnknownFormat);
}
}
@@ -139,8 +100,7 @@ QRhiSampler::Filter rhiFilterFromTextureFilter(QAbstractTexture::Filter filter)
case QAbstractTexture::LinearMipMapLinear:
return QRhiSampler::Linear;
default:
- Q_UNREACHABLE();
- return QRhiSampler::Nearest;
+ Q_UNREACHABLE_RETURN(QRhiSampler::Nearest);
}
}
@@ -159,8 +119,7 @@ QRhiSampler::Filter rhiMipMapFilterFromTextureFilter(QAbstractTexture::Filter fi
case QAbstractTexture::LinearMipMapLinear:
return QRhiSampler::Linear;
default:
- Q_UNREACHABLE();
- return QRhiSampler::None;
+ Q_UNREACHABLE_RETURN(QRhiSampler::None);
}
}
@@ -232,15 +191,12 @@ void filterLayersAndFaces(const QTextureImageData &data, F f)
f(createUploadEntry(level, 0, data.data(0, 0, level)));
}
} else if (layers > 1 && faces == 1) {
- qWarning() << Q_FUNC_INFO << "Unsupported case, see QTBUG-83343";
- /*
for (int layer = 0; layer < data.layers(); layer++) {
- for (int level = 0; level < mipLevels; level++) {
+ for (int level = 0; level < miplevels; level++) {
f(createUploadEntry(level, layer, data.data(layer, 0, level)));
}
}
- */
- } else if (faces > 1 && layers == 1) {
+ } else if (faces > 1 && layers == 1) {
// Mip levels do not seem to be supported by cubemaps...
for (int face = 0; face < data.faces(); face++) {
f(createUploadEntry(0, face, data.data(0, face, 0)));
@@ -257,8 +213,7 @@ void filterLayerAndFace(int layer, int face, F f)
if (layer == 0 && face == 0) {
f(0);
} else if (layer > 0 && face == 0) {
- qWarning() << Q_FUNC_INFO << "Unsupported case, see QTBUG-83343";
- // f(layer);
+ f(layer);
} else if (layer == 0 && face > 0) {
f(face);
} else {
@@ -371,7 +326,7 @@ bool RHITexture::loadTextureDataFromGenerator()
void RHITexture::loadTextureDataFromImages()
{
int maxMipLevel = 0;
- for (const Image &img : qAsConst(m_images)) {
+ for (const Image &img : std::as_const(m_images)) {
const QTextureImageDataPtr imgData = img.generator->operator()();
// imgData may be null in the following cases:
// - Texture is created with TextureImages which have yet to be
@@ -671,7 +626,20 @@ QRhiTexture *RHITexture::buildRhiTexture(SubmissionContext *ctx)
}
}
- QRhiTexture *rhiTexture = ctx->rhi()->newTexture(rhiFormat, pixelSize, sampleCount, rhiFlags);
+ if(actualTarget == QAbstractTexture::Target3D)
+ rhiFlags |= QRhiTexture::ThreeDimensional;
+
+ QRhiTexture *rhiTexture = nullptr;
+ switch (m_properties.target) {
+ case QAbstractTexture::Target1DArray:
+ case QAbstractTexture::Target2DArray:
+ //This will setup the array flags correctly
+ rhiTexture = ctx->rhi()->newTextureArray(rhiFormat, m_properties.layers, pixelSize, sampleCount, rhiFlags);
+ break;
+ default:
+ rhiTexture = ctx->rhi()->newTexture(rhiFormat, pixelSize, sampleCount, rhiFlags);
+ break;
+ }
if (!rhiTexture->create()) {
qWarning() << Q_FUNC_INFO << "creating QRhiTexture failed";
@@ -760,7 +728,7 @@ void RHITexture::uploadRhiTextureData(SubmissionContext *ctx)
});
}
- if (uploadEntries.size() > 0) {
+ if (!uploadEntries.empty()) {
QRhiTextureUploadDescription uploadDescription;
uploadDescription.setEntries(uploadEntries.begin(), uploadEntries.end());
ctx->m_currentUpdates->uploadTexture(m_rhi, uploadDescription);
diff --git a/src/plugins/renderers/rhi/textures/texture_p.h b/src/plugins/renderers/rhi/textures/texture_p.h
index acdcd2455..2ba45f98f 100644
--- a/src/plugins/renderers/rhi/textures/texture_p.h
+++ b/src/plugins/renderers/rhi/textures/texture_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_RENDER_RHI_GLTEXTURE_H
#define QT3DRENDER_RENDER_RHI_GLTEXTURE_H
diff --git a/src/plugins/renderers/rhi/textures/textures.pri b/src/plugins/renderers/rhi/textures/textures.pri
deleted file mode 100644
index dd9e6404f..000000000
--- a/src/plugins/renderers/rhi/textures/textures.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDEPATH += $$PWD
-
-SOURCES += \
- $$PWD/renderbuffer.cpp \
- $$PWD/texture.cpp
-
-HEADERS += \
- $$PWD/renderbuffer_p.h \
- $$PWD/texture_p.h
diff --git a/src/plugins/renderplugins/CMakeLists.txt b/src/plugins/renderplugins/CMakeLists.txt
index 42389e72a..03e4fce27 100644
--- a/src/plugins/renderplugins/CMakeLists.txt
+++ b/src/plugins/renderplugins/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from renderplugins.pro.
add_subdirectory(scene2d)
diff --git a/src/plugins/renderplugins/renderplugins.pro b/src/plugins/renderplugins/renderplugins.pro
deleted file mode 100644
index 1bc2f6c6c..000000000
--- a/src/plugins/renderplugins/renderplugins.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += scene2d
diff --git a/src/plugins/renderplugins/scene2d/CMakeLists.txt b/src/plugins/renderplugins/scene2d/CMakeLists.txt
index a46ca15d9..21ddbb018 100644
--- a/src/plugins/renderplugins/scene2d/CMakeLists.txt
+++ b/src/plugins/renderplugins/scene2d/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from scene2d.pro.
#####################################################################
diff --git a/src/plugins/renderplugins/scene2d/main.cpp b/src/plugins/renderplugins/scene2d/main.cpp
index 31a4daaf9..fb9abe04d 100644
--- a/src/plugins/renderplugins/scene2d/main.cpp
+++ b/src/plugins/renderplugins/scene2d/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "scene2dplugin.h"
diff --git a/src/plugins/renderplugins/scene2d/scene2d.pro b/src/plugins/renderplugins/scene2d/scene2d.pro
deleted file mode 100644
index 2cb07756b..000000000
--- a/src/plugins/renderplugins/scene2d/scene2d.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = scene2d
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private 3dextras 3dquickscene2d 3dquickscene2d-private
-
-HEADERS += \
- scene2dplugin.h
-
-SOURCES += \
- main.cpp \
- scene2dplugin.cpp
-
-DISTFILES += \
- scene2dplugin.json
-
-PLUGIN_TYPE = renderplugins
-PLUGIN_CLASS_NAME = Scene2DPlugin
-load(qt_plugin)
diff --git a/src/plugins/renderplugins/scene2d/scene2dplugin.cpp b/src/plugins/renderplugins/scene2d/scene2dplugin.cpp
index bffaa5b0b..7e7b042b3 100644
--- a/src/plugins/renderplugins/scene2d/scene2dplugin.cpp
+++ b/src/plugins/renderplugins/scene2d/scene2dplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "scene2dplugin.h"
diff --git a/src/plugins/renderplugins/scene2d/scene2dplugin.h b/src/plugins/renderplugins/scene2d/scene2dplugin.h
index 4f972a87c..d03f6bbde 100644
--- a/src/plugins/renderplugins/scene2d/scene2dplugin.h
+++ b/src/plugins/renderplugins/scene2d/scene2dplugin.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3DRENDER_SCENE2DPLUGIN_H
#define QT3DRENDER_SCENE2DPLUGIN_H
diff --git a/src/plugins/sceneparsers/CMakeLists.txt b/src/plugins/sceneparsers/CMakeLists.txt
index 5749e9e43..abc33e92a 100644
--- a/src/plugins/sceneparsers/CMakeLists.txt
+++ b/src/plugins/sceneparsers/CMakeLists.txt
@@ -1,7 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from sceneparsers.pro.
add_subdirectory(gltf)
-if(QT_FEATURE_qt3d_assimp AND NOT IOS AND NOT TVOS AND NOT QNX
+if(QT_FEATURE_qt3d_assimp AND NOT QNX
AND (CLANG OR GCC OR QT_FEATURE_qt3d_system_assimp OR (ANDROID AND CLANG) OR MSVC))
add_subdirectory(assimp)
endif()
diff --git a/src/plugins/sceneparsers/assimp/CMakeLists.txt b/src/plugins/sceneparsers/assimp/CMakeLists.txt
index 18bb83d56..1edc3cad7 100644
--- a/src/plugins/sceneparsers/assimp/CMakeLists.txt
+++ b/src/plugins/sceneparsers/assimp/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from assimp.pro.
#####################################################################
@@ -22,6 +25,7 @@ qt_internal_add_plugin(AssimpSceneImportPlugin
Qt::Core
Qt::CorePrivate
Qt::Gui
+ NO_UNITY_BUILD
)
#### Keys ignored in scope 1:.:.:assimp.pro:<TRUE>:
diff --git a/src/plugins/sceneparsers/assimp/assimp.pro b/src/plugins/sceneparsers/assimp/assimp.pro
deleted file mode 100644
index f761db12e..000000000
--- a/src/plugins/sceneparsers/assimp/assimp.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGET = assimpsceneimport
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private 3dextras 3danimation
-
-include(../../../3rdparty/assimp/assimp_dependency.pri)
-
-HEADERS += \
- assimphelpers.h \
- assimpimporter.h
-
-SOURCES += \
- assimphelpers.cpp \
- main.cpp \
- assimpimporter.cpp
-
-DISTFILES += \
- assimp.json
-
-PLUGIN_TYPE = sceneparsers
-PLUGIN_CLASS_NAME = AssimpSceneImportPlugin
-load(qt_plugin)
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers.cpp b/src/plugins/sceneparsers/assimp/assimphelpers.cpp
index 77209a7a9..58b429959 100644
--- a/src/plugins/sceneparsers/assimp/assimphelpers.cpp
+++ b/src/plugins/sceneparsers/assimp/assimphelpers.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "assimphelpers.h"
@@ -45,6 +9,8 @@
#include <QtCore/QDir>
#include <QtCore/QDebug>
+#include <memory>
+
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
@@ -208,9 +174,9 @@ Assimp::IOStream *AssimpIOSystem::Open(const char *pFile, const char *pMode)
const QLatin1String cleanedMode = QLatin1String{pMode}.trimmed();
if (const QIODevice::OpenMode openMode = openModeFromText(cleanedMode.data())) {
- QScopedPointer<QFile> file(new QFile(fileName));
+ auto file = std::make_unique<QFile>(fileName);
if (file->open(openMode))
- return new AssimpIOStream(file.take());
+ return new AssimpIOStream(file.release());
}
return nullptr;
}
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers.h b/src/plugins/sceneparsers/assimp/assimphelpers.h
index fd102213c..a4b9b4fb9 100644
--- a/src/plugins/sceneparsers/assimp/assimphelpers.h
+++ b/src/plugins/sceneparsers/assimp/assimphelpers.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ASSIMPHELPERS_H
#define ASSIMPHELPERS_H
diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.cpp b/src/plugins/sceneparsers/assimp/assimpimporter.cpp
index 1a775d888..4d32d1cc7 100644
--- a/src/plugins/sceneparsers/assimp/assimpimporter.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpimporter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "assimpimporter.h"
@@ -56,9 +20,8 @@
#include <Qt3DExtras/qdiffusespecularmapmaterial.h>
#include <Qt3DExtras/qphongmaterial.h>
#include <Qt3DExtras/qmorphphongmaterial.h>
-#include <Qt3DExtras/qdiffusemapmaterial.h>
-#include <Qt3DExtras/qdiffusespecularmapmaterial.h>
-#include <Qt3DExtras/qphongmaterial.h>
+#include <Qt3DExtras/qnormaldiffusemapmaterial.h>
+#include <Qt3DExtras/qnormaldiffusespecularmapmaterial.h>
#include <Qt3DAnimation/qkeyframeanimation.h>
#include <Qt3DAnimation/qmorphinganimation.h>
#include <QtCore/QFileInfo>
@@ -72,11 +35,12 @@
QT_BEGIN_NAMESPACE
-using namespace Qt3DCore;
-using namespace Qt3DExtras;
namespace Qt3DRender {
+using namespace Qt3DCore;
+using namespace Qt3DExtras;
+
/*!
\class Qt3DRender::AssimpImporter
\inmodule Qt3DRender
@@ -105,6 +69,8 @@ const QString ASSIMP_MATERIAL_AMBIENT_TEXTURE = QLatin1String("ambientTex");
const QString ASSIMP_MATERIAL_SPECULAR_TEXTURE = QLatin1String("specularTexture");
const QString ASSIMP_MATERIAL_EMISSIVE_TEXTURE = QLatin1String("emissiveTex");
const QString ASSIMP_MATERIAL_NORMALS_TEXTURE = QLatin1String("normalsTex");
+// Keep the old "normalsTex" parameter name to keep backwards compatibility, add "normalTexture" as a new one
+const QString ASSIMP_MATERIAL_NORMALS_TEXTURE2 = QLatin1String("normalTexture");
const QString ASSIMP_MATERIAL_OPACITY_TEXTURE = QLatin1String("opacityTex");
const QString ASSIMP_MATERIAL_REFLECTION_TEXTURE = QLatin1String("reflectionTex");
const QString ASSIMP_MATERIAL_HEIGHT_TEXTURE = QLatin1String("heightTex");
@@ -151,9 +117,14 @@ inline QString aiStringToQString(const aiString &str)
QMaterial *createBestApproachingMaterial(const aiMaterial *assimpMaterial)
{
aiString path; // unused but necessary
+ const bool hasNormalTexture = (assimpMaterial->GetTexture(aiTextureType_NORMALS, 0, &path) == AI_SUCCESS);
const bool hasDiffuseTexture = (assimpMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &path) == AI_SUCCESS);
const bool hasSpecularTexture = (assimpMaterial->GetTexture(aiTextureType_SPECULAR, 0, &path) == AI_SUCCESS);
+ if (hasNormalTexture && hasDiffuseTexture && hasSpecularTexture)
+ return QAbstractNodeFactory::createNode<QNormalDiffuseSpecularMapMaterial>("QNormalDiffuseSpecularMapMaterial");
+ if (hasNormalTexture && hasDiffuseTexture)
+ return QAbstractNodeFactory::createNode<QNormalDiffuseMapMaterial>("QNormalDiffuseMapMaterial");
if (hasDiffuseTexture && hasSpecularTexture)
return QAbstractNodeFactory::createNode<QDiffuseSpecularMapMaterial>("QDiffuseSpecularMapMaterial");
if (hasDiffuseTexture)
@@ -382,7 +353,7 @@ AssimpImporter::~AssimpImporter()
*/
bool AssimpImporter::areAssimpExtensions(const QStringList &extensions)
{
- for (const auto &ext : qAsConst(extensions))
+ for (const auto &ext : std::as_const(extensions))
if (AssimpImporter::assimpSupportedFormatsList.contains(ext.toLower()))
return true;
return false;
@@ -451,7 +422,7 @@ Qt3DCore::QEntity *AssimpImporter::scene(const QString &id)
if (m_scene->m_animations.size() > 0) {
qWarning() << "No target found for " << m_scene->m_animations.size() << " animations!";
- for (Qt3DAnimation::QKeyframeAnimation *anim : qAsConst(m_scene->m_animations))
+ for (Qt3DAnimation::QKeyframeAnimation *anim : std::as_const(m_scene->m_animations))
delete anim;
m_scene->m_animations.clear();
}
@@ -510,7 +481,7 @@ Qt3DCore::QEntity *AssimpImporter::node(aiNode *node)
animations,
aiStringToQString(node->mName));
const auto morphTargetList = morphingAnimations.at(0)->morphTargetList();
- for (Qt3DAnimation::QMorphingAnimation *anim : qAsConst(animations)) {
+ for (Qt3DAnimation::QMorphingAnimation *anim : std::as_const(animations)) {
anim->setParent(entityNode);
anim->setTarget(mesh);
anim->setMorphTargets(morphTargetList);
@@ -567,7 +538,7 @@ Qt3DCore::QEntity *AssimpImporter::node(aiNode *node)
animations,
aiStringToQString(node->mName));
- for (Qt3DAnimation::QKeyframeAnimation *anim : qAsConst(animations)) {
+ for (Qt3DAnimation::QKeyframeAnimation *anim : std::as_const(animations)) {
anim->setTarget(transform);
anim->setParent(entityNode);
}
@@ -822,7 +793,7 @@ QGeometryRenderer *AssimpImporter::loadMesh(uint meshIndex)
for (uint i = 0; i < mesh->mNumFaces; i++) {
aiFace face = mesh->mFaces[i];
Q_ASSERT(face.mNumIndices == 3);
- for (ushort j = 0; j < face.mNumIndices; j++)
+ for (uint j = 0; j < face.mNumIndices; j++)
reinterpret_cast<quint16*>(ibufferContent.data())[i * 3 + j] = face.mIndices[j];
}
}
@@ -846,11 +817,7 @@ QGeometryRenderer *AssimpImporter::loadMesh(uint meshIndex)
= new Qt3DAnimation::QMorphingAnimation(geometryRenderer);
QList<QString> names;
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<Qt3DAnimation::QMorphTarget *> targets;
-#else
- QVector<Qt3DAnimation::QMorphTarget *> targets;
-#endif
uint voff = 0;
uint noff = 0;
uint tanoff = 0;
@@ -1167,11 +1134,7 @@ void AssimpImporter::loadAnimation(uint animationIndex)
aiMesh *mesh = m_scene->m_aiScene->mMeshes[targetNode->mMeshes[0]];
Qt3DAnimation::QMorphingAnimation *morphingAnimation = new Qt3DAnimation::QMorphingAnimation;
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<float> positions;
-#else
- QVector<float> positions;
-#endif
positions.resize(morphAnim->mNumKeys);
// set so that weights array is allocated to correct size in morphingAnimation
morphingAnimation->setTargetPositions(positions);
@@ -1179,11 +1142,7 @@ void AssimpImporter::loadAnimation(uint animationIndex)
aiMeshMorphKey &key = morphAnim->mKeys[j];
positions[j] = key.mTime * tickScale;
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<float> weights;
-#else
- QVector<float> weights;
-#endif
weights.resize(key.mNumValuesAndWeights);
for (int k = 0; k < weights.size(); k++) {
const unsigned int value = key.mValues[k];
@@ -1322,8 +1281,12 @@ void AssimpImporter::copyMaterialTextures(QMaterial *material, aiMaterial *assim
tex->setWrapMode(wrapMode);
qCDebug(AssimpImporterLog) << Q_FUNC_INFO << " Loaded Texture " << fullPath;
- setParameterValue(m_scene->m_textureToParameterName[textureType[i]],
- material, QVariant::fromValue(tex));
+ const QString parameterName = m_scene->m_textureToParameterName[textureType[i]];
+ setParameterValue(parameterName, material, QVariant::fromValue(tex));
+
+ if (parameterName == ASSIMP_MATERIAL_NORMALS_TEXTURE) {
+ setParameterValue(ASSIMP_MATERIAL_NORMALS_TEXTURE2, material, QVariant::fromValue(tex));
+ }
}
}
}
@@ -1402,4 +1365,6 @@ AssimpImporter::SceneImporter::~SceneImporter()
QT_END_NAMESPACE
+#include "moc_assimpimporter.cpp"
+
#include "assimpimporter.moc"
diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.h b/src/plugins/sceneparsers/assimp/assimpimporter.h
index 0488ec652..8ec117fc7 100644
--- a/src/plugins/sceneparsers/assimp/assimpimporter.h
+++ b/src/plugins/sceneparsers/assimp/assimpimporter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT3D_ASSIMPIMPORTER_H
#define QT3D_ASSIMPIMPORTER_H
diff --git a/src/plugins/sceneparsers/assimp/main.cpp b/src/plugins/sceneparsers/assimp/main.cpp
index 2727bb6fe..a6072cd2b 100644
--- a/src/plugins/sceneparsers/assimp/main.cpp
+++ b/src/plugins/sceneparsers/assimp/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "assimpimporter.h"
diff --git a/src/plugins/sceneparsers/gltf/CMakeLists.txt b/src/plugins/sceneparsers/gltf/CMakeLists.txt
index 67a092a93..c39b2de6b 100644
--- a/src/plugins/sceneparsers/gltf/CMakeLists.txt
+++ b/src/plugins/sceneparsers/gltf/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from gltf.pro.
#####################################################################
diff --git a/src/plugins/sceneparsers/gltf/gltf.pro b/src/plugins/sceneparsers/gltf/gltf.pro
deleted file mode 100644
index 8f0cc2fe0..000000000
--- a/src/plugins/sceneparsers/gltf/gltf.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = gltfsceneimport
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private 3dextras
-
-HEADERS += \
- gltfimporter.h
-
-SOURCES += \
- main.cpp \
- gltfimporter.cpp
-
-DISTFILES += \
- gltf.json
-
-PLUGIN_TYPE = sceneparsers
-PLUGIN_CLASS_NAME = GLTFSceneImportPlugin
-load(qt_plugin)
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
index e56590098..4f29cab06 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "gltfimporter.h"
@@ -275,8 +239,6 @@
QT_BEGIN_NAMESPACE
-using namespace Qt3DCore;
-using namespace Qt3DExtras;
namespace {
@@ -323,6 +285,9 @@ Qt3DRender::QFilterKey *buildFilterKey(const QString &key, const QJsonValue &val
namespace Qt3DRender {
+using namespace Qt3DCore;
+using namespace Qt3DExtras;
+
Q_LOGGING_CATEGORY(GLTFImporterLog, "Qt3D.GLTFImport", QtWarningMsg);
class GLTFRawTextureImage : public QAbstractTextureImage
@@ -482,7 +447,7 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
const QJsonValue mesh = jsonObj.value(KEY_MESH);
if (!mesh.isUndefined()) {
const QString meshName = QString::number(mesh.toInt());
- const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName);
+ const auto geometryRenderers = std::as_const(m_meshDict).equal_range(meshName);
for (auto it = geometryRenderers.first; it != geometryRenderers.second; ++it) {
QGeometryRenderer *geometryRenderer = it.value();
QEntity *entity = new QEntity;
@@ -497,7 +462,7 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
const auto meshes = meshesValue.toArray();
for (const QJsonValue mesh : meshes) {
const QString meshName = mesh.toString();
- const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName);
+ const auto geometryRenderers = std::as_const(m_meshDict).equal_range(meshName);
if (Q_UNLIKELY(geometryRenderers.first == geometryRenderers.second)) {
qCWarning(GLTFImporterLog, "node %ls references unknown mesh %ls",
qUtf16PrintableImpl(id), qUtf16PrintableImpl(meshName));
@@ -520,11 +485,11 @@ Qt3DCore::QEntity* GLTFImporter::node(const QString &id)
case 0:
break;
case 1:
- result = qAsConst(entities).first();
+ result = std::as_const(entities).first();
break;
default:
result = new QEntity;
- for (QEntity *entity : qAsConst(entities))
+ for (QEntity *entity : std::as_const(entities))
entity->setParent(result);
}
}
@@ -753,7 +718,7 @@ GLTFImporter::AccessorData::AccessorData(const QJsonObject &json, int major, int
bool GLTFImporter::isGLTFSupported(const QStringList &extensions)
{
- for (auto suffix: qAsConst(extensions)) {
+ for (auto suffix: std::as_const(extensions)) {
suffix = suffix.toLower();
if (suffix == QLatin1String("json") || suffix == QLatin1String("gltf") || suffix == QLatin1String("qgltf"))
return true;
@@ -852,7 +817,7 @@ QMaterial *GLTFImporter::materialWithCustomShader(const QString &id, const QJson
// Default ES2 Technique
QString techniqueName = jsonObj.value(KEY_TECHNIQUE).toString();
- const auto it = qAsConst(m_techniques).find(techniqueName);
+ const auto it = std::as_const(m_techniques).find(techniqueName);
if (Q_UNLIKELY(it == m_techniques.cend())) {
qCWarning(GLTFImporterLog, "unknown technique %ls for material %ls in GLTF file %ls",
qUtf16PrintableImpl(techniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
@@ -869,7 +834,7 @@ QMaterial *GLTFImporter::materialWithCustomShader(const QString &id, const QJson
QTechnique *gl2Technique = nullptr;
QString coreTechniqueName = jsonObj.value(KEY_TECHNIQUE_CORE).toString();
if (!coreTechniqueName.isNull()) {
- const auto it = qAsConst(m_techniques).find(coreTechniqueName);
+ const auto it = std::as_const(m_techniques).find(coreTechniqueName);
if (Q_UNLIKELY(it == m_techniques.cend())) {
qCWarning(GLTFImporterLog, "unknown technique %ls for material %ls in GLTF file %ls",
qUtf16PrintableImpl(coreTechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
@@ -884,7 +849,7 @@ QMaterial *GLTFImporter::materialWithCustomShader(const QString &id, const QJson
//Optional GL2 technique
QString gl2TechniqueName = jsonObj.value(KEY_TECHNIQUE_GL2).toString();
if (!gl2TechniqueName.isNull()) {
- const auto it = qAsConst(m_techniques).find(gl2TechniqueName);
+ const auto it = std::as_const(m_techniques).find(gl2TechniqueName);
if (Q_UNLIKELY(it == m_techniques.cend())) {
qCWarning(GLTFImporterLog, "unknown technique %ls for material %ls in GLTF file %ls",
qUtf16PrintableImpl(gl2TechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
@@ -1086,9 +1051,9 @@ QMaterial *GLTFImporter::commonMaterial(const QJsonObject &jsonObj)
} else {
for (QVariantHash::const_iterator it = params.constBegin(), itEnd = params.constEnd(); it != itEnd; ++it)
mat->setProperty(it.key().toUtf8(), it.value());
- }
- renameFromJson(jsonObj, mat);
+ renameFromJson(jsonObj, mat);
+ }
return mat;
}
@@ -1215,7 +1180,7 @@ QMaterial *GLTFImporter::pbrMaterial(const QJsonObject &jsonObj)
QMaterial* GLTFImporter::material(const QString &id)
{
- const auto it = qAsConst(m_materialCache).find(id);
+ const auto it = std::as_const(m_materialCache).find(id);
if (it != m_materialCache.cend())
return it.value();
@@ -1448,7 +1413,7 @@ void GLTFImporter::cleanup()
m_shaderPaths.clear();
delete_if_without_parent(m_programs);
m_programs.clear();
- for (const auto &params : qAsConst(m_techniqueParameters))
+ for (const auto &params : std::as_const(m_techniqueParameters))
delete_if_without_parent(params);
m_techniqueParameters.clear();
delete_if_without_parent(m_techniques);
@@ -1470,7 +1435,7 @@ void GLTFImporter::processJSONAsset(const QJsonObject &json)
const QString version = json.value(KEY_VERSION).toString();
if (!version.isEmpty()) {
const QStringList verTokens = version.split('.');
- if (verTokens.length() >= 2) {
+ if (verTokens.size() >= 2) {
m_majorVersion = verTokens[0].toInt();
m_minorVersion = verTokens[1].toInt();
}
@@ -1491,7 +1456,7 @@ void GLTFImporter::processJSONBufferView(const QString &id, const QJsonObject& j
} else {
bufName = json.value(KEY_BUFFER).toString();
}
- const auto it = qAsConst(m_bufferDatas).find(bufName);
+ const auto it = std::as_const(m_bufferDatas).find(bufName);
if (Q_UNLIKELY(it == m_bufferDatas.cend())) {
qCWarning(GLTFImporterLog, "unknown buffer: %ls processing view: %ls",
qUtf16PrintableImpl(bufName), qUtf16PrintableImpl(id));
@@ -1547,8 +1512,8 @@ void GLTFImporter::processJSONProgram(const QString &id, const QJsonObject &json
const QString fragName = jsonObject.value(KEY_FRAGMENT_SHADER).toString();
const QString vertName = jsonObject.value(KEY_VERTEX_SHADER).toString();
- const auto fragIt = qAsConst(m_shaderPaths).find(fragName);
- const auto vertIt = qAsConst(m_shaderPaths).find(vertName);
+ const auto fragIt = std::as_const(m_shaderPaths).find(fragName);
+ const auto vertIt = std::as_const(m_shaderPaths).find(vertName);
if (Q_UNLIKELY(fragIt == m_shaderPaths.cend() || vertIt == m_shaderPaths.cend())) {
qCWarning(GLTFImporterLog, "program: %ls missing shader: %ls %ls",
@@ -1563,27 +1528,27 @@ void GLTFImporter::processJSONProgram(const QString &id, const QJsonObject &json
const QString tessCtrlName = jsonObject.value(KEY_TESS_CTRL_SHADER).toString();
if (!tessCtrlName.isEmpty()) {
- const auto it = qAsConst(m_shaderPaths).find(tessCtrlName);
+ const auto it = std::as_const(m_shaderPaths).find(tessCtrlName);
prog->setTessellationControlShaderCode(
QShaderProgram::loadSource(QUrl::fromLocalFile(it.value())));
}
const QString tessEvalName = jsonObject.value(KEY_TESS_EVAL_SHADER).toString();
if (!tessEvalName.isEmpty()) {
- const auto it = qAsConst(m_shaderPaths).find(tessEvalName);
+ const auto it = std::as_const(m_shaderPaths).find(tessEvalName);
prog->setTessellationEvaluationShaderCode(
QShaderProgram::loadSource(QUrl::fromLocalFile(it.value())));
}
const QString geomName = jsonObject.value(KEY_GEOMETRY_SHADER).toString();
if (!geomName.isEmpty()) {
- const auto it = qAsConst(m_shaderPaths).find(geomName);
+ const auto it = std::as_const(m_shaderPaths).find(geomName);
prog->setGeometryShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(it.value())));
}
const QString computeName = jsonObject.value(KEY_COMPUTE_SHADER).toString();
if (!computeName.isEmpty()) {
- const auto it = qAsConst(m_shaderPaths).find(computeName);
+ const auto it = std::as_const(m_shaderPaths).find(computeName);
prog->setComputeShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(it.value())));
}
@@ -1748,7 +1713,7 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json)
const QJsonObject attrs = primitiveObject.value(KEY_ATTRIBUTES).toObject();
for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it) {
const QString k = (m_majorVersion > 1) ? QString::number(it.value().toInt()) : it.value().toString();
- const auto accessorIt = qAsConst(m_accessorDict).find(k);
+ const auto accessorIt = std::as_const(m_accessorDict).find(k);
if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) {
qCWarning(GLTFImporterLog, "unknown attribute accessor: %ls on mesh %ls",
qUtf16PrintableImpl(k), qUtf16PrintableImpl(id));
@@ -1783,7 +1748,7 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json)
const auto indices = primitiveObject.value(KEY_INDICES);
if (!indices.isUndefined()) {
const QString accIndex = (m_majorVersion > 1) ? QString::number(indices.toInt()) : indices.toString();
- const auto accessorIt = qAsConst(m_accessorDict).find(accIndex);
+ const auto accessorIt = std::as_const(m_accessorDict).find(accIndex);
if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) {
qCWarning(GLTFImporterLog, "unknown index accessor: %ls on mesh %ls",
qUtf16PrintableImpl(accIndex), qUtf16PrintableImpl(id));
@@ -1855,11 +1820,7 @@ void GLTFImporter::processJSONMesh(const QString &id, const QJsonObject &json)
target->setProperty(propName.constData(), QVariant(size));
}
} else {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QMetaType propType = target->property(propName.constData()).metaType();
-#else
- const QMetaType propType(target->property(propName.constData()).type());
-#endif
if (propType.id() == QMetaType::Int) {
target->setProperty(propName.constData(), QVariant(it.value().toInt()));
} else {
@@ -1925,11 +1886,11 @@ void GLTFImporter::processJSONTexture(const QString &id, const QJsonObject &json
QJsonValue srcValue = jsonObject.value(KEY_SOURCE);
QString source = (m_majorVersion > 1) ? QString::number(srcValue.toInt()) : srcValue.toString();
- const auto imagIt = qAsConst(m_imagePaths).find(source);
+ const auto imagIt = std::as_const(m_imagePaths).find(source);
if (Q_UNLIKELY(imagIt == m_imagePaths.cend())) {
// if an image is not found in paths, it probably means
// it was an embedded resource, referenced in m_imageData
- const auto embImgIt = qAsConst(m_imageData).find(source);
+ const auto embImgIt = std::as_const(m_imageData).find(source);
if (Q_UNLIKELY(embImgIt == m_imageData.cend())) {
qCWarning(GLTFImporterLog, "texture %ls references missing image %ls",
qUtf16PrintableImpl(id), qUtf16PrintableImpl(source));
@@ -2071,7 +2032,7 @@ void GLTFImporter::loadBufferData()
*/
void GLTFImporter::unloadBufferData()
{
- for (const auto &bufferData : qAsConst(m_bufferDatas)) {
+ for (const auto &bufferData : std::as_const(m_bufferDatas)) {
QByteArray *data = bufferData.data;
delete data;
}
@@ -2533,7 +2494,7 @@ void GLTFImporter::populateRenderStates(QRenderPass *pass, const QJsonObject &st
}
// Create render states with default values for any remaining enable states
- for (int enableState : qAsConst(enableStates)) {
+ for (int enableState : std::as_const(enableStates)) {
QRenderState *renderState = buildStateEnable(enableState);
if (renderState != nullptr)
pass->addRenderState(renderState);
@@ -2542,7 +2503,7 @@ void GLTFImporter::populateRenderStates(QRenderPass *pass, const QJsonObject &st
void GLTFImporter::addProgramToPass(QRenderPass *pass, const QString &progName)
{
- const auto progIt = qAsConst(m_programs).find(progName);
+ const auto progIt = std::as_const(m_programs).find(progName);
if (Q_UNLIKELY(progIt == m_programs.cend()))
qCWarning(GLTFImporterLog, "missing program %ls", qUtf16PrintableImpl(progName));
else
@@ -2630,4 +2591,5 @@ bool GLTFRawTextureImage::GLTFRawTextureImageFunctor::operator ==(const QTexture
QT_END_NAMESPACE
+#include "moc_gltfimporter.cpp"
#include "gltfimporter.moc"
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.h b/src/plugins/sceneparsers/gltf/gltfimporter.h
index 79f35ebad..19414f230 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.h
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014-2016 Klarälvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014-2016 Klarälvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GLTFIMPORTER_H
#define GLTFIMPORTER_H
diff --git a/src/plugins/sceneparsers/gltf/gltfio.cpp b/src/plugins/sceneparsers/gltf/gltfio.cpp
index 8dbaff825..111a8f1f4 100644
--- a/src/plugins/sceneparsers/gltf/gltfio.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfio.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <Qt3DCore/QEntity>
#include <Qt3DCore/QTransform>
@@ -249,7 +213,7 @@ Qt3DCore::QEntity* GLTFIO::node(const QString &id)
const auto meshes = jsonObj.value(KEY_MESHES).toArray();
for (const QJsonValue &mesh : meshes) {
const QString meshName = mesh.toString();
- const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName);
+ const auto geometryRenderers = std::as_const(m_meshDict).equal_range(meshName);
if (Q_UNLIKELY(geometryRenderers.first == geometryRenderers.second)) {
qCWarning(GLTFIOLog, "node %ls references unknown mesh %ls",
qUtf16PrintableImpl(id), qUtf16PrintableImpl(meshName));
@@ -272,11 +236,11 @@ Qt3DCore::QEntity* GLTFIO::node(const QString &id)
case 0:
break;
case 1:
- result = qAsConst(entities).first();
+ result = std::as_const(entities).first();
break;
default:
result = new QEntity;
- for (QEntity *entity : qAsConst(entities))
+ for (QEntity *entity : std::as_const(entities))
entity->setParent(result);
}
}
@@ -544,7 +508,7 @@ QMaterial *GLTFIO::materialWithCustomShader(const QString &id, const QJsonObject
{
//Default ES2 Technique
QString techniqueName = jsonObj.value(KEY_TECHNIQUE).toString();
- const auto it = qAsConst(m_techniques).find(techniqueName);
+ const auto it = std::as_const(m_techniques).find(techniqueName);
if (Q_UNLIKELY(it == m_techniques.cend())) {
qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls",
qUtf16PrintableImpl(techniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
@@ -562,7 +526,7 @@ QMaterial *GLTFIO::materialWithCustomShader(const QString &id, const QJsonObject
QTechnique *gl2Technique = nullptr;
QString coreTechniqueName = jsonObj.value(KEY_TECHNIQUE_CORE).toString();
if (!coreTechniqueName.isNull()) {
- const auto it = qAsConst(m_techniques).find(coreTechniqueName);
+ const auto it = std::as_const(m_techniques).find(coreTechniqueName);
if (Q_UNLIKELY(it == m_techniques.cend())) {
qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls",
qUtf16PrintableImpl(coreTechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
@@ -577,7 +541,7 @@ QMaterial *GLTFIO::materialWithCustomShader(const QString &id, const QJsonObject
//Optional GL2 technique
QString gl2TechniqueName = jsonObj.value(KEY_TECHNIQUE_GL2).toString();
if (!gl2TechniqueName.isNull()) {
- const auto it = qAsConst(m_techniques).find(gl2TechniqueName);
+ const auto it = std::as_const(m_techniques).find(gl2TechniqueName);
if (Q_UNLIKELY(it == m_techniques.cend())) {
qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls",
qUtf16PrintableImpl(gl2TechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
@@ -720,7 +684,7 @@ QMaterial *GLTFIO::commonMaterial(const QJsonObject &jsonObj)
QMaterial* GLTFIO::material(const QString &id)
{
- const auto it = qAsConst(m_materialCache).find(id);
+ const auto it = std::as_const(m_materialCache).find(id);
if (it != m_materialCache.cend())
return it.value();
@@ -877,7 +841,7 @@ void GLTFIO::processJSONBuffer(const QString &id, const QJsonObject& json)
void GLTFIO::processJSONBufferView(const QString &id, const QJsonObject& json)
{
QString bufName = json.value(KEY_BUFFER).toString();
- const auto it = qAsConst(m_bufferDatas).find(bufName);
+ const auto it = std::as_const(m_bufferDatas).find(bufName);
if (Q_UNLIKELY(it == m_bufferDatas.cend())) {
qCWarning(GLTFIOLog, "unknown buffer: %ls processing view: %ls",
qUtf16PrintableImpl(bufName), qUtf16PrintableImpl(id));
@@ -937,8 +901,8 @@ void GLTFIO::processJSONProgram(const QString &id, const QJsonObject &jsonObject
{
QString fragName = jsonObject.value(KEY_FRAGMENT_SHADER).toString(),
vertName = jsonObject.value(KEY_VERTEX_SHADER).toString();
- const auto fragIt = qAsConst(m_shaderPaths).find(fragName),
- vertIt = qAsConst(m_shaderPaths).find(vertName);
+ const auto fragIt = std::as_const(m_shaderPaths).find(fragName),
+ vertIt = std::as_const(m_shaderPaths).find(vertName);
if (Q_UNLIKELY(fragIt == m_shaderPaths.cend() || vertIt == m_shaderPaths.cend())) {
qCWarning(GLTFIOLog, "program: %ls missing shader: %ls %ls",
qUtf16PrintableImpl(id), qUtf16PrintableImpl(fragName), qUtf16PrintableImpl(vertName));
@@ -984,7 +948,7 @@ void GLTFIO::processJSONTechnique(const QString &id, const QJsonObject &jsonObje
// Program
QRenderPass* pass = new QRenderPass;
QString programName = jsonObject.value(KEY_PROGRAM).toString();
- const auto progIt = qAsConst(m_programs).find(programName);
+ const auto progIt = std::as_const(m_programs).find(programName);
if (Q_UNLIKELY(progIt == m_programs.cend())) {
qCWarning(GLTFIOLog, "technique %ls: missing program %ls",
qUtf16PrintableImpl(id), qUtf16PrintableImpl(programName));
@@ -1057,7 +1021,7 @@ void GLTFIO::processJSONTechnique(const QString &id, const QJsonObject &jsonObje
}
//Create render states with default values for any remaining enable states
- for (int enableState : qAsConst(enableStates)) {
+ for (int enableState : std::as_const(enableStates)) {
QRenderState *renderState = buildStateEnable(enableState);
if (renderState != nullptr)
pass->addRenderState(renderState);
@@ -1100,7 +1064,7 @@ void GLTFIO::processJSONMesh(const QString &id, const QJsonObject &json)
const QJsonObject attrs = primitiveObject.value(KEY_ATTRIBUTES).toObject();
for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it) {
QString k = it.value().toString();
- const auto accessorIt = qAsConst(m_accessorDict).find(k);
+ const auto accessorIt = std::as_const(m_accessorDict).find(k);
if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) {
qCWarning(GLTFIOLog, "unknown attribute accessor: %ls on mesh %ls",
qUtf16PrintableImpl(k), qUtf16PrintableImpl(id));
@@ -1134,7 +1098,7 @@ void GLTFIO::processJSONMesh(const QString &id, const QJsonObject &json)
const auto indices = primitiveObject.value(KEY_INDICES);
if (!indices.isUndefined()) {
QString k = indices.toString();
- const auto accessorIt = qAsConst(m_accessorDict).find(k);
+ const auto accessorIt = std::as_const(m_accessorDict).find(k);
if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) {
qCWarning(GLTFIOLog, "unknown index accessor: %ls on mesh %ls",
qUtf16PrintableImpl(k), qUtf16PrintableImpl(id));
@@ -1191,7 +1155,7 @@ void GLTFIO::processJSONTexture(const QString &id, const QJsonObject &jsonObject
QString samplerId = jsonObject.value(KEY_SAMPLER).toString();
QString source = jsonObject.value(KEY_SOURCE).toString();
- const auto imagIt = qAsConst(m_imagePaths).find(source);
+ const auto imagIt = std::as_const(m_imagePaths).find(source);
if (Q_UNLIKELY(imagIt == m_imagePaths.cend())) {
qCWarning(GLTFIOLog, "texture %ls references missing image %ls",
qUtf16PrintableImpl(id), qUtf16PrintableImpl(source));
@@ -1234,7 +1198,7 @@ void GLTFIO::loadBufferData()
void GLTFIO::unloadBufferData()
{
- for (const auto &bufferData : qAsConst(m_bufferDatas)) {
+ for (const auto &bufferData : std::as_const(m_bufferDatas)) {
QByteArray *data = bufferData.data;
delete data;
}
diff --git a/src/plugins/sceneparsers/gltf/main.cpp b/src/plugins/sceneparsers/gltf/main.cpp
index 6c612b24d..3cfcd97c9 100644
--- a/src/plugins/sceneparsers/gltf/main.cpp
+++ b/src/plugins/sceneparsers/gltf/main.cpp
@@ -1,42 +1,5 @@
-
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "gltfimporter.h"
diff --git a/src/plugins/sceneparsers/gltfexport/CMakeLists.txt b/src/plugins/sceneparsers/gltfexport/CMakeLists.txt
index 4c4e9c280..234b19523 100644
--- a/src/plugins/sceneparsers/gltfexport/CMakeLists.txt
+++ b/src/plugins/sceneparsers/gltfexport/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from gltfexport.pro.
#####################################################################
diff --git a/src/plugins/sceneparsers/gltfexport/gltfexport.pro b/src/plugins/sceneparsers/gltfexport/gltfexport.pro
deleted file mode 100644
index 9da330605..000000000
--- a/src/plugins/sceneparsers/gltfexport/gltfexport.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = gltfsceneexport
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private 3dextras
-
-HEADERS += \
- gltfexporter.h
-
-SOURCES += \
- main.cpp \
- gltfexporter.cpp
-
-DISTFILES += \
- gltfexport.json
-
-PLUGIN_TYPE = sceneparsers
-PLUGIN_CLASS_NAME = GLTFSceneExportPlugin
-load(qt_plugin)
diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
index e7846d7b5..12c979019 100644
--- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
+++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "gltfexporter.h"
@@ -53,6 +17,7 @@
#include <QtCore/qtemporarydir.h>
#include <QtCore/qregularexpression.h>
#include <QtCore/qmetaobject.h>
+#include <QtCore/qlibraryinfo.h>
#include <QtGui/qvector2d.h>
#include <QtGui/qvector4d.h>
#include <QtGui/qmatrix4x4.h>
@@ -221,11 +186,11 @@ inline void promoteColorsToRGBA(QJsonObject *obj)
QT_BEGIN_NAMESPACE
+namespace Qt3DRender {
+
using namespace Qt3DCore;
using namespace Qt3DExtras;
-namespace Qt3DRender {
-
Q_LOGGING_CATEGORY(GLTFExporterLog, "Qt3D.GLTFExport", QtWarningMsg)
const QString MATERIAL_DIFFUSE_COLOR = QStringLiteral("kd");
@@ -390,7 +355,7 @@ bool GLTFExporter::exportScene(QEntity *sceneRoot, const QString &outDir,
QFile::Permissions targetPermissions = gltfFile.permissions();
// Copy exported scene to actual export directory
- for (const auto &sourceFileStr : qAsConst(m_exportedFiles)) {
+ for (const auto &sourceFileStr : std::as_const(m_exportedFiles)) {
QFileInfo fiSource(m_exportDir + sourceFileStr);
QFileInfo fiDestination(finalExportDir + sourceFileStr);
if (fiDestination.exists()) {
@@ -544,7 +509,7 @@ void GLTFExporter::copyTextures()
void GLTFExporter::createShaders()
{
qCDebug(GLTFExporterLog, "Creating shaders...");
- for (const auto &si : qAsConst(m_shaderInfo)) {
+ for (const auto &si : std::as_const(m_shaderInfo)) {
const QString fileName = m_exportDir + si.uri;
QFile f(fileName);
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
@@ -662,11 +627,7 @@ void GLTFExporter::parseMaterials()
if (material->effect()) {
QList<QParameter *> parameters = material->effect()->parameters();
for (auto param : parameters) {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (param->value().metaType().id() == QMetaType::QColor) {
-#else
- if (param->value().type() == QMetaType::QColor) {
-#endif
QColor color = param->value().value<QColor>();
if (param->name() == MATERIAL_AMBIENT_COLOR) {
matInfo.colors.insert(QStringLiteral("ambient"), color);
@@ -968,7 +929,7 @@ void GLTFExporter::parseMeshes()
sl << bv.name;
qCDebug(GLTFExporterLog) << " buffer views:" << sl;
sl.clear();
- for (const auto &acc : qAsConst(meshInfo.accessors))
+ for (const auto &acc : std::as_const(meshInfo.accessors))
sl << acc.name;
qCDebug(GLTFExporterLog) << " accessors:" << sl;
qCDebug(GLTFExporterLog, " material: '%ls'",
@@ -1155,7 +1116,7 @@ QString GLTFExporter::addShaderInfo(QShaderProgram::ShaderType type, QByteArray
if (code.isEmpty())
return QString();
- for (const auto &si : qAsConst(m_shaderInfo)) {
+ for (const auto &si : std::as_const(m_shaderInfo)) {
if (si.type == QShaderProgram::Vertex && code == si.code)
return si.name;
}
@@ -1220,7 +1181,7 @@ bool GLTFExporter::saveScene()
m_obj["buffers"] = buffers;
QJsonObject bufferViews;
- for (const auto &bv : qAsConst(bvList)) {
+ for (const auto &bv : std::as_const(bvList)) {
QJsonObject bufferView;
bufferView["buffer"] = QStringLiteral("buf");
bufferView["byteLength"] = int(bv.length);
@@ -1233,7 +1194,7 @@ bool GLTFExporter::saveScene()
m_obj["bufferViews"] = bufferViews;
QJsonObject accessors;
- for (const auto &acc : qAsConst(accList)) {
+ for (const auto &acc : std::as_const(accList)) {
QJsonObject accessor;
accessor["bufferView"] = acc.bufferView;
accessor["byteOffset"] = int(acc.offset);
@@ -1280,7 +1241,7 @@ bool GLTFExporter::saveScene()
m_obj["meshes"] = meshes;
QJsonObject cameras;
- for (const auto &camInfo : qAsConst(m_cameraInfo)) {
+ for (const auto &camInfo : std::as_const(m_cameraInfo)) {
QJsonObject camera;
QJsonObject proj;
proj["znear"] = camInfo.znear;
@@ -1312,7 +1273,7 @@ bool GLTFExporter::saveScene()
if (m_rootNodeEmpty) {
// Don't export the root node if it is there just to group the scene, so we don't get
// an extra empty node when we import the scene back.
- for (auto c : qAsConst(m_rootNode->children))
+ for (auto c : std::as_const(m_rootNode->children))
sceneNodes << exportNodes(c, nodes);
} else {
sceneNodes << exportNodes(m_rootNode, nodes);
@@ -1520,7 +1481,7 @@ bool GLTFExporter::saveScene()
// Save shaders for custom materials
QJsonObject shaders;
- for (const auto &si : qAsConst(m_shaderInfo)) {
+ for (const auto &si : std::as_const(m_shaderInfo)) {
QJsonObject shaderObj;
shaderObj["uri"] = si.uri;
shaders[si.name] = shaderObj;
@@ -1593,7 +1554,7 @@ bool GLTFExporter::saveScene()
QByteArray pre = "<RCC><qresource prefix=\"/gltf_res\">\n";
QByteArray post = "</qresource></RCC>\n";
f.write(pre);
- for (const auto &file : qAsConst(m_exportedFiles)) {
+ for (const auto &file : std::as_const(m_exportedFiles)) {
QString line = QString(QStringLiteral(" <file>%1</file>\n")).arg(file);
f.write(line.toUtf8());
}
@@ -1615,7 +1576,7 @@ void GLTFExporter::delNode(GLTFExporter::Node *n)
{
if (!n)
return;
- for (auto *c : qAsConst(n->children))
+ for (auto *c : std::as_const(n->children))
delNode(c);
delete n;
}
@@ -1625,7 +1586,7 @@ QString GLTFExporter::exportNodes(GLTFExporter::Node *n, QJsonObject &nodes)
QJsonObject node;
node["name"] = n->name;
QJsonArray children;
- for (auto c : qAsConst(n->children))
+ for (auto c : std::as_const(n->children))
children << exportNodes(c, nodes);
node["children"] = children;
if (auto transform = m_transformMap.value(n))
@@ -1803,11 +1764,7 @@ void GLTFExporter::exportParameter(QJsonObject &jsonObj, const QString &name,
paramObj[typeStr] = GL_SAMPLER_2D;
paramObj[valueStr] = m_textureIdMap.value(textureVariantToUrl(variant));
} else {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
switch (variant.metaType().id()) {
-#else
- switch (variant.type()) {
-#endif
case QMetaType::Bool:
paramObj[typeStr] = GL_BOOL;
paramObj[valueStr] = variant.toBool();
@@ -2079,11 +2036,7 @@ QString GLTFExporter::textureVariantToUrl(const QVariant &var)
void GLTFExporter::setVarToJSonObject(QJsonObject &jsObj, const QString &key, const QVariant &var)
{
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
switch (var.metaType().id()) {
-#else
- switch (var.type()) {
-#endif
case QMetaType::Bool:
jsObj[key] = var.toBool();
break;
diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.h b/src/plugins/sceneparsers/gltfexport/gltfexporter.h
index 254bc2e2a..50fb475f6 100644
--- a/src/plugins/sceneparsers/gltfexport/gltfexporter.h
+++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GLTFEXPORTER_H
#define GLTFEXPORTER_H
diff --git a/src/plugins/sceneparsers/gltfexport/main.cpp b/src/plugins/sceneparsers/gltfexport/main.cpp
index 16cd533b8..14847da2c 100644
--- a/src/plugins/sceneparsers/gltfexport/main.cpp
+++ b/src/plugins/sceneparsers/gltfexport/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "gltfexporter.h"
diff --git a/src/plugins/sceneparsers/sceneparsers.pro b/src/plugins/sceneparsers/sceneparsers.pro
deleted file mode 100644
index 573a5ddad..000000000
--- a/src/plugins/sceneparsers/sceneparsers.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = subdirs
-# QNX is not supported, and Linux GCC 4.9 on ARM chokes on the assimp
-# sources (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66964).
-QT_FOR_CONFIG += 3dcore-private
-!ios:!tvos:!qcc:qtConfig(qt3d-assimp):if(qtConfig(qt3d-system-assimp)|android-clang|clang|win32-msvc|gcc) {
- SUBDIRS += assimp
-}
-SUBDIRS += gltf
-
-qtConfig(temporaryfile):qtConfig(regularexpression) {
- SUBDIRS += gltfexport
-}