diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2014-12-02 11:57:41 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2014-12-16 17:42:27 +0100 |
commit | 7f325ecbc2875b17fb95e13de3073bf29d3fb348 (patch) | |
tree | 293ccc8d835ce1664b4292c8fa1811bec0393850 /src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | |
parent | 1bd42483b4c21ee11364b31150b1ec85e5307830 (diff) |
Allow batching of GL_LINES and GL_POINTS geometry
This is analogous to GL_TRIANGLES and GL_TRIANGLE_STRIP. There is no
reason why we shouldn't batch it. In the case of GL_LINES this means a
slight behavior change, though: If you provided geometry with an uneven
number of vertices, it would draw lines the way opengl specifies it and
drop the last vertex. Now, with batching, it will draw a line from the
last vertex of an "uneven" node to the first vertex of the next node.
This, however, is exactly like it already works for GL_TRIANGLES if you
specify a number of vertices not divisible by 3. We assume the user
should specify a number of vertices that matches the drawing mode.
Change-Id: I372b9c15a19f065d3aeb3727688cca408ce9608e
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 9675d6e48a..5a78b90e7c 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -1727,7 +1727,8 @@ void Renderer::uploadBatch(Batch *b) QSGGeometryNode *gn = b->first->node; QSGGeometry *g = gn->geometry(); QSGMaterial::Flags flags = gn->activeMaterial()->flags(); - bool canMerge = (g->drawingMode() == GL_TRIANGLES || g->drawingMode() == GL_TRIANGLE_STRIP) + bool canMerge = (g->drawingMode() == GL_TRIANGLES || g->drawingMode() == GL_TRIANGLE_STRIP || + g->drawingMode() == GL_LINES || g->drawingMode() == GL_POINTS) && b->positionAttribute >= 0 && g->indexType() == GL_UNSIGNED_SHORT && (flags & (QSGMaterial::CustomCompileStep | QSGMaterial_FullMatrix)) == 0 |