Commit Graph

793 Commits

Author SHA1 Message Date
Mike Krus 0dc38ecbbf Fix deprecation handling
Change-Id: If981333f7a3d78028d4f08c59867453d4192b955
Task-number: QTBUG-81058
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-01-14 08:04:10 +00:00
Mike Krus a40654ad45 Remove use of messages for RayCaster
Change-Id: Ibe0b38df62700608135788331adfcb7fa28159a7
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-01-13 09:57:23 +00:00
Paul Lemire b7873ef588 QSortPolicy: add Uniform sorting mode
We used to perform uniform minization between adjacent render commands all the time.
Since this can yield to a higher CPU usages (but more efficient rendering submission),
we now make this step optional.

[ChangeLog] QSortPolicy add Uniform mode (to control whether uniform minization
should be performed)

Change-Id: I5c0e0dba22400a9884ee1d75426fd76b073fdcb5
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2019-12-20 11:58:14 +01:00
Mike Krus 94e79666cc Update textures and disables in postJobs
Work was done in postFrame() in main thread anyway, so reduce
amount of jobs slightly

Change-Id: I8bbb3efcaf9246eb8df1033bde133bc16233f889
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-12-16 09:37:14 +00:00
Qt Forward Merge Bot e77c85a200 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I5a5b1d497430afdd0fe11933832a2477a7efbe30
2019-12-14 03:05:15 +01:00
Mike Krus 22eccf3a95 Use jobsDone to sync render capture back to frontend
Removes the jobs who's only purpose was to send a message to the frontend.
Now added a jobsDone() call to render which is called from main thread
when jobs are completed, so it's safe to sync data to frontend.

Added a task trace for the backend to front end synching.

Change-Id: I587462bea353c5d5a0065b542adcacef4dedb05f
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-12-13 21:06:38 +00:00
Qt Forward Merge Bot 54535dec77 Merge remote-tracking branch 'origin/5.14.0' into 5.14
Change-Id: Ibf5f508eec94be4bae2df3ce2e1511de696dcd72
2019-12-13 12:52:20 +01:00
Mike Krus ecd193d7b5 Fix picking with primitive restart for line loops
Previous fix was not closing the loop on every primitive,
just the last one.

Task-number: QTBUG-71919
Change-Id: I22d52258477b0c4777118ee36a0b3868da982885
Reviewed-by: Volker Enderlein <volker.enderlein@ifm-chemnitz.de>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-12-13 07:10:27 +00:00
Mike Krus 6e448dd591 Deprecate message API
Deprecates the message classes and the public APIs to send/receive them.
(deprecates the constructors as deprecating classes breaks syncqt)

Change-Id: I4908f15c3c5f1d63969a0f2e11f6ecb22e2e3748
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-12-09 13:40:08 +00:00
Mike Krus 69789d0184 Fix picking with primitive restart
Task-number: QTBUG-71919
Change-Id: If7923fab6c43f5d7139d1bbdceb73c17bf489099
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-12-09 07:23:02 +00:00
Paul Lemire 96b1b9e3e1 Fix OnDemand rendering with Scene3D
When using OnDemand rendering, Scene3D would lock if nothing in
the scene were to change. By being blocked, it would also not
process jobs for other aspects (input, logics). That would prevent
things like a CameraController from running, which in turn would
make it impossible to move the camera and trigger a change in the
scene to request rendering.

Additionally, Scene3D would ignore whether the Qt3D renderer actually
needed rendering or not as it was watching on its own the changeArbiter
for changes to decide whether rendering was required or not. This would
ignore the case where Qt3D needs multiple frames to render a correct frame
(e.g loading buffers, shaders at frame n, rebuilding commands at frame n+1)

Scene3D now asks the Qt3D renderer by calling the shouldRender() function
to decide whether rendering is needed or not, in addition to watching the
changeArbiter.

Regardless of whether rendering is needed, it now let each aspect process
jobs. This ensures things like FrameAction/Input are processed.

Then, Scene3D decides whether full rendering is required or whether
it only has to be called to allow the Qt3D simulation loop to proceed for the
next frame. If the latter, it does it so as not to have QtQuick trigger a
redraw.

Change-Id: I870f773c224286d6b7ec0f6045319e51e09cbf8e
Task-number: QTBUG-80521
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-12-04 13:39:06 +01:00
Mike Krus 00e0783992 Fix compile warnings
Change-Id: Idb253d8cb42809ae21cfbbda70d6b6c75891070f
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-12-03 09:07:40 +00:00
Mike Krus 568b2d62e6 Revert "Fix post FF API changes"
84766ed909

Change-Id: I12341ec1b7bc68a7586c6671aa7b8f21caed17e0
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-12-03 09:07:36 +00:00
Friedemann Kleint a10e61dce4 Avoid initializing QFlags with 0 or nullptr
It is being deprecated.

Change-Id: Idb6e794be1a26a3ca7c1d19ac1f47e4a0125f11b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-11-25 13:41:45 +01:00
Paul Lemire 50db67eb31 PackUniformHash to QVector
Surprisingly it's hard to notice its effect in the speed of execution,
frame preparation looks to be more or less the same with the profiler.
However with vtune, the profiling traces show a huge difference with
QHash, mainly in time spent allocating memory. It shows a noticeable
reduction in CPU usage.

On bigscene-cpp with 600 entities

QHash   -> On a 158s run, CPU time is 112s (70%)
           free accounts for 26s (23%), malloc 24s (21%)

QVector -> On a 190s run, CPU time is 110s (58%)
	   free accounts for 5s (4.5%), malloc 4.7s (4.2%)

Change-Id: I880d44b1acf7f051e479ed356864c3caf407f23f
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-11-14 06:37:38 +01:00
Paul Lemire 8de836c63e FilterProximityJob: only run it if our RV requires proximity filtering
Which is only very rarely required by user applications.
Avoid useless memory allocations every frame

Change-Id: I69ea73ebfffdbe928f99333b4d1dd90cf4ada430
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-11-13 07:32:37 +01:00
Paul Lemire 53a780960a Uniform: use QVarLengthArray<16 ,float> instead of <4, float>
This otherwise yield for lots of reallocations that could be avoided.
The gains seem to be about 2/3% of cpu usage according the analysis
with vTune.

It does indeed mean that for smaller uniforms vec4, float, sampler
we are wasting a bit of memory. The impact of this is likely to be
unsignificant though.

Change-Id: Id72c81a795bf9326ef48b170bb0806de9b430412
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-11-13 07:32:32 +01:00
Paul Lemire db9f0721c4 Buffer: make sure we force allocate before doing partial updates
Change-Id: I229f9bcd21a10c0a4cff5c4f559cd285a3e50276
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-30 15:25:38 +01:00
Paul Lemire 3c5848a923 Compute renderables/computables/lights once instead of once per RV
All RV end up using exactly the same vector before filtering it down
on per RV specifics. No point in compute RV times the same thing.

Change-Id: Ia674095627771c8e9ada090fa47623cbbbd8a3f8
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-29 07:50:32 +01:00
Paul Lemire 1194641110 ComputeCommand: add unit tests for manual trigger mode
Change-Id: Ia106a235648df7232fbcaf4f61c880a9ab5491ef
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-24 16:02:14 +02:00
Mike Krus 84766ed909 Fix post FF API changes
Change-Id: I347f6df41c0a4f2295831e78248669b4a2d6b5ef
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-22 21:29:58 +01:00
Paul Lemire 257c9bc8b5 Renderer: build cache data for new RenderViews
Change-Id: I95690444badaf573b9e2775b50c61113de8d1c77
Reviewed-by: Michael Brasser <michael.brasser@live.com>
2019-10-22 19:51:09 +02:00
Paul Lemire 6303910dc4 ComputeCommand/SubtreeEnabler use direct sync job to update frontend
Change-Id: I773955df33f0b4dcdaa0953633761ff82f3d0da4
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-22 16:13:37 +02:00
Mike Krus 4d0f8bcdea Remove remaining messaging code in QSkeletonLoader
And matching unit tests

Change-Id: Iff0b13b2ad9ff07d08c767f4b20de2a1685a5570
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-22 15:13:37 +01:00
Mike Krus 1e499f548a Remove old code from animation classes & update tests
Change-Id: Ic91a4f168172d6f34d858488e6fc170e8ed875f9
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-21 15:38:45 +01:00
Paul Lemire ae88eeee62 Convent SendBufferCaptureJob to direct sync
Change-Id: I8d5bc69cb75d73e628f08d70b2e40d665c39802b
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-21 15:15:42 +02:00
Paul Lemire af354bc1df Convert LoadBufferJob to use direct sync
Change-Id: I44334264fba285494624a8a4ee6ff3b85755402c
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-21 15:15:37 +02:00
Paul Lemire 7eb01e9532 Split RenderCommand generation and uniform update
In most cases, we can generate the RenderCommands once and reuse them in
subsequent frames only updating the uniforms. We still have to copy the
RenderCommands as the renderer renders while we start preparing the next frame.
This is still faster than regenerating them entirely.

Regenerating the entire commands will happen only when FrameGraph or Scene
structure changes. That should rarely be happening on a per frame basis.

Next step could be to look at how to only update commands for Entity with Parameters
that have changed.

Change-Id: I202870850a46fcd3946f81bffddb7027d192f374
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-21 13:35:38 +02:00
Mike Krus ce4663c265 Clean up old property update code
Remove useless includes, clear up commented out or unused code

Change-Id: Id3382b16108d79f1e2522d43463c8d70aef8fcb2
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-20 21:25:38 +01:00
Paul Lemire 92f29f8592 FrameGraphNode: mark dirty on cleanup
Otherwise the FG cache is not rebuilt and we might have dangling
pointers around.

Change-Id: Id97de41092617acbf067fcac4cf7805c2eb715da
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-17 12:04:16 +02:00
Paul Lemire aee3dbc8b8 Buffer: mark as dirty even if empty on firstTime
We otherwise assert in the case we create an empty buffer
that is empty but referenced by Attributes.
This is still a valid case as buffer data can be set later
on.

Change-Id: Ida198f5815f6cbb488b6b27436c4238146c3ae39
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-17 12:04:16 +02:00
Paul Lemire 4b6c80579d tst_ktxtextures: remove OTHER_FILES variable from .pro
Change-Id: I0db693461c282c7bcf8006c3094f50ea3f0a0eba
Reviewed-by: Michael Brasser <michael.brasser@live.com>
2019-10-17 07:03:01 +02:00
Paul Lemire 3c9a56d4e6 Add unit tests for KTX loading
Change-Id: I3e80497d107329f250bd524a02157c6246e36e68
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-15 10:25:37 +02:00
Paul Lemire 0ff2215bb0 Merge "Merge remote-tracking branch 'origin/5.13' into 5.14" 2019-10-15 10:00:08 +02:00
Paul Lemire 7339e9ae93 Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: I44133fbc9b93e96918463b0b0891ee5ab7db9f2c
2019-10-15 09:40:40 +02:00
Mike Krus e8ef2e3e75 Update QScene2D to use direct sync
Change-Id: Iba2fa5ce9d295706fc50f904cac68f00bd8f02b7
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-14 19:56:15 +01:00
Mike Krus fd85ebb1e2 Update PickBoundingVolumeJob to use direct sync
Change-Id: I7878294cd44872ccdc17515fbb44a6b2a99239e5
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-14 20:37:25 +02:00
Paul Lemire c8134efd47 Convert Shader/ShaderBuilder jobs to use direct sync
Change-Id: Ia56ba6176c86e34904611ae57e682ac9d52c79f7
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-14 08:04:40 +02:00
Mike Krus ca48552bf2 Update QAbstractTexture message handling
Change-Id: I5c0ff05d405766b2e0aee992ee1c150b5a0cf059
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-11 07:23:45 +01:00
Mike Krus d794202f3b Clean QJoint message handling
Change-Id: Ib09024017a2d213e50b3acc89d7c411728eb1869
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-11 07:23:35 +01:00
Paul Lemire c731ef9f45 Convert LoadGeometryJob to use direct sync
Change-Id: Id744de2f10e7744ad5a9d4f425ae534153ed7446
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-10 23:57:56 +02:00
Paul Lemire bf437f7da6 Update QShaderData to use direct sync
Also a bit of cleanup

Change-Id: I317fa2dbaa62a55fe371e982ed23976e65696d79
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-08 14:40:59 +02:00
Mike Krus e504957c84 Move skeleton loading code to job
Also removes last couple of messages updating backend to frontend.

Change-Id: I65056c7cf5ff06efab9c9a205f843ed882f9c0be
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-08 12:48:24 +01:00
Mike Krus 06567dc188 Update LoadSkeletonJob to use direct sync
Change-Id: I5622f9784628b7217f6e37c700ac314b7264f439
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-08 12:48:19 +01:00
Mike Krus ee7dd0b8ec Fix compile warnings
Change-Id: Iac24c13fa77bb0c6317af77f61016ee6fbf9a916
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-08 10:06:35 +01:00
Paul Lemire 222c7f3c57 Update LoadSceneJob to use direct sync
Change-Id: Ie615b903e2bd2307e0b7fe853022ea9a17342ab8
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-07 15:15:25 +02:00
Paul Lemire 48ff8579fe Update world transform job to use direct sync
Change-Id: Ie6cdb99332b5c99e583bdb7dfa5c4810ea5bba72
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-07 15:15:25 +02:00
Mike Krus 53efe4ea5a Remove use of node/components added/removed messages
Introduce mechanism to notify backend nodes of changes in relationship
between nodes. If a component is added or removed from an entity,
or if a node is added or removed from a property of another node, then
just rely on the node being marked as dirty when syncing takes place.

For nodes that do not support syncing, messages are delivered as before
but allocated on the stack rather than the heap.

Change-Id: I06affac77e42a9998d9c7f44e231c7724c52b320
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-04 07:10:20 +01:00
Paul Lemire 703f7964f8 Fix in parameters: backend value wasn't reset on cleanup
Lead to a regression where some uniforms wouldn't have the expected
value following destruction/reconstruction of the backend Parameter.

Change-Id: Id747cb2903f25a4a5cc0c5d479a09805d317f380
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-10-03 22:11:14 +02:00
Mike Krus df75e9c6d5 Update ray casting job to use direct sync
When the job is complete and we're back in the main thread,
the job can look up the frontend node and deliver the hits
directly. This saves allocating messages.

Unit test changed quite a bit as it needs an aspect engine &
manager to pass to the job for looking up nodes.

Change-Id: I09d88c5e478fa387690af522c5798a37f3f2d9a6
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2019-10-03 06:58:01 +01:00