Details
-
Suggestion
-
Resolution: Out of scope
-
P2: Important
-
None
-
5.6.0
Description
In our application, we have a lot of small icons that we would like to give a solid color. Most of the time, the color is the same for all icons, but sometimes a couple of icons may differ, e.g. pulsate between two colors. Our first approach was using a QML ShaderEffect, basically like OpacityMask, using an image as a mask source, but a solid color instead of a source image for the fill.
I expected the performance to be almost equal to rendering an Image, but the frame rate dropped significantly, although I set supportsAtlasTextures to true and all elements were batched. I was wondering if this is caused by the fact that the texture is bound again and again, whereas Images and also the QSGSimpleTextureNode only bind the texture if it has changed. Are there plans to improve the ShaderEffect performance in this respect?
I solved the performance issues by implementing a custom component in C++, which was performing well. For this, I had to copy a lot of code from the QSGOpaqueTextureMaterialShader. Are there any plans to support extending an existing shader?
In addition, I ended up encoding the color into vertex colors instead of a shader parameter, to improve batching even more. Are there plans to support vertices with vertex colors and texture coordinates out of the box, e.g. adding a QSGGeometry::TexturedColoredPoint2D?
Attachments
Issue Links
- relates to
-
QTBUG-53901 Optimize ShaderEffect construction
- Closed