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

Investigate if `ShaderEffectSource` does not need to create a new layer

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Quick: SceneGraph
    • None

    Description

      If `ShaderEffectSource`'s target is already a texture provider (such as layered item, or `Image`), and the parameters match (such as same texture format), it may not be necessary to create a new layer and texture.

      This is a use case when `ShaderEffectSource` has a `sourceRect` that is a sub-rect of the source texture.

      In order to achieve that, applications can currently use `QSGTexture` to come up with such `QSGTextureView` and use it with an arbitrary texture provider item as indirection. However, this would be simpler if `ShaderEffectSource` did that itself without all the additional effort.

      The concept for texture view is already in the scene graph due to the atlas texture (`QSGTexture::normalizedTextureSubRect()`), as textures in the atlas are simply texture views for the atlas texture. However, it would be also convenient to have `QSGTextureView` that does the normalization calculations for non-atlas texture views. This new class would contain the target texture, and `setRect()` method that does the normalization calculation since `normalizedTextureSubRect()` needs to return the normalized rect.

      It is first necessary to make it clear (document it) that a texture does not need to be an atlas texture if it makes use of `QSGTexture::normalizedTextureSubRect()`. According to my experiments, Qt is already fine with that (at least with `ShaderEffect` as the texture consumer case), the texture may not return true for `QSGTexture::isAtlasTexture()` but still the sub rect is respected.
       
       
       

       

      Attachments

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

        Activity

          People

            janichol Andy Nichols
            fuzun Fatih Uzunoglu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes