aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp10
-rw-r--r--tests/manual/nodetypes_ng/MultiClipRects.qml20
2 files changed, 20 insertions, 10 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 14ab7f9393..9203c67201 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -2844,17 +2844,17 @@ void Renderer::updateClipState(const QSGClipNode *clipList, Batch *batch) // RHI
drawCall.vbufOffset = aligned(vOffset, 4);
const int vertexByteSize = g->sizeOfVertex() * g->vertexCount();
- vOffset += vertexByteSize;
+ vOffset = drawCall.vbufOffset + vertexByteSize;
int indexByteSize = 0;
if (g->indexCount()) {
drawCall.ibufOffset = aligned(iOffset, 4);
indexByteSize = g->sizeOfIndex() * g->indexCount();
- iOffset += indexByteSize;
+ iOffset = drawCall.ibufOffset + indexByteSize;
}
drawCall.ubufOffset = aligned(uOffset, m_ubufAlignment);
- uOffset += StencilClipUbufSize;
+ uOffset = drawCall.ubufOffset + StencilClipUbufSize;
QMatrix4x4 matrixYUpNDC = m_current_projection_matrix;
if (clip->matrix())
@@ -2919,13 +2919,13 @@ void Renderer::enqueueStencilDraw(const Batch *batch) // RHI only
QRhiCommandBuffer::DynamicOffset ubufOffset(0, drawCall.ubufOffset);
if (i == 0) {
cb->setGraphicsPipeline(m_stencilClipCommon.replacePs);
- cb->setShaderResources(srb, 1, &ubufOffset);
cb->setViewport(m_pstate.viewport);
} else if (i == 1) {
cb->setGraphicsPipeline(m_stencilClipCommon.incrPs);
- cb->setShaderResources(srb, 1, &ubufOffset);
cb->setViewport(m_pstate.viewport);
}
+ // else incrPs is already bound
+ cb->setShaderResources(srb, 1, &ubufOffset);
cb->setStencilRef(drawCall.stencilRef);
const QRhiCommandBuffer::VertexInput vbufBinding(batch->stencilClipState.vbuf, drawCall.vbufOffset);
if (drawCall.indexCount) {
diff --git a/tests/manual/nodetypes_ng/MultiClipRects.qml b/tests/manual/nodetypes_ng/MultiClipRects.qml
index 793ebeae93..2d3804af21 100644
--- a/tests/manual/nodetypes_ng/MultiClipRects.qml
+++ b/tests/manual/nodetypes_ng/MultiClipRects.qml
@@ -61,8 +61,8 @@ Item {
GradientStop { position: 1; color: "black" }
}
- // Clip using scissor, 2 levels.
- // This means that the lightGreen-yellow-blue batch's clip list will have two clips.
+ // Clip using scissor, up to 2 levels. This means that the
+ // lightGreen-yellow-blue batch's clip list will have two clips.
Row {
spacing: 10
Repeater {
@@ -103,9 +103,9 @@ Item {
}
}
- // Clip using stencil, 2 levels.
- // This means that the lightGreen-yellow batch's clip list will have two clips
- // and so two stencil draw calls before drawing the actual content.
+ // Clip using stencil, up to 3 levels. This means that the
+ // lightGreen-yellow-blue batch's clip list will have three clips and
+ // so two stencil draw calls before drawing the actual content.
Row {
spacing: 10
Repeater {
@@ -133,6 +133,16 @@ Item {
x: 75
y: 75
NumberAnimation on rotation { from: 360; to: 0; duration: 5000; loops: Animation.Infinite; }
+ clip: true
+
+ Rectangle {
+ color: "blue"
+ width: 50
+ height: 50
+ x: 0
+ y: 0
+ NumberAnimation on rotation { from: 360; to: 0; duration: 5000; loops: Animation.Infinite; }
+ }
}
}
}