aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-18 10:29:10 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-18 10:29:47 +0200
commiteb30e3d7ee81c48cea720e7ecd2ed45647bc70ee (patch)
tree810e8ad0642434eeb4043c3a06c82217314300e1 /src/quick/scenegraph/coreapi
parent9c9fca5e27bd91da1ea07bebd7569049493c5ccf (diff)
parent521ace713d8e5230d47f3da8cd941699ca085af2 (diff)
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
Diffstat (limited to 'src/quick/scenegraph/coreapi')
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp43
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h1
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp10
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp2
4 files changed, 35 insertions, 21 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 6d0ed4ce9f..8632ea0b52 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -1523,6 +1523,7 @@ void Renderer::prepareOpaqueBatches()
if (gni->clipList() == gnj->clipList()
&& gni->geometry()->drawingMode() == gnj->geometry()->drawingMode()
+ && (gni->geometry()->drawingMode() != GL_LINES || gni->geometry()->lineWidth() == gnj->geometry()->lineWidth())
&& gni->geometry()->attributes() == gnj->geometry()->attributes()
&& gni->inheritedOpacity() == gnj->inheritedOpacity()
&& gni->activeMaterial()->type() == gnj->activeMaterial()->type()
@@ -1621,6 +1622,7 @@ void Renderer::prepareAlphaBatches()
if (gni->clipList() == gnj->clipList()
&& gni->geometry()->drawingMode() == gnj->geometry()->drawingMode()
+ && (gni->geometry()->drawingMode() != GL_LINES || gni->geometry()->lineWidth() == gnj->geometry()->lineWidth())
&& gni->geometry()->attributes() == gnj->geometry()->attributes()
&& gni->inheritedOpacity() == gnj->inheritedOpacity()
&& gni->activeMaterial()->type() == gnj->activeMaterial()->type()
@@ -2283,6 +2285,7 @@ void Renderer::renderMergedBatch(const Batch *batch)
m_currentMaterial = material;
QSGGeometry* g = gn->geometry();
+ updateLineWidth(g);
char const *const *attrNames = program->attributeNames();
for (int i=0; i<batch->drawSets.size(); ++i) {
const DrawSet &draw = batch->drawSets.at(i);
@@ -2413,24 +2416,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch)
offset += a.tupleSize * size_of_type(a.type);
}
- if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES)
- glLineWidth(g->lineWidth());
-#if !defined(QT_OPENGL_ES_2)
- else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) {
- QOpenGLFunctions_1_0 *gl1funcs = 0;
- QOpenGLFunctions_3_2_Core *gl3funcs = 0;
- if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile)
- gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
- else
- gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>();
- Q_ASSERT(gl1funcs || gl3funcs);
- if (gl1funcs)
- gl1funcs->glPointSize(g->lineWidth());
- else
- gl3funcs->glPointSize(g->lineWidth());
- }
-#endif
-
+ updateLineWidth(g);
if (g->indexCount())
glDrawElements(g->drawingMode(), g->indexCount(), g->indexType(), iOffset);
else
@@ -2446,6 +2432,27 @@ void Renderer::renderUnmergedBatch(const Batch *batch)
}
}
+void Renderer::updateLineWidth(QSGGeometry *g)
+{
+ if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES)
+ glLineWidth(g->lineWidth());
+#if !defined(QT_OPENGL_ES_2)
+ else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) {
+ QOpenGLFunctions_1_0 *gl1funcs = 0;
+ QOpenGLFunctions_3_2_Core *gl3funcs = 0;
+ if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile)
+ gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
+ else
+ gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>();
+ Q_ASSERT(gl1funcs || gl3funcs);
+ if (gl1funcs)
+ gl1funcs->glPointSize(g->lineWidth());
+ else
+ gl3funcs->glPointSize(g->lineWidth());
+ }
+#endif
+}
+
void Renderer::renderBatches()
{
if (Q_UNLIKELY(debug_render())) {
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index c7b5f73688..d19fa0e17d 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -603,6 +603,7 @@ private:
void nodeWasRemoved(Node *node);
void nodeWasAdded(QSGNode *node, Node *shadowParent);
BatchRootInfo *batchRootInfo(Node *node);
+ void updateLineWidth(QSGGeometry *g);
inline Batch *newBatch();
void invalidateAndRecycleBatch(Batch *b);
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index 3f54e13c52..1fd37be84a 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -522,7 +522,8 @@ void QSGGeometry::setDrawingMode(GLenum mode)
/*!
Gets the current line or point width or to be used for this geometry. This property
only applies to line width when the drawingMode is \c GL_LINES, \c GL_LINE_STRIP, or
- \c GL_LINE_LOOP, and only applies to point size when the drawingMode is \c GL_POINTS.
+ \c GL_LINE_LOOP. For desktop OpenGL, it also applies to point size when the drawingMode
+ is \c GL_POINTS.
The default value is \c 1.0
@@ -536,7 +537,12 @@ float QSGGeometry::lineWidth() const
/*!
Sets the line or point width to be used for this geometry to \a width. This property
only applies to line width when the drawingMode is \c GL_LINES, \c GL_LINE_STRIP, or
- \c GL_LINE_LOOP, and only applies to point size when the drawingMode is \c GL_POINTS.
+ \c GL_LINE_LOOP. For Desktop OpenGL, it also applies to point size when the drawingMode
+ is \c GL_POINTS.
+
+ \note How line width and point size are treated is implementation dependent: The application
+ should not rely on these, but rather create triangles or similar to draw areas. On OpenGL ES,
+ line width support is limited and point size is unsupported.
\sa lineWidth(), drawingMode()
*/
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 71f4f62db9..51f3976ed9 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -806,7 +806,7 @@ void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry)
the vertices and their structure, to be drawn. The Material defines how the shape is
filled.
- The following is a code snipped illustrating how to create a red
+ The following is a code snippet illustrating how to create a red
line using a QSGGeometryNode:
\code
QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 2);