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

composing a very small QWidget and a QOpenGLWidget in the same large top level widget is extremely slow

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.7.0 RC
    • None
    • Linux, OS X
    • macOS

    Description

      Build and execute the attached test case. After starting it, resize the left dock widget by any amount - it is important that its size does not fluctuate with the length of the text it contains, and a manual resize causes it to remain fixed.

      The default state of the test application's main window is docked QWidget + QOpenGLWidget central widget. Note that, from this state, FPS are increased dramatically by doing any of the following:

      • hiding the docked widget
      • undocking (floating) the docked widget
      • switching from using a QOpenGLWidget as the central widget's viewport to using a QGLWidget

      Note that, in the slow state, the size of the docked widget has little impact on FPS. This surprised me, and may represent a bug: when forced to resort to texture composition for a raster widget, a texture the size of the top level widget being composed is uploaded, regardless of the size of the raster widget. If the top level widget is large, zeroing the mostly-unused texture and uploading it both take many milliseconds. As a result, I must use QGLWidget in place of QOpenGLWidget to avoid prompting composition.

      It is actually far faster to compose a small raster widget and a single, large QOpenGLWidget-viewport QGraphicsView by placing the raster widget in the associated graphics scene than it is to have the raster widget and graphics view as siblings composited by the top level widget!

      Additional information: http://esoerik.blogspot.com/2016/06/blittextureforwidget-yeah-why-dont-you.html

      The attached test case code is also available on github: https://github.com/erikhvatum/qopengl_vs_qgl_fps

      Attachments

        1. FPSCounter.cpp
          2 kB
        2. FPSCounter.h
          0.4 kB
        3. main.cpp
          1 kB
        4. MainWindow.cpp
          3 kB
        5. MainWindow.h
          0.9 kB
        6. qopengl_vs_qgl_fps.pro
          0.4 kB

        Issue Links

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

          Activity

            People

              sletta Gunnar Sletta
              ehvatum Erik Hvatum
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes