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

Investigate pre-compiled shader programs and a shader disk cache with OpenGL ES 3.0+

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 5.9
    • Component/s: GUI: OpenGL
    • Labels:
      None
    • Environment:

      Embedded with GLES 3.0+, primarily DRIVE CX. Desktop and mobile secondary.

    • Technical Risk:
      Normal
    • Commits:
      85f868e73e4cf9dffe27b737f8dc3f5bb626ed04, f0e60aefa48e2299c14918983ffa1016fb4677ba, e8801e7c09414753a8e01a6be303c7922bbe023f
    • Epic Link:

      Description

      Investigate pre-compiled shader programs (as in glProgramBinary in GLES 3.0 and up) in Qt.

      Possible approaches:

      • Use glGetProgramBinary to read back driver-specific linked programs. Could have a runtime disk cache in Qt (Quick), as already demonstrated on scenegraph-playground. This way the sources must still be shipped, and compilation happens on the first startup. ( + when driver / version string does not match anymore) Subsequent startups then just do a glProgramBinary and get the benefits.
      • Some vendors provide host tools, like NVIDIA's glslc (proprietary, for embedded), which compile, link, and output glProgramBinary-suitable binaries.
      • Other approaches don't really work (we cannot roll our own tool etc. due to (a) cross-compilation (b) the shader binaries being driver - and even driver version - specific.)

      Cons:

      • Batching uses shader rewriting therefore offline pre-compilation of shaders used by Qt Quick materials is not feasible.
      • The OpenGL ShaderEffect's reflection is based on parsing shader sources. Offline pre-compiled shaders would require switching to GL program queries which are quite awful and pose various problems, like requiring a context.

      Based on the above a runtime disk cache is the feasible solution, however:

      • NVIDIA does shader caching on disk anyway, including on embedded.

      Might be wasted effort. Should benchmark first.

        Attachments

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

          Activity

            People

            Assignee:
            lagocs Laszlo Agocs
            Reporter:
            lagocs Laszlo Agocs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes