Commit Graph

6679 Commits

Author SHA1 Message Date
Paul Lemire 028c35909c visitorutils_p.h: add proper header guard
Change-Id: If994bef73fc10348bb0364f11a267856428907a5
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2018-03-09 06:35:18 +00:00
Mike Krus 1efca1346f Enable alpha blending on QTextureMaterial
Change-Id: I8466ccd47f8bda9fec184f548a2df7807d456ac7
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2018-03-08 15:10:36 +00:00
Andy Nichols 0a9f500469 Don't assume position attribute uses default name in visitPrimitives
It is not ok to assume that the position attribute has the default
position attribute. It should be the fallback behavior like it is in
calculateLocalBoundingVolume. In this case we should try and query the
boundingPositionAttribute if it is set.  If anything this could have
been called just "positionAttribute" since we need to introspect mesh
data in a few places and need to know the positionAttribute.

The previous logic meant that meshes used by Qt 3D Studio could not take
advantage of advanced picking (anything other than bounding spheres)
because it does not use the built-in materials or default attribute
names (they are optional after all).

Change-Id: I5b02a0532add1582ae48121cdc6a7b3040ad1cdd
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2018-03-08 11:11:33 +00:00
Mike Krus 74c7f57f8d Documentation for ray casting
Also updated object picker and pick settings and made raycaster
components non-sharable.

Change-Id: Ief3e5dcb3eefdd94c05e7a4e914b43d56b43e24a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2018-03-07 12:17:13 +00:00
Mike Krus 1de8948ff8 Add more job tests for raycasting
- test screen space ray casting
- fixed handling of filters
- fixed handling of ray length
- few tests for filter handling

Change-Id: Ifc24d8f9e73556669338b3936a41dfa2c674e306
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2018-03-07 12:17:10 +00:00
Volker Krause 42a27f1a9c Either fully qualify property types, or not at all
The semi-qualified types confuse the meta type system, QAbstractAnimation
in particular, as that also exists as a top-level type.

Change-Id: If20387fe76d46f88f6a89523d5d3f4aac8b1fef0
Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io>
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
2018-03-06 08:51:24 +00:00
Friedemann Kleint 7ddb976ab2 ObjGeometryLoader::doLoad(): Fix fall through warnings
Fix:
objgeometryloader.cpp:161:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
objgeometryloader.cpp:163:51: warning: this statement may fall through [-Wimplicit-fallthrough=]

Amends 4338a85487.

Change-Id: I4a77a6436eef0d91ccc69decdfe4365dfdc5df22
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2018-03-02 09:06:52 +00:00
Paul Lemire c35f78e4e4 Add unit test to check memory alignment
Change-Id: I59b817f9972d0a6866f7cc57a4bcd6fe2cd097c9
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-03-01 09:03:05 +00:00
Anders Hafreager 912d3bdc64 Add test to check if readding shader removes dna from m_pendingRemoval
Task-number: QTBUG-66498
Change-Id: Icb18a996c9384b3e41f296694d91b13677f054c4
Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 16:32:19 +00:00
Anders Hafreager f7e01ffeb3 Prevent readded shaders to be purged from cache
In ShaderCache::removeRef, the shader DNA is added to m_pendingRemoval.
Previously, if the shader was readded before ShaderCache::purge was
called, ShaderCache::purge would still remove it even if it was in use.

This change removes a readded shader DNA from m_pendingRemoval.

Task-number: QTBUG-66498
Change-Id: If18b28273cccfd2a8cba2c7bc6379d983ce6ecb9
Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 16:32:10 +00:00
Topi Reinio eedad5e473 Doc: Fix documentation warnings for Qt 3D Render
This change fixes multiple QDoc warnings for Qt 3D Render that are
related to how Clang parses the source code and the \fn QDoc
commands. A number of changes are related to preventing documentation
for private classes from generating warnings.

We still have a number of 'No documentation for ...' warnings left -
those are not addressed in this change.

Change-Id: Ic92a729496a81e7869060811ed7dd23408cff833
Reviewed-by: Martin Smith <martin.smith@qt.io>
2018-02-28 12:41:20 +00:00
Paul Lemire 9f7e98db85 QResourcesManager: remove simd code from header
Rather move the simd code to a .cpp file that gets compiled once with
the proper flags

Change-Id: Ifc28eed844ef94224f45d0e307046a1cb884bf14
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 12:33:20 +00:00
Paul Lemire e1b34d6ad3 Fix SIMD related warnings
Change-Id: Ia7d08551de0b10e3e859da5301ea8e2be501c722
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 12:33:16 +00:00
Paul Lemire b894719797 simd: declare AVX2 friends only if __AVX2__ defined
Change-Id: I8fd88461874367bcaa9f4b27a9b4fc660cd2a030
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 12:33:12 +00:00
Paul Lemire 461194b0aa RenderThread: fix races with texture and buffer
Add dependencies to ensure we won't allow the RenderThread to proceed if we
haven't completed the execution of the texture and buffer gatherer jobs.

Change-Id: Iaad67be893738b948bf26ca903f3bff7f16a1b88
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 12:15:42 +00:00
Paul Lemire bf0b3bdf5a Fix race between RenderThread and ShaderGathererJob
By setting the proper dependency which ensures we are done looking for
dirtyShaders by the time updateGLResources in the RenderThread is executed.

Patch provided by svenn-arne.dragly@qt.io

Change-Id: I4515cbfc3a391f887a42178220e6f0814a707745
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 12:15:37 +00:00
Paul Lemire d3b6a6054c Fix RenderView uniform minification
In the case where we had two or more groups of RenderCommands where each group
shares a common shader, uniform minification wouldn't be applied to the second
command of each groups after the first one.

Change-Id: Ie73f559e3f44f0f22ddd79017fd413262cae6ab4
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 10:46:29 +00:00
Paul Lemire 6ea64e9ba9 Load textures in a single frame
Because of texture sharing, Qt3D compares functor before executing them.
Instead of blindly loading a TextureImage functor which could turn out to not
be used, Qt3D required 2 frames to fully update a texture. This behavior has
been removed, now when a texture image functor is updated, it updates the
texture in one frame. It is assumed that the user is responsible for declaring
only TextureImage that he is actually going to use.

Any scene that uses OnDemand rendering and frequently changes a texture image
functor can be used to test this. (ex-painted-cube is a good example for KDAB)
or paintedtexture-cpp in manual tests

Change-Id: I8c2f13876244a862633e10e472e2b49cbd6e126b
Task-number: QTBUG-63561
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 10:46:24 +00:00
Paul Lemire 3dff7c204d Revert "Keep rendering in sync with aspect jobs by adding barriers"
This reverts commit 4631964843.

We want to be able to render one set of RenderViews for frame n while
concurrently building RenderViews for frame n + 1. The reverted commit removed
that behavior which reduced the CPU time available to prepare a frame.
This would cause on some scenes a failure to meet the ~10ms budget we have to
prepare a frame. This is therefore a regression. The root cause behind this
regression is that a job cannot be executed until all the jobs which have been
previously launched have completed.
The proposed solution would be to instead add an OpenGL command thread that
can be used to load graphics resources required for the RenderViews directly
when required. This would in turn allow to cache RenderViews and keep the
concurrent behavior of RenderView submission and creation.

With that goal in mind, the following patches will be rebased and updated
https://codereview.qt-project.org/#/c/189309/
https://codereview.qt-project.org/#/c/189310/

Change-Id: I4879047c45986a0e615e3aef7b7352f82a04a9da
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-28 10:44:49 +00:00
Laszlo Agocs a43cf37266 Set mip levels correctly when having only texture images
Otherwise it is impossible to provide custom texture data for multiple
mip levels. (as QTextureImageData is the only public API; there is no
texture data generator in this case, only individual texture images)

Task-number: QTBUG-66686
Change-Id: Iaab37ee6510ffd4db07ce7865d9b6f0ff80d2947
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2018-02-27 08:53:11 +00:00
Mike Krus 4ce90380ad Add unit test for QScreenRayCaster
Change-Id: I76933b23f27bc0fefcbc55342715b2ebd7f7716d
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-24 08:56:53 +00:00
Mike Krus 8b6bc3103f Add unit test for layers on raycaster
Change-Id: I5f8401e7a61924fbfe88fddf5b44fd77fa92099d
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-23 19:06:33 +00:00
Mike Krus 97104a7a46 Add debug support for Sphere
Change-Id: I8262ada29898df37c33855b9cb33aead419b02a6
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-23 19:06:15 +00:00
Mike Krus ff8f7eb89e Update QRay3D stream IO
for debugging and streaming

Change-Id: Id9924fa9a99c6412069e6907473d0dfe083e3107
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-23 19:05:44 +00:00
Adam Treat 2b20e5e02d Add a warning to texture loading mirrored property
The default behavior for texture loading of uncompressed or CPU
compressed images results in a performance price at runtime. Add a
warning to the documentation describing this behavior and how to avoid
it. Ideally, in the future we'll have an asset conditioning pipeline
that will handle this in an optimal manner for the user of the 3D
framework.

Change-Id: I795d011adfedcbcf8d80224a36adbf9465140066
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-22 16:45:07 +00:00
Anders Hafreager e813fb36e7 Fix color scaling in copyGLFramebufferDataToImage
Previous implementation used a component conversion for
QAbstractTexture::RGBA32F (when GL_TYPE is GL_FLOAT) which results in a
non-linear mapping from [0,1] to [0,127]. A non-linear mapping should
only be used for some GL_TYPE other than GL_FLOAT.
See https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/
glReadPixels.xhtml for more.

This change maps color linearly to the range [0,255] when
QAbstractTexture::TextureFormat is QAbstractTexture::RGBA32F.

Task-number: QTBUG-66514
Change-Id: I4aa36b59acd193c7342ba4b0577f132e0c19ef85
Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-22 13:03:45 +00:00
Liang Qi 0518563376 Merge remote-tracking branch 'origin/5.9' into 5.11
Conflicts:
	src/render/backend/renderer.cpp
	tests/auto/auto.pro

Change-Id: Idc5bb088ae7f591809f8795124a3e44410bf4cf9
2018-02-21 11:29:36 +01:00
Paul Lemire 0fd16cf43f QParameter: add bookkeeping of QNode values
Change-Id: I0a7334907e4b34df6955fb24832958b674d7b62b
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-21 07:04:30 +00:00
Sean Harmer ba3c6bc0ff Revert "CameraControllers: use the Camera's upVector"
This reverts commit 627167bd4a.

There was a reason to use the y axis as the up vector here which
is to keep the camera controller oriented correctly. Without this
restriction it's far too easy to end up with a twisted camera.

If we want a fully free trackball type controller, let's add that
as a new type, or perhaps as an option on these.

Change-Id: I56c8708535d4ccd05ccb5f2ddea732bb27abda58
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2018-02-19 11:20:09 +00:00
Topi Reinio 51dca65145 Doc: Fix documentation warnings for Qt 3D Core
This change fixes multiple QDoc warnings for Qt 3D Core that are
related to how Clang parses the source code and the \fn QDoc
commands.

We still have a number of 'No documentation for ...' warnings left -
those are not addressed in this change.

Change-Id: Ia6394f453d7bd959bc4d4cc9347ac0039b80f661
Reviewed-by: Martin Smith <martin.smith@qt.io>
2018-02-16 11:34:41 +00:00
Sean Harmer b5dc950424 Merge "Merge remote-tracking branch 'origin/5.10' into 5.11" into refs/staging/5.11 2018-02-15 20:59:24 +00:00
Sean Harmer 6e82860f19 Merge remote-tracking branch 'origin/5.10' into 5.11
Conflicts:
	src/animation/doc/src/qt3danimation-module.qdoc
	src/render/backend/abstractrenderer_p.h
	src/render/backend/buffervisitor_p.h
	src/render/backend/renderer.cpp
	src/render/backend/renderer_p.h
	src/render/backend/triangleboundingvolume_p.h
	src/render/backend/trianglesextractor_p.h
	src/render/frontend/sphere_p.h
	src/render/jobs/calcboundingvolumejob.cpp
	src/render/jobs/job_common_p.h
	src/render/jobs/pickboundingvolumejob.cpp
	src/render/jobs/pickboundingvolumejob_p.h
	src/render/jobs/pickboundingvolumeutils.cpp
	src/render/jobs/renderviewjobutils_p.h
	tests/auto/render/boundingsphere/tst_boundingsphere.cpp
	tests/auto/render/commons/testrenderer.h
	tests/auto/render/raycasting/tst_raycasting.cpp
	tests/auto/render/render.pro
	tests/auto/render/renderer/tst_renderer.cpp

Change-Id: I76633bc5a5a065e5f9ea62cc16563377e5c693a3
2018-02-15 20:59:03 +00:00
Andy Shaw 907d011908 Android: glTF is available here, so we can build the tool
Change-Id: I4b498d9a17a35adaa503c1464e0b342ba693d4fe
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-02-15 14:41:02 +00:00
Laszlo Agocs 0bbccd4925 Handle primitive restart in buffer visitor
Task-number: QTBUG-66407
Change-Id: Ic79851e94fcadee8f707cb2682938692db094aa7
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-15 08:56:12 +00:00
Svenn-Arne Dragly c40c7ac6b5 Fix OnDemand rendering by keeping ComputeDirty from being re-enabled
The previous implementation would reset ComputeDirty every frame if
markDirty(AllDirty) had been called earlier. This would break the
OnDemand rendering policy because every frame would be rendered even if
there were no changes or no compute commands in the scene.

This change removes the code that would re-enable the ComputeDirty flag
every frame and documents that the user must either set the rendering
policy to Always or trigger the rendering of a new frame if the
rendering policy is set to OnDemand.

Change-Id: Ide03a3a49ee1670fd9d67ed47454c6679219765d
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-14 16:54:12 +00:00
Liang Qi a400bbe50d Merge "Merge remote-tracking branch 'origin/5.10.1' into 5.11" into refs/staging/5.11 2018-02-14 11:56:26 +00:00
Liang Qi 1382b0cfb3 Merge remote-tracking branch 'origin/5.10.1' into 5.11
Conflicts:
	src/render/backend/renderer.cpp
	src/render/backend/renderer_p.h
	tests/auto/render/renderer/tst_renderer.cpp

Done-with: Svenn-Arne Dragly <svenn-arne.dragly@qt.io>
Change-Id: I2ca9bac4777e51434579edf86030414734f533ac
2018-02-14 12:47:58 +01:00
Juan Jose Casafranca d360e16fdc Add private api to retrieve a vector of typed components
Change-Id: If53d29902d786c3e8369e521582aee5ab0bdcf7a
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-14 09:54:46 +00:00
David Cremoux f762595542 Fix regression crash on Windows when ES2 is used
Using OpenGL ES 2.0 cause a division by zero due to a modification to
GraphicsHelperES2: uniform.m_rawByteSize is not correctly initialized.

Task-number: QTBUG-64964
Change-Id: Ib500b683b1402d0160a5e18236ac5b0a4cbf131a
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-13 12:48:47 +00:00
Jesus Fernandez 9c3c479193 Remove null pointer check
>>>     CID 187918:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "node" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

Change-Id: Ic799724e91d118a2c5b2715c5742a4184b09a217
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-12 10:34:46 +00:00
Kaj Grönholm d5bd8f06c7 Avoid duplicate animation job dependencies
When testing Qt3D Studio runtime 2.0, noticed slowing down and memory
usage increasing which came from AspectTaskRunnable m_dependers growing.
Located reason being multiple dependencies to
m_findRunningClipAnimatorsJob, so make sure that each job has only
single dependency to that and m_loadAnimationClipJob.

Task-number: QT3DS-909
Change-Id: I0d3ebc3ea2ab17af51394c69bc32b8aa2db0913e
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2018-02-10 08:29:32 +00:00
Topi Reinio c8964b8f1c Doc: Divide documentation into submodules
QDoc in Qt 5.11 will use Clang (libclang) to parse C++ documentation.
In order to do that, Clang needs to have the include paths available
when parsing source; qmake provides that information to QDoc but only
when the documentation project is located under the correct module
(source) path.

By having dedicated doc projects for Qt 3D Core, Render, Input, etc.
the number of documentation warnings is signicantly reduced. A
top-level 'Qt 3D' project is still kept, and contains the landing page,
overview, examples, and top-level 'C++ classes' and 'QML types' pages
that list all types documented across all Qt 3D submodules.

Change-Id: Id5936de36f31c2a8764a64e1e9d7ae0d10e8ab14
Reviewed-by: Martin Smith <martin.smith@qt.io>
2018-02-09 12:07:25 +00:00
Svenn-Arne Dragly e1d1a59eb0 Move calculateBoundingVolumeJob dependency on updateTreeEnabledJob
Move it to renderBinJobs because we clear all dependencies of
calculateBoundingVolumeJob at the start of this function.

Change-Id: Idebe10349181d95813e47e85b2e6f4f2ae39e615
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2018-02-09 10:26:33 +00:00
Svenn-Arne Dragly 370201c3af Proceed to the next frame even if we cannot lock the surface
Previously, if the render surface could not be locked or makeCurrent
failed, the aspect thread would be stuck waiting for the next frame and
the render thread would be stuck waiting for the render jobs.

This change makes sure both threads continue, which will allow changes
to the surface to be synchronized and make the render thread try to
lock the surface again.

Task-number: QTBUG-66243
Change-Id: I01bbe4c2ca74961f363efbe87c0586edaad41c62
Reviewed-by: Harald Vistnes <harald.vistnes@gmail.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2018-02-09 08:28:03 +00:00
Friedemann Kleint 352dacc004 QAbstractCameraController: Make struct InputState public
For generating Python bindings, the struct InputState needs to
be public since a Python binding needs to be created for it
so that a wrapper of QAbstractCameraController can be generated
that calls into Python for an implementation of moveCamera().

Task-number: PYSIDE-487
Change-Id: Ib410b19a9e886ad06335dac05fd56206a72220bf
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2018-02-09 07:53:23 +00:00
Paul Lemire 2a29dec5f5 ObjGeometryLoader: Fix out of bound error
Apparently this was a major security issue reported to security.qt-project.org

Change-Id: Id52f035134ca6111e24b5820eb1b64b99449e47f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-02-08 08:17:33 +00:00
Määttä Antti 31f424bb81 Fix crash in scene2d at shutdown
The resource manager policy for scene2d nodes has been changed so the
scene2d constructor gets called multiple times at startup. That in turn
increments render thread user counter every time. The cleanup code gets
called for each instanciated QScene2D node so at shutdown the counter
never reaches zero and the render thread is not closed properly. Change
the implementation so that the counter gets incremented only when the
render thread has been properly initialized.

Task-number: QTBUG-66003
Change-Id: I33a5b1f407e65329776bcabe0b66ff049581a435
Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
(cherry picked from commit 564dfd87c5)
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2018-02-08 07:24:50 +00:00
Määttä Antti 156afc0f9d Fix crash if sharecontext is requested before initailization
Scene2D can sometimes receive the render initialization event before the
qt3d renderer has been initialized. This causes crash because the
sharecontext hasn't been set yet. Add safeguard against this.

Task-number: QT3DS-904
Change-Id: Ib50a60ed89c12ac54c9165266466d9804affe77c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
(cherry picked from commit 13f340c92b)
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2018-02-08 07:24:45 +00:00
Sean Harmer b923dae74e Ensure node creation changes are sent before using in list properties
This completes the fix for out of order event delivery related to
creation changes. We now ensure that QNodes used as values in singular
and list properties are fully constructed on the backend before they
are referenced in properties of other nodes.

Also added a check to not recurse into sending too many changes
when adding a child node.

Written with Svenn-Arne Dragly.

Task-number: Task-number: QTBUG-65956
Change-Id: I1470e0f685c81d1277ac04ad985ec1b76f1c27c0
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
(cherry picked from commit 8fa23602cf)
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
2018-02-08 07:24:42 +00:00
Antti Kokko 89b7f69886 Add changes file for Qt 5.10.1
Change-Id: Ibbcf306b33c9a6b5d67c71b5c76d4e45055b9452
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2018-02-08 05:44:05 +00:00