summaryrefslogtreecommitdiffstats
path: root/src/gui/util/qshadergenerator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-8/+8
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-221-28/+36
|\ | | | | | | Change-Id: Iace12004afdfe765a3068dfcf6f1320c1123c539
| * QShaderGenerator: Allow more expressions in input nodesNicolas Guichard2020-02-201-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently QShaderGenerator will crash when encountering some expressions in input nodes. For example, this node prototype would make it crash: "VERTEX_COLOR": { "outputs": ["color", "alpha"], "rules": [ "headerSnippets": ["in vec4 vertexColor;"], "substitution": "vec3 $color = vertexColor.rgb; float $alpha = vertexColor.a;" ] } Change-Id: I37abb8099d376843a4cb13228140467dc1b8f60c Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
| * QShaderGenerator: Don't crash when a node has multiple outputsNicolas Guichard2020-02-201-28/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was already possible to declare a node prototype with multiple outputs, but trying to assign to all those outputs was not possible and instead resulted in a crash. It is now possible to declare nodes like this without crashing: "SEPERATE_XYZ": { "inputs": ["vector"], "outputs": ["x", "y", "z"], "rules": [ { "substitution": "float $x = $vector.x; float $y = $vector.y; float $z = $vector.z;" } ] } Change-Id: I748e77e84c9120dc688c573eee33dc13c6bfbace Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Friedemann Kleint2020-02-201-3/+39
|\| | | | | | | Change-Id: Ide8768d0d95aaeec943658aea27a03737d7dbf3f
| * Fix QShaderGenerator crashing when a node port name prefixed another oneNicolas Guichard2020-02-191-3/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QShaderGenerator didn't handle substitutions like `vec4 $color = mix($color1, $color2, $fac);` Note that `$color` is a prefix to `$color1` and `$color2`. For the substitution `QByteArray::replace` was used so if `$color` was handled first and replaced by `v1`, `$color1` and `$color2` were never correctly replaced and instead became `v11` and `v12` which caused a crash later on. Change-Id: Idaf800fdac468f33c323eb722701da5f8eb918d6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* | Replace usages of QVariant::value by qvariant_castOlivier Goffart2019-12-151-2/+2
|/ | | | | | | This is done automatically with a clazy check Change-Id: I3b59511d3d36d416c8eda74858ead611d327b116 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Only generate temporaries when it makes sensePaul Lemire2019-05-021-30/+204
| | | | | | | | | | | - Never for global inputs - Otherwise only if the temporary is referenced more than once -> meaning it's actually caching the result of some operation Tests updated accordingly. Change-Id: Ic76615370d23dee3965ca6350d5257a8be5a3e22 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QShaderGenerator: don't generate temporary variables for global inputsPaul Lemire2019-04-101-2/+60
| | | | | | | | | Up until now, the QShaderGenerator would create temporary variables for uniform, attributes, const. This change makes it use the global inputs directly rather than relying on the intermediate properties. Change-Id: Ia9497367d61e536969fe87536606f309c286dbb2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QShaderGenerator: fix substitution for attributes on GL2/ES2Paul Lemire2019-04-101-1/+4
| | | | | | | | GL2/ES2 expect it to be attribute and not in like later versions of OpenGL. Task-number: QTBUG-74829 Change-Id: Iddd22386ed315d6e6843d8225e49a4b73b6ad9ba Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QShaderGenerator: stop abusing from auto everywherePaul Lemire2019-04-091-33/+37
| | | | | | | | | Leads to a huge loss of context for people trying to understand and maintain that code. Replacing with proper types to ensure better readability and maintenance. Change-Id: I9900b743e8b7fe11bcc7db9ce3191c89f8718afc Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Enable BuiltIn input in the shader graph builderJuan Jose Casafranca2018-04-101-0/+4
| | | | | | | | BuiltIn inputs shouldnt be translated into a code input. We comment the input line for this variables Change-Id: I3b7d2fd06afc6a122d90a999fc5a5246fc93234e Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* GLSL 1.00 ES must be selected using "#version 100"Kevin Ottens2017-08-041-1/+1
| | | | | | | | I was mistaken before, the "es" part for that version isn't optional, it *must* be omitted. Change-Id: I9e83d2317523fb0a905e40b95a56033cf693b93b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Implement graph layers support in QShaderGeneratorKevin Ottens2017-08-021-4/+12
| | | | | Change-Id: I823f7866bc5e1f3b262f1aacf4c341dabda7305d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add support for QShaderLanguage enums in QShaderGeneratorKevin Ottens2017-08-021-5/+227
| | | | | Change-Id: I93306d783309cda09fedae3713afde851df3e9a3 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add support for parameters in QShaderGeneratorKevin Ottens2017-07-081-2/+19
| | | | | Change-Id: Iff8fec51ddbf9b018cb5ec3aff357125134013eb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [Shader Graph Gen.] Introduce QShaderGeneratorKevin Ottens2017-06-201-0/+104
This class is meant to generate code from shader graphs Change-Id: I1cf22352387f3f9f55e7589aa77a296689836911 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>