summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglframebufferobject.cpp
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2010-01-13 14:53:04 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2010-01-13 14:53:04 (GMT)
commit7bfc32ca6a462b498b9f349454113cd37f64e89f (patch)
treea224c41e1228f1aa7decda1ed8370e2df66814dc /src/opengl/qglframebufferobject.cpp
parent59ee1b9d387468a5a80b5c450aa202d1b33e6bd1 (diff)
downloadQt-7bfc32ca6a462b498b9f349454113cd37f64e89f.zip
Qt-7bfc32ca6a462b498b9f349454113cd37f64e89f.tar.gz
Qt-7bfc32ca6a462b498b9f349454113cd37f64e89f.tar.bz2
Rework how Qt handles GL extensions.
Qt used to store the GL extensions a particular implementation supported in a global cache, which was initialized once and never updated. This could cause problems because different types of context might support different kinds of extensions (e.g. the difference between sw and hw contexts). With this patch, the GL extensions are cached and updated within each QGLContext. It also makes the extension initialization lazy, which saves application initialization costs for embedded platforms. The patch introduces a internal cross platform QGLTemporaryContext class that is used to create a light-weight GL context without going via QGLWidget and friends (QWS and WinCE still have QGLWidget fallbacks for now). Reviewed-by: Kim Reviewed-by: Samuel
Diffstat (limited to 'src/opengl/qglframebufferobject.cpp')
-rw-r--r--src/opengl/qglframebufferobject.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index ed21923..ce80796 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -396,7 +396,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
fbo_guard.setContext(ctx);
- bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
+ bool ext_detected = (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject);
if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx)))
return;
@@ -466,7 +466,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
}
if (attachment == QGLFramebufferObject::CombinedDepthStencil
- && (QGLExtensions::glExtensions & QGLExtensions::PackedDepthStencil)) {
+ && (QGLExtensions::glExtensions() & QGLExtensions::PackedDepthStencil)) {
// depth and stencil buffer needs another extension
glGenRenderbuffers(1, &depth_stencil_buffer);
Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer));
@@ -1028,8 +1028,7 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const
*/
bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
{
- QGLExtensions::init();
- return (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
+ return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject);
}
/*!
@@ -1188,8 +1187,7 @@ bool QGLFramebufferObject::isBound() const
*/
bool QGLFramebufferObject::hasOpenGLFramebufferBlit()
{
- QGLExtensions::init();
- return (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit);
+ return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit);
}
/*!
@@ -1229,7 +1227,7 @@ void QGLFramebufferObject::blitFramebuffer(QGLFramebufferObject *target, const Q
GLbitfield buffers,
GLenum filter)
{
- if (!(QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit))
+ if (!(QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit))
return;
const QGLContext *ctx = QGLContext::currentContext();