diff options
author | Mike Krus <mike.krus@kdab.com> | 2020-04-27 11:56:17 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2020-05-06 15:29:54 +0200 |
commit | 764924da8ab3255c1b8d1ad5b39f85675f4b855e (patch) | |
tree | c7b3e9d94318fd347ef2717feb5b539f5c18ff13 /src | |
parent | 9838d91e2d433f13c57bdae48e31ba0b909988aa (diff) |
Fix build for Qt6
- updated dependencies, excluding qtgamepad for now
- fixed issues with Q_PROPERTY not supporting forward declarations
- fixed for changes in QtQuick private API
- fixed for changes in QtOpenGLVersionFunctions API
- fixed for removal of QT_OPENGL_ES* macros
- fixed for changes in QtConcurrent API
- fixed RHI based build
Change-Id: I42ccd2f101b7f0a78e2860c6d551722bf6710a11
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src')
75 files changed, 695 insertions, 114 deletions
diff --git a/src/animation/frontend/qabstractclipanimator.h b/src/animation/frontend/qabstractclipanimator.h index 687589b5e..bbdc1c145 100644 --- a/src/animation/frontend/qabstractclipanimator.h +++ b/src/animation/frontend/qabstractclipanimator.h @@ -41,6 +41,8 @@ #define QT3DANIMATION_QABSTRACTCLIPANIMATOR_H #include <Qt3DAnimation/qt3danimation_global.h> +#include <Qt3DAnimation/qchannelmapper.h> +#include <Qt3DAnimation/qclock.h> #include <Qt3DCore/qcomponent.h> QT_BEGIN_NAMESPACE @@ -48,8 +50,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DAnimation { class QAnimationClip; -class QChannelMapper; -class QClock; class QAbstractClipAnimatorPrivate; class Q_3DANIMATIONSHARED_EXPORT QAbstractClipAnimator : public Qt3DCore::QComponent diff --git a/src/animation/frontend/qabstractclipblendnode.h b/src/animation/frontend/qabstractclipblendnode.h index 3bc6d37d0..12630fbf0 100644 --- a/src/animation/frontend/qabstractclipblendnode.h +++ b/src/animation/frontend/qabstractclipblendnode.h @@ -38,13 +38,13 @@ #define QT3DANIMATION_QABSTRACTCLIPBLENDNODE_H #include <Qt3DAnimation/qt3danimation_global.h> +#include <Qt3DAnimation/qabstractanimationclip.h> #include <Qt3DCore/qnode.h> QT_BEGIN_NAMESPACE namespace Qt3DAnimation { -class QAbstractAnimationClip; class QAbstractClipBlendNodePrivate; class Q_3DANIMATIONSHARED_EXPORT QAbstractClipBlendNode : public Qt3DCore::QNode diff --git a/src/animation/frontend/qblendedclipanimator.h b/src/animation/frontend/qblendedclipanimator.h index 2fb7595aa..67f9551d6 100644 --- a/src/animation/frontend/qblendedclipanimator.h +++ b/src/animation/frontend/qblendedclipanimator.h @@ -42,12 +42,12 @@ #include <Qt3DAnimation/qt3danimation_global.h> #include <Qt3DAnimation/qabstractclipanimator.h> +#include <Qt3DAnimation/qabstractclipblendnode.h> QT_BEGIN_NAMESPACE namespace Qt3DAnimation { -class QAbstractClipBlendNode; class QBlendedClipAnimatorPrivate; class Q_3DANIMATIONSHARED_EXPORT QBlendedClipAnimator : public Qt3DAnimation::QAbstractClipAnimator diff --git a/src/animation/frontend/qclipanimator.h b/src/animation/frontend/qclipanimator.h index 6025a5343..d3b789692 100644 --- a/src/animation/frontend/qclipanimator.h +++ b/src/animation/frontend/qclipanimator.h @@ -42,13 +42,12 @@ #include <Qt3DAnimation/qt3danimation_global.h> #include <Qt3DAnimation/qabstractclipanimator.h> +#include <Qt3DAnimation/qabstractanimationclip.h> QT_BEGIN_NAMESPACE namespace Qt3DAnimation { -class QAbstractAnimationClip; -class QChannelMapper; class QClipAnimatorPrivate; class Q_3DANIMATIONSHARED_EXPORT QClipAnimator : public Qt3DAnimation::QAbstractClipAnimator diff --git a/src/animation/frontend/qskeletonmapping.h b/src/animation/frontend/qskeletonmapping.h index 5f37bfeb9..e8fcb3f9a 100644 --- a/src/animation/frontend/qskeletonmapping.h +++ b/src/animation/frontend/qskeletonmapping.h @@ -40,15 +40,12 @@ #ifndef QT3DANIMATION_QSKELETONMAPPING_H #define QT3DANIMATION_QSKELETONMAPPING_H +#include <Qt3DCore/qabstractskeleton.h> #include <Qt3DAnimation/qabstractchannelmapping.h> #include <Qt3DAnimation/qt3danimation_global.h> QT_BEGIN_NAMESPACE -namespace Qt3DCore { -class QAbstractSkeleton; -} - namespace Qt3DAnimation { class QSkeletonMappingPrivate; diff --git a/src/core/geometry/qattribute.h b/src/core/geometry/qattribute.h index aa0e5ce8b..eedb2d32c 100644 --- a/src/core/geometry/qattribute.h +++ b/src/core/geometry/qattribute.h @@ -42,13 +42,13 @@ #include <Qt3DCore/qt3dcore_global.h> #include <Qt3DCore/qnode.h> +#include <Qt3DCore/qbuffer.h> #include <QtCore/QSharedPointer> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QBuffer; class QAttributePrivate; typedef QSharedPointer<QBuffer> QBufferPtr; diff --git a/src/core/geometry/qgeometry.h b/src/core/geometry/qgeometry.h index a619884a0..89b3c7019 100644 --- a/src/core/geometry/qgeometry.h +++ b/src/core/geometry/qgeometry.h @@ -42,12 +42,12 @@ #include <Qt3DCore/qnode.h> #include <Qt3DCore/qt3dcore_global.h> +#include <Qt3DCore/qattribute.h> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QAttribute; class QGeometryPrivate; class Q_3DCORESHARED_EXPORT QGeometry : public Qt3DCore::QNode diff --git a/src/core/nodes/qcomponent.h b/src/core/nodes/qcomponent.h index 182a21e50..f07b34c9f 100644 --- a/src/core/nodes/qcomponent.h +++ b/src/core/nodes/qcomponent.h @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE namespace Qt3DCore { +class QEntity; class QComponentPrivate; class Q_3DCORESHARED_EXPORT QComponent : public QNode diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h index f24daf63f..e6914919d 100644 --- a/src/core/nodes/qnode.h +++ b/src/core/nodes/qnode.h @@ -52,7 +52,6 @@ namespace Qt3DCore { class QNode; class QNodePrivate; -class QEntity; class QAspectEngine; #if defined(QT_BUILD_INTERNAL) diff --git a/src/core/resources/qframeallocator.cpp b/src/core/resources/qframeallocator.cpp new file mode 100644 index 000000000..e85ae4057 --- /dev/null +++ b/src/core/resources/qframeallocator.cpp @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/* !\internal + \class Qt3DCore::QFrameAllocator + \inmodule Qt3DCore + \brief Provides a pool of memory chunks to be used to allocate objects on a per frame basis. + + The memory can be recycled by following frames by calling clear which won't deallocate any memory. + + \note Be really careful when allocating polymorphic types. You must be + sure to call deallocate with the subclass type to properly release all + memory. +*/ + +#include "qframeallocator_p.h" +#include "qframeallocator_p_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3DCore { + +QFrameAllocatorPrivate::QFrameAllocatorPrivate() + : m_maxObjectSize(0U) + , m_alignment(0U) +{ +} + +QFrameAllocator::QFrameAllocator(uint maxObjectSize, uint alignment, uint pageSize) + : d_ptr(new QFrameAllocatorPrivate) +{ + Q_ASSERT(alignment && pageSize && pageSize < UCHAR_MAX); + Q_D(QFrameAllocator); + d->m_maxObjectSize = maxObjectSize; + d->m_alignment = alignment; + d->m_allocatorPool.resize(d->allocatorIndexFromSize(maxObjectSize) + 1); + for (int i = 0, n = d->m_allocatorPool.size(); i < n; ++i) + d->m_allocatorPool[i].init((i + 1) * d->m_alignment, pageSize); +} + +QFrameAllocator::~QFrameAllocator() +{ + Q_D(QFrameAllocator); + for (int i = 0, n = d->m_allocatorPool.size(); i < n; ++i) + d->m_allocatorPool[i].release(); +} + +// Clear all memory chunks, allocated memory is not released +void QFrameAllocator::clear() +{ + Q_D(QFrameAllocator); + for (int i = 0, n = d->m_allocatorPool.size(); i < n; ++i) + d->m_allocatorPool[i].clear(); +} + +// Trim excess memory used by chunks +void QFrameAllocator::trim() +{ + Q_D(QFrameAllocator); + for (int i = 0, n = d->m_allocatorPool.size(); i < n; ++i) + d->m_allocatorPool[i].trim(); +} + +uint QFrameAllocator::maxObjectSize() const +{ + Q_D(const QFrameAllocator); + return d->m_maxObjectSize; +} + +int QFrameAllocator::allocatorPoolSize() const +{ + Q_D(const QFrameAllocator); + return d->m_allocatorPool.size(); +} + +bool QFrameAllocator::isEmpty() const +{ + Q_D(const QFrameAllocator); + for (const QFixedFrameAllocator &allocator : d->m_allocatorPool) { + if (!allocator.isEmpty()) + return false; + } + return true; +} + +uint QFrameAllocator::totalChunkCount() const +{ + Q_D(const QFrameAllocator); + uint chunkCount = 0; + for (const QFixedFrameAllocator& allocator : d->m_allocatorPool) + chunkCount += allocator.chunkCount(); + return chunkCount; +} + +QFixedFrameAllocator::QFixedFrameAllocator() + : m_blockSize(0) + , m_nbrBlock(0) + , m_lastAllocatedChunck(nullptr) + , m_lastFreedChunck(nullptr) +{ +} + +QFixedFrameAllocator::~QFixedFrameAllocator() +{ + release(); +} + +void QFixedFrameAllocator::init(uint blockSize, uchar pageSize) +{ + m_blockSize = blockSize; + m_nbrBlock = pageSize; +} + +void *QFixedFrameAllocator::allocate() +{ + Q_ASSERT(m_blockSize); + return scan().allocate(m_blockSize); +} + +QFrameChunk &QFixedFrameAllocator::scan() +{ + Q_ASSERT(m_blockSize); + Q_ASSERT(m_nbrBlock); + + if (m_lastAllocatedChunck && m_lastAllocatedChunck->m_blocksAvailable) + return *m_lastAllocatedChunck; + + for (int i = 0; i < m_chunks.size(); i++) { + if (m_chunks[i].m_blocksAvailable > 0) { + m_lastAllocatedChunck = m_chunks.begin() + i; + return *m_lastAllocatedChunck; + } + } + m_chunks.resize(m_chunks.size() + 1); + QFrameChunk &newChunk = m_chunks.last(); + newChunk.init(m_blockSize, m_nbrBlock); + m_lastAllocatedChunck = &newChunk; + m_lastFreedChunck = &newChunk; + return newChunk; +} + +void QFixedFrameAllocator::deallocate(void *ptr) +{ + Q_ASSERT(m_blockSize && m_nbrBlock); + if (!m_chunks.empty() && ptr != nullptr) { + if (m_lastFreedChunck != nullptr && m_lastFreedChunck->contains(ptr, m_blockSize)) + m_lastFreedChunck->deallocate(ptr, m_blockSize); + else { + for (int i = 0; i < m_chunks.size(); i++) { + if (m_chunks[i].contains(ptr, m_blockSize)) { + m_chunks[i].deallocate(ptr, m_blockSize); + m_lastFreedChunck = m_chunks.begin() + i; + break ; + } + } + } + } +} + +void QFixedFrameAllocator::trim() +{ + for (int i = m_chunks.size() - 1; i >= 0; i--) { + if (m_chunks.at(i).isEmpty()) { + m_chunks[i].release(); + if (m_lastAllocatedChunck == &m_chunks[i]) + m_lastAllocatedChunck = nullptr; + if (m_lastFreedChunck == &m_chunks[i]) + m_lastFreedChunck = nullptr; + m_chunks.removeAt(i); + } + } +} + +void QFixedFrameAllocator::release() +{ + for (int i = m_chunks.size() - 1; i >= 0; i--) + m_chunks[i].release(); + m_chunks.clear(); + m_lastAllocatedChunck = nullptr; + m_lastFreedChunck = nullptr; +} + +// Allows to reuse chunks without having to reinitialize and reallocate them +void QFixedFrameAllocator::clear() +{ + for (int i = m_chunks.size() - 1; i >= 0; i--) + m_chunks[i].clear(m_blockSize, m_nbrBlock); +} + +bool QFixedFrameAllocator::isEmpty() const +{ + for (const QFrameChunk &chunck : m_chunks) { + if (chunck.m_blocksAvailable != chunck.m_maxBlocksAvailable) + return false; + } + return true; +} + +// QFrameChuck is agnostic about blocksize +// However if it was initialized with a block size of 16 +// You should then pass 16 to allocate and deallocate +void QFrameChunk::init(uint blockSize, uchar blocks) +{ + m_data = new uchar[blockSize * blocks]; + m_firstAvailableBlock = 0; + m_blocksAvailable = blocks; + m_maxBlocksAvailable = blocks; + uchar *p = m_data; + // Init each block with its position stored in its first byte + for (uchar i = 0; i < blocks; p += blockSize) + *p = ++i; +#ifdef QFRAMEALLOCATOR_DEBUG + VALGRIND_CREATE_MEMPOOL(m_data, 0, true); + VALGRIND_MAKE_MEM_NOACCESS(m_data, blockSize * blocks); + VALGRIND_MEMPOOL_ALLOC(m_data, m_data, blockSize * blocks); +#endif +} + +void *QFrameChunk::allocate(uint blockSize) +{ + if (m_blocksAvailable == 0) + return nullptr; + uchar *r = m_data + (m_firstAvailableBlock * blockSize); + m_firstAvailableBlock = *r; + --m_blocksAvailable; + return r; +} + +// Shouldn't be called more than once for the same pointer +void QFrameChunk::deallocate(void *p, uint blockSize) +{ + if (p >= m_data) { + uchar *toRelease = static_cast<uchar *>(p); + uchar oldFreeBlock = m_firstAvailableBlock; + m_firstAvailableBlock = static_cast<uchar>((toRelease - m_data) / blockSize); + *toRelease = oldFreeBlock; + ++m_blocksAvailable; + } +} + +bool QFrameChunk::contains(void *p, uint blockSize) +{ + uchar *c = static_cast<uchar *>(p); + return (m_data <= c && c < m_data + blockSize * m_maxBlocksAvailable); +} + +// Reset chunck without releasing heap allocated memory +void QFrameChunk::clear(uint blockSize, uchar blocks) +{ + m_firstAvailableBlock = 0; + m_blocksAvailable = blocks; + + uchar *p = m_data; + // Init each block with its position stored in its first byte + for (uchar i = 0; i < blocks; p += blockSize) + *p = ++i; +} + +void QFrameChunk::release() +{ +#ifdef QFRAMEALLOCATOR_DEBUG + VALGRIND_MEMPOOL_FREE(m_data, m_data); + VALGRIND_DESTROY_MEMPOOL(m_data); +#endif + delete [] m_data; +} + +void* QFrameAllocator::allocateRawMemory(size_t size) +{ + Q_D(QFrameAllocator); + Q_ASSERT(size <= d->m_maxObjectSize); + uint allocatorIndex = d->allocatorIndexFromSize(uint(size)); + return d->allocateAtChunk(allocatorIndex); +} + +void QFrameAllocator::deallocateRawMemory(void* ptr, size_t size) +{ + Q_D(QFrameAllocator); + Q_ASSERT(size <= d->m_maxObjectSize); + uint allocatorIndex = d->allocatorIndexFromSize(uint(size)); + d->deallocateAtChunck(ptr, allocatorIndex); +} + +} // Qt3D + +QT_END_NAMESPACE diff --git a/src/core/resources/qframeallocator_p.h b/src/core/resources/qframeallocator_p.h new file mode 100644 index 000000000..4c2b5a961 --- /dev/null +++ b/src/core/resources/qframeallocator_p.h @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QT3DCORE_QFRAMEALLOCATOR_P_H +#define QT3DCORE_QFRAMEALLOCATOR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifdef QFRAMEALLOCATOR_DEBUG +#include <valgrind/valgrind.h> +#include <valgrind/memcheck.h> +#endif + +#include <QtCore/QDebug> +#include <QtCore/QScopedPointer> +#include <QtCore/QVector> + +#include <Qt3DCore/private/qt3dcore_global_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DCore { + +class QFrameAllocatorPrivate; + +class Q_3DCORE_PRIVATE_EXPORT QFrameAllocator +{ +public: + explicit QFrameAllocator(uint maxObjectSize, uint alignment = 16, uint pageSize = 128); + ~QFrameAllocator(); + + template<typename T> + T* allocate() + { + void* ptr = allocateRawMemory(sizeof(T)); + new (ptr) T(); // Don't forget to call the constructor of the object using the placement new operator + return static_cast<T*>(ptr); + } + + template<typename T> + void deallocate(T *ptr) + { + ptr->~T(); // Call destructor + deallocateRawMemory(ptr, sizeof(T)); + } + + void* allocateRawMemory(size_t size); + + void deallocateRawMemory(void *ptr, size_t size); + + void clear(); + void trim(); + uint maxObjectSize() const; + uint totalChunkCount() const; + int allocatorPoolSize() const; + bool isEmpty() const; + +private: + Q_DECLARE_PRIVATE(QFrameAllocator) + const QScopedPointer<QFrameAllocatorPrivate> d_ptr; +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QFRAMEALLOCATOR_P_H diff --git a/src/core/resources/qframeallocator_p_p.h b/src/core/resources/qframeallocator_p_p.h new file mode 100644 index 000000000..bf4e0a2b1 --- /dev/null +++ b/src/core/resources/qframeallocator_p_p.h @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QT3DCORE_QFRAMEALLOCATOR_P_P_H +#define QT3DCORE_QFRAMEALLOCATOR_P_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <Qt3DCore/qt3dcore_global.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DCore { + +class QFrameAllocator; + +struct Q_AUTOTEST_EXPORT QFrameChunk +{ + void init(uint blockSize, uchar blocks); + void *allocate(uint blockSize); + + void deallocate(void *p, uint blockSize); + bool contains(void *p, uint blockSize); + void clear(uint blockSize, uchar blocks); + void release(); + + inline bool isEmpty() const { return m_blocksAvailable == m_maxBlocksAvailable; } + + uchar *m_data; + uchar m_firstAvailableBlock; + uchar m_blocksAvailable; + uchar m_maxBlocksAvailable; +}; + +class Q_AUTOTEST_EXPORT QFixedFrameAllocator +{ +public: + QFixedFrameAllocator(); + ~QFixedFrameAllocator(); + + void init(uint blockSize, uchar pageSize = 128); + void *allocate(); + void deallocate(void *ptr); + void trim(); + void release(); + void clear(); + bool isEmpty() const; + + inline int chunkCount() const { return m_chunks.size(); } + inline uchar pageSize() const { return m_nbrBlock; } + inline uint blockSize() const { return m_blockSize; } + +private: + QFrameChunk &scan(); + +private: + uint m_blockSize; + uchar m_nbrBlock; + QVector<QFrameChunk> m_chunks; + QFrameChunk *m_lastAllocatedChunck; + QFrameChunk *m_lastFreedChunck; +}; + +class QFrameAllocatorPrivate +{ +public: + QFrameAllocatorPrivate(); + + inline void *allocateAtChunk(uint allocatorIndex) + { + return m_allocatorPool[allocatorIndex].allocate(); + } + + inline void deallocateAtChunck(void *ptr, uint allocatorIndex) + { + m_allocatorPool[allocatorIndex].deallocate(ptr); + } + + inline uint allocatorIndexFromSize(uint targetSize) const + { + return (targetSize + m_alignment - 1) / m_alignment - 1; + } + + uint m_maxObjectSize; + uint m_alignment; + QVector<QFixedFrameAllocator> m_allocatorPool; +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3DCORE_QFRAMEALLOCATOR_P_P_H diff --git a/src/core/resources/qhandle_p.h b/src/core/resources/qhandle_p.h index 46bd5f5d4..15f34fe98 100644 --- a/src/core/resources/qhandle_p.h +++ b/src/core/resources/qhandle_p.h @@ -123,6 +123,13 @@ uint qHash(const QHandle<T> &h, uint seed) return qHash(h.handle(), seed); } +template <typename T> +uint qHash(const QHandle<T> &h) +{ + using QT_PREPEND_NAMESPACE(qHash); + return qHash(h.handle()); +} + } // Qt3DCore // simpler than fighting the Q_DECLARE_TYPEINFO macro, use QString as a dummy to get movable semantics diff --git a/src/core/resources/resources.pri b/src/core/resources/resources.pri index d25070d56..8fa4791c3 100644 --- a/src/core/resources/resources.pri +++ b/src/core/resources/resources.pri @@ -1,9 +1,12 @@ HEADERS += \ + $$PWD/qframeallocator_p.h \ + $$PWD/qframeallocator_p_p.h \ $$PWD/qloadgltf_p.h \ $$PWD/qresourcemanager_p.h \ $$PWD/qhandle_p.h SOURCES += \ + $$PWD/qframeallocator.cpp \ $$PWD/qresourcemanager.cpp diff --git a/src/core/transforms/qarmature.h b/src/core/transforms/qarmature.h index 5e02f99c3..34f91e280 100644 --- a/src/core/transforms/qarmature.h +++ b/src/core/transforms/qarmature.h @@ -42,13 +42,13 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DCore/qt3dcore_global.h> +#include <Qt3DCore/qabstractskeleton.h> QT_BEGIN_NAMESPACE namespace Qt3DCore { class QArmaturePrivate; -class QAbstractSkeleton; class Q_3DCORESHARED_EXPORT QArmature : public Qt3DCore::QComponent { diff --git a/src/core/transforms/qskeleton.h b/src/core/transforms/qskeleton.h index 51763b488..871d3b3b4 100644 --- a/src/core/transforms/qskeleton.h +++ b/src/core/transforms/qskeleton.h @@ -41,13 +41,13 @@ #define QT3DCORE_QSKELETON_H #include <Qt3DCore/qabstractskeleton.h> +#include <Qt3DCore/qjoint.h> #include <Qt3DCore/qt3dcore_global.h> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QJoint; class QSkeletonPrivate; class Q_3DCORESHARED_EXPORT QSkeleton : public QAbstractSkeleton diff --git a/src/core/transforms/qskeletonloader.h b/src/core/transforms/qskeletonloader.h index 23b8cdda4..d3297a67f 100644 --- a/src/core/transforms/qskeletonloader.h +++ b/src/core/transforms/qskeletonloader.h @@ -41,6 +41,7 @@ #define QT3DCORE_QSKELETONLOADER_H #include <Qt3DCore/qabstractskeleton.h> +#include <Qt3DCore/qjoint.h> #include <Qt3DCore/qt3dcore_global.h> #include <QtCore/qurl.h> @@ -48,7 +49,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QJoint; class QSkeletonLoaderPrivate; class Q_3DCORESHARED_EXPORT QSkeletonLoader : public QAbstractSkeleton diff --git a/src/extras/defaults/qabstractspritesheet.h b/src/extras/defaults/qabstractspritesheet.h index ec72473f9..d52d801fd 100644 --- a/src/extras/defaults/qabstractspritesheet.h +++ b/src/extras/defaults/qabstractspritesheet.h @@ -42,17 +42,12 @@ #include <Qt3DExtras/qt3dextras_global.h> #include <Qt3DCore/QNode> +#include <Qt3DRender/qabstracttexture.h> #include <QtGui/QVector2D> #include <QtGui/QMatrix3x3> QT_BEGIN_NAMESPACE -namespace Qt3DRender { - -class QAbstractTexture; - -} // namespace Qt3DRender - namespace Qt3DExtras { class QAbstractSpriteSheetPrivate; diff --git a/src/extras/defaults/qforwardrenderer.h b/src/extras/defaults/qforwardrenderer.h index 22334373c..165b17a41 100644 --- a/src/extras/defaults/qforwardrenderer.h +++ b/src/extras/defaults/qforwardrenderer.h @@ -42,6 +42,7 @@ #include <Qt3DExtras/qt3dextras_global.h> #include <Qt3DRender/qtechniquefilter.h> +#include <Qt3DCore/qentity.h> #include <QtCore/QRectF> #include <QtGui/QColor> #include <Qt3DRender/QClearBuffers> diff --git a/src/extras/defaults/qspritesheet.h b/src/extras/defaults/qspritesheet.h index d1faeb825..93c4262b0 100644 --- a/src/extras/defaults/qspritesheet.h +++ b/src/extras/defaults/qspritesheet.h @@ -41,6 +41,7 @@ #define QT3DEXTRAS_QSPRITESHEET_H #include <Qt3DExtras/qabstractspritesheet.h> +#include <Qt3DExtras/qspritesheetitem.h> #include <QtCore/QRect> #include <QtCore/QVector> @@ -48,7 +49,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DExtras { -class QSpriteSheetItem; class QSpriteSheetPrivate; class Q_3DEXTRASSHARED_EXPORT QSpriteSheet : public QAbstractSpriteSheet diff --git a/src/extras/defaults/qt3dwindow.cpp b/src/extras/defaults/qt3dwindow.cpp index 8fcc77a29..34264a89f 100644 --- a/src/extras/defaults/qt3dwindow.cpp +++ b/src/extras/defaults/qt3dwindow.cpp @@ -298,7 +298,7 @@ void setupWindowSurface(QWindow *window, Qt3DRender::API api) noexcept break; } QSurfaceFormat format = QSurfaceFormat::defaultFormat(); -#ifdef QT_OPENGL_ES_2 +#if QT_CONFIG(opengles2) format.setRenderableType(QSurfaceFormat::OpenGLES); #else if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { diff --git a/src/extras/text/qdistancefieldglyphcache.cpp b/src/extras/text/qdistancefieldglyphcache.cpp index 66d2c0495..63621848c 100644 --- a/src/extras/text/qdistancefieldglyphcache.cpp +++ b/src/extras/text/qdistancefieldglyphcache.cpp @@ -44,6 +44,7 @@ #include "qdistancefieldglyphcache_p.h" #include "qtextureatlas_p.h" +#include <QtGui/qpainterpath.h> #include <QtGui/qfont.h> #include <QtGui/qpainterpath.h> #include <QtGui/private/qdistancefield_p.h> diff --git a/src/input/backend/assignkeyboardfocusjob_p.h b/src/input/backend/assignkeyboardfocusjob_p.h index 200fd72f1..0789a8dbc 100644 --- a/src/input/backend/assignkeyboardfocusjob_p.h +++ b/src/input/backend/assignkeyboardfocusjob_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <Qt3DInput/qkeyboarddevice.h> #include <Qt3DCore/qaspectjob.h> #include <Qt3DCore/qnodeid.h> diff --git a/src/input/frontend/qactioninput.h b/src/input/frontend/qactioninput.h index 7bc9a768d..86dfcb282 100644 --- a/src/input/frontend/qactioninput.h +++ b/src/input/frontend/qactioninput.h @@ -41,6 +41,7 @@ #define QT3DINPUT_QACTIONINPUT_H #include <Qt3DInput/qabstractactioninput.h> +#include <Qt3DInput/qabstractphysicaldevice.h> #include <Qt3DInput/qt3dinput_global.h> #include <Qt3DCore/qnode.h> @@ -48,7 +49,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DInput { -class QAbstractPhysicalDevice; class QActionInputPrivate; class Q_3DINPUTSHARED_EXPORT QActionInput : public Qt3DInput::QAbstractActionInput diff --git a/src/input/frontend/qaxisaccumulator.h b/src/input/frontend/qaxisaccumulator.h index 4f12f2a69..e767b426f 100644 --- a/src/input/frontend/qaxisaccumulator.h +++ b/src/input/frontend/qaxisaccumulator.h @@ -41,13 +41,13 @@ #define QT3DINPUT_QAXISACCUMULATOR_H #include <Qt3DInput/qt3dinput_global.h> +#include <Qt3DInput/qaxis.h> #include <Qt3DCore/qcomponent.h> QT_BEGIN_NAMESPACE namespace Qt3DInput { -class QAxis; class QAxisAccumulatorPrivate; class Q_3DINPUTSHARED_EXPORT QAxisAccumulator : public Qt3DCore::QComponent diff --git a/src/input/frontend/qkeyboarddevice.h b/src/input/frontend/qkeyboarddevice.h index ee4b864f7..8b309f6a7 100644 --- a/src/input/frontend/qkeyboarddevice.h +++ b/src/input/frontend/qkeyboarddevice.h @@ -40,7 +40,7 @@ #ifndef QT3DINPUT_INPUT_QKEYBOARDDEVICE_H #define QT3DINPUT_INPUT_QKEYBOARDDEVICE_H -#include <Qt3DInput/QKeyboardHandler> +#include <Qt3DInput/qkeyboardhandler.h> #include <Qt3DInput/qt3dinput_global.h> #include <Qt3DInput/qabstractphysicaldevice.h> @@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DInput { class QKeyboardDevicePrivate; -class QKeyboardHandler; class Q_3DINPUTSHARED_EXPORT QKeyboardDevice : public Qt3DInput::QAbstractPhysicalDevice { diff --git a/src/input/frontend/qkeyboardhandler.h b/src/input/frontend/qkeyboardhandler.h index 1ee9ef1af..6dac60c37 100644 --- a/src/input/frontend/qkeyboardhandler.h +++ b/src/input/frontend/qkeyboardhandler.h @@ -56,6 +56,7 @@ class Q_3DINPUTSHARED_EXPORT QKeyboardHandler : public Qt3DCore::QComponent Q_OBJECT Q_PROPERTY(Qt3DInput::QKeyboardDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged) Q_PROPERTY(bool focus READ focus WRITE setFocus NOTIFY focusChanged) + Q_MOC_INCLUDE("Qt3DInput/qkeyboarddevice.h") public: explicit QKeyboardHandler(QNode *parent = nullptr); ~QKeyboardHandler(); diff --git a/src/input/frontend/qmousedevice.h b/src/input/frontend/qmousedevice.h index 66ad39e0f..3f8850d49 100644 --- a/src/input/frontend/qmousedevice.h +++ b/src/input/frontend/qmousedevice.h @@ -48,11 +48,8 @@ QT_BEGIN_NAMESPACE namespace Qt3DInput { class QMouseDevicePrivate; -class QMouseHandler; - class QMouseInput; - class Q_3DINPUTSHARED_EXPORT QMouseDevice : public Qt3DInput::QAbstractPhysicalDevice { Q_OBJECT diff --git a/src/input/frontend/qmousehandler.h b/src/input/frontend/qmousehandler.h index 307d30e9f..e895d8dd3 100644 --- a/src/input/frontend/qmousehandler.h +++ b/src/input/frontend/qmousehandler.h @@ -42,13 +42,13 @@ #include <Qt3DInput/qt3dinput_global.h> #include <Qt3DInput/qmouseevent.h> +#include <Qt3DInput/qmousedevice.h> #include <Qt3DCore/qcomponent.h> QT_BEGIN_NAMESPACE namespace Qt3DInput { -class QMouseDevice; class QMouseHandlerPrivate; class Q_3DINPUTSHARED_EXPORT QMouseHandler : public Qt3DCore::QComponent diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp index 30a8184b5..5daef2d47 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicscontext.cpp @@ -63,7 +63,8 @@ #include <renderbuffer_p.h> #include <glshader_p.h> -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) +#include <QtOpenGL/QOpenGLVersionFunctionsFactory> #include <QOpenGLFunctions_2_0> #include <QOpenGLFunctions_3_2_Core> #include <QOpenGLFunctions_3_3_Core> @@ -384,19 +385,19 @@ GraphicsHelperInterface *GraphicsContext::resolveHighestOpenGLFunctions() } glHelper->initializeHelper(m_gl, nullptr); } -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) else { QAbstractOpenGLFunctions *glFunctions = nullptr; - if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_4_3_Core>()) != nullptr) { + if ((glFunctions = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_3_Core>()) != nullptr) { qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 4.3"; glHelper = new GraphicsHelperGL4(); - } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_3_3_Core>()) != nullptr) { + } else if ((glFunctions = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_3_Core>()) != nullptr) { qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 3.3"; glHelper = new GraphicsHelperGL3_3(); - } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_3_2_Core>()) != nullptr) { + } else if ((glFunctions = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_2_Core>()) != nullptr) { qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 3.2"; glHelper = new GraphicsHelperGL3_2(); - } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_2_0>()) != nullptr) { + } else if ((glFunctions = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_2_0>()) != nullptr) { qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 2 Helper"; glHelper = new GraphicsHelperGL2(); } @@ -892,7 +893,7 @@ GLint GraphicsContext::elementType(GLint type) case GL_FLOAT_VEC4: return GL_FLOAT; -#ifndef QT_OPENGL_ES_2 // Otherwise compile error as Qt defines GL_DOUBLE as GL_FLOAT when using ES2 +#if !QT_CONFIG(opengles2) // Otherwise compile error as Qt defines GL_DOUBLE as GL_FLOAT when using ES2 case GL_DOUBLE: #ifdef GL_DOUBLE_VEC3 // For compiling on pre GL 4.1 systems case GL_DOUBLE_VEC2: @@ -912,7 +913,7 @@ GLint GraphicsContext::tupleSizeFromType(GLint type) { switch (type) { case GL_FLOAT: -#ifndef QT_OPENGL_ES_2 // Otherwise compile error as Qt defines GL_DOUBLE as GL_FLOAT when using ES2 +#if !QT_CONFIG(opengles2) // Otherwise compile error as Qt defines GL_DOUBLE as GL_FLOAT when using ES2 case GL_DOUBLE: #endif case GL_UNSIGNED_BYTE: @@ -948,7 +949,7 @@ GLuint GraphicsContext::byteSizeFromType(GLint type) { switch (type) { case GL_FLOAT: return sizeof(float); -#ifndef QT_OPENGL_ES_2 // Otherwise compile error as Qt defines GL_DOUBLE as GL_FLOAT when using ES2 +#if !QT_CONFIG(opengles2) // Otherwise compile error as Qt defines GL_DOUBLE as GL_FLOAT when using ES2 case GL_DOUBLE: return sizeof(double); #endif case GL_UNSIGNED_BYTE: return sizeof(unsigned char); @@ -990,7 +991,7 @@ GLint GraphicsContext::glDataTypeFromAttributeDataType(Qt3DCore::QAttribute::Ver #ifdef GL_HALF_FLOAT return GL_HALF_FLOAT; #endif -#ifndef QT_OPENGL_ES_2 // Otherwise compile error as Qt defines GL_DOUBLE as GL_FLOAT when using ES2 +#if !QT_CONFIG(opengles2) // Otherwise compile error as Qt defines GL_DOUBLE as GL_FLOAT when using ES2 case QAttribute::Double: return GL_DOUBLE; #endif diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp index 3ae9ed932..72cee57a4 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes2.cpp @@ -79,7 +79,7 @@ GraphicsHelperES2::~GraphicsHelperES2() } void GraphicsHelperES2::initializeHelper(QOpenGLContext *context, - QAbstractOpenGLFunctions *) + QAbstractOpenGLFunctions *) { Q_ASSERT(context); m_funcs = context->functions(); diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp index 97a256b9c..c4a68229c 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp @@ -180,7 +180,7 @@ GraphicsHelperES3::~GraphicsHelperES3() } void GraphicsHelperES3::initializeHelper(QOpenGLContext *context, - QAbstractOpenGLFunctions *functions) + QAbstractOpenGLFunctions *functions) { GraphicsHelperES2::initializeHelper(context, functions); m_extraFuncs = context->extraFunctions(); diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp index 6989be743..45704076b 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "graphicshelpergl2_p.h" -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_2_0> #include <private/attachmentpack_p.h> #include <QtOpenGLExtensions/QOpenGLExtensions> diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h index 7eac312b8..cb38ea481 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h @@ -53,7 +53,7 @@ #include <graphicshelperinterface_p.h> -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) QT_BEGIN_NAMESPACE diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp index cb0a62224..021c668b2 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp @@ -39,7 +39,7 @@ #include "graphicshelpergl3_2_p.h" -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_3_2_Core> #include <QOpenGLFunctions_3_3_Core> #include <QtOpenGLExtensions/qopenglextensions.h> diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h index a7396dc87..3e363337d 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h @@ -54,7 +54,7 @@ #include <graphicshelperinterface_p.h> #include <QtCore/qscopedpointer.h> -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) QT_BEGIN_NAMESPACE diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp index f5a61aa4b..200d9c3eb 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp @@ -39,7 +39,7 @@ #include "graphicshelpergl3_3_p.h" -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_3_3_Core> #include <QtOpenGLExtensions/qopenglextensions.h> #include <private/attachmentpack_p.h> diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h index 3b667420c..68eebe987 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h @@ -54,7 +54,7 @@ #include <graphicshelperinterface_p.h> #include <QtCore/qscopedpointer.h> -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) QT_BEGIN_NAMESPACE diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp index 96e055870..0a36e6a24 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp @@ -39,7 +39,7 @@ #include "graphicshelpergl4_p.h" -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_4_3_Core> #include <QtOpenGLExtensions/qopenglextensions.h> #include <private/attachmentpack_p.h> diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h index 1fa390806..8d3e8f957 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h @@ -54,7 +54,7 @@ #include <graphicshelperinterface_p.h> #include <QtCore/qscopedpointer.h> -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) QT_BEGIN_NAMESPACE diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h index bbbf05ee0..b574c34a1 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h @@ -53,6 +53,7 @@ #include <QOpenGLFunctions> #include <QOpenGLTexture> +#include <QOpenGLVersionFunctions> #include <QVector> #include <shadervariables_p.h> #include <Qt3DRender/private/uniform_p.h> diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp index d4d3457ab..0cba8760c 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -66,7 +66,7 @@ #include <openglvertexarrayobject_p.h> #include <QOpenGLShaderProgram> -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_2_0> #include <QOpenGLFunctions_3_2_Core> #include <QOpenGLFunctions_3_3_Core> @@ -628,7 +628,7 @@ QImage SubmissionContext::readFramebuffer(const QRect &rect) case QAbstractTexture::RGBA8_UNorm: case QAbstractTexture::RGBA8U: case QAbstractTexture::SRGB8_Alpha8: -#ifdef QT_OPENGL_ES_2 +#if QT_CONFIG(opengles2) format = GL_RGBA; imageFormat = QImage::Format_RGBA8888_Premultiplied; #else @@ -644,7 +644,7 @@ QImage SubmissionContext::readFramebuffer(const QRect &rect) case QAbstractTexture::RGBFormat: case QAbstractTexture::RGB8U: case QAbstractTexture::RGB8_UNorm: -#ifdef QT_OPENGL_ES_2 +#if QT_CONFIG(opengles2) format = GL_RGBA; imageFormat = QImage::Format_RGBX8888; #else @@ -656,7 +656,7 @@ QImage SubmissionContext::readFramebuffer(const QRect &rect) bytes = area * 4; stride = rect.width() * 4; break; -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) case QAbstractTexture::RG11B10F: bytes = area * 4; format = GL_RGB; @@ -1074,7 +1074,7 @@ void SubmissionContext::resetMasked(qint64 maskOfStatesToReset) if (maskOfStatesToReset & LineWidthMask) funcs->glLineWidth(1.0f); -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) if (maskOfStatesToReset & RasterModeMask) m_glHelper->rasterMode(GL_FRONT_AND_BACK, GL_FILL); #endif diff --git a/src/plugins/renderers/opengl/renderer/frameprofiler_p.h b/src/plugins/renderers/opengl/renderer/frameprofiler_p.h index 591ace53e..f1d235724 100644 --- a/src/plugins/renderers/opengl/renderer/frameprofiler_p.h +++ b/src/plugins/renderers/opengl/renderer/frameprofiler_p.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#if !defined(QT_NO_OPENGL) && !QT_CONFIG(opengles2) #define QT3D_SUPPORTS_GL_MONITOR #endif diff --git a/src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h b/src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h index ff58b3074..7ab7fbb05 100644 --- a/src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h +++ b/src/plugins/renderers/opengl/renderer/openglvertexarrayobject_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtGui/qopenglvertexarrayobject.h> +#include <QOpenGLVertexArrayObject> #include <submissioncontext_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/renderers/opengl/renderer/renderer.cpp b/src/plugins/renderers/opengl/renderer/renderer.cpp index 57ee5ec88..45b74d924 100644 --- a/src/plugins/renderers/opengl/renderer/renderer.cpp +++ b/src/plugins/renderers/opengl/renderer/renderer.cpp @@ -866,7 +866,6 @@ void Renderer::enqueueRenderView(RenderView *renderView, int submitOrder) } bool Renderer::canRender() const - { // Make sure that we've not been told to terminate if (m_renderThread && !m_running.loadRelaxed()) { diff --git a/src/plugins/renderers/opengl/textures/gltexture.cpp b/src/plugins/renderers/opengl/textures/gltexture.cpp index 30247a719..a44ef6877 100644 --- a/src/plugins/renderers/opengl/textures/gltexture.cpp +++ b/src/plugins/renderers/opengl/textures/gltexture.cpp @@ -45,6 +45,7 @@ #include <private/qopengltexturehelper_p.h> #include <QDebug> #include <QOpenGLFunctions> +#include <QtOpenGL/QOpenGLVersionFunctionsFactory> #include <QOpenGLTexture> #include <QOpenGLPixelTransferOptions> #include <Qt3DRender/qtexture.h> @@ -55,7 +56,7 @@ #include <Qt3DRender/private/qtextureimagedata_p.h> #include <renderbuffer_p.h> -#if !defined(QT_OPENGL_ES_2) +#if !QT_CONFIG(opengles2) #include <QOpenGLFunctions_3_1> #include <QOpenGLFunctions_4_5_Core> #endif @@ -660,7 +661,7 @@ void GLTexture::introspectPropertiesFromSharedTextureId() const QAbstractTexture::Target targets[] = { QAbstractTexture::Target2D, QAbstractTexture::TargetCubeMap, -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) QAbstractTexture::Target1D, QAbstractTexture::Target1DArray, QAbstractTexture::Target3D, @@ -673,13 +674,13 @@ void GLTexture::introspectPropertiesFromSharedTextureId() #endif }; -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) // Try to find texture target with GL 4.5 functions const QPair<int, int> ctxGLVersion = ctx->format().version(); if (ctxGLVersion.first > 4 || (ctxGLVersion.first == 4 && ctxGLVersion.second >= 5)) { // Only for GL 4.5+ #ifdef GL_TEXTURE_TARGET - QOpenGLFunctions_4_5_Core *gl5 = ctx->versionFunctions<QOpenGLFunctions_4_5_Core>(); + QOpenGLFunctions_4_5_Core *gl5 = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_5_Core>(); if (gl5 != nullptr) gl5->glGetTextureParameteriv(m_sharedTextureId, GL_TEXTURE_TARGET, reinterpret_cast<int *>(&m_properties.target)); #endif @@ -694,7 +695,7 @@ void GLTexture::introspectPropertiesFromSharedTextureId() const GLenum targetBindings[] = { GL_TEXTURE_BINDING_2D, GL_TEXTURE_BINDING_CUBE_MAP, -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) GL_TEXTURE_BINDING_1D, GL_TEXTURE_BINDING_1D_ARRAY, GL_TEXTURE_BINDING_3D, @@ -748,10 +749,10 @@ void GLTexture::introspectPropertiesFromSharedTextureId() gl->glGetTexParameteriv(int(m_properties.target), GL_TEXTURE_WRAP_S, reinterpret_cast<int *>(&m_parameters.wrapModeY)); gl->glGetTexParameteriv(int(m_properties.target), GL_TEXTURE_WRAP_T, reinterpret_cast<int *>(&m_parameters.wrapModeZ)); -#ifndef QT_OPENGL_ES_2 +#if !QT_CONFIG(opengles2) // Try to retrieve dimensions (not available on ES 2.0) if (!ctx->isOpenGLES()) { - QOpenGLFunctions_3_1 *gl3 = ctx->versionFunctions<QOpenGLFunctions_3_1>(); + QOpenGLFunctions_3_1 *gl3 = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_3_1>(); if (!gl3) { qWarning() << "Failed to retrieve shared texture dimensions"; return; diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp index 5b217929c..2d0292d9d 100644 --- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp @@ -39,6 +39,7 @@ #include "submissioncontext_p.h" +#include <Qt3DCore/private/qbuffer_p.h> #include <Qt3DRender/qgraphicsapifilter.h> #include <Qt3DRender/qparameter.h> #include <Qt3DRender/qcullface.h> @@ -60,7 +61,6 @@ #include <Qt3DRender/private/buffermanager_p.h> #include <Qt3DRender/private/managers_p.h> #include <Qt3DRender/private/attachmentpack_p.h> -#include <Qt3DRender/private/qbuffer_p.h> #include <Qt3DRender/private/stringtoint_p.h> #include <Qt3DRender/private/vulkaninstance_p.h> #include <QGuiApplication> @@ -96,6 +96,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt3DCore; + namespace Qt3DRender { namespace Render { namespace Rhi { @@ -1514,7 +1516,7 @@ void SubmissionContext::uploadDataToRHIBuffer(Buffer *buffer, RHIBuffer *b, bool // Note: we are only storing the updates data CPU side at this point // actually upload will be performed when the buffer will be bound // as we would otherwise need to know the usage type of the buffer - QVector<Qt3DRender::QBufferUpdate> updates = std::move(buffer->pendingBufferUpdates()); + QVector<Qt3DCore::QBufferUpdate> updates = std::move(buffer->pendingBufferUpdates()); for (auto it = updates.begin(); it != updates.end(); ++it) { auto update = it; // We have a partial update diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h index 7578639e6..979bf7ec9 100644 --- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h +++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h @@ -54,7 +54,6 @@ #include <rhibuffer_p.h> #include <Qt3DRender/qclearbuffers.h> -#include <Qt3DRender/qattribute.h> #include <Qt3DRender/private/handle_types_p.h> #include <Qt3DRender/qblitframebuffer.h> #include <Qt3DRender/private/shader_p.h> diff --git a/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h b/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h index 34758530d..3d78c5d07 100644 --- a/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h +++ b/src/plugins/renderers/rhi/managers/rhiresourcemanagers_p.h @@ -132,6 +132,13 @@ inline uint qHash(const GraphicsPipelineIdentifier &key, uint seed) return qHash(p, seed) + qHash(key.renderViewIndex, seed); } +inline uint qHash(const GraphicsPipelineIdentifier &key) +{ + const QPair<HGeometry, Qt3DCore::QNodeId> p = { key.geometry, key.shader }; + using QT_PREPEND_NAMESPACE(qHash); + return qHash(p) + qHash(key.renderViewIndex); +} + inline bool operator==(const GraphicsPipelineIdentifier &a, const GraphicsPipelineIdentifier &b) { return a.geometry == b.geometry && a.shader == b.shader diff --git a/src/plugins/renderers/rhi/renderer/rendercommand.cpp b/src/plugins/renderers/rhi/renderer/rendercommand.cpp index 8320abac1..065bc71a0 100644 --- a/src/plugins/renderers/rhi/renderer/rendercommand.cpp +++ b/src/plugins/renderers/rhi/renderer/rendercommand.cpp @@ -62,7 +62,7 @@ RenderCommand::RenderCommand() m_instanceCount(0), m_indexOffset(0), m_indexAttributeByteOffset(0), - m_indexAttributeDataType(Qt3DRender::QAttribute::UnsignedShort), + m_indexAttributeDataType(Qt3DCore::QAttribute::UnsignedShort), m_indirectAttributeByteOffset(0), m_drawIndexed(false), m_drawIndirect(false), diff --git a/src/plugins/renderers/rhi/renderer/rendercommand_p.h b/src/plugins/renderers/rhi/renderer/rendercommand_p.h index e6924a60c..decc87230 100644 --- a/src/plugins/renderers/rhi/renderer/rendercommand_p.h +++ b/src/plugins/renderers/rhi/renderer/rendercommand_p.h @@ -62,7 +62,7 @@ #include <QOpenGLTexture> #include <QMatrix4x4> #include <QtGui/private/qrhi_p.h> -#include <Qt3DRender/qattribute.h> +#include <Qt3DCore/qattribute.h> QT_BEGIN_NAMESPACE class QRhiGraphicsPipeline; @@ -137,7 +137,7 @@ public: int m_instanceCount; int m_indexOffset; uint m_indexAttributeByteOffset; - Qt3DRender::QAttribute::VertexBaseType m_indexAttributeDataType; + Qt3DCore::QAttribute::VertexBaseType m_indexAttributeDataType; uint m_indirectAttributeByteOffset; bool m_drawIndexed; bool m_drawIndirect; diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp index ee9a26a98..c27a4e097 100644 --- a/src/plugins/renderers/rhi/renderer/renderer.cpp +++ b/src/plugins/renderers/rhi/renderer/renderer.cpp @@ -73,7 +73,6 @@ #include <Qt3DRender/private/geometryrenderermanager_p.h> #include <Qt3DRender/private/techniquemanager_p.h> #include <Qt3DRender/private/platformsurfacefilter_p.h> -#include <Qt3DRender/private/loadbufferjob_p.h> #include <Qt3DRender/private/rendercapture_p.h> #include <Qt3DRender/private/updatelevelofdetailjob_p.h> #include <Qt3DRender/private/buffercapture_p.h> @@ -1286,7 +1285,7 @@ void Renderer::lookForDownloadableBuffers() const QVector<HBuffer> activeBufferHandles = m_nodesManager->bufferManager()->activeHandles(); for (const HBuffer &handle : activeBufferHandles) { Buffer *buffer = m_nodesManager->bufferManager()->data(handle); - if (buffer->access() & QBuffer::Read) + if (buffer->access() & Qt3DCore::QBuffer::Read) m_downloadableBuffers.push_back(buffer->peerId()); } } diff --git a/src/plugins/renderers/rhi/renderer/renderview.cpp b/src/plugins/renderers/rhi/renderer/renderview.cpp index 54295ef5f..789118f60 100644 --- a/src/plugins/renderers/rhi/renderer/renderview.cpp +++ b/src/plugins/renderers/rhi/renderer/renderview.cpp @@ -621,6 +621,8 @@ EntityRenderCommandData RenderView::buildDrawRenderCommands(const QVector<Entity const QVector<Qt3DCore::QNodeId> attributeIds = geometry->attributes(); for (Qt3DCore::QNodeId attributeId : attributeIds) { + using namespace Qt3DCore; + Attribute *attribute = m_manager->attributeManager()->lookupResource(attributeId); switch (attribute->attributeType()) { diff --git a/src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp b/src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp index 6455d2e10..72c27de1d 100644 --- a/src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp +++ b/src/plugins/renderers/rhi/renderer/renderviewbuilder.cpp @@ -466,9 +466,13 @@ public: m_renderer->cache()->leafNodeCache[m_leafNode]; dataCacheForLeaf.materialParameterGatherer.clear(); - for (const auto &materialGatherer : qAsConst(m_materialParameterGathererJobs)) - dataCacheForLeaf.materialParameterGatherer.unite( - materialGatherer->materialToPassAndParameter()); + for (const auto &materialGatherer : qAsConst(m_materialParameterGathererJobs)) { + const MaterialParameterGathererData &source = materialGatherer->materialToPassAndParameter(); + for (auto it = std::begin(source); it != std::end(source); ++it) { + Q_ASSERT(!dataCacheForLeaf.materialParameterGatherer.contains(it.key())); + dataCacheForLeaf.materialParameterGatherer.insert(it.key(), it.value()); + } + } } private: diff --git a/src/plugins/renderers/rhi/textures/texture_p.h b/src/plugins/renderers/rhi/textures/texture_p.h index 536cb962e..c78bc1c1b 100644 --- a/src/plugins/renderers/rhi/textures/texture_p.h +++ b/src/plugins/renderers/rhi/textures/texture_p.h @@ -53,7 +53,7 @@ #include <Qt3DRender/qtexture.h> #include <Qt3DRender/qtextureimagedata.h> -#include <Qt3DRender/qtexturegenerator.h> +#include <Qt3DRender/private/qtexturegenerator_p.h> #include <Qt3DRender/private/backendnode_p.h> #include <Qt3DRender/private/handle_types_p.h> #include <Qt3DRender/private/texture_p.h> diff --git a/src/quick3d/imports/scene3d/scene3ditem_p.h b/src/quick3d/imports/scene3d/scene3ditem_p.h index 0beaf94c0..5cd94d74b 100644 --- a/src/quick3d/imports/scene3d/scene3ditem_p.h +++ b/src/quick3d/imports/scene3d/scene3ditem_p.h @@ -53,6 +53,7 @@ #include <QtCore/qpointer.h> #include <QtQuick/QQuickItem> +#include <Qt3DCore/qentity.h> QT_BEGIN_NAMESPACE diff --git a/src/quick3d/imports/scene3d/scene3dview_p.h b/src/quick3d/imports/scene3d/scene3dview_p.h index ffb80f93b..c39c81dd8 100644 --- a/src/quick3d/imports/scene3d/scene3dview_p.h +++ b/src/quick3d/imports/scene3d/scene3dview_p.h @@ -53,16 +53,13 @@ #include <QtQuick/QQuickItem> #include <QtCore/QFlags> +#include <Qt3DCore/qentity.h> +#include "scene3ditem_p.h" QT_BEGIN_NAMESPACE class QSGTexture; -namespace Qt3DCore { -class QEntity; -class QNode; -} - namespace Qt3DRender { class QLayer; diff --git a/src/quick3d/quick3d/items/quick3dbuffer.cpp b/src/quick3d/quick3d/items/quick3dbuffer.cpp index 7beb1cc90..dd2c4dca4 100644 --- a/src/quick3d/quick3d/items/quick3dbuffer.cpp +++ b/src/quick3d/quick3d/items/quick3dbuffer.cpp @@ -71,7 +71,7 @@ QByteArray Quick3DBuffer::convertToRawData(const QJSValue &jsValue) Q_ASSERT(m_v4engine); QV4::Scope scope(m_v4engine); QV4::Scoped<QV4::TypedArray> typedArray(scope, - QJSValuePrivate::convertedToValue(m_v4engine, jsValue)); + QJSValuePrivate::convertToReturnedValue(m_v4engine, jsValue)); if (!typedArray) return QByteArray(); diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.h b/src/quick3d/quick3dscene2d/items/qscene2d.h index 136d6347f..22708bf21 100644 --- a/src/quick3d/quick3dscene2d/items/qscene2d.h +++ b/src/quick3d/quick3dscene2d/items/qscene2d.h @@ -43,7 +43,7 @@ #include <QtCore/QUrl> #include <QtCore/QEvent> -#include <Qt3DCore/qnode.h> +#include <Qt3DCore/qentity.h> #include <QtQuick/qquickitem.h> diff --git a/src/quick3d/quick3dscene2d/items/scene2d.cpp b/src/quick3d/quick3dscene2d/items/scene2d.cpp index 2b0a6580d..4e2dbcd18 100644 --- a/src/quick3d/quick3dscene2d/items/scene2d.cpp +++ b/src/quick3d/quick3dscene2d/items/scene2d.cpp @@ -244,7 +244,7 @@ void Scene2D::initializeRender() m_context->makeCurrent(m_sharedObject->m_surface); m_sharedObject->m_renderControl->initialize(m_context); -#ifdef QT_OPENGL_ES_2_ANGLE +#if QT_CONFIG(angle) m_usingAngle = false; if (m_context->isOpenGLES()) { const char *versionStr = reinterpret_cast<const char *>( @@ -309,7 +309,7 @@ void Scene2D::render() const Qt3DRender::Render::Attachment *attachmentData = nullptr; QMutex *textureLock = nullptr; -#ifdef QT_OPENGL_ES_2_ANGLE +#if QT_CONFIG(angle) QScopedPointer<SurfaceLocker> surfaceLocker; if (m_usingAngle) surfaceLocker.reset(new SurfaceLocker(m_sharedObject->m_surface)); @@ -329,7 +329,7 @@ void Scene2D::render() new Scene2DEvent(Scene2DEvent::Render)); return; } -#ifdef QT_OPENGL_ES_2_ANGLE +#if QT_CONFIG(angle) if (m_usingAngle == false) textureLock->lock(); #else @@ -382,7 +382,7 @@ void Scene2D::render() m_context->functions()->glFlush(); if (texture->isAutoMipMapGenerationEnabled()) texture->generateMipMaps(); -#ifdef QT_OPENGL_ES_2_ANGLE +#if QT_CONFIG(angle) if (m_usingAngle == false) textureLock->unlock(); #else diff --git a/src/quick3d/quick3dscene2d/items/scene2d_p.h b/src/quick3d/quick3dscene2d/items/scene2d_p.h index c7626f73d..539602b2d 100644 --- a/src/quick3d/quick3dscene2d/items/scene2d_p.h +++ b/src/quick3d/quick3dscene2d/items/scene2d_p.h @@ -119,7 +119,7 @@ public: Qt3DRender::Quick::QScene2D::RenderPolicy m_renderPolicy; QVector<Qt3DCore::QNodeId> m_entities; Qt3DRender::QPickEventPtr m_cachedPickEvent; -#ifdef QT_OPENGL_ES_2_ANGLE +#if QT_CONFIG(angle) bool m_usingAngle; #endif QVector<QMetaObject::Connection> m_connections; diff --git a/src/render/framegraph/qblitframebuffer.h b/src/render/framegraph/qblitframebuffer.h index 22c422928..75943ee2c 100644 --- a/src/render/framegraph/qblitframebuffer.h +++ b/src/render/framegraph/qblitframebuffer.h @@ -42,6 +42,7 @@ #include <Qt3DRender/qframegraphnode.h> #include <Qt3DRender/qrendertargetoutput.h> +#include <Qt3DRender/qrendertarget.h> #include <QtCore/QRect> QT_BEGIN_NAMESPACE @@ -49,7 +50,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { class QBlitFramebufferPrivate; -class QRenderTarget; class Q_3DRENDERSHARED_EXPORT QBlitFramebuffer : public QFrameGraphNode { diff --git a/src/render/framegraph/qcameraselector.h b/src/render/framegraph/qcameraselector.h index 61d730f57..99e108af0 100644 --- a/src/render/framegraph/qcameraselector.h +++ b/src/render/framegraph/qcameraselector.h @@ -40,6 +40,7 @@ #ifndef QT3DRENDER_QCAMERASELECTOR_H #define QT3DRENDER_QCAMERASELECTOR_H +#include <Qt3DCore/qentity.h> #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qframegraphnode.h> diff --git a/src/render/framegraph/qproximityfilter.h b/src/render/framegraph/qproximityfilter.h index 56b48c46f..860807773 100644 --- a/src/render/framegraph/qproximityfilter.h +++ b/src/render/framegraph/qproximityfilter.h @@ -40,6 +40,7 @@ #ifndef QT3DRENDER_QPROXIMITYFILTER_H #define QT3DRENDER_QPROXIMITYFILTER_H +#include <Qt3DCore/qentity.h> #include <Qt3DRender/qframegraphnode.h> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qrendertargetselector.h b/src/render/framegraph/qrendertargetselector.h index cb6c679ff..84fdfe82e 100644 --- a/src/render/framegraph/qrendertargetselector.h +++ b/src/render/framegraph/qrendertargetselector.h @@ -44,13 +44,13 @@ #include <Qt3DCore/qnode.h> #include <Qt3DRender/qframegraphnode.h> #include <Qt3DRender/qrendertargetoutput.h> +#include <Qt3DRender/qrendertarget.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { class QRenderTargetSelectorPrivate; -class QRenderTarget; class Q_3DRENDERSHARED_EXPORT QRenderTargetSelector : public QFrameGraphNode { diff --git a/src/render/frontend/qcamera.h b/src/render/frontend/qcamera.h index b57f57957..82a1c04bd 100644 --- a/src/render/frontend/qcamera.h +++ b/src/render/frontend/qcamera.h @@ -41,6 +41,7 @@ #define QT3DRENDER_CAMERA_H #include <Qt3DCore/qentity.h> +#include <Qt3DCore/qtransform.h> #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qcameralens.h> #include <QtGui/QMatrix4x4> @@ -49,11 +50,6 @@ QT_BEGIN_NAMESPACE -namespace Qt3DCore { -class QEntity; -class QTransform; -} - namespace Qt3DRender { class QCameraPrivate; diff --git a/src/render/frontend/qlevelofdetail.h b/src/render/frontend/qlevelofdetail.h index 1192ff1e8..f31c90db7 100644 --- a/src/render/frontend/qlevelofdetail.h +++ b/src/render/frontend/qlevelofdetail.h @@ -43,6 +43,7 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qlevelofdetailboundingsphere.h> +#include <Qt3DRender/qcamera.h> #include <QtGui/QVector3D> @@ -50,7 +51,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QCamera; class QLevelOfDetailPrivate; class Q_3DRENDERSHARED_EXPORT QLevelOfDetail : public Qt3DCore::QComponent diff --git a/src/render/materialsystem/qmaterial.h b/src/render/materialsystem/qmaterial.h index 74feb3675..2d306d016 100644 --- a/src/render/materialsystem/qmaterial.h +++ b/src/render/materialsystem/qmaterial.h @@ -44,15 +44,15 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DRender/qt3drender_global.h> +#include <Qt3DRender/qeffect.h> +#include <Qt3DRender/qabstracttexture.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QAbstractTexture; class QParameter; class QMaterialPrivate; -class QEffect; class Q_3DRENDERSHARED_EXPORT QMaterial : public Qt3DCore::QComponent { diff --git a/src/render/materialsystem/qshaderimage.h b/src/render/materialsystem/qshaderimage.h index cc9d3c728..de323f6c6 100644 --- a/src/render/materialsystem/qshaderimage.h +++ b/src/render/materialsystem/qshaderimage.h @@ -42,12 +42,12 @@ #include <Qt3DCore/qnode.h> #include <Qt3DRender/qt3drender_global.h> +#include <Qt3DRender/qabstracttexture.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QAbstractTexture; class QShaderImagePrivate; class Q_3DRENDERSHARED_EXPORT QShaderImage : public Qt3DCore::QNode diff --git a/src/render/materialsystem/qshaderprogrambuilder.h b/src/render/materialsystem/qshaderprogrambuilder.h index fa8f77ea0..2280306b3 100644 --- a/src/render/materialsystem/qshaderprogrambuilder.h +++ b/src/render/materialsystem/qshaderprogrambuilder.h @@ -42,6 +42,7 @@ #include <Qt3DCore/qnode.h> #include <Qt3DRender/qt3drender_global.h> +#include <Qt3DRender/qshaderprogram.h> #include <QtCore/qurl.h> @@ -49,7 +50,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QShaderProgram; class QShaderProgramBuilderPrivate; class Q_3DRENDERSHARED_EXPORT QShaderProgramBuilder : public Qt3DCore::QNode diff --git a/src/render/picking/qpickevent.h b/src/render/picking/qpickevent.h index 854008aaf..0733499bf 100644 --- a/src/render/picking/qpickevent.h +++ b/src/render/picking/qpickevent.h @@ -43,19 +43,15 @@ #include <QtCore/QObject> #include <QtGui/QVector3D> #include <QtCore/QPointF> +#include <Qt3DCore/qentity.h> +#include <Qt3DRender/qviewport.h> #include <Qt3DRender/qt3drender_global.h> QT_BEGIN_NAMESPACE -namespace Qt3DCore { -class QEntity; -} - namespace Qt3DRender { -class QViewport; class QPickEventPrivate; - class QPickEvent; typedef QSharedPointer<QPickEvent> QPickEventPtr; diff --git a/src/render/raycasting/qraycastingservice.cpp b/src/render/raycasting/qraycastingservice.cpp index bdb1557f7..e9a88e3a3 100644 --- a/src/render/raycasting/qraycastingservice.cpp +++ b/src/render/raycasting/qraycastingservice.cpp @@ -194,8 +194,9 @@ QQueryHandle QRayCastingService::query(const QRay3D &ray, // Blocking mapReduce #if QT_CONFIG(concurrent) - FutureQueryResult future = QtConcurrent::run(d, &QRayCastingServicePrivate::collides, - ray, provider, mode, handle); + FutureQueryResult future = QtConcurrent::run([d, ray, provider, mode, handle]{ + return d->collides(ray, provider, mode, handle); + }); d->m_results.insert(handle, future); #else d->m_results.insert(handle, d->collides(ray, provider, mode, handle)); diff --git a/src/render/renderstates/qstenciloperation.h b/src/render/renderstates/qstenciloperation.h index 3e2cbacea..313d1726b 100644 --- a/src/render/renderstates/qstenciloperation.h +++ b/src/render/renderstates/qstenciloperation.h @@ -41,13 +41,13 @@ #define QT3DRENDER_QSTENCILOPERATION_H #include <Qt3DRender/qrenderstate.h> +#include <Qt3DRender/qstenciloperationarguments.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { class QStencilOperationPrivate; -class QStencilOperationArguments; class Q_3DRENDERSHARED_EXPORT QStencilOperation : public QRenderState { diff --git a/src/render/renderstates/qstenciltest.h b/src/render/renderstates/qstenciltest.h index 1faaa524c..518255dbe 100644 --- a/src/render/renderstates/qstenciltest.h +++ b/src/render/renderstates/qstenciltest.h @@ -42,13 +42,13 @@ #define QT3DRENDER_QSTENCILTEST_H #include <Qt3DRender/qrenderstate.h> +#include <Qt3DRender/qstenciltestarguments.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { class QStencilTestPrivate; -class QStencilTestArguments; class Q_3DRENDERSHARED_EXPORT QStencilTest : public QRenderState { diff --git a/src/render/texture/qabstracttexture.h b/src/render/texture/qabstracttexture.h index 37329b61a..f46344eff 100644 --- a/src/render/texture/qabstracttexture.h +++ b/src/render/texture/qabstracttexture.h @@ -41,6 +41,7 @@ #define QT3DRENDER_QABSTRACTTEXTURE_H #include <Qt3DRender/qtextureimagedata.h> +#include <Qt3DRender/qtexturewrapmode.h> #include <Qt3DRender/qt3drender_global.h> #include <Qt3DCore/qnode.h> @@ -49,7 +50,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { class QAbstractTexturePrivate; -class QTextureWrapMode; class QAbstractTextureImage; class QTextureDataUpdate; |