aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickopenglshadereffect.cpp
Commit message (Collapse)AuthorAgeFilesLines
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-7/+7
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix clang 5 warningsAllan Sandfeld Jensen2018-02-071-2/+3
| | | | | | | Fixes clang develop-builds Change-Id: If262d7038fc36bcec281be4c218b3cf3d4ae4deb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce Q_FALLTHROUGH()Friedemann Kleint2018-01-101-1/+1
| | | | | | | Silence g++ 7.X warnings. Change-Id: Iba80ab547111d883ff8b3e99173cc5f3a79ae81f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Shawn Rutledge2017-11-131-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h tests/auto/quick/quick.pro Change-Id: Ia12f20e95fb151bbbc75dbf187364a924cd0bc7a
| * Fix tst_qquickshadereffectJ-P Nurmi2017-11-091-1/+1
| | | | | | | | | | | | | | | | | | The expected signal counts were not matching. Since the test has not been run in the CI, it went unnoticed. Furthermore, the test crashed due to a missing null pointer check. Change-Id: Iff80a2ea17832eb7bc531ac9eb2fc482f2c69e38 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Support external textures (samplerExternalOES) in ShaderEffectYevhen Kyriukha2017-06-231-11/+17
|/ | | | | | | | | | | | samplerExternalOES type defined in OES_EGL_image_external extension is used on embedded platforms to achieve zero-copy of textures. [ChangeLog][Qt Quick] Added support for samplerExternalOES sampler type in ShaderEffect Task-number: QTBUG-59462 Change-Id: Ib1e864f2e1321949b0a6539d37b92d2b62541ea8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Run includemocs in qtdeclarativeThiago Macieira2017-04-261-0/+2
| | | | | Change-Id: I84e363d735b443cb9beefffd14b8c023a37aa489 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-241-3/+7
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/quick/accessible/qaccessiblequickview_p.h src/quick/items/qquickmousearea.cpp src/quick/util/qquickanimatorjob.cpp tools/qmlplugindump/main.cpp Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
| * Shaders: Fix crash when disconnecting shaders from item propertiesErik Verbruggen2017-02-151-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | The disconnect was done with a signal index local to the item, instead of 'global' to the item and all its parents. The index also had to be a method index, not a signal index. Together this resulted in a failing disconnect, which would keep SlotObjects alive with outdated data. Any subsequent use would result in a crash. Task-number: QTBUG-58336 Change-Id: I26b1868b2f8c61a4ffab1c72c85178632ca87599 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Use QStringBuilder moreAnton Kudryavtsev2016-08-261-9/+7
|/ | | | | | | Reduce allocations. Change-Id: I8b8a0d0360e618c65894f1f7c12476b41a1dbc5d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-3/+3
| | | | | | | | And add accessors. This makes it easier later on to change the storage of the fields. Change-Id: I21163668ac83a7d52f398981baf3c27ef161c177 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QtQuick: fix use-after-free of shader property connectionsErik Verbruggen2016-07-111-2/+17
| | | | | | | | | | | | A use-after-free would occur if the sender of a connection would disconnect (and destroy the slot object), and then the receiver would try to clean-up and access the slot object again. The fix is to have the receiver take out a reference to the slot object, because it will manage the life-time, and thus delete the slot object when it doesn't need it anymore. Change-Id: Ie2033cfb7212acceb2c2cd0bd9e7e45c2dd5e434 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* QtQuick: clean up shader effect property connectionsErik Verbruggen2016-07-051-38/+88
| | | | | | | | | | | | | | | - Don't use a signal mapper, but handle the mapping using a custom slot object and a lambda to do the dispatching ourselves. - Don't do meta-calls by property name, but by index. - Cache the meta-object. - Resolve the property indices by using the QML property cache. For a shader with 6 property connections, the time spent goes from 320k instructions to 80k instructions (valgrind on x86_64). Task-number: QTBUG-53901 Change-Id: I2809198cf62f9716b3683798222203fc3e97fbb3 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Add a core profile file selector to OpenGL ShaderEffectLaszlo Agocs2016-07-011-1/+11
| | | | | | | | | | | Similarly to what we do with "hlsl" in the D3D12 backend, we can use "glslcore" to provide a file-based alternative to the GraphcsInfo or OpenGLInfo-based conditions in the fragmentShader and vertexShader properties. This is particularly useful in a few places inside Qt, for example Quick Controls, that have to cater to all possiblities. Change-Id: I5d89e7b1534afbc323a663869bab7796bd1a337d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Unify ShaderEffect property settingLaszlo Agocs2016-06-291-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rendererInterface() should not require isSceneGraphInitialized() to be true - the API and language queries like graphicsApi() have no need for the scenegraph, they only need the plugin to be loaded, i.e. that the QQuickWindow is constructed. This is the key to be able to make GraphicsInfo report graphicsApi and shaderType with the correct values as early as possible - meaning as soon as the item is associated with a window. The initialization of the scenegraph (the exact timing of which varies backend to backend) does not matter here. The fragment and vertex shader property setting is now unified in the two ShaderEffect implementations: - If the component is complete, the shader is attempted to be processed right from the setter. - Otherwise the item will trigger processing once the component is complete. - If there is no window when processing is trigerred, it is deferred via polish. To implement item polish handling we need a new virtual in QQuickItemPrivate since we cannot intrdouce virtuals into the public classes. This way one can write a condition (and later potentially use file selectors) like this: fragmentShader: GraphicsInfo.shaderType == GraphicsInfo.GLSL ? "..." : ... without having to worry about getting an unintended value processed due to GraphicsInfo not yet reporting an up-to-date value. parseLog() forces, for GL at least, shader processing to prevent autotests from breaking. Change-Id: If55c69d746c29cd07348ddad2d6b0f2b5dd7f3a2 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add support for reading GLSL from files with ShaderEffectLaszlo Agocs2016-06-291-0/+15
| | | | | | | | | | | | | An enabler for using file selectors instead of writing GraphicsInfo-based conditions in the vertexShader and fragmentShader properties. [ChangeLog][QtQuick] ShaderEffect with OpenGL now supports reading GLSL shader sources from local files and from the resource system. Whenever a fragmentShader or vertexShader property is a valid such URL, the value is treated as a file specification instead of actual source code. Change-Id: I9df2a397adc8f82f1eb6b83d27e9e3d9d1a02f46 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/scenegraphngLaszlo Agocs2016-05-241-1/+0
| | | | | | | | | | Conflicts: src/quick/items/qquickopenglshadereffectnode.cpp src/quick/items/qquickshadereffect.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h src/quick/scenegraph/qsgdefaultglyphnode_p.h Change-Id: I3d6874b4e4231a89d2836c04fe8e7f2ef2d698c4
* Adaptable shader effect enablersLaszlo Agocs2016-04-291-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The D3D12 node implementation is mostly missing. The rest of the enablers should be in place now however. Importing QtQuick 2.8 provides new properties for ShaderEffect: - shaderType can be used to decide which language should be used - shaderCompilationType tells if compilation is runtime or offline - shaderSourceType tells if the vertex/fragmentShader properties refer to source strings or source files or pre-compiled bytecode files The last two are bitmasks. In practice however we will support only one approach per backend for now (runtime + source string for OpenGL, offline + bytecode for D3D12). In addition to QSGShaderEffectNode, introduce the QSGGuiThreadShaderEffectManager interface. This provides the gui thread bits for the above and performs shader reflection. Backends that use the new ShaderEffect system must provide both. For each ShaderEffect item there will be a manager (on the gui thread) and a node (on the render thread). Reflection is expected to be done via standard helper libs (d3d12shader + D3DReflect from d3dcompiler for the D3D12 backend), or via manually inspecting SPIR-V, or parsing the source (like the GL path does now), or by using some 3rd party library (not recommended). In any case we require that reflection is doable on the gui thread without dependencies to the actual graphics API. The ShaderEffect documentation is greatly extended, covering HLSL and the new properties. The test app uses manually compiled shaders on its HLSL path for now. This is because there is no story yet for build system integration for public use (the internal HLSL -> bytecode in C header rule is only suitable for the d3d12 plugin itself, apps need something different). Change-Id: Id112104906fbcb26b9902a35f19d8d509b340d1b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add the skeleton for the new, more generic shader effect implLaszlo Agocs2016-04-131-20/+21
| | | | | | | | | which should route and place most of its work into the scenegraph. And fix a test. Change-Id: I04f29cba53c2bab62e41b3b524794d3c4d20a472 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Route ShaderEffect through the old GL implLaszlo Agocs2016-04-131-43/+38
| | | | | | | | | | | | | | Register the common QQuickShaderEffect class as ShaderEffect to QML. In case of GL this will route to QQuickOpenGLShaderEffect. For others the default no-op implementation is used (at least for now). Later this new implementation will route to a backend-specific scenegraph node via the adaptation layer. This also means that QQuickOpenGLShaderEffect is no longer a QQuickItem and QQuickShaderEffect must handle everything item-related and forward. Change-Id: I1ff4b674253543a04978a69f4a3b67f3a44dd983 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Prefix GL-specific shader effect codeLaszlo Agocs2016-04-131-0/+865
Rename the C++ sources and classes. The QML type name remains the same. No changes in functionality. The shader effect, node, material (and uniform animator and particles and bits and pieces here and there...) are highly interconnected and do not follow the usual design practices for Quick and the scenegraph and the adaptation layer. Therefore while we aim for keeping full compatibility for GL apps, other backends will likely get a different ShaderEffect item implementation. The C++ class QQuickShaderEffect itself is currently a dummy with an unchanged API. It is not in use for now but forms the basis for the implementation for other backends. This will be covered in future commits. Change-Id: Ia39ce4b303f8f33e2f241d11e35fa62423e43127 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>