summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglvertexarrayobject.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@digia.com>2014-08-26 12:33:13 +0200
committerSean Harmer <sean.harmer@kdab.com>2014-08-26 20:55:17 +0200
commit23a2ad6f61ce237ea21e960726d2f92c84d200fc (patch)
treeca06615b3876d4134e696ff8d5a84f752b4b6195 /src/gui/opengl/qopenglvertexarrayobject.cpp
parent76b4493595918370ef7b1f6922b1ae5e08b95a46 (diff)
Fail early when creating QOpenGLVertexArrayObject
There is a significant performance regression with using QOpenGLVertexArrayObject::Binder on platforms not supporting VAOs. This is because of the function resolving/initialization in create which is called once pr bind if d->vao == 0. Change-Id: I74e77f50921116c306247dc371c68b287a2e22d7 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui/opengl/qopenglvertexarrayobject.cpp')
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index 3b106fecf5..f39b10dc60 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -150,6 +150,11 @@ bool QOpenGLVertexArrayObjectPrivate::create()
qWarning("QOpenGLVertexArrayObject::create() requires a valid current OpenGL context");
return false;
}
+
+ //Fail early, if context is the same as ctx, it means we have tried to initialize for this context and failed
+ if (ctx == context)
+ return false;
+
context = ctx;
QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));