Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-52496

QML ShaderEffect unnecessarily slow?



    • Type: Suggestion
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.6.0
    • Fix Version/s: None
    • Component/s: Quick: SceneGraph
    • Labels:


      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?


          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              sletta Gunnar Sletta
              che Carsten Henßinger
              2 Vote for this issue
              5 Start watching this issue



                  Gerrit Reviews

                  There are no open Gerrit changes