summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix UB (signed char passed to <cctype> function)Marc Mutz2023-08-051-1/+1
| | | | | | | | | | | | | | Passing char to a <cctype> function is UB for characters that are outside the range [0...255, EOF]. You have to cast chars to uchar so the implicit conversion to int does not produce negative values. Amends a6ffce09ce6d4fd39fbb50eb58f7b5d1027f4d60. Change-Id: I597ee3ff87d38c40dbdf794ee07d302da26f520e Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit cf084d958c1d795fbdc06b6a377ab61d68e0960a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* GLTFImporter: fix crash when no material matchesAurélien Brooke2023-07-211-2/+2
| | | | | | | | | | Don't call renameFromJson(jsonObj, mat) with a nullptr mat. Fixes: QTBUG-100386 Change-Id: Ib35cd34212db6a309f629eabc93c19a69957eaf7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 670144a660823238ca286d5b631c9e1ae7dd8f00) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qt3dwindow: request Direct3DSurface when requesting d3d11Paul Lemire2023-07-201-1/+1
| | | | | | | Change-Id: I0c6f179d6663f74dbc709f1ef4fbe9ef7ce97901 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 1ef8b39dd9357aae347650937d730e3d29696807) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* ObjGeometryLoader: fix out-of-bounds accessesAurélien Brooke2023-06-121-1/+10
| | | | | | | | | | | | | We were reading values before the beginning of the array. "Conditional jump or move depends on uninitialised value(s)" Check the value of lineSize before using it as an index. Fixes: QTBUG-97751 Change-Id: I57c4f36973f3d5a6f9aecf4d22626af3e29f71f4 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit c1c07cb434fe4ead401e70d4fae7000ba6c50c76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Fix incorrect module/type names in \qmlproperty commandsTopi Reinio2023-06-0610-37/+37
| | | | | | | | | | | | | | | | Multiple \qmlproperty commands used a non-existent module identifier, or the name of the C++ module in place of the QML one. Also, in some instances, the C++ type name was used in \qmlproperty signature. Fixing these also makes a number of QML properties appear in the generated docs. Change-Id: I452361d3b0397d3ce405a2fb28577c37a24f02e3 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> (cherry picked from commit fdd85c5f3c4b1102e8a2ceea42782bae0b0e5076) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSkyboxEntity: add support for the RHI rendererAurélien Brooke2023-06-052-0/+18
| | | | | | | | | | | The shaders were already there, but no QTechnique was leveraging it. Fixes: QTBUG-113314 Fixes: QTBUG-112739 Change-Id: Ib53d73f7e78ba1a2e1727c384015a95c791dce82 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 56b8be847e9ebb1d9287df150f0cbe398eed94d6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Adapt to the RHI API conceptLaszlo Agocs2023-05-2212-27/+14
| | | | | | Task-number: QTBUG-113331 Change-Id: If874d14ee83db862f58445fdad2822dcf4cb7fc5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Revert "Doc: Add tests/manual in exampledirs to fix broken links"Topi Reinio2023-04-291-2/+1
| | | | | | | | | | | | | | | | This reverts commit dee62f491a761cc860e5377746264d9e2990eca2. Adding the manual tests as 'exampledirs' makes QDoc parse the example documentation and also adds broken entries to the examples-manifest.xml. We do not want the examples from /tests to generate documentation or appear in Qt Creator. Revert the change, and address the QDoc warnings that this commit tried to fix by other means. Pick-to: 6.5 Change-Id: I848344ae0836e341fabda5b740162b0015f6baf1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* Make 'struct Light' to support std140Inho Lee2023-04-201-1/+4
| | | | | | | | | | | | | Properties' offsets are not properly set for std140 standard. And they are not compatible to what the host machine supposes. Since the layout can be translated differently according to the graphics backend, it's safe to add paddings. Fixes: QTBUG-110128 Pick-to: 6.5 Change-Id: Ib0748f5b0476543ecd2e42252c434bcf4b371786 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix valgrind issue in GeometryRendererFriedemann Kleint2023-04-191-1/+2
| | | | | | | | | | | | | | | | | | | | | Initialize member hasView, fixing: ==20448== Conditional jump or move depends on uninitialised value(s) ==20448== Uninitialised value was created by a heap allocation ==20448== at 0x484DE30: memalign (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==20448== by 0x484DF92: posix_memalign (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==20448== by 0x4DC9DEE: _mm_malloc (mm_malloc.h:45) ==20448== by 0x4DC9DEE: Qt3DCore::AlignedAllocator::allocate(unsigned int) (qresourcemanager.cpp:63) ==20448== by 0x4B45C7F: allocateBucket (qresourcemanager_p.h:265) ==20448== by 0x4B45C7F: allocateResource (qresourcemanager_p.h:202) ==20448== by 0x4B45C7F: getOrAcquireHandle (qresourcemanager_p.h:369) ==20448== by 0x4B45C7F: getOrCreateResource (qresourcemanager_p.h:396) ==20448== by 0x4B45C7F: Qt3DRender::Render::GeometryRendererFunctor::create(Qt3DCore::QNodeId) const (geometryrenderer.cpp:191) Pick-to: 6.5 Task-number: QTBUG-112914 Change-Id: I7e55a782c85cbbdd538eab0a775a5aaa0f6d4b4c Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Enable build of Assimp on iOS and tvOSAurélien Brooke2023-04-131-1/+1
| | | | | | | | It compiles and runs perfectly fine. Pick-to: 6.5 Change-Id: Id733074567173ee9846e215687a0ab9950c9ab54 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Resolve QTransform symbol ambiguity in unity buildAmir Masoud Abdol2023-04-137-138/+149
| | | | | | | | | | | | Without this fix, when using unity build, qt3d mixes its symbol with qtbase, ie., `QTransform` in `src/gui/kernel/qinputmethod.h`, and `src/gui/kernel/qscreen.h`. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ibab5c7ec21bed20e1ca3058e586b38598d992b17 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Silence warning about unsafe sprintf, use snprintf insteadAmir Masoud Abdol2023-04-131-5/+1
| | | | | | | | | | | Apple Clang, and clang also complains about this, and warnings like this tend to break the unity build in certain situation. So, if possible, I rather address them. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I8e24267a1ebfc0c3ff4f2f8afdcb7c6aed62db80 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Create materials with normal textures in Assimp importerAurélien Brooke2023-04-131-5/+15
| | | | | | | | [ChangeLog][Assimp importer] The scene importer now creates materials that support normal textures if the loaded scene has some. Change-Id: I33327d6b97207a3510f678610787f7f85a3f97da Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* PlatformSurfaceFilter: fix crash when Scene3D is destroyed after windowAurélien Brooke2023-04-131-1/+2
| | | | | | | | | | | | | | When closing a window containing a Scene3D, the aspect engine is destroyed after the QWindow (because of delete later), so the m_obj pointer we store inside the PlatformSurfaceFilter becomes dangling, leading to a crash in the destructor. Use QPointer to ensure m_obj it set null when it is destroyed. Fixes: QTBUG-111325 Pick-to: 6.5 Change-Id: Icf153700a5708abff4b92b14ce2f9bb12d8653eb Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* RHI: generate GLSL shaders of correct version when running on OpenGL ESAurélien Brooke2023-04-131-15/+34
| | | | | | | | | | | | | | | | | OpenGL ES has different shader versions than Desktop OpenGL, which the existing code was not accounting for. Check if we are running OpenGL ES to choose the proper GLSL version, and add the flag QShaderVersion::GlslEs. This fixes errors like this when running on Android: No GLSL shader code found (versions tried: QList(320, 310, 300, 100) ) in baked shader QShader(stage=0 shaders=QList(ShaderKey(1 Version(120 QFlags()) 0)) desc.isValid=true) Pick-to: 6.5 Change-Id: I6b387962e5cf48cdb0aec8ac3e8348d7847fc20a Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Resolve duplicate symbol error for `memoryBarrierGLBitfield`Amir Masoud Abdol2023-04-112-4/+4
| | | | | | | | | | I slightly modified the function name to avoid the collision during the unity build. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I1f1ffedc4ecb277a377569b47ee24d4657ceebe5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Silence a type conversion warningAmir Masoud Abdol2023-04-031-1/+1
| | | | | Change-Id: I816ad2e2133a5762b4b9b1c46fd93cb0bbff0f45 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: Add tests/manual in exampledirs to fix broken linksAndreas Eliasson2023-03-221-1/+2
| | | | | | | | | | Some of the examples were moved from the examples dir to the tests dir to reduce maintenance. After this move, however, qdoc cannot find the examples. Pick-to: 6.5 Change-Id: Ie67d83c695504901fced4a85293ad344beafeead Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* Doc: Remove unused imagedirsKai Köhne2023-03-201-9/+1
| | | | | Change-Id: Id7ac8d7d729ded4e4a51b0141f0eb14b18d7a6ab Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Scene3D: fix crash in setItemAreaAndDevicePixelRatio when entity is nullAurélien Brooke2023-03-201-2/+5
| | | | | | Pick-to: 6.5 Change-Id: Ib4ced4fa56fb038b5ee440e0f4e752b2d2570abe Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Remove qmake build filesMike Krus2023-03-1792-3045/+0
| | | | | | | | Except in examples Pick-to: 6.5 Change-Id: I31b06ddfc79f14dde3369518a76d57606daf939f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove links to old examplesMike Krus2023-03-171-5/+1
| | | | | | | | Those have been moved to manual tests Pick-to: 6.5 Change-Id: Ifede716b69b003c7523ae21ee5f9668dbad6f5a3 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Doc: Fix missing imagesKai Köhne2023-03-122-0/+0
| | | | | | | | | | | | | | | | Commit 00d139e3 moved both images from examples to tests/manual. This resulted in qdoc not finding the image anymore: Warning: The file C:/dev/qt/dev/msvc-2022-amd64/qtbase/doc/qt3d/images/shadowmapping-depth.png does not exist, skipping it... Warning: The file C:/dev/qt/dev/msvc-2022-amd64/qtbase/doc/qt3d/images/shadowmapping-qt3d.png does not exist, skipping it... Fix this by adding a copy of the files todoc/qt3d/images. Since this is an identical copy, git should be clever enough to not duplicate the actual content. Pick-to: 6.5 Change-Id: I6e2b753946d8195e008ce812f107ce72db41a32c Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Exclude Assimp from Unity BuildAmir Masoud Abdol2023-02-261-0/+1
| | | | | | | | Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ifb061194f34ffdeded0e264f870f2d8328f2f9e7 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* OpenGL SubmissionContext: reset m_renderTargetFormat for default FBOPaul Lemire2023-02-241-1/+5
| | | | | | | | | | | | | | | | | | | | We rely on m_renderTargetFormat when doing render capture to know in whick internal format the currently bound FBO is. m_renderTargetFormat is reset once per surface change based on the QSurfaceFormat. However, when using custom RenderTargets, it gets overwritten in the call to SubmissionContext::activateRenderTarget which happens for each RenderView. If we switch back to the default FBO in a RenderView that follows one using a custom RenderTarget, both using the same surface, we failed to reset the m_renderTargetFormat and it would mistakenly remain to the value set for the custom RenderTarget. If a RenderCapture were to happen at that stage, this would lead to crashes as we would compute the capture buffer assuming a format that doesn't match that of the current FBO. Pick-to: 6.5 6.4 Change-Id: I5c722f20857b23b5696617065c8f50406e10aea9 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* TriangleCollisionVisitor: perform intersections tests in local spacePaul Lemire2023-02-211-11/+9
| | | | | | | | | | | Rather than multiply each triangle vertex by a mat4 to bring them to world space (which is actually costlier than the actual intersection test), we compute a local ray once and use it to test against the local vertices. Pick-to: 6.5 6.4 5.15 Change-Id: I4de9da278186f8214c32be394beb09daa9bc4914 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* QDistanceFieldCache: fix QTextureAtlas dangling pointerPaul Lemire2023-02-141-2/+8
| | | | | | | | | Note: already merged in 5.15 Pick-to: 6.5 6.4 6.2 Change-Id: If968714f1ca4869e9c607224b537e355b4a6f0dd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add some exclusions for CMake Unity (Jumbo) buildsFriedemann Kleint2023-02-105-0/+15
| | | | | | | | | | | QtGui headers referencing QTransform clash with source files using namespace Qt3DCore. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I17a4571ef4a69e1133b96442c309cd1f5f922a0c Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* quick3drender plugin: Disambiguate meta type id constantsFriedemann Kleint2023-02-102-6/+4
| | | | | | | | | | | Make them function-local to prevent clashes in CMake Unity (Jumbo) builds, Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I3c42d2b2f45f5aef5f63ced4f68911d6d34a2884 Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* qspritesheetitem_p.h: Fix include guardFriedemann Kleint2023-02-101-3/+3
| | | | | | | | | | | It clashes with qspritesheetitem_p.h. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I551f09cd5ee29696711b9e1ea9b3b1a96e84c0c6 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* 3DCore: Remove using namespace Qt3DCoreFriedemann Kleint2023-02-106-9/+12
| | | | | | | | | | | It causes clashes in CMake Unity (Jumbo) builds (3DCore::QBufferPrivate vs QBufferPrivate). Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ibb8a8f37b5da3531daeca1d82aef892d253ece7f Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Fix warnings about fields anonymous namespacesFriedemann Kleint2023-02-101-8/+5
| | | | | | | | | | | | | Remove anonymous namespace, fixing warning: qsgareaallocator.cpp:27:8: warning: QSGAreaAllocatorNode has a field QSGAreaAllocatorNode::splitType whose type uses the anonymous namespace [-Wsubobject-linkage] which occur in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ieb575215dad57df299e3ea11cc9f1504f311fada Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* QText2DEntity: fix QTextureAtlas parenting that could lead to crashesPaul Lemire2023-02-102-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | We rely on a DistanceFieldFont object to manage QTextureAtlas that hold the glyphs. The DistanceFieldFont/QTextureAtlas are supposed to be parented by the scene root to ensure that a QTextureAtlas lives as long as possible. DistanceFieldFont/QTextureAtlas are stored in a cache global to the scene to minimize the use of resources. When adding text elements, we can reuse atlases since the cache is global to the scene and only destroy an atlas (and remove it from the cache) when we know no more glyphs are referencing it. However we were mistakenly passing a null parenty to DistanceFieldFont instace of the scene root. This resulted on the QTextureAtlas not being parented by the scene root but rather by the first DistanceFieldRenderer to use the atlas. This meants that if the DistanceFieldRenderer were to be destroyed, so would the atlas (yet it would still be referenced by the glyph cache leading to crashes). Pick-to: 6.5 6.4 6.2 5.15 Change-Id: Id84f6a651b162a4bb3c571b11388fd2429b231de Reviewed-by: Mike Krus <mike.krus@kdab.com>
* QPaintedTextureImage: fill image with transparency by defaultPaul Lemire2023-02-101-0/+1
| | | | | | | | | Avoids having junk in the texture on the first paint call if not filling a rectangle with a QPainter. Pick-to: 6.5 6.4 5.15 Change-Id: Icb65b6f994a9edea5132a2c54406fa0dd817bcb2 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Remove Qt6 QT_VERSION checks from the code basePaul Lemire2023-02-1073-605/+1
| | | | | | | | | | Those are left overs from the Qt 5.15 to Qt 6 port. Now that both code based have diverged, there's no much point in keeping those checks. Pick-to: 6.5 Change-Id: I4e83876b6b4cb18b181af32e376f4411054a1183 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* 3DCore: rip away the configure option and static choice of SIMDThiago Macieira2023-01-1916-258/+78
| | | | | | | | | | | | Instead, simply use whatever is available from the compiler. This also does away with the separation between Matrix4x4_SSE and Matrix4x4_AVX2. The two classes store the data the same way and are source-compatible; they just operate differently. This also allows for an AVX2-enabled Qt3DRenderer to link to and run with a non-AVX Qt3DCore. Change-Id: I76216ced393445a4ae2dfffd172a512266b2414d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Qt3DCore: update AVX2 code to mean x86-64-v3Thiago Macieira2023-01-191-5/+1
| | | | | | | | | | | | | | | | qsimd_p.h doesn't like when you compile with just -mavx2. I guess no one is using these flags except me, and I already set the full arch in CFLAGS. Qt 6.4 calls x86-64-v3 "arch haswell". Will be fixed in 6.5. Drive-by remove the AVX512 bits that weren't in use. Pick-to: 6.4 Change-Id: I76216ced393445a4ae2dfffd172a4f5684351514 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix the input qualifier of the fragment shader for GLSL1.10Inho Lee2023-01-102-1/+10
| | | | | | | | | | | | FS's input qualifier is different with VS's in GLSL1.10. If prototypes has 'headerSnippetsFrag', it will be applied for FS instead of 'headerSnippets'. Fixes: QTBUG-99019 Pick-to: 6.5 6.4 6.2 Change-Id: I588d3f78d4ba895a9a90b20a87b92a6da9ffee18 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* RHI SubmissionContext: remove unused membersAurélien Brooke2022-12-212-16/+4
| | | | | Change-Id: I193e646fbc1b33e112bed58059ec536c46064bc9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Assimp importer: ensure loop variable has enough widthAurélien Brooke2022-12-211-1/+1
| | | | | | | | | loop variable has narrower type 'ushort' (aka 'unsigned short') than iteration's upper bound 'unsigned int' [bugprone-too-small-loop- variable] Change-Id: Id6ab16316f9eb40e47d8494bf70621792284a7b4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove unused forward declarationsAurélien Brooke2022-12-213-5/+0
| | | | | Change-Id: I008781fa63d253c4f1a7201d911da87f451d797f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* OpenGLVertexArrayObject: fix bugprone erase() callAurélien Brooke2022-12-211-3/+4
| | | | | | | | | openglvertexarrayobject.cpp:117:5: this call will remove at most one item even when multiple items should be removed [bugprone-inaccurate- erase] Change-Id: Ife88facc1cad159658c08180548fe365eaeb1714 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove qsizetype to int narrowing conversionsAurélien Brooke2022-12-2136-145/+145
| | | | | | | | Change the variable type from int to qsizetype when receiving qsizetype values. Change-Id: I2adf71e1d2f26b1452fee28890c0f68300f54224 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Scene3DItem: fix screen flickering when using OnDemandPaul Lemire2022-12-192-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using OnDemand, we detect whether Qt3D actually needs to render or not. Based on that we set a flag on the Scene3DRenderer to tell it whether it should render or not. The subtlety lies in the fact that depending on that flag value, we will still call Qt3D render but not at the same moment. We need to call render to unlock the Qt3D render loop for next frame. Therefore when we should skip a frame, we call render in Scene3DRender::beforeSynchronize (updatePaintNode) and return early while in the other case beforeSynchronize doesn't call render and it gets called later in beforeRenderPassRecording. We know that the render call in the skip frame case won't render anything. To work correctly, we must obviously set the skip frame flag before beforeSynchronize / beforeRenderPassRecording is called which wasn't the case. This therefore resulted in random screen flashing as we would end up having beforeSynchronize rely on the skip frame value for the previous frame. This means we would end up issuing a render call in beforeSynchronize using assuming it wouldn't render anything when it actually did (no FBO would be bound and Qt3D would render straight to the window ...) Also update the number of frames to render before skipping to 3 to match Qt 5.15 and ensure we have something visible for the first time Scene3D is launched. Pick-to: 6.4 6.5 Change-Id: Icc34b62a0af2ff44232b39c694a4702488a890a2 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* RHI: fix the leak of QRhiResourceUpdateBatchAurélien Brooke2022-12-192-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | There are 2 ways to dispose of a QRhiResourceUpdateBatch obtained with QRhi::nextResourceUpdateBatch(): 1) Either give it to beginPass/endPass/beginComputePass/endComputePass so it is sent to the RHI backend and then automatically released; 2) or call QRhiResourceUpdateBatch::release() if the resource update is not used for any pass. The Qt3D RHI renderer was never disposing of the QRhiResourceUpdateBatch, and could end up exhausting all the 64 batches available in the RHI: "Resource update batch pool exhausted (max is 64)", in addition to consuming a lot of RAM if the buffers or textures are large. To fix this, ensure the QRhiResourceUpdateBatch'es we allocate are always released: when requesting a new one, send the previous one to endPass/endComputePass (1), and when destroying the SubmissionContext, release the one we will not use (2). Pick-to: 6.4 6.5 Change-Id: Ic3fb145b11a8e615c83745f560f019e6c4ee37f7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix incorrect usages of std::make_move_iteratorAurélien Brooke2022-12-196-35/+21
| | | | | | | | | | | | | | In several places, std::make_move_iterator was used to move from a const vector, which is not possible and fell back to copy. Use the existing Qt3DCore::moveAtEnd utility to ensure a move operation is actually happening. * When readability permits, pass directly a return value as second parameter; * Otherwise, std::move from a mutable vector. Change-Id: I56c8925bbdeab95257d0a7fa89cffcda53fd6451 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* qtexturedataupdate.h: fix namespace declaration for syncqt to workPaul Lemire2022-12-191-2/+1
| | | | | | | | | syncqt doesn't find the class name if the namespace line doesn't end with {. Pick-to: 6.4 6.5 Change-Id: Icf30464ed0ecb9ce84d6c62c04edfc5d374ed26f Reviewed-by: Mike Krus <mike.krus@kdab.com>
* LoadSceneJob: don't risk to leak the loaded subtreeAurélien Brooke2022-12-172-3/+4
| | | | | | | | | | | | | | There is a risk that the front-end QSceneLoader node has been destroyed by the time the LoadSceneJob completes. The postFrame() would then do nothing, and the m_sceneSubtree pointer will be forgotten, leaking the whole tree. This can happen in real life when loading very large scenes. To ensure that we cannot leak the scene tree, use strict pointer ownership with std::unique_ptr. Pick-to: 6.4 6.5 Change-Id: Ie2281bc178fc8793bab967a13ea8d30aa46268a0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Handle nullptr returned from the shader managerMartin Andersson2022-12-161-0/+3
| | | | | | | | Sometimes the shader manager returns a nullptr when fetching the shader from a handle, so the return value needs to be checked before it is accessed. Pick-to: 6.5 6.4 5.15 Change-Id: Ia021cd8f22ceb2626a7a2734b7e346fbcc8e0301 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>