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

Could pipeline state objects be better reused between (layer) renderers

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P2: Important
    • 5.15
    • 5.14
    • Qt RHI, Quick: SceneGraph
    • None

    Description

      QSGBatchRenderer owns the QRhiGraphicsPipeline cache in 5.14.0. This is not ideal with layers (ShaderEffect or Item.layer) because each layer is getting their own renderer, meaning no pipelines are reused.

      In the nodetypes_ng layer test scene, that features at least 5 items with Item.layer enabled, there are 16 pipelines created. The ideal result should in fact be no more than 8 (because most of the layers rely on the same materials, but the renderpass descriptor - for Vulkan - is different for the swapchain and offscreen passes so complete reuse is not possible - the layers can share each others pipelines, however).

      Like the srb cache, the pso cache should rather be in ShaderManager. At first glance there is no reason while this cannot be feasible.

      On a second look, this is more complicated, due to the QRhiRenderPassDescriptor. While the srb is handled nicely (not included in the pipeline cache key hash value (which is not actually nice), while operator== is using isLayoutCompatible), the layers' different renderpass descriptor object will cause a pipeline cache miss.

      The ideal solution is something along the lines of:

      • introducing an isCompatible() for QRhiRenderPassDescriptor (can be always true for GL and D3D, and to be determined based on the relevant factors (attachment counts, formats) for Metal and Vulkan)
      • use isCompatible() in operator==(const GraphicsPipelineStateKey &) for rpDesc, similarly to how it already uses isLayoutCompatible() for the srb
      • once this is in place, moving m_pipelines into ShaderManager is actually helpful because it will then start reusing pipeline objects between different layers as well

      Attachments

        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