Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.3, 6.6
-
None
-
-
0933e62b2 (dev), 302a7530d (6.8), 280f289fa (6.7), 59743e96b (tqtc/lts-6.5)
Description
I have constructed a simple example with a custom QQuickItem wich renders 10x10 Rectangles by using QSGRectangleNodes (constructed with window()->createRectangleNode())
When I analyse the running program with RenderDoc (https://renderdoc.org/) I see that with newer Versions of Qt (beginning with Qt 6.5.3) the batching wont work any longer.
Each rectangle will be drawn in a single draw call for itself.
When I try the same example with Qt 6.5.2 then the all the rectangles are combined into a single draw call (see attached screenshots)
I tried various newer Qt versions (also Qt 6.6.0, 6.6.1 and 6.6.2) which all show the same bug.
QSGNode* DemoQuickItem::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) { QSGNode* rootNode = oldNode ? oldNode : new QSGTransformNode; if (!oldNode) { const int gridSize = 10; const qreal rectSize = width() / gridSize; for (int i = 0; i < gridSize; ++i) { for (int j = 0; j < gridSize; ++j) { QColor color = QColor::fromHsv((i * gridSize + j) % 360, 255, 255); QRectF rect(rectSize * i, rectSize * j, rectSize, rectSize); QSGRectangleNode* rectNode = window()->createRectangleNode(); rectNode->setRect(rect); rectNode->setColor(color); rootNode->appendChildNode(rectNode); } } } return rootNode; }
The funny thing is that Qt seems to think it is batching. When I set QSG_VISUALIZE=batches then it shows a big single colored rectangle (see screenshot). But the draw calls are not combined. Even the colored overlay for the batching visualization is rendered rectangle for rectangle
It could be related to https://bugreports.qt.io/browse/QTBUG-97557
When I debug into the application in qsgbatchrenderer.cpp then canMerge fails because "g->indexCount()" is zero:
https://github.com/qt/qtdeclarative/commit/f9e95c9d447f8b4223ce02e7ddf6c4ed0bfc5ec9
Attachments
Issue Links
- relates to
-
QTBUG-97557 Qt Quick batch rendering issue when a batch contain nodes that have different index types
- Closed