summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Picking: reuse LayerFilterJob to perform layer filteringPaul Lemire2021-08-094-0/+544
| | | | | | | | | | | This fixes picking for cases where multiple LayerFilters using different filter modes are present in the FrameGraph. This also reduces code duplication. Change-Id: I19d0c2c5777930820ab950cbf2bfe08ef7d2484f Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 406ea4134444a05dd89f215b3144181c0b0ce924) Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix for QShaderNode fix that selected highest version number of a rulePaul Lemire2021-08-031-2/+2
| | | | | | | | | | | | The rule selection still has to be made from last added rule to first so that format.support works correctly. - Update QShaderNode unit tests Change-Id: I47af898ee0d82e91009efccf1dca9937feaca717 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 21168905a7eda8806543b490a0fae5a5a0ec7cad) Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Rerun bounding volume update jobs when entity enabled property changesPaul Lemire2021-07-301-0/+4
| | | | | | | | | | | | | Otherwise, this results in the bounding volume being out of sync with entities (an entity initially disabled that gets enabled would have an empty bounding volume) until some other events in the scene triggers a rebuild. Task-number: QTBUG-93035 Change-Id: Ia21eec0eb5601169e1789321080803a5aed12e82 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit d29f3b277d0f949f2fa0b0e0214e38ec3e790c40) Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix multi-view pickingMike Krus2021-06-153-2/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When using Scene3DView, qt3d still has a single scene graph and and a single framegraph. It automatically creates layers and layer filters to make sure the right objects are only rendered in the right view. This affects picking though as it was not aware of layer filters. This patch collects the filtered layers for each view and makes sure only entities matching those layers are tested for picking (this uses code that existed for ray casting). This changes the behavior of Qt3D though as non rendered objects (ie, excluded by layer filtering) are no longer pickable. Only way now would be to provide a shader that just discarded everything. Note: Scene3DView is not available in Qt6 so on this branch this only really affects custom scenes with multiple views each showing different content. [ChangeLog] Non rendered entities (due to layer filtering) are no longer pickable Ticket-number: QTBUG-94214 Change-Id: I8515368e43342b33ac219dff533e92efa72fbe7d Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit d79376732105dea749e71cdb114251084c7138a9) Reviewed-by: Mike Krus <mike.krus@kdab.com>
* ObjectPicker: ensure pristine pickers are handledNicolas Guichard2021-05-061-0/+15
| | | | | | | | | | | | | When adding a QObjectPicker component to a QEntity, the object couldn't actually be picked until one of hoverEnabled, dragEnabled or priority changed. This fixes the issue by ensuring notifyJob is called at least once, when the picker is initialized. Change-Id: I5b035cf5be6ef1da35c2d24cf76bc2daaad9bc57 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 1641eae01636ddb82b668c4f91d2c26f89e5bc06)
* Fix sampler2DArrayShadow uniform in QShaderGeneratorJim Albamont2020-12-281-1/+1
| | | | | | | | Also update the test Change-Id: I23d897f40747192687e632d21aa8fe2f57645909 Pick-to: 6.0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix binding of CubeMapArray texturesJim Albamont2020-12-111-0/+107
| | | | | | | | | | | | | | | To bind to a specific face: use glFramebufferTextureLayer and calculate the layer as 6 * layer + face. To bind to a specific cubemap: There is no way in OpenGL to directly bind to an entire cubemap within the array. Instead bind to the entire texture as for a CubeMap with AllFaces. It is up to the drawing code to select the right cubemap and face, 6 * layer + face Change-Id: Ib9e1a598503eeba1fa729677944aba6d799f90b2 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 94ab90f93dc5338338f30e6d78854b55353d3cb8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix disabling shader cache via environment variableJim Albamont2020-12-091-0/+2
| | | | | | | | | | | The tests were a broken too because the QT3D_DISABLE_SHADER_CACHE environment var was still set from the previous test. These tests passed before because the shader builder used the cache if either the QT3D_DISABLE_SHADER_CACHE or QT3D_REBUILD_SHADER_CACHE are not set. Change-Id: Ic04bf3bb8bb7b9b27e3dc9663fe5e96647a3bed4 Pick-to: dev 6.0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix GLTexture cleanupPaul Lemire2020-11-053-1/+132
| | | | | | | | | | The GLTexture class wasn't registered for cleanup on the manager. This could result in it being reuse while not being reinitialized resulting in incorrect rendering. Change-Id: I85e6a5c3b5ca9d3cfa5ac5bcb1db3695dabfa576 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit dbf5da312ae3f406cc45a80c6ab2464b6e2d1e14)
* Handle invalid entity names in QSceneLoader::componentMichael Brasser2020-11-021-0/+7
| | | | | | | | | Return nullptr rather than crashing. Change-Id: Ie11fe798e0bcd3bfdfda053331eabf9ed16e3d94 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 59387766853e64e70efb911772ea5dfe04ff5aad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add caching mechanism to ShaderBuilderPaul Lemire2020-11-021-2/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is a 2 level cache system: runtime and offline First we now generate a hash key based on unique features of a graph, the api it targets, the last time the graph file was modified. We then use that hash key to at runtime check whether we have already loaded a graph matching the same hash key. If that's not the case, we switch to using the offline cache and checking whether a file already exists for that shader or not. If the file exists, we load it, use the code it contains and add it to the runtime cache. If the file does not exist, we revert to actually generating the shader and we save the generated code to both the offline cache and the runtime cache. By default, the offline cache with try to write into the location reported by QStandardLocation::writableLocation(QStandardLocation::TempLocation). Optionally, the environment variable QT3D_WRITABLE_CACHE_PATH can be set with a path to a writable location. If QT3D_REBUILD_SHADER_CACHE is not empty, cache will be regenerated. Alternatively if QT3D_DISABLE_SHADER_CACHE is set, cache will be ignored. Change-Id: Ia348f92ce4cdd5e63ec89e58b7954d1f127f26bb Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 17324467897e25bfc1abef0db540b0690c04a55e)
* Expand QPaintedTextureImage documentationMichael Brasser2020-10-221-0/+2
| | | | | | | | | Also make use of the newly documented pattern in the manual test. Change-Id: Idefe271eea345848af3817e08ac5b45946843dad Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 3d2d67b571b0f6ed3df1c0d3eeed1e89097bef57) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix a crash when node is added and destroyed immediatelySean Harmer2020-10-051-0/+47
| | | | | | | | | | | | | | When a node is added to the scene it is scheduled for a post-creation initialization. However, if the node is destroyed before this post-creation queue has been processed we will crash. This commit ensures that the node being deleted is removed from the post-creation queue. Usually the queue will be empty and so this should not add a performance penalty. Change-Id: Ibe4289e1e54cdb145f8588f15dc4ad894e427582 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 0a533673b5450d49725d23e08ac13b03fad564fb)
* Add QNodePrivate::registerDestructionHelper for std::vector containersPaul Lemire2020-09-241-9/+190
| | | | | | | | | Ideally should support generic containers but clang seems to fail to generate the symbol on the mac. Change-Id: Ic1d6d815ab9aff60a97b3b0047228f55d7efe158 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 5a33b94b348e5c65155b526e7746d9fe45560959)
* QShaderGenerator: add a #define LAYER_name for each layerPaul Lemire2020-09-181-0/+36
| | | | | | | | | | This will make it more convenient to insert conditional code based on whether a layer is defined or not. Change-Id: Ia72b569f022dd2ee723bf2493710eab709042639 Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 7889cf1c6f9790391690ce31f391529b2dd8230e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QShaderGenerator: generate node headers in the same order as statementsNicolas Guichard2020-07-313-84/+83
| | | | | | | | | | | | | | | This ensures that header snippets that depend on one another are forced to be emitted in the correct order, assuming the nodes also depend on one another. This has the side effect of dropping header snippets from nodes which are not connected to any output node or with any unbound input. Also removed a few lines of unused code. Change-Id: I5e544470aea1d34467f8165fb49e48d38931e0bc Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 0ee455a025b21c06f99c41cba5a699a4a1bc78c8)
* rhi: fix SubmissionContext::loadShader for Unicode filesNicolas Guichard2020-07-161-0/+8
| | | | | | | | | | | | | QRegularExpression::match takes a QString and not a QByteArray, so QRegularExpressionMatch::capturedStart is not reliable to locate bytes in a QByteArray which might contain Unicode data. This fixes the issue by explicitly working on QStrings. Change-Id: Ia32ee169718d98e7197d7bfa19ca23e6e243dc25 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 13067bf7313e2e0e9c16e952bc97dd8854695967) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix incorrect use of QString vs QByteArrayMike Krus2020-06-292-6/+8
| | | | | | | Change-Id: I206fc781de5e4f281c9850c7d9f89c2ef3e588a0 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 0a69fa7279e6f9bbc77483247c2742005675d6a8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QBuffer::updateData being called several times in a rowPaul Lemire2020-06-182-0/+81
| | | | | | | | | | | | QBuffer::updateData would send a single update at the time and would overwrite the latest update if it was called again before synching with the backend took place. This patches fixes by storing a list of pending updates instead. Change-Id: I1fc501ad921c953ec88117fcc49c0cfcde6ca8aa Task-number: QTBUG-81921 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Leverage RV cache to reuse render commands when possiblePaul Lemire2020-06-041-64/+159
| | | | | | | | | | | | | | | | | | | | | | | | | - Only perform render command filtering when needed (when camera has moved usually) - Keep RenderCommand around so that we only update them if needed: -> We keep a double set of commands we per RV and switch in between every frame - Introduce EntityRenderCommandDataView as a wrapper around RenderCommands -> Use std::vector for RenderCommand storage (avoids hidden detachments) -> Filter and sort indices into the RenderCommand vector rather than the commands directly - Cleanup RenderView -> Remove InnerData field -> Hide direct RenderCommand access - Next steps -> Only update uniforms that need to be updated -> Most likely lights/standard uniforms won't all change every frame -> Only update light sources for entity when needed Change-Id: I153822a16c0989a8ac5b83d756385056c96572aa Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 59345bc1a733ee035b342feecadc923e062a850c)
* QResourcesManager: switch to std::vectorPaul Lemire2020-06-047-13/+13
| | | | | | | | | | Given QVector is potentially slower for this use case and the fact that QVector might become QList in Qt6, we're better of using the std. Change-Id: If2c403439ddb856b60f8bfd5ae7c6ec1cb2c892a Reviewed-by: Mike Krus <mike.krus@kdab.com> (cherry picked from commit 04bdb35a6c5f5fe417c06392e6a0861d80ec9dba)
* QShaderGraph: disable edges connected to disabled nodesv5.15.0-rc2v5.15.0-rc1v5.15.0Nicolas Guichard2020-04-271-0/+44
| | | | | | | | | | | | | | | | | | | | This graph failed to generate statements with enabledLayers = {"0"}: _edge0i__ function0 __edge0o__ / \ input output \_edge1i__ function1 __edge1o__/ with function0 and edge0o on layer "0" only and function1 and edge1o on layer "1" only and all other nodes and edges on all layers. The issue was that when only layer "0" is enabled, edge1i didn't get properly discarded and Kahn's algorithm didn't ever schedule input. Task-number: QTBUG-83766 Change-Id: Idb8705d487c3748153e0c4b3330b9589e827139e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* rhi: Port most of Qt3DExtras materials to RHIJean-Michaël Celerier2020-04-221-0/+2
| | | | | Change-Id: Iba20f047404b20c1e5b9bdcef917b3c2a1000d59 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* rhi: Handle RHI-required information in QShaderGraphJean-Michaël Celerier2020-04-211-1/+1
| | | | | Change-Id: I705843bbb1f6928c2e36b327469882e11fb9613e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Merge remote-tracking branch 'origin/5.14' into 5.15Antti Määttä2020-04-219-0/+564
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp src/plugins/renderers/opengl/graphicshelpers/submissioncontext_p.h src/plugins/renderers/opengl/renderer/renderer.cpp src/render/backend/attachmentpack_p.h src/render/frontend/qrenderaspect.cpp src/render/picking/qabstractraycaster.cpp tests/manual/manual.pro Change-Id: I617b7e34bf7e11b2921bfc15e1b99c3e81891ec7
| * Allow for when a Scene3D item switches screensAndy Shaw2020-03-139-0/+564
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a Scene3D item switches screens then it will need to be reinitalized so that the supporting contexts, offscreen surfaces are set to use the same screen and not the original one. This ensures that the item is still rendered correctly on the new screen. This includes a manual test using QQuickWidget in separate windows that enables it going from one screen to the other. This is a fresh version after the previous version was found to have a bug shown in the scene3d-loader test which has now been resolved. Change-Id: I3c711e894018db52ec00a8a5d2e0fb0128743ab1 Done-with: Antti Kokko <antti.kokko@qt.io> Fixes: QTBUG-79192 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Mike Krus <mike.krus@kdab.com>
| * Revert "Allow for when a Scene3D item switches screens"Paul Lemire2020-02-185-300/+0
| | | | | | | | | | | | | | | | | | This reverts commit 648b7459e8a6ce8ce1f115a14da63d546b743439. Reason for revert: Introduces QTBUG-82275 Change-Id: I5514ad58707c086eaaab3203773614c939e461e8 Reviewed-by: Mike Krus <mike.krus@kdab.com>
| * Destroy FBOs when RenderTarget node is destroyedPaul Lemire2020-02-131-0/+42
| | | | | | | | | | | | | | | | It appears we never destroyed FBOs which lead to bugs when destroying and recreating a RenderTarget Change-Id: I99b3df95b821670aa3bbd63209ff9bcc21afbf79 Reviewed-by: Mike Krus <mike.krus@kdab.com>
| * Allow for when a Scene3D item switches screensAndy Shaw2020-02-075-0/+300
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a Scene3D item switches screens then it will need to be reinitalized so that the supporting contexts, offscreen surfaces are set to use the same screen and not the original one. This ensures that the item is still rendered correctly on the new screen. This includes a manual test using QQuickWidget in separate windows that enables it going from one screen to the other. Fixes: QTBUG-79192 Change-Id: Id5bbc0d30d04ea4a945463238868b68283df0543 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* | Adjust number of jobs based on number of render pathsMike Krus2020-04-142-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renderer currently creates a large number of jobs, most of them doing nothing, this quickly adds up when we have lots of branches. To keep those down, we adjust the number based as estimate of branches that have work to do (no draw detection will fail if it's not the leaf node). Also make RenderViewCommandBuilder and MaterialParameterGathererJob only run if necessary (and reset instance counter on each frame). Finally, only create the right number of MaterialParameterGathererJobs for the amount of updates required. Change-Id: I2d38c72589a38445d0110fc22a472fb9482d1a03 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | bigscene-cpp: add debug overlayPaul Lemire2020-04-141-0/+3
| | | | | | | | | | Change-Id: Ie5c5bc56e194a2d31bc7217d023c9d94c3c92748 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Make bigscene-cpp multiviewportPaul Lemire2020-04-141-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | It is now testing with more than a single Framegraph branch which should allow to check how well it scales horizontally, given FG branch are processed in parallel. Increasing the number of entities only allows to check how well it scales vertically. Change-Id: Ic039a0d198cb7ae9bbe7f2d24be833a04a60d74a Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Add benchmark for ShaderParameterPackPaul Lemire2020-04-145-1/+136
| | | | | | | | | | Change-Id: I05e42f7fdfb6b54c30299b7e6664a48f61116b28 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Properly stop running animations when using a negative playratePaul Lemire2020-03-301-0/+108
| | | | | | | | | | | | | | | | When reaching a normalized time of 0 they would otherwise continue to run Change-Id: Idaea755d3a12f9c9da9c25732c2221e9b3f9f4c7 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Add ability to dump filter statesMike Krus2020-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | Add button in overlay UI to dump: - the details of technique and render pass filters in the render views - the details of technique and render pass keys in the scene graph This is useful to understand why some objects are not rendered. Change-Id: I57a284081ec986e49e90c979042cc0c17ee0d1cf Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Fix crash in rendercapture-cpp manual testPaul Lemire2020-03-231-1/+1
| | | | | | | | | | Change-Id: Id4ad6552fc1a254bd9414bab63400d624e902442 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Move shadergraph to Qt3DJean-Michaël Celerier2020-03-1912-1/+3787
| | | | | | | | | | Change-Id: I3ed10747175a58513933b29eac66ddf92fe87d07 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Initial creation of RHI plug-in and refactoringJean-Michaël Celerier2020-03-164-1/+453
| | | | | | | | | | Change-Id: Ifbb51003e15f798798040597b5f7224641e8147c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Split examples so that build works without qtdeclarativeJean-Michaël Celerier2020-03-115-77/+105
| | | | | | | | | | Change-Id: I98507808b43b116b1950fd60df54704562a234ce Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Allow Qt3DWindow to choose which graphics API to use on constructionJean-Michaël Celerier2020-03-111-1/+1
| | | | | | | | | | Change-Id: Id3ff72a2eaa7f85844a546ef55dc3e1b71a14659 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge gatherer and caching jobsMike Krus2020-03-062-7/+2
| | | | | | | | | | | | | | Avoid extra thread sync just for copying data around Change-Id: Ib119115bbb3a7a8a2aa99a3e271595caecc371f7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Move common job handling out of RendererMike Krus2020-03-0612-84/+262
| | | | | | | | | | | | | | | | | | Should be done in aspect as it's independent of the backend. Moved some tests to separate test using an empty renderer as other backends are likely to have different jobs. Change-Id: I2bec0939045acea7b91ecb1622ba18bf9f5db3c6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Add ability to dump job graph to dot fileMike Krus2020-02-141-1/+1
| | | | | | | | | | | | | | | | | | Can be triggered from the overlay API and using sending a "dump jobs" command to the aspect engine. Gets saved in the current working directory. Change-Id: I19fc94a1215187c1d7eb9d1f3b13b968939cc917 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Destroy FBOs when RenderTarget node is destroyedPaul Lemire2020-02-131-0/+42
| | | | | | | | | | | | | | | | It appears we never destroyed FBOs which lead to bugs when destroying and recreating a RenderTarget Change-Id: I507b045d9b9e1088ff49f719c8846cc43c4fc8f2 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Shader fixesPaul Lemire2020-02-131-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | - Make sure that shaders marked for destruction are un marked from destruction if recreated before having been destroyed. - When loading shaders, make sure the shader wasn't already loaded when loading it. This can happen is a shader is abandoned and then re adopted. Change-Id: I04597479d782bc6d31e4c7f78425c02c31217c7e Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Animations: handle colors as vec3 or vec4Paul Lemire2020-02-121-9/+105
| | | | | | | | | | Change-Id: If450816fadce4adad4881938ecaea9c4000afe16 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Merge "Merge remote-tracking branch '5.14' into 5.15"Mike Krus2020-02-062-7/+37
|\ \
| * | Merge remote-tracking branch '5.14' into 5.15Mike Krus2020-02-052-7/+37
| |\| | | | | | | | | | Change-Id: I76b7e29d240b89e27ef509b30cc3cd622f281fc9
| | * Fix stale Entity cachesPaul Lemire2020-01-312-12/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure we mark the internal state as dirty when Entities get cleaned up. We could otherwise end up with stale caches referencing Entity's that have been cleaned up (referencing null bounding volumes ...) Change-Id: Ia2d2c67f8635e28690f33c0a7d4c9ff1de0eb471 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | | tst_qresoucemanager: add test to make sure cleanup is workingPaul Lemire2020-02-061-0/+21
| | | | | | | | | | | | | | | Change-Id: I5006778b74fee6d030f65deaba86bb38a7a0a86b Reviewed-by: Mike Krus <mike.krus@kdab.com>