aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdefaultrendercontext.cpp
diff options
context:
space:
mode:
authorJesus Fernandez <jesus.fernandez@qt.io>2018-02-05 17:20:08 +0100
committerJesus Fernandez <Jesus.Fernandez@qt.io>2018-04-24 16:37:10 +0000
commit5cc8db797a88a0b2654876e768ba9cdebc053534 (patch)
tree7182acc0607d6611c4143b67fe62afdad6b98e84 /src/quick/scenegraph/qsgdefaultrendercontext.cpp
parent03739f2150d59248fb2c4b688c6352182f630f3e (diff)
Use different buffer for indices and vertices only in the WebGL plugin
This patch partially reverts 098ba086530ccd555369a9ea88f3c6668726ab81. Only QtWebGL will use separate buffers for indices and vertices. This patch gives a performance boost. Task-number: QTBUG-66191 Task-number: QTBUG-67147 Change-Id: I58b4db2bdf44cd954390e85e079de82031caf9e5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultrendercontext.cpp')
-rw-r--r--src/quick/scenegraph/qsgdefaultrendercontext.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
index 7882496062..22e97a2dc9 100644
--- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp
+++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp
@@ -39,6 +39,7 @@
#include "qsgdefaultrendercontext_p.h"
+#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLFramebufferObject>
#include <QtQuick/private/qsgbatchrenderer_p.h>
@@ -317,6 +318,17 @@ QSGDefaultRenderContext *QSGDefaultRenderContext::from(QOpenGLContext *context)
return qobject_cast<QSGDefaultRenderContext *>(context->property(QSG_RENDERCONTEXT_PROPERTY).value<QObject *>());
}
+bool QSGDefaultRenderContext::separateIndexBuffer() const
+{
+ // WebGL: A given WebGLBuffer object may only be bound to one of
+ // the ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target in its
+ // lifetime. An attempt to bind a buffer object to the other
+ // target will generate an INVALID_OPERATION error, and the
+ // current binding will remain untouched.
+ static const bool isWebGL = qGuiApp->platformName().compare(QLatin1String("webgl")) == 0;
+ return isWebGL;
+}
+
QSGDistanceFieldGlyphCache *QSGDefaultRenderContext::distanceFieldGlyphCache(const QRawFont &font)
{
QString key = fontKey(font);