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

Rhi does not respect QSurfaceFormat::defaultFormat::swapBehavior

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Qt3D
    • None

    Description

      I'm developing a 3D app that I'd like to have minimal latency. Unfortunately,

      format.setSwapBehavior(QSurfaceFormat::SwapBehavior::DoubleBuffer);

       is ignored and triple buffering is used instead as shown in the logs:

      qt.rhi.general: Creating new swapchain of 3 buffers, size 1248x1330, presentation mode 2

      I believe this patch should fix it to use double buffering:

      diff --git a/src/gui/painting/qbackingstorerhisupport.cpp b/src/gui/painting/qbackingstorerhisupport.cpp
      index 05329d61c5..2fdb2c4928 100644
      --- a/src/gui/painting/qbackingstorerhisupport.cpp
      +++ b/src/gui/painting/qbackingstorerhisupport.cpp
      @@ -159,6 +159,8 @@ QRhiSwapChain *QBackingStoreRhiSupport::swapChainForWindow(QWindow *window)
                   flags |= QRhiSwapChain::NoVSync;
               if (format.alphaBufferSize() > 0)
                   flags |= QRhiSwapChain::SurfaceHasNonPreMulAlpha;
      +        if (format.swapBehavior() ==  QSurfaceFormat::SwapBehavior::DoubleBuffer || format.swapBehavior() == QSurfaceFormat::SwapBehavior::SingleBuffer)
      +            flags |= QRhiSwapChain::MinimalBufferCount;

      Attachments

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

        Activity

          People

            seanharmer Sean Harmer
            clickingbuttons clicking buttons
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes