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

ShaderEffectSource in recursive mode with multisampling is broken

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 6.5.3
    • Quick: SceneGraph
    • None
    • macOS

    Description

      This bug is related to https://bugreports.qt.io/browse/QTBUG-112355 and can be reproduced using the same code. Please refer to the linked above bug report for the reproduction code.

      Steps to reproduce:

      1. This bug report is relying on the presence of the bug reported in https://bugreports.qt.io/browse/QTBUG-112355 for better visibility. If that other bug is fixed, the repro scenario might not expose the present bug visually anymore (one would need a more involved repro), although one still might be able to reproduce the OpenGL error message, see below.
      2. Use an Apple Silicon machine
      3. Use the Qt6 demo example shadereffects.zip from https://bugreports.qt.io/browse/QTBUG-112355 
      4. Enable the live mode of the recursive ShaderEffectSource (id: shaderOutput) in the shadereffects.qml file
      5. Enable multisampling by specifying the environment variable "QT_QUICK_MULTISAMPLE=1".

      Expected results:

      • the initial pink color (coming from the bug reported in https://bugreports.qt.io/browse/QTBUG-112355 ) is supposed to quickly fade out, since the shader code is performing a recursive 50% mixture with the previous frame

      Observed results:

      • On Apple Silicon machine using default Metal backend the pink doesn't fade out but stays permanently at 50% mixture
      • If OpenGL backend is selected by specifying the environment variable "QSG_RHI_BACKEND=opengl", the code performs as expected, but is permanently sending a warning message into console: "Texture <address> () used with different accesses within the same pass, this is not allowed."
      • If multisampling is not enabled, the bug doesn't show up.

      On Apple Intel and Windows the bug seems to show up differently (as garbage or as empty shader result), we haven't prepared the respective repros for you, since we believe it's the same bug.

      We have tracked down what we believe might be the root cause of the issue. In https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/quick/scenegraph/qsgrhilayer.cpp?h=6.5.3#n392 if multisampling is not enabled the texture is copied, but this is not done if multisampling is enabled. With OpenGL backend this leads to the texture accessed in https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/rhi/qrhi.cpp?h=6.5.3#n7880 to have a mode incompatible with QRhiPassResourceTracker::TexStorageLoad/Store mode. With other backends (Metal, D3D etc.) we believe this leads to different manifestations of the same incompatibility.

      Attachments

        Issue Links

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

          Activity

            People

              janichol Andy Nichols
              aqn Vadim Zavalishin
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes