Fix corrupt rendering when toggling rendernode-based items
Meaning the toggling of visibility. Having a QSGRenderNode come and go in the scenegraph leads to visual problems, in case the adding and removal of the node toggles the m_forceNoUseDepthBuffer flag, which in turn makes useDepthBuffer() return a different value than before (so disables and then enables doing the opaque pass in the renderer). Changing this value needs a full rebuild of the render lists. When adding a node, this is done (regardless of toggling the flag). When removing, it was not done at all. Now we do it when resetting the no-Z flag back to false. Add a button to the customrendernode example to toggle visibility since this is useful for example's purposes anyways. However, this on its own is not sufficient to reproduce the issue. For that, the DepthAwareRendering flag needs to be removed from the QSGRenderNode subclass. Pick-to: 6.6 6.5 Fixes: QTBUG-119160 Change-Id: I232354d88f5a4fe5f9f2d6102d0d5439d92782fb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
ab52d28879
commit
d70b847f77
|
@ -102,6 +102,11 @@ Item {
|
|||
}
|
||||
|
||||
|
||||
Button {
|
||||
text: qsTr("Toggle custom item visibility")
|
||||
onClicked: custom.visible = !custom.visible
|
||||
}
|
||||
|
||||
CustomRender {
|
||||
id: custom
|
||||
width: Math.min(parent.width, parent.height)
|
||||
|
|
|
@ -1265,8 +1265,13 @@ void Renderer::nodeWasRemoved(Node *node)
|
|||
if (e) {
|
||||
e->removed = true;
|
||||
m_elementsToDelete.add(e);
|
||||
if (m_renderNodeElements.isEmpty())
|
||||
if (m_renderNodeElements.isEmpty()) {
|
||||
m_forceNoDepthBuffer = false;
|
||||
// Must have a full rebuild given useDepthBuffer() now returns
|
||||
// a different value than before, meaning there can once again
|
||||
// be an opaque pass.
|
||||
m_rebuild |= FullRebuild;
|
||||
}
|
||||
|
||||
if (e->batch != nullptr)
|
||||
e->batch->needsPurge = true;
|
||||
|
|
Loading…
Reference in New Issue