aboutsummaryrefslogtreecommitdiffstats
path: root/tools/shadergen/parser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Include what you need: qquaternion.hMarc Mutz2025-07-101-0/+2
| | | | | | | | | | | | | | | | qmatrix4x4.h will lose its qquaternion.h include, so include qquaternion.h explicitly in all files that mention 'QQuaternion', unless, for a foo.cpp, the own foo.h has already included it. Picking all the way back, even though the include removal won't be picked as far back, because it's the correct thing to do and cannot fail. Also add forward declarations, where they suffice. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Ibfc1e941978c750c05e57e3772f3a68bc921c81f Reviewed-by: Volker Hilsheimer <[email protected]>
* Correct tools licenseLucie Gérard2024-06-191-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tools should be LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 6.8 Task-number: QTBUG-121787 Change-Id: I0883ded9f64fcf8107c397a837149133911f2951 Reviewed-by: Kai Köhne <[email protected]>
* Do not wrap pointers in "const auto &"Ulf Hermann2024-03-211-4/+2
| | | | | | | That's somewhat misleading and makes gcc 12 produce bogus warnings. Change-Id: Ic563bba09a8baec34f07dacf774463399f902d15 Reviewed-by: Giuseppe D'Angelo <[email protected]>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: Ica3bbbb023404386bb6490d53aa14b43c7c7d6e3 Reviewed-by: Fabian Kosmale <[email protected]>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: I0061e0929b70518e438dfee1d341b1570f782b70 Reviewed-by: Fabian Kosmale <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-06-161-28/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: Ide4aff802cf55e705cbafc003a68ed0d897b2a68 Reviewed-by: Jörg Bornemann <[email protected]>
* Shadergen: Generate shaders for when instancing is usedChristian Strømme2021-01-251-1/+61
| | | | | | | | | Base implementation for supporting instancing. Custom instance tables create in C++ are not supported with this change. Task-number: QTBUG-89788 Change-Id: I95d0758b4e927c95a42561ae930c8fec098e37ba Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Better handling of components, members and listsChristian Strømme2021-01-221-249/+335
| | | | | | | | | | | Improved how components are registered and used. Added logic to better handle QQmlListProperty properties: - Clone the list when creating an instance of a component. - Clear the inherited list when overriding in an instance. Change-Id: I4809db375df9e3a12968239c40ccbb6636467588 Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Clean-up the type infoChristian Strømme2021-01-211-256/+164
| | | | | | | | | | | This is an attempt to make the type system a bit more sane and easier to use. Instead of having additional type values defined, we now use the QMetaType system. There are some downsides with not having our own type identifiers, as it means we don't have compile time type ids for the non-builtin types (for now). Change-Id: I675dbd1c63c500fb34ea2ff7ae2a33aa301d722d Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Remove unused case in fromString()Christian Strømme2021-01-191-4/+0
| | | | | | | | There's no string version of mat4x4. Pick-to: 6.0 Change-Id: Ifb1f07f9f040ecde13ea44fa9308c40c0a6884c5 Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Silence narrowing warningsChristian Strømme2021-01-191-2/+2
| | | | | | | | | Narrowing from double to float in some cases, but those are intentional, so make it explicit. Pick-to: 6.0 Change-Id: Ia036f68896acf4c071af7f20fe963546d9850b37 Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Remove misplaced fall throughChristian Strømme2021-01-191-1/+1
| | | | | | | | | Not a real problem as the code is now, but should be avoided never the less. Pick-to: 6.0 Change-Id: I986868c2a0569d1e58445c2fecad1a734a65ccd9 Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Remove BuiltinType enumChristian Strømme2021-01-191-37/+33
| | | | | | | | | There's no need for this, it's just aliasing the QMetaType::Types anyways. Pick-to: 6.0 Change-Id: I71fb5b0823c7854c33d77030fb87edc935e4974b Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Removei light wrapper classChristian Strømme2021-01-191-1/+1
| | | | | | | We already have this data Change-Id: I72564cdf768065328b898bcc77680cf98c42960e Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Remove material wrapper classChristian Strømme2021-01-191-4/+4
| | | | | | | | We can query the material type directly from the object, no need to store the type separately. Change-Id: I22adac2d7f203efd0ae11bb3dff412379c1c0a68 Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Look-up shaders by identifierChristian Strømme2020-12-181-0/+7
| | | | | | Pick-to: 6.0 Change-Id: I6cf9f48e16363fd7f6dc70269de423764f5098d2 Reviewed-by: Laszlo Agocs <[email protected]>
* Shadergen: Handle render pass commands when intercepting object defsChristian Strømme2020-12-181-0/+23
| | | | | | | This type was missed in the initial effect patch Change-Id: Ieeb23ae666e1a8886036720093913c294ac532b4 Reviewed-by: Laszlo Agocs <[email protected]>
* Shadergen: Silence message about unhandled types when parsingChristian Strømme2020-12-181-2/+4
| | | | | | | | | There are many types we don't care about, so don't be print does unless asked to be verbose. Pick-to: 6.0 Change-Id: I89dc6f3aa0c0eae2492e4b220a6400afbad67db2 Reviewed-by: Laszlo Agocs <[email protected]>
* Shadergen: Handle hitting unknown object definition betterChristian Strømme2020-12-181-2/+3
| | | | | | | | | The Q_UNREACHABLE was used for testing, we don't really want to cause a hard exit in non-testing environment and even then we're better off with a useful debug message. Change-Id: I0d33927fc964af761c928906e63ea991e40a5692 Reviewed-by: Laszlo Agocs <[email protected]>
* Shadergen: Potential usage after free when adding type namesChristian Strømme2020-12-181-1/+1
| | | | | | | | | If an existing type is added to the map we'll invalidate the iterator, so don't use it after insert. Pick-to: 6.0 Change-Id: I1b179ca12d64767883feb23d843ef32377a07932 Reviewed-by: Laszlo Agocs <[email protected]>
* Shadergen: Fix indexOf usageChristian Strømme2020-12-181-2/+4
| | | | | | | | | The type changed so remove unsafe checks Pick-to: 6.0 Change-Id: If0fc43f1ec72314e8d7a29b8e3bb16f262991d72 Reviewed-by: Inho Lee <[email protected]> Reviewed-by: Laszlo Agocs <[email protected]>
* Add support for generating shaders for effectsChristian Strømme2020-12-151-7/+124
| | | | | | Fixes: QTBUG-86739 Change-Id: Iafef0d920f2baeed26208f2c77b30533237a15bd Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Miscellaneous improvementsChristian Strømme2020-12-111-39/+36
| | | | | | | | | Don't call the qmllists count() function for each iteration, refactor out the common code for creating and building types. Pick-to: 6.0 Change-Id: I2d00ee311d876a68be95efe2b203a934b7d1fe4d Reviewed-by: Andy Nichols <[email protected]>
* shaderge: copy dynamic properties from the base componentChristian Strømme2020-12-101-0/+4
| | | | | | Pick-to: 6.0 Change-Id: I8b4390917bbce41388f2df49382af54f087de89f Reviewed-by: Laszlo Agocs <[email protected]>
* Fix reentrancy issue with the type mapChristian Strømme2020-12-101-12/+24
| | | | | | | | | | Make sure the type map is cleared out on each call. This is mostly a problem in the auto test as it calls into the parse* functions multiple times. Pick-to: 6.0 Change-Id: I2942a084672715eb96d805f97e8c54b8b698430a Reviewed-by: Laszlo Agocs <[email protected]>
* Fix type conversion functionsChristian Strømme2020-12-011-30/+44
| | | | | | | | Avoid possible out of bounds access Pick-to: 6.0 Change-Id: I62d4423aab9fde7a7b00314bfe25af6bd87acad1 Reviewed-by: Laszlo Agocs <[email protected]>
* Update metatype handlingDavid Skoland2020-11-101-2/+2
| | | | | | | | Use the correct logic for handling usertypes and replace QVariant::Type occurrences with QMetaType. Change-Id: I1af43b1e03055f91ba35e235a5e06cbd9a775717 Reviewed-by: Christian Strømme <[email protected]>
* Shadergen: Improve command line optionChristian Strømme2020-10-151-5/+5
| | | | | | | | | | | | | | | | | Make the command-line options more streamlined. - No need to provide a source argument, the current folder is expected to be the "working" directory. - Added -C argument so the tool can change the current working directory before processing any files. - The -g (generate) is now the default. New -n (dry-run) option added instead. - The tool will now try to traverse the working directory to find files to process. An argument was added to control the max search depth when traversing the working directory (--depth N). Change-Id: Ib02988fabe0a50a02da6e0009d2e24a6168aa459 Reviewed-by: Laszlo Agocs <[email protected]>
* Shadergen: Fix an implicit-fallthrough warningInho Lee2020-09-291-0/+1
| | | | | Change-Id: Ic06e1d1230b8336440b4af82ffbea4300b53fd6b Reviewed-by: Laszlo Agocs <[email protected]>
* Shadergen: Add component testsChristian Strømme2020-09-171-0/+20
| | | | | | | | | Adds parsing and building of Default, Principled and custom material components. Change-Id: Ie619dba9e9abeb1a8b4a457487b6e558cbb88c80 Reviewed-by: Antti Määttä <[email protected]> Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Better type handlingChristian Strømme2020-09-171-117/+575
| | | | | | | | | We need this for the custom material, as the uniforms for the shader is defined as qml properties first, we therefore need to set them up as expected. Change-Id: I41944c66344ca3b655b3c92a85aab5d5739059de Reviewed-by: Christian Strømme <[email protected]>
* Add code for handling default materials in the shadergen toolChristian Strømme2020-09-171-12/+59
| | | | | | | Task-number: QTBUG-84773 Change-Id: Ic045e4f9e245dd77f37399a6ad6e7893f1d2dace Reviewed-by: Andy Nichols <[email protected]> Reviewed-by: Antti Määttä <[email protected]>
* Add code for handling custom materials in the shadergen toolChristian Strømme2020-09-171-5/+106
| | | | | | Task-number: QTBUG-84773 Change-Id: I0152f9546d55b6acd9a5a32ff76876273e949989 Reviewed-by: Christian Strømme <[email protected]>
* Fix QString and QStringView concatenation issueChristian Strømme2020-09-171-1/+1
| | | | | Change-Id: I24e0bf63805ebb873c309117f72751009a434c13 Reviewed-by: Christian Strømme <[email protected]>
* Fix how URLs are set in the shadergen toolChristian Strømme2020-09-171-4/+14
| | | | | | | | | Take the source directory into account when setting local files, as we'll need to know where the actual files are located later. Change-Id: If5cd45e5c0d3be181dc6bb49d41ece3a4cf42b4d Reviewed-by: Andy Nichols <[email protected]> Reviewed-by: Antti Määttä <[email protected]>
* Add enabler for keeping all materials in one listChristian Strømme2020-09-161-2/+2
| | | | | | Change-Id: I4e99af27e3052d7af6ce2bb6f5435f0eda2fc18e Reviewed-by: Andy Nichols <[email protected]> Reviewed-by: Antti Määttä <[email protected]>
* Shadergen: Create types even if they have no membersChristian Strømme2020-09-161-1/+1
| | | | | | | | Even though a type does not have any members, we still want to know about the type, as it shows intent. Change-Id: I0e217d0fcb5284ffbac9a215392a76ccbeddabdb Reviewed-by: Antti Määttä <[email protected]>
* Handle absolute and relative paths as input for shadergenAntti Määttä2020-09-091-1/+4
| | | | | | Change-Id: I08193237f8c400e09228c6e2ea590e1901c378a1 Reviewed-by: Inho Lee <[email protected]> Reviewed-by: Andy Nichols <[email protected]>
* Remove Support for AreaLightAndy Nichols2020-09-071-10/+0
| | | | | | | | | | | | | | | | | | | AreaLights while part of the API are broken in much of the existing rendering paths. We could fix this, but the techniques used to render real-time AreaLights are very expensive, and don't really make sense for the hardware platforms we see as our targets (Embedded). So instead we should remove them for 6.0 with the possibility of re-adding support later if there is an actual demand. Previously in Qt 3D Studio (and Qt Quick 3D by extension) we had support for AreaLights, but not spot lights, and so AreaLights was the only way to have a directional light with falloff. Since then we have added support for SpotLights which should fulfill this use case without compromising runtime performance. Fixes: QTBUG-86488 Change-Id: Ic0b9e5c46319def09c52a8766db306a9ca95724a Reviewed-by: Laszlo Agocs <[email protected]>
* Adapt to QStringViewMaurice Kalinowski2020-08-291-8/+8
| | | | | | | QStringRef has been removed in qtbase Change-Id: I7fda3956c9529caf51b2607754cb2bcb0ec5a644 Reviewed-by: Fabian Kosmale <[email protected]>
* Shadergen: Fix typo in commentsChristian Strømme2020-08-261-6/+6
| | | | | Change-Id: I50bf25dde311d8ad2fe1a6c1554df2519263ff15 Reviewed-by: Antti Määttä <[email protected]>
* Shadergen: Add support for inspecting modelsChristian Strømme2020-08-261-4/+96
| | | | | | | | | Instead of using a dummy model use the actual model as it's declared in the Qml project. Change-Id: Ie199d1053180d5a6b7b8d6ef91069ebb8cb347cb Reviewed-by: Antti Määttä <[email protected]> Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Put all components in one mapChristian Strømme2020-08-261-24/+29
| | | | | | | | | Component names are unique so no need to keep separate maps for each type. Change-Id: Id4b963a17dc5c83120645c7c5da91e75715e88cb Reviewed-by: Tomi Korpipää <[email protected]> Reviewed-by: Andy Nichols <[email protected]>
* Shadergen: Handle all light typesChristian Strømme2020-08-261-33/+16
| | | | | | | | We were only handling directional lights and not the rest. Change-Id: I5c09248d1b8ad6326902f245af14d4fd1a5848ed Reviewed-by: Tomi Korpipää <[email protected]> Reviewed-by: Andy Nichols <[email protected]>
* Fix passing the source directory to the shadergen toolChristian Strømme2020-08-261-10/+11
| | | | | | | | | | | The "working directory" was basically serving the purpose of what we now call the "source" directory, i.e., the location of the projects resources. This path is used to locate qml files, texture etc. Change-Id: Id1bb906228009d7cab7f41fc96bef9ec89d1dcc4 Reviewed-by: Antti Määttä <[email protected]> Reviewed-by: Tomi Korpipää <[email protected]> Reviewed-by: Andy Nichols <[email protected]>
* Add offline shader generatorChristian Strømme2020-08-171-0/+820
Initial code for the build-time shader generator. For now, it only picks-up the principled material and generates shaders based on the values it sees at build time. Change-Id: I001d01a6b0ff016725753064a5920f7380f596dc Reviewed-by: Andy Nichols <[email protected]>