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

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

      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.

       

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes