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

QML ShaderEffect unnecessarily slow?

    XMLWordPrintable

    Details

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

      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

              Assignee:
              sletta Gunnar Sletta
              Reporter:
              che Carsten Henßinger
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes