summaryrefslogtreecommitdiffstats
path: root/src/render/materialsystem/shaderdata.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove deprecated classes and functionsPaul Lemire2020-02-111-4/+2
| | | | | | | Mostly old messaging API Change-Id: I17eb2206b2ede56d2f7d36375d5e711d6149019f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make the OpenGL renderer a pluginPaul Lemire2020-02-051-8/+0
| | | | | | | | By default the QRenderAspect will try to load this plugin Change-Id: Ie55e207fb8e6d0b64f717bbb99699eb669eaa3f2 Task-number: QTBUG-61151 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Update QShaderData to use direct syncPaul Lemire2019-10-081-135/+106
| | | | | | | Also a bit of cleanup Change-Id: I317fa2dbaa62a55fe371e982ed23976e65696d79 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* ShaderData: don't call markDirty(AllDirty)Paul Lemire2019-07-241-1/+1
| | | | | | | | But only markDirty(ParametersDirty) as that's the only thing this is affecting. Change-Id: I450d013dc266ca70ca51cfa866b731a6e8b6499a Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Render: Use SIMD Vectors and Matrices in the backendPaul Lemire2018-02-021-5/+5
| | | | | Change-Id: I19b3b2f8fcb06eb2bc600ebe370465dd15a8eabc Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* ShaderData: fix unnecessary cast between enumsMarc Mutz2016-10-051-1/+1
| | | | | | | | | | | | | | | | QVariant::Type and QMetaType::Type are in sync, but static checkers don't know this, so they complain about mixed-enum type conversions. It turns out that the code is overly complicated. Instead of casting QVariant::type()'s return value to QMetaType::Type and comparing it against QMetaType::QVector3D, simply compare directly to QVariant:: Vector3D instead. Introduced in 1e0fb6c74d81a5b6c17a7f127566e4fb8ed2f28b. Coverity-Id: 168163 Change-Id: I563bebcf869555238db0135125e221ba12ed41ae Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* ShaderData: add getter to retrieve transform type of propertiesPaul Lemire2016-09-071-15/+17
| | | | | | | | Replaces isPropertyToBeTransformed by propertyTransformType which returns the TransformType (NoTransform) if the property isn't transformed. Change-Id: Ib7d91bdcfe18409e6ad6d6f5bc119c46dd7fb143 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* ShaderData: refactoringPaul Lemire2016-09-051-120/+53
| | | | | | | | | | | | | | | | | | | | Only store the original properties (does not store transformed values anymore as these can change on a per thread basis and lead to races in the ShaderData). Instead introduce a method to check if a property needs to be transformed and a method which given a viewMatrix returns the transformed value. This can then be used concurrently by each UniformBlockValueBuilder without introducing races. Also since building UBO from a ShaderData has been disabled since 5.7, remove all the nested ShaderData update logic. Unit tests updated. Change-Id: Id0e5956b9f7d93f8d019c3d8999268fc3ad68e79 Task-number: QTBUG-54818 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Fix data race when multiple renderview builders transform light dataSean Harmer2016-07-191-0/+3
| | | | | | | | Whilst fixing this, realized a logical flaw in the handling of ShaderData nodes. See QTBUG-54818. Change-Id: Ia204ca403cafa2dbafc83e1761b7f78f5d6a1832 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Add a new transform mode for ShaderData propertiesKevin Ottens2016-07-021-0/+5
| | | | | | | | | Sometimes you just want to transform the direction of the vector and not translate it. So add a specific ModelToWorldDirection mode going through a QVector4D to do this properly. Change-Id: I7292aff6abf2aa3a154a5bec90b6d7da6ea0d595 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* readPeerProperties is gone in QBackendNodeKevin Ottens2016-07-021-58/+15
| | | | | | | | Since it's not called anymore, remove it from ShaderData and add the handling of transformed properties to initializeFromPeer(). Change-Id: I462c8f99ae9d71025aff13176b98956fa9a40a6f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* render: eradicate Q_FOREACH loops [remaining low-risk, take 2]Marc Mutz2016-05-141-2/+3
| | | | | | | | | | | | | ... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(), where needed. This is the batch with low-risk changes. They operate on local containers or the loop body clearly does not cause the container to change. Change-Id: I5a9e5fd1d64863da15b982558ae1aded045deb33 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Qt3D: replace QStringLiteral with QLatin1String when appending or comparingMarc Mutz2016-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It makes little sense to use QStringLiteral in the following situations: - for comparison to a QString, because operator== is overloaded for QLatin1String. - when constructing an empty QString, because QLatin1String("") resolves to sharedEmpty() when converted to QString, which is preferable to an independent copy of sharedEmpty(). - for strings which are immediately appended to, or which are appended to other strings. because no dynamic memory allocation is saved by doing so. But if the only advantage of QStringLiteral does not apply, all its disadvantages dominate, to wit: injection of calls to the qstring dtor, non-sharability of data between C strings and QStringLiterals and among QStringLiterals, and doubled storage requirements. Fix by replacing QStringLiteral with QLatin1String or QLatin1Char, as needed. Ported one use of QString::number(i) to QLatin1Char('0' + i) where i is guaranteed to be < 10. Saves 179B and 2150B, resp., in Input and Render text size on optimized Linux AMD64 GCC 6.0 builds. Change-Id: I2e8f43ed085875ce387ffddb18bba37ff21f6cf0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QNodePropertyChange -> QPropertyUpdatedChangeSean Harmer2016-05-101-2/+2
| | | | | | Task-number: QTBUG-51494 Change-Id: Ic326499f80b5a91b2d19c09770de926f220cc805 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QNodeDynamicPropertyChange -> QDynamicPropertyUpdatedChangeSean Harmer2016-05-101-2/+2
| | | | | | Task-number: QTBUG-51494 Change-Id: Ie31b7b00131e4cb7b400019f87e9153cb66d26a5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Rename NodeUpdated ChangeFlag to PropertyUpdatedSean Harmer2016-05-101-1/+1
| | | | | | | | This more correctly reflects the semantic meaning. Task-number: QTBUG-51494 Change-Id: I3a230e959ea007f1d19808eae73b5d95b6f06514 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QShaderData should notify dynamic property changesKevin Ottens2016-05-061-40/+28
| | | | | | | | | We only sent the value at creation time, but not on updates. Catch those specific changes and notify them to the backend. Change-Id: I1f8b7f5f90ecb25a29bc105452eec77e07cb30d4 Task-number: QTBUG-53161 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* render/materialsystem: eradicate Q_FOREACH loops [low-risk]Marc Mutz2016-05-051-2/+3
| | | | | | | | | | | | | | | | ... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(), where needed. This is the batch with low-risk changes. They operate on local containers or the loop body clearly does not cause the container to change. Saves ~5.4KiB in text size on optimized GCC 6.0 Linux AMD64 builds. Change-Id: I4343ea0b67b33240896a44df87a60fb460d9ee2d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Send shader data's property reader to the backendKevin Ottens2016-05-041-0/+2
| | | | | | | | | | Somehow got lost during the transition to the no cloning approach. Because of that, no property updates where processed anymore in shader data backend instances. Change-Id: I18edd5f71a711765344041c62b69b4772b11b75d Task-number: QTBUG-53161 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove QBackendNode::updateFromPeer()Sean Harmer2016-05-031-9/+0
| | | | | | | | | | Implemented a few missing initializeFromPeer() implementations along with the corresponding frontend node creation change creation functions. Adapted unit tests. Change-Id: I571e53a7b68a5544bd0e308df0baf7e52533306e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove TransformType from the public APIKevin Ottens2016-05-021-8/+8
| | | | | | | | | This is in fact needed only in the backend class, so no need to expose it to the outside. Change-Id: Ia0e9a619e8d18da59ae67ec70566614aa171719a Task-number: QTBUG-51505 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove virtual QBackendNode *create(QNode *frontend) constSean Harmer2016-05-011-9/+0
| | | | | | | | from QBackendNodeMapper and subclasses. No longer needed now we have disabled cloning. Change-Id: I261fa7bccfa9a4019d479079e2ff7c19154e5e72 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Q_NULLPTR -> nullptrSean Harmer2016-05-011-5/+5
| | | | | | Task-number: QTBUG-52736 Change-Id: I58f9cbcdf018e7b672d33dd865067485412b79fe Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* ShaderData: Comment out NodeAdded/Removed sectionsPaul Lemire2016-04-301-14/+16
| | | | | | | Doesn't seemed to be used but commented until further investigation Change-Id: I7c614d514e0c9b2c46ec929d4d622bedbda84430 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QAbstractLight now inherits directly QComponentKevin Ottens2016-04-281-5/+1
| | | | | | | | | | | | | We are turning the relationship between QAbstractLight and QShaderData from a "is-a" to a "has-a". For that we relay all the properties of the light to its internal shader data dynamic properties. Interestingly it also removes a couple of special handling for lights which aren't needed anymore. Change-Id: Ia937b8934f94ce318e02901d90ac340e172cbc75 Task-number: QTBUG-51489 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QShaderData also recognizes dynamic propertiesKevin Ottens2016-04-281-0/+13
| | | | | | | | Now those dynamic properties are copied as well and replicated on the backend side. Change-Id: Ia6b24c4fee2e412ad1b0f859b087d052c3510963 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* ShaderData: implement initializeFromPeerPaul Lemire2016-04-261-0/+29
| | | | | Change-Id: I09bc0e39090e5873e31204c8789184e0379bd5ad Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename QScenePropertyChange -> QNodePropertyChangeSean Harmer2016-04-211-2/+2
| | | | | | | Trying to unify naming of change types. Change-Id: I0bfca0b7ba5adeaaa6145f75ddb41731f76adc09 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* ShaderData: sceneChangeEvent calls base class implementationPaul Lemire2016-04-151-0/+2
| | | | | | | To handle enable property updates. Change-Id: If5f2acd8c4041ac9f3f1f4ea147c48fd82307abb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* RenderShaderDataFunctor handles creationSean Harmer2016-03-311-0/+8
| | | | | Change-Id: I88438dafdd5a6636fb845b22144ca6f670838323 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QBackendNode::peerUuid() renamed to peerId()Paul Lemire2016-03-051-2/+2
| | | | | Change-Id: I72471d0b22d16bbbee33610e30a06daadffedbd9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix uses of inefficient QList<QNodeId>Marc Mutz2016-03-011-2/+2
| | | | | | | | | | | | | QNodeId is a 64-bit type, so holding it in QList on 32-bit platforms is horribly inefficient. Fix by porting to QVector instead. [ChangeLog][Important Behavior Changes] QNodeIds are now passed and accepted in QVectors, not QLists. Change-Id: I3cbe35d639eb2ddf9d106294f542f65b431dc4a4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove ParameterMappingPaul Lemire2016-02-261-1/+1
| | | | | | | | | | | | | | * Bindings are now entirely deduced from shader introspection * Modified the BackendNodeDirtyFlags to remove the class at this prevents the operator~() to be called * Make the Renderer loop check for the ComputeDirty flag and don't unset it if set Note: uses a hack to reset m_changeSet in performCompute as right know we are sometimes missing the markDirty(ComputeDirty) set by the ComputeJob nodes. Will be sorted out later. Change-Id: Ic4fa71ecf01b625e885a58a66278387bf5b36339 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Propagate backend node changes to Renderer; render-on-demandWieland Hagen2016-02-241-0/+1
| | | | | | | | | | | | Each sceneChangeEvent marks a dirty bit in the AbstractRenderer. If no changes were accumulated during one frame, the renderer decides not to render the frame, by returning false from shouldRender(). We still need to go through each backend node and see what flags to set exactly, and to make sure we also react on backend-initiated changes. Change-Id: I80588bc5c4ebeb5d57b45ddfbd4d79ec268968b1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Added AbstractRenderer pointer to RenderBackendNodeWieland Hagen2016-02-241-1/+3
| | | | | | | | Modified all node functors to pass QRenderAspect's renderer instance to all newly created backend nodes Change-Id: Iffa4941bff53f6acf87f46789219c7ae2f123615 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* const QNodeId & -> QNodeIdPaul Lemire2016-02-221-5/+5
| | | | | Change-Id: Ia672918cbae3b950e20e68bfbfd6982676a5981e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* RenderView: various small fixes in things frequently calledPaul Lemire2016-02-211-7/+20
| | | | | Change-Id: Ib81db6fd387853069cc7bda1206ff5ef95a377c2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Removed factory member variableRobert Brock2016-02-071-2/+1
| | | | | | | | | The variable was removed from QBackendNode and subsequently all areas it appeared. Task-number: QTBUG-49682 Change-Id: I5904714b55aaefbe07ee11008ff49cd1d9b89950 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-261-5/+3
|\ | | | | | | | | | | | | | | | | Conflicts: src/doc/src/qt3dcollision-module.qdoc src/render/frontend/qcamera.cpp src/render/frontend/qcameralens.cpp Change-Id: I8a0ae250a6b8e065a1ef3c817968ebb7ef23b20d
| * Don't allocate QMutex members on the heap.Volker Krause2016-01-191-5/+3
| | | | | | | | | | Change-Id: I23f1ccd2f2bbee2fcab2eadfeeec83e1ac489623 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Unify license header usageAntti Kokko2016-01-261-11/+14
| | | | | | | | | | | | | | Update old header.LGPL3 to header.LGPL Change-Id: I8eac0cd6bbc276a56df487249cc459c0d4fab165 Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* | Rename UniformBuffer to GLBufferPaul Lemire2016-01-131-1/+1
|/ | | | | | | | This class could be reused for any kind of GLBuffer (not just uniform buffer) so rename it accordingly. Change-Id: I978696534f64fc3717ac135af94e9fe44aa23fba Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Lights phase 1: infrastructureLaszlo Agocs2015-11-261-28/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QAbstractLight becomes QLight and gets its own backend node. This way we can easily gather all lights for the scene and filter them when building render commands. Both the frontend and backend remain a subclass of (Q)ShaderData but will not be part of the ordinary ShaderData component list. This prevents mixing up ShaderDatas and Lights but allows reusing the same underlying infrastructure so that properties can automatically be transformed for example. It is worth noting that the position property for lights is now removed: the position is determined by the entity's (to which the light component belongs) position. A number of changes are made to ShaderData itself as backend subclassing with different managers is not straightforward. For now the distance between the rendered entity and the entity with the light component is calculated and lights will be chosen based on this distance. A framegraph node for controlling this will be added in future patches. No uniform setting or shader changes are included here. Task-number: QTBUG-48834 Change-Id: I43a6c5f9420d4254d798c558bd58680b2b09eceb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* RenderShaderData/UBO: improve nested shader data buffer updatePaul Lemire2015-10-141-5/+6
| | | | | | | | | Although the actual implementation is not optimal when having an array of nested children (as we need to reupload all the children if only one of them as changed), only trigger this update if at least one of the children was updated. Change-Id: I0688323b78a0db70f9f0115e1e8447296506f0c8 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Move Qt3DCore into Qt3DCore namespaceSean Harmer2015-10-131-8/+8
| | | | | | | Update other aspects, tests and examples accordingly. Change-Id: Ib1bcf0bdf4f5aec4422dc0c80bfc32b27fb1a317 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Move material system into own directorySean Harmer2015-10-131-0/+315
Change-Id: Iddc3a5d41dc0aff858d8bc3c5b2f7982bd693d00 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>