Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-74406 Abstract away the graphics APIs in Qt
  3. QTBUG-78620

Move away from QVector and d pointers in QRhiResource subclasses

    XMLWordPrintable

Details

    • Technical task
    • Resolution: Done
    • P2: Important
    • 5.14
    • Qt RHI
    • None

    Description

      This is already done in QRhiCommandBuffer (because recording draw calls has higher frequency than e.g. pipeline (re)creation), perhaps expand to the whole api (to reduce allocations).

      As found out during QTBUG-78792, there are further potential pitfalls with the following approach:

      QVector<Something> somethings() const;
      void setSomethings(const QVector<Something> &);

      Especially in QRhiShaderResourceBinding, where one may create a QRhiShaderResourceBinding set just to look up an srb in a cache (e.g. a QHash). This is very heavy as it stands since one has to create a QVector of d-pointered class. This is extremely wasteful when there is a cache hit since we did all those allocs for nothing basically.

       

      Note that this does not cover the freely copyable "description" structs like QRhiVertexInputLayout. Those should be looked at separately, if moving away from QVector is sensible and if it would bring any visible improvements in practice.

       

      Attachments

        Issue Links

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

          Activity

            People

              lagocs Laszlo Agocs
              lagocs Laszlo Agocs
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes