summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* ChangeArbiter/SceneChange: use id as change subjectPaul Lemire2015-02-283-26/+20
| | | | | | | | | | | | Instead of having a QNode* or QObservable as the subject of a change, we use it's unique NodeId instead. That will prevent the ChangeArbiter from trying to distribute changes by looking at a QNode/QObservable id when the QNode/QObservable might have been destroyed in the meantime. Change-Id: Ia419d5b841434fd65522c8c65de552089cfe97cf Task-number: QTBUG-44628 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Unit Tests for RenderShaderPaul Lemire2015-02-283-1/+139
| | | | | | | | Note: Only test proper initialization, cleanup and that it matches a frontend peer. Doesn't that shader loading as this requires a context, surface... Change-Id: I05f6ef059005b4781b82876a8d73e46d41d44387 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix: remove QByteArrayLiteral used when setting SceneChange property namesPaul Lemire2015-02-282-12/+12
| | | | | | | | This was probably forgotten when the property name was changed fron QByteArray to char *. Change-Id: Idd6a988703a241519b3aba7b1d127adae5e1375e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Added NodeInstantiatorSean Harmer2015-02-2814-2/+679
| | | | | | | | | Hopefully in the long term we can make the renderer smart enough that it can automatically use instancing to render such things. Change-Id: I9f5cfabeea11f5e6b925d5ad2466afa8e601e6f8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Disable building benchmarks in debug buildsLaszlo Agocs2015-02-271-1/+5
| | | | | | | Because linking fails on Windows due to the benchmarks being release-only. Change-Id: I386b38f10ec5018f34bbbd45c6ff29ad6925faa5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* unit tests for qchangearbiterPaul Lemire2015-02-181-97/+143
| | | | | Change-Id: I7f6e37cd010b530bd36e15d8461e6d50da7a42b9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Skip benchmark on WinCE for nowLaszlo Agocs2015-02-141-1/+1
| | | | | | | | | | | Some of them do not compile: tst_bench_qresourcesmanager.cpp(115) : error C2039: 'time' : is not a member of 'std' For now let's just skip them in wince builds. Change-Id: Id58ef24431abeb2916836e7ab5a9a05f8c8eeb01 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Copyright header change.Mika Salmela2015-02-0924-456/+336
| | | | | | | | As for preparation for Qt5.5 release the copyright header is updated to correspond the current license requirements. Change-Id: I36632918b66f455539453b42c369689fb11298ec Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Complete unit tests for QNode and friendsKevin Ottens2015-02-082-12/+175
| | | | | | | | Thanks to QLockableObserverInterface I can finally unit tests the changes I did in f446248. Change-Id: Ica9c47417bd7036fa22dc0c5ddb38bb3754bec56 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Introduce QLockableObserverInterfaceKevin Ottens2015-02-081-8/+14
| | | | | | | | | We introduce QLockableObserverInterface as an intermediate interface before the QChangeArbiter and depend on that interface whenever possible. Change-Id: Ic92efec8d68c88344bb43f8fc7dc10b1212180af Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Don't store QRenderState* in RenderRenderPassKevin Ottens2015-02-031-52/+97
| | | | | | | | RenderRenderPass is now storing pointers to backend objects as soon as possible. Change-Id: I6f8c4b92d18bcfe726df5731b978df0606a6a81c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Don't keep pointers to QParameterMappingKevin Ottens2015-02-031-2/+8
| | | | | | | | | The backend is not supposed to keep pointers on frontend objects it doesn't own. Instead store the data in RenderParameterMapping instances as soon as possible. Change-Id: I5f0ff04f06c54c2ad0fbe483051db9974f4aedf8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add tests for RenderRenderPassKevin Ottens2015-02-023-0/+298
| | | | | Change-Id: Ifa1ee12959202093bea49d1e6c5b028d17eae01c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add QServiceLocator and skeleton system and OpenGL info servicesSean Harmer2015-01-283-0/+175
| | | | | Change-Id: I587d4d9f6065e377e7254ca916fdab2c0527ac30 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* On component removal only deal with the idKevin Ottens2015-01-281-4/+4
| | | | | | | | Would have been nice to unit test the other end of this event handling (namely QEntity) but it is tight coupled to ChangeArbiter. Change-Id: I78a63a237cfac7502a0b2e48118559f5b1bec85a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Unit tests for RenderEntity sceneChangeEventKevin Ottens2015-01-283-0/+200
| | | | | Change-Id: Icc554960901833834dfd00ce2505b160d125e86a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Cleanup entities component lists on destructionKevin Ottens2015-01-281-0/+23
| | | | | Change-Id: I1e5f006b612a69e6b5cc98aecb6c8fdc3d6281b0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add QAspectFactory class, creates aspects by nameKevin Ottens2015-01-233-0/+139
| | | | | Change-Id: I91480d9a61accf313d10f5ddb21100fdc13481c2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* tst_cloning: Add unit test for cloningPaul Lemire2015-01-104-40/+159
| | | | | Change-Id: I008e81fa698195b732c535a2728bd117ddd1b325 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Change uuid -> id as it really isn't universally unique any longerSean Harmer2014-12-193-57/+57
| | | | | Change-Id: If25d1f71dfff62009db1cd4f72a1b0725b4c6d14 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Unit tests for QGraphicsUtilsPaul Lemire2014-12-123-1/+380
| | | | | | | | Helps make sure that the methods are working as expected before being used by the renderer. Change-Id: If335bf4c7f9cb95d5e7b1f9bd862d438e71a3fe1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename QNodeUuid to QNodeIdSean Harmer2014-11-191-3/+3
| | | | | Change-Id: I0450a4d4708af1ccd3d4c8f2ddc5c9a5c9deca27 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make QCircularBuffer and QBoundedCircularBuffer privateSean Harmer2014-11-196-6/+6
| | | | | Change-Id: I298fbaf819a118a5da4453082ec7f1484835480a Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Rename QResourcesManager -> QResourceManager and make privateSean Harmer2014-11-1810-69/+69
| | | | | | | | Once we are happy with the API we can make this public for a future release. Change-Id: I914f087e10adddbadac1649a8b889b9f53f82fd2 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add skeleton unit tests for QEntity and QAspectEngineSean Harmer2014-11-175-0/+179
| | | | | | | | | | | | QAspectEngine is crashing upon shutdown so adding a test case to investigate. Without a root entity set we just get warnings about threads being killed whilst still running. With a root entity set, it crashes. Need to solve these before we can test any more work towards a clean shutdown. Next commit solves the crash so merge it together with this one. Change-Id: Ic90c0f130ed48b418bb376b38eb10f23ea90590e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Enforce that we never try to allocate unexpectedly huge items.Milian Wolff2014-11-141-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also allows us to greatly simplify the code while at it. If future subclasses ever become larger than our maxObjectSize, we can either force them to overload operator new themselves or increase the maxObjectSize in the allocator. That never happens in practice and just increases the codesize and also slows down the code. The benchmark now shows the following numbers for perf's instr:k counter on my machine: ********* Start testing of tst_QFrameAllocator ********* Config: Using QtTest library 5.5.0, Qt 5.5.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 4.9.2) PASS : tst_QFrameAllocator::initTestCase() PASS : tst_QFrameAllocator::benchmarkAllocateSmall() RESULT : tst_QFrameAllocator::benchmarkAllocateSmall(): 880,438 instructions per iteration (total: 880,438, iterations: 1) PASS : tst_QFrameAllocator::benchmarkAllocateBig() RESULT : tst_QFrameAllocator::benchmarkAllocateBig(): 965,937 instructions per iteration (total: 965,937, iterations: 1) PASS : tst_QFrameAllocator::benchmarkDeallocateSmall() RESULT : tst_QFrameAllocator::benchmarkDeallocateSmall(): 701,573 instructions per iteration (total: 701,573, iterations: 1) PASS : tst_QFrameAllocator::benchmarkDeallocateBig() RESULT : tst_QFrameAllocator::benchmarkDeallocateBig(): 701,572 instructions per iteration (total: 701,572, iterations: 1) PASS : tst_QFrameAllocator::benchmarkAllocateRaw() RESULT : tst_QFrameAllocator::benchmarkAllocateRaw(): 867,893 instructions per iteration (total: 867,893, iterations: 1) PASS : tst_QFrameAllocator::benchmarkDeallocateRaw() RESULT : tst_QFrameAllocator::benchmarkDeallocateRaw(): 771,701 instructions per iteration (total: 771,701, iterations: 1) PASS : tst_QFrameAllocator::cleanupTestCase() Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted ********* Finished testing of tst_QFrameAllocator ********* Change-Id: I0500a206e8460e27b5157d6238a06bee355b7318 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add benchmark suite for QFrameAllocator.Milian Wolff2014-11-143-1/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Results for instr:k perf counter on my machine are: ********* Start testing of tst_QFrameAllocator ********* Config: Using QtTest library 5.5.0, Qt 5.5.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 4.9.2) PASS : tst_QFrameAllocator::initTestCase() PASS : tst_QFrameAllocator::benchmarkAllocateSmall() RESULT : tst_QFrameAllocator::benchmarkAllocateSmall(): 1,060,442 instructions per iteration (total: 1,060,442, iterations: 1) PASS : tst_QFrameAllocator::benchmarkAllocateBig() RESULT : tst_QFrameAllocator::benchmarkAllocateBig(): 1,145,940 instructions per iteration (total: 1,145,940, iterations: 1) PASS : tst_QFrameAllocator::benchmarkDeallocateSmall() RESULT : tst_QFrameAllocator::benchmarkDeallocateSmall(): 901,579 instructions per iteration (total: 901,579, iterations: 1) PASS : tst_QFrameAllocator::benchmarkDeallocateBig() RESULT : tst_QFrameAllocator::benchmarkDeallocateBig(): 901,579 instructions per iteration (total: 901,579, iterations: 1) PASS : tst_QFrameAllocator::benchmarkAllocateRaw() RESULT : tst_QFrameAllocator::benchmarkAllocateRaw(): 1,067,539 instructions per iteration (total: 1,067,539, iterations: 1) PASS : tst_QFrameAllocator::benchmarkDeallocateRaw() RESULT : tst_QFrameAllocator::benchmarkDeallocateRaw(): 971,701 instructions per iteration (total: 971,701, iterations: 1) PASS : tst_QFrameAllocator::cleanupTestCase() Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted ********* Finished testing of tst_QFrameAllocator ********* Change-Id: Iae2bcd53d4efcff4b8486b4571dc1d1acfcbc19d Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Guard against unsafe usage of QFrameAllocator::(de)allocateRawMemory.Milian Wolff2014-11-141-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before one could potentially fall into a trap when one would call allocateRawMemory<BaseClass>(size); When size belongs to a child class inheriting from BaseClass and falls into a different (larger) bucket, the following deallocation via deallocateRawMemory<BaseClass>() would fail. Because there we just picked the size of the BaseClass to find the bucket. Now the whole API is restructured to guard against this wrong usage: - we only ever operator on void* in the *Raw* methods - we pass on the size explictily This also means we must use the safe operator deallocate overloads that also take the size as a parameter. The unit test was run first to check that this was indeed an issue. Then it is ported to the new API and cleanup up a bit as well to reduce duplicated code. Change-Id: I559af1c0ffc633962fac12d6e3cadf87c09ef92d Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Cleanup code and remove C-isms.Milian Wolff2014-11-141-12/+12
| | | | | Change-Id: I09aa2d0d7b95b809ba3da4841c05c04c47d377f8 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QNodeUuid: typedef for QUuidPaul Lemire2014-11-021-3/+3
| | | | | | | Should allow to easily replace QUuid by a custom quint64 based struct Change-Id: Ib4ba57efd2e070317aa3417b37ce091f2b4779a0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QObservableInterface refactoredPaul Lemire2014-11-021-8/+2
| | | | | | | | | | | | | Explicit registerArbiter/unregisterArbiter methods. QNode: removed QReadWriteLock for the QChangeArbiter, no need to protect as the QChangeArbiter is always set in the main thread. QBackendNode: similar for the QBackend, all locks removed as we are always locked when synching changes. QObservable was removed. Change-Id: I570afbf3e3230ac9d9613474fedd7849aba7412a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Optimize: Use a plain non-recursive QMutex in the QResourceManager.Milian Wolff2014-10-293-17/+12
| | | | | | | | | | | | | | | | | | | | | The overhead of a read/write lock should not be required for such small critical sections. It will also allow us to cleanup the code a bit more. Already, the code changes lead to a small improvement before: RESULT : tst_QResourcesManager::benchmarkAllocateSmallResources(): 46,552,767 instructions per iteration (total: 46,552,767, iterations: 1) RESULT : tst_QResourcesManager::benchmarkAllocateBigResources(): 48,338,703 instructions per iteration (total: 48,338,703, iterations: 1) after: RESULT : tst_QResourcesManager::benchmarkAllocateSmallResources(): 44,848,672 instructions per iteration (total: 44,848,672, iterations: 1) RESULT : tst_QResourcesManager::benchmarkAllocateBigResources(): 46,634,161 instructions per iteration (total: 46,634,161, iterations: 1) Change-Id: I8ef0aa52be3caf8b4c8691579677f693a054565c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Optimize ArrayPreallocationPolicy.Milian Wolff2014-10-254-28/+53
| | | | | | | | | | | | | | | | | | The tricks applied are identical to those done previously for ArrayAllocationPolicy: We remove the obsolete hash for the index mapping and instead use pointer differences directly, which is much faster and reduces the memory consumption. Some variables are also renamed to better reflect common allocator nomenclature. The added benchmark shows a reduction of the instruction count by a factor of about 10. Change-Id: Icabc354ab9e1e8ea0b1dc83c71a2f2cfe49d1da0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QResourcesManager: Added dynamic ArrayAllocation policyPaul Lemire2014-10-2511-23/+855
| | | | | | | | | | | | | Startup memory usage is now 10% of what it was before. Unit tests corrected and benchmarks added. Benchmarks: DynamicArrayPolicy QResourcesManager Change-Id: Idaeedba5156ac2d6a0a494e7399d9dcb141dc81c Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QChangeArbiter and Observers/Observables made privatePaul Lemire2014-10-173-7/+7
| | | | | | | | | Note: the Renderer aspect uses all those private headers, when we introduce the QBackendNode class that will be a wrapper around those, we will be able to remove those private includes. Change-Id: I6240f754e6da251da158cafcf76029ae59000e05 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Hide doClone implementations behind a macroKevin Ottens2014-10-152-22/+4
| | | | | | | | | This way we will avoid inconsistencies. It also means making some of the copy() implementations more clever. Change-Id: Ic79c9ec7c9c32f8951d5d9f5184592880bf8d5fd Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Silence warnings in QNode unit testSean Harmer2014-10-041-3/+3
| | | | | Change-Id: I903493cc3399b6680ac5947f1c81033a1f1c745c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QNode refactoringPaul Lemire2014-10-035-120/+94
| | | | | | | | | | | | | | | | Move almost everything to private classes. Assimp loading restored. All examples working. QNode hierachy is now handled through QObject::setParent, addChild, removeChild are part of the private api. Note: commented QChangeArbiter unit tests as they can no longer work with this patch and will restore them when QChangeArbiter will have been made private. Task-number: QTBUG-41470 Task-number: QTBUG-41523 Change-Id: I4430974b3aa7f3744c38714b451b122e0cb4d0c9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Improved/Refactored cloning and doClone off all subclassesPaul Lemire2014-09-303-13/+29
| | | | | | | | Note: As we are using QScene during cloning, it is important that node hierarchy be created and added in the proper order (parent then child). Change-Id: I8fd53f7ca696ec9aca19cc70dc116ccba4154911 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Unit Tests for QChangeArbiterPaul Lemire2014-09-303-1/+714
| | | | | Change-Id: I60e9fd42191c14428b38ee9c343477dd4fac3596 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Unit Tests for QScenePaul Lemire2014-09-302-0/+372
| | | | | Change-Id: If4fe9107b72b9efe9bec24e854f4f1b7e6b6553d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QFrameAllocator allocate based on size instead of typePaul Lemire2014-09-301-0/+65
| | | | | | | | Allows to handle allocation of subclasses using the overloaded new operator from the parent. Change-Id: Ie587c81fb3a5cb5aa6735377bfcc57bb4407b117 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Mark backend render classes as private and fix compilationSean Harmer2014-08-172-3/+3
| | | | | Change-Id: I1afb8408e03d4b5405e8ee82d1a3b6b4364d3f5d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Completed node unit testsPaul Lemire2014-08-141-5/+85
| | | | | Change-Id: Iba356b1266b820b50b86efcbd6590f120db80b79 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QResourcesManager unit test completedPaul Lemire2014-08-143-7/+411
| | | | | Change-Id: I3fbf2f71d2ef35d0f0cbe6ac2c8d1f539a6c0de7 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* tst_node corrected to work with abstract nodes and componentsPaul Lemire2014-08-131-22/+52
| | | | | Change-Id: Icaed79267790f6d17c2e3ba481a1a9bd3e65a95e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Renamed Component to QComponentPaul Lemire2014-07-051-9/+9
| | | | | Change-Id: Ifd585f5883e446d0569c38219d26ba581455e857 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Renamed Entity to QEntityPaul Lemire2014-07-051-7/+7
| | | | | Change-Id: I16b3d967e1244e3d47bffd36f6284a0e9ef0a89f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Renamed Node to QNodePaul Lemire2014-07-051-19/+19
| | | | | Change-Id: I0a0ebde1c107db8831b596eab1e512a2062979f7 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rendering using QFrameAllocatorPaul Lemire2014-07-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | Renderer contains a QThreadStorage object containing a vector of QFrameAllocator. Each Renderview Jobs calls the Renderer to retrieve the QFrameAllocator for their thread and their frame index (between 0 and the maximum number of cached frames). If the QThreadStorage hasn't been initialized, it is initialized, otherwise the QFrameAllocator is returned directly. The QFrameAllocator is automatically cleared if the previous call wasn't for the same frame index. QUniformValues and RenderViews have been updated to used QFrameAllocator to allocate objects instead of using new. RenderQueue has been slightly modified. It is now possible to retrieve the RenderQueue to render without popping it out of the QCircularBuffer of RenderQueues. A call to popFrameQueue does that. This is needed to be sure that we won't be rendering a RenderQueue that could have been cleared because the backend is rebuilding a newer frame. This forces the Renderer to render the whole frame before allowing the Jobs to build other frames if there are more than the maximum amount of cached frames. Change-Id: Ie7718e201e2f6b420903092d1706277e9786916e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>