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

Consume atlassed/compressed textures from Qt Quick 2

    XMLWordPrintable

    Details

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

      Description

      The simplest integration is through a custom image provider:

      Image {
          source: "image://atlasprovider/symbolic/name"
      }
      

      "atlasprovider" is the name of the provider (registered in the QQmlEngine); that provider will get a load request for "symbolic/name". The name can really be anything.

      Depending on the provider the response can be synchronous or asynchronous. I've decided to implement an asynchronous one (also to understand how it works).

      I've no idea what QQ2 does for ordinary images, probably it depends if the image is local or remote.

      Note that an asynchronous provider has a "major" drawback: Image elements in QML will have 0x0 width/height until they're loaded. This can make some layouts "jump" during the first couple of frames, while they're getting loaded. Might be nice to extend image such that we can provide a placeholder width and height until the real image is loaded.

      Out of the provider you'll eventually get a texture factory (a QQuickTextureFactory subclass), which reports some info about the texture (byte size, surface size), and it's able to create a QSGTexture when requested to do so. One needs to create a different factory (which in turn generates a QSGTexture) per each requested image. In the case of atlasses however multiple images will refer to the same texture data / GL texture, that needs to be dealt with somehow (I've made a refcounted structure referenced by all the factories/textures using the same image).

      Implementation questions:

      • QQuickTextureFactory reports a byteCount(). What is it for? How to report it correctly in case of multiple factories all referencing the same atlas? (QQuickTextureFactory does not report it's atlassing nor which other factories it's sharing data with)
      • Should the compressed texture data also be kept in CPU memory?
        • And for how long? As long as the QQuickTextureFactory exists, because it must be able to create new QSGTextures out of it?
      • Ideally when should the OpenGL texture generation / upload happen?
        • When creating the QSGTexture out of a QQuickTextureFactory?
        • On the first QSGTexture::bind()?

        Attachments

        For Gerrit Dashboard: QTBUG-59872
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            peppe Giuseppe D'Angelo
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes