summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add replacement materials exampleSean Harmer2018-04-042-2/+2
| | | | | | | | | | | | | All texture assets were made by KDAB under the CLA. The material "sphere" mesh is from Allegorithmic and published under the Creative Commons 4 license. See paragraph 1.2 of https://www.allegorithmic.com/legal/substance-share Task-number: QTBUG-61415 Change-Id: I23d61723bbac561e22e11fa57105b29148c01699 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* ObjGeometryLoader: Fix out of bound errorPaul Lemire2018-02-086-1/+117
| | | | | | | Apparently this was a major security issue reported to security.qt-project.org Change-Id: Id52f035134ca6111e24b5820eb1b64b99449e47f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Ensure node creation changes are sent before using in list propertiesSean Harmer2018-02-021-0/+83
| | | | | | | | | | | | | | | | 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>
* Add test for picking object from multiple directionsMike Krus2018-02-023-0/+198
| | | | | | | | | This would have caught the breakage caused by changing how the camera view matrix was computed Change-Id: I521b7e6c700aeaa1c751cdf0aceb8b8ab66a6af9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Compile failing shaders once only and avoid asserting on failureLaszlo Agocs2018-02-011-0/+13
| | | | | | | | | | | This way a material with a broken shader will fail once (and won't be retried unless the shader code gets changed), and the application will continue gracefully, without asserting. Task-number: QTBUG-65936 Change-Id: I7003e8c6f7d9094280d7757c1020b485f93e3b37 Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Handle 0 stride vertex dataMike Krus2018-01-292-1/+92
| | | | | | | | | | | | | | | All examples, even with packed data, set actual vertex size on the attribute. However, convention is to pass 0 for packed data, in which case GL will compute vertex size based on number of coordinates and component data size. Neither the buffer visitor nor the triangle visitor respected this convention and relied on the real size to be set. Now computing the actual stride if it's passed in as 0. Change-Id: I9a65fd7d8d56f181e31faa93389e3fdd1a973c17 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Revise buffer traversal in bounding volume calculationLaszlo Agocs2018-01-291-1/+136
| | | | | | | | | | | | | Take the index attribute (and buffer) into account, when present. Rely on QGeometryRenderer::vertexCount(), when set. Initially done on dev as: 1d874d33da9174a82fccc266c66a22af006ac8ef Task-number: QTBUG-65590 Change-Id: I98d1865e3581272471d6b93b9633da38dc77163d Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix componentAdded/componentRemoved notifications dispatch to componentsMike Krus2018-01-261-6/+28
| | | | | | | | | | | | | | | | When a component is added to an entity, two change notifications were sent but they both were directed to the entity. This makes sure one message is sent to the entity and one to the component, as was intended. Same for remove notifications. Fixed the unit tests which where incorrectly testing for the subject id of the change notification. Change-Id: Ic697c08e92e884abf28e675e4ae2b44a93ca45d5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Handle multiple surfaces properly for pickingMike Krus2018-01-263-43/+293
| | | | | | | | | | | | | | | | This fixes issues with picking when having multiple viewports and/or multiple windows. Now check that the mouse event actually hits inside the viewport extents. Also track the source of events and check that the surface matches the source of the event. Remaining issue is overlapping viewports within the same window Task-number: QTBUG-59567 Change-Id: I76a4ee2bec7300d893fef6040d89bf81f2109795 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Calculate and store real transform of camera in addition to view matrixSvenn-Arne Dragly2018-01-223-1/+258
| | | | | | | | | | | | | | | | | | | | | | | | | We used to store the viewMatrix as returned by QMatrix4x4::lookAt in the transform component of the QCamera. This was unfortunate for two reasons: 1) An arbitrary entity could not be used as a camera without changing its transform to a viewMatrix, which breaks any other use of the entity. 2) Adding entities as children to cameras lead to the wrong transformation. This made it impossible to properly add objects that should be attached to the camera, such as the hands of a character in first-person view. This commit computes the transform of the camera based on the requested position, view center and up vector. The view matrix is calculated when the matrices are updated in the RenderView. This calculation assumes that the view direction is along the entity's negative z-axis and that the up vector is along the y-axis. Change-Id: If22b29e3d38bf55fbf79e9f7baf0c922e0a48aeb Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add unit test and fix for broken order of event deliverySean Harmer2018-01-181-0/+74
| | | | | | | | | | | | | | | Ensure a backend node is always created before it is used in a property of any other node. This avoids a race between sending the creation, add child and property update changes and the start of a new Qt 3D frame. The race is caused by the use of the event loop to trigger the node created and child added changes. Also be careful not to repeat the node creation. Task-number: QTBUG-65829 Change-Id: I6ca5eb269ce657f8d42d855550fb4f898e3bd420 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Volker Krause <volker.krause@kdab.com>
* Scene3D: allow to force blocking renderingPaul Lemire2018-01-161-1/+1
| | | | | | | | | | | | | | | | When using Scene3D, when the jobs preparing the render commands for the 3D scene take too long (more than the QtQuick refresh rate), the Scene3D wouldn't render anything when QtQuick requested it to. Then, the next time it would be asked to render (next QtQuick frame), if the jobs have finished by then, it will render. If the jobs are still not ready, then the above process is repeated. This patch introduces an environment variable SCENE3D_BLOCKING_RENDERMODE which can be set to force Scene3D to wait (for at most 10ms) instead of returning immediately for the jobs being ready. Change-Id: I2db10e622570a7bc8a2e2cbaff113c110135cd3e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Get rid of the INDEXBITS template argument for QHandleLars Knoll2017-12-132-44/+41
| | | | | | | | | It's not required anymore, as the resource manager can grow as needed. Change-Id: If509de7f2ef90e1af9729d8fc60d7ecb08ede687 Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add layer entity filter cachingSvenn-Arne Dragly2017-11-141-0/+4
| | | | | | | | Also add all dirty flag enums found in dev. Change-Id: Ib364773002a3170aef66e7b365a0a41d8e60bd92 Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Rework resource handlingLars Knoll2017-11-073-90/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | Rework the way the QResourceManager allocates and manages it's resources. Get rid of the huge pre-allocated freelist, and instead merge it with the counter field (that is now always a quintptr large). Give QHandle a direct pointer to it's data in addition to the counter. This makes QHandle 8 or 16 bytes large, but speeds up access to it's data and gives more safety on the counter as that one now always has at least 31 bits. Counter and the linked freelist use the same memory location. To avoid potential conflicts, make sure the counter is always an odd number, so it can't be a valid pointer. Do not use INDEXBITS anymore, the resource manager can now always allocate as many resources as we have RAM available and will grow with the required use (and not allocate fixed memory upfront). This change reduces the memory consumption of the qardboard example from a bit above 40 to 10MB. Change-Id: I514f2d3f957f8635098fb88342e42e3361456340 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Deal with trailing spaces and crlfKevin Ottens2017-11-073-1/+36
| | | | | | | | | We ended up having corrupted meshes if the application which exported the OBJ was adding trailing white spaces. Also make sure we got a test case using crlf for end of lines. Change-Id: Iace9dbc3d0d124fefe9e3350d396fdf26555cd17 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Blacklist checkRunRendererRunning in WindowsTony Sarajärvi2017-10-201-0/+2
| | | | | | | | | After a fix for a crash, this test now FAILs, which requires blacklisting until it is fixed Task-number: QTBUG-63639 Change-Id: I918600f36053a5a3e1adb31da4f1d4ec3303b8b0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Blacklist tst_FilterCompatibleTechniqueJob in WindowsTony Sarajärvi2017-10-191-0/+2
| | | | | | | | | | After a fix for a crash, this test now FAILs, which requires blacklisting until it is fixed Task-number: QTBUG-63639 Change-Id: I10ce9b6b80aa5adf83f2113be7c6b2007463b73e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* tst_FilterCompatibleTechniqueJob: Fix crash on Open GL context creation failureFriedemann Kleint2017-10-181-3/+12
| | | | | | | | | | Add a few pointer checks. This allows for the test to be blacklisted instead of marked as insignificant. Task-number: QTBUG-63639 Change-Id: Ide9216226d880909a600c3becc0d6ca7259e5a69 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Share the effect from the phong materialSean Harmer2017-10-033-21/+32
| | | | | | | | | | | | | | | | This only loads the shader source once instead of 1000 times. Reduces the time to first frame by a further 30% by massively reducing the work the main thread has to do at startup. The Qt3DExtras material classes are convenient but lead to bad practices like this. We should provide a way to allow them to share the effect easily but still use the provided materials for their API. Perhaps a new ctor overload that takes a QEffect pointer would work nicely. Also fixed some float vs double vs int precision warnings as a drive by. Change-Id: I181de8d95841eb88c91c29ef6f45d215da079b98 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Share the mesh in bigscene-cppSean Harmer2017-10-033-8/+12
| | | | | | | | No point loading the same data 1k times. Shaves 35% off the time from application start to first frame being complete. Change-Id: I8cd7c8a5aa377c0663c03e35d7a4c03f50b052f6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use qFuzzyCompare for rotation anglesSean Harmer2017-10-031-2/+2
| | | | | | | Fixes clang warning. Change-Id: I1831bd112c33cdd1fe9cc7ae169cfba05cb8a694 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Don't send change notifications for unneeded propertiesSean Harmer2017-10-031-0/+4
| | | | | | | | | The backend doesn't need to know about the rotation angles used to update the transform. Saves about 3% of time on the main thread related to mallocing the property change notifications. Change-Id: I784baf705cdd697ba860dc7a0c2e0e1c9ee467ec Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove unused buildPropertyMappings() overload and testsSean Harmer2017-09-291-72/+1
| | | | | | | Everything goes through the other overload now. Change-Id: Id0c196a6967a9f83e47092ca1fc7f4ab4ebe9309 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* Add unit test for FindRunningClipAnimatorsJobSean Harmer2017-09-295-1/+340
| | | | | | | Should pass before and after the refactoring. Change-Id: I9ef8f948f03a131546fc6485e9c66494ff383714 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add convenience function to ChannelMapper to return list of MappingsSean Harmer2017-09-271-2/+34
| | | | | | | | Caches the resolution of node ids to ChannelMappings. Updated test to check this new feature. Change-Id: I0c2f539c2bd91e7918b98c5b60c9ca486b63ec08 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Ensure meshName gets used in the functorSean Harmer2017-09-271-0/+28
| | | | | Change-Id: I9015546607b5663f1feada64bc03cb73d3538ef2 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Actually get matching clip indices for componentsSean Harmer2017-09-261-8/+8
| | | | | | | | | | | Rather than assuming they are in order. The blended clip animator code path now behaves the same as the simple QClipAnimator in that it can handle clips with channel components not in the expected order. We can now look at making both share a common code path. Change-Id: I61848e07b4f418ba9f4c56f56f4f49c9a5fbd588 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Fix gathering clip value node idsSean Harmer2017-09-262-4/+14
| | | | | | | | This correctly handles the case where the blend tree consists of a single value node. Added test case to catch it. Change-Id: I8982d2081748866d163f107a4513bd2d17feb83a Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Fix crash on surface selector unit testMike Krus2017-09-121-2/+2
| | | | | | | | Change order of local variables affecting the destructions order and making sure window outlives the surface selector Change-Id: Ia04f110656f4cc563643fb056ae491ffadf3a8b4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix bounding sphere pickingMike Krus2017-09-123-0/+183
| | | | | | | | | | In some cases, the list of pickable objects may contain entities that don’t have an object picker (or not parent has). Now filter the pick results to only keep entities which either have an object picker or are children of an entity that does. Added unit test which now passes Change-Id: I930c3d60cf2d19e845fe6c0de904c53b93ebe8be Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Get rid of the AllocationPolicy template argument in the ResourceManagerLars Knoll2017-09-114-10/+4
| | | | | | | We always use the same policy anyway. Change-Id: I3349b8c19ce0e6239b140dfac7ba66f8dda1b9be Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Get rid of the HandleManager classLars Knoll2017-09-116-347/+2
| | | | | | | | | Instead, direclty use the Allocator to acquire and release handles without an additional indirection. This removes around 30% of the overhead in run(). Change-Id: Ic4a9343dd52a900eb1c7eb6b4135bc7670076df1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove ArrayPreallocationPolicyLars Knoll2017-09-114-472/+12
| | | | | | | It's not used anywhere Change-Id: Id65ec9fc8e38697c0dbd23fe4f816e1637a22483 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* GraphicsHelperGL2: Remember to set raw byte sizeKevin Ottens2017-09-061-0/+6
| | | | | | | | | | | If one ended up with this helper then the applyUniform would lead to a divide by zero for any type. As a side-effect, the support for more matrix types needed to be done for unit tests to keep passing. Change-Id: I66c8a2eb7e5617f2fed96c689cb4ebc024ef9853 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* VSyncFrameAdvanceService: don't use timers in unit testsMauro Persano2017-08-311-78/+30
| | | | | | | | | | | | | | Unit tests for VSyncFrameAdvanceService rely on somewhat strict timing and may fail under certain loads. This patch replaces timers with a semaphore to synchronize between threads. This also makes the unit test closer to actual Qt3D code, where there's a semaphore in the renderer to synchronize render view submissions. Change-Id: Ie328cdee1b3a0c2ad17f02d4f14e57e218556061 Task-Id: QTBUG-62825 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* VSyncFrameAdvanceService: fix Scene3D renderingPaul Lemire2017-08-111-1/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | When rendering with Scene3D it could be that doRender() is called a lot more times than the speed at which the Qt3D simulation loop is running (this happens when resizing the window) This results in vsyncFrameAdvance->proceedToNextFrame() being called while the simulation isn't in a waiting state (simulation loop not yet blocking on vsyncFrameAdvance->waitForNextFrame()). This means that when the simulation loop finally unlocks, it would be able to make several loops for a given frame. Obviously this is really dangerous as the simulation loop drives the synching of changes and this could result in the data being prepared by the render jobs and the actual data in the managers to be corrupt. To fix that, vsyncFrameAdvance->waitForNextFrame() now acquires all available resources + 1 to cope with proceedToNextFrame being called more than once. Obviously this doesn't happen when Qt3D drives the rendering and the VSyncFrameAdvanceService was adjusted to have different behaviors depending on whether we are rendering with Scene3D or not. Change-Id: I495779571256d132fa7e1b3b31114f737de35a71 Task-number: QTBUG-60613 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add QRenderState unit testWieland Hagen2017-08-033-0/+313
| | | | | | | Backend nodes should receive frontend proeperty changes Change-Id: I19ba70d08de833aab467a51d5b21553f0b602ec6 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add private module qt3dcoretestSean Harmer2017-08-036-0/+365
| | | | | | | | Static library containing helpers for unit tests to avoid having to build the same files 200 times. Change-Id: I89d63abbd7777a96276154298c2748e2d6774514 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix deferred-renderer-qml lightingWieland Hagen2017-08-024-63/+119
| | | | | | | | | | | | | | The lights must be part of entities that are actually included in the final scene effect layer. So the light world positions have to be forwarded from the actual scene entities to some "dummy" light entities that exist just for the final scene effect render step. Also correct model / modelNormal matrices must be used for global normal/position calculation in the GBuffer render step. Task-number: QTBUG-46707 Change-Id: I380d2e2ecb008ab0606dcd36cd5d98dd1ec41ba6 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* deferred-renderer-qml example: add all .qml files to projectWieland Hagen2017-08-021-0/+2
| | | | | Change-Id: I9add67acbfab26c78c137753bb6b81865bf0abcf Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix RenderCommand sortingPaul Lemire2017-08-021-2/+186
| | | | | | | | | | | | - Remove type punning mechanism that was used to filter previously (could lead to undefined behavior) - Properly filter based on shader and material - Add unit tests Change-Id: I8d0fd4a49d586e6ec26515e2cafe1ea94d38f8f1 Task-number: QTBUG-60183 Reviewed-by: Oleg Evseev <ev.mipt@gmail.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Use QSharedPointer::create() moreMarc Mutz2017-07-2222-62/+62
| | | | | | | | | | This is the result of running the (experimental) clang-tidy check qt-modernize-qsharedpointer-create Discarded changes: none. Change-Id: Ic6368521ebf5841267ffe7917cc652627f7b26a7 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* RenderCapture: read back from the correct framebufferPaul Lemire2017-07-1711-9/+620
| | | | | | | | | | | Up until now, RenderCapture would read back from the back buffer. In cases where it's used within a RenderTargetSelector, it should instead read back from the ColorAttachment0 of the framebuffer. Later on we might allow to specify the ColorAttachment. Change-Id: I9ca94333184338b2fdb79c5c2668d5929ac8d405 Task-number: QTBUG-61547 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Fix Deferred-Renderer examplesWieland Hagen2017-06-278-20/+22
| | | | | | | | | | RGB32F and RGB16F will not work on some drivers. Shader variables must be initialized to zero, will flicker if not done. Task-number: QTBUG-56248 Change-Id: Iead5df1a607db80b733aefa73d7a59c8310a8d81 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Change manual tests using Scene2D to use TextureMaterialMäättä Antti2017-06-248-250/+6
| | | | | | | | | | Change render-qml-to-texture-qml and video-texture to use TextureMaterial. This removes the dependency to the render-qml-to-texture manual test from these tests. This also fixes the controls in the render-qml-to-texture-qml test, which were 'upside down'. Change-Id: I248014decd8f9d06b0e0922d035afe8c0b0f78ff Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix QRenderCaptureReply deallocationMäättä Antti2017-06-211-0/+21
| | | | | | | | Add deallocation guard and set parent of the reply. Task-number: QTBUG-61508 Change-Id: Ia299450d792b2254c2944472382c8241b271ebf6 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* animationutils: Improve autotests for QColorLaszlo Agocs2017-06-191-0/+54
| | | | | Change-Id: I88e254c36e99a83a8e7bbc562b7a729a04ace28a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Update NodeInstantiator's children on parent updateMauro Persano2017-06-163-0/+45
| | | | | | | | | | | | | | Currently the parent for elements created by NodeInstantiator are set to the instantiator's parent. This doesn't work for nested instantiators, since at the time the inner instantiator's children are being created the instantiator itself doesn't yet have a parent node yet. Update the parent of elements created by the instantiator when the instantiator's parent changes. Change-Id: I6f260ad2a8a81af5551799e6c643d8849f46e342 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Add support for linear interpolation in clip jsonLaszlo Agocs2017-06-143-0/+88
| | | | | | | ...and add an autotest Change-Id: I5c473f5f5918db9cc108f9966fe549e2cba374de Reviewed-by: Sean Harmer <sean.harmer@kdab.com>