Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
5.12.1, 5.15.2, 6.1.3, 6.2.0 Beta4
-
None
-
-
383b70aba1e27adb3e836db6f41edd2c8b6275ef (qt/tqtc-qtdeclarative/5.15)
Description
While using a custom render item based on QSGRenderNode which has the clip property enabled (setClip(true)), the clip/scissor rectangle seems to be calculated wrongly in a rare case when this element is the only element in the scene.
Debugging & looking into the 5.12 sources (qsgbatchrenderer.cpp) it seems that in that in this case the renderRenderNode() call is used to draw the scene instead of the usual "render(Un)MergedBatch".
Inside the renderRenderNode () call is a call to updateClip() which jumps to updateStencilClip() and calculates the clip rectangle using the variable "m_current_projection_matrix", but it is not initialized in this code path and the calculation seems wrong.
This is alleviated and "m_current_projection_matrix" is initialized correctly in the "typical" render(Un)MergedBatch code path by a piece of code below:
m_current_projection_matrix = projectionMatrix();
// updateClip() uses m_current_projection_matrix.
updateClip(gn->clipList(), batch);
Such initialization is missing in the renderRenderNode() before calling updateClip() - which leads to the error I believe.
After adding a simple rectangle to the scene the clip values get a proper initialization and the element is rendered correctly.