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>
This commit is contained in:
Jørgen Lind 2014-08-26 12:33:13 +02:00 committed by Sean Harmer
parent 76b4493595
commit 23a2ad6f61

View File

@ -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()));