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

QML ShaderEffect unnecessarily slow?

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.6.0
    • Quick: SceneGraph

    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

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

          Activity

            People

              janichol Andy Nichols
              che Carsten Henßinger
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes