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

QStencilTestArguments::referenceValue takes no effect in RHI

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.6.2
    • Qt3D
    • None
    • Windows

    Description

      It seems setting QStencilTestArguments::referenceValue to 1 takes no effect on rendering with RHI.

      I add renderstates to the framegraph in the Basic shapes example to enable writing to the stencilbuffer.
      I start the application in renderdoc.
      With RHI, using QSG_RHI_BACKEND=opengl, nothing is written on the stencilbuffer, the corresponding function is also incorrect: glStencilFuncSeparate(GL_FRONT, GL_ALWAYS, 0, 0)
      The 3. parameter is the reference value that’s supposed to be set via QStencilTestArguments::setReferenceValue in the qt3d framework.
      Running the same application with QT3D_RENDERER=opengl, it produces the expected result (loading it in renderdoc, I can see values on the stencilbuffer and I can see the corresponding function correctly set: glStencilFuncSeparate(GL_FRONT, GL_ALWAYS, 1, 0)).

      Changes to main.cpp in basic shapes (skipping the necessary includes here):

       //FrameGraph
       

      {      auto renderStates = new Qt3DRender::QRenderStateSet();      auto* stencilTest = new Qt3DRender::QStencilTest();      stencilTest->setEnabled(true);      stencilTest->front()->setReferenceValue(1);      stencilTest->front()->setStencilFunction(Qt3DRender::QStencilTestArguments::Always);      auto* stencilOp = new Qt3DRender::QStencilOperation();      stencilOp->setEnabled(true);      stencilOp->front()->setAllTestsPassOperation(Qt3DRender::QStencilOperationArguments::Replace);      stencilOp->front()->setStencilTestFailureOperation(Qt3DRender::QStencilOperationArguments::Keep);      stencilOp->front()->setDepthTestFailureOperation(Qt3DRender::QStencilOperationArguments::Keep);      auto* stencilMask = new Qt3DRender::QStencilMask();      stencilMask->setEnabled(true);      stencilMask->setFrontOutputMask(0xFF);      renderStates->addRenderState(stencilTest);      renderStates->addRenderState(stencilOp);      renderStates->addRenderState(stencilMask);      view->activeFrameGraph()->setParent(renderStates);      view->setActiveFrameGraph(renderStates);  }

      Attachments

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

        Activity

          People

            seanharmer Sean Harmer
            matta Lenardne Szolnoki
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes