From aaa4a26f82f99fa8724841eba91bad029306e0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 16 Aug 2011 09:29:44 +0200 Subject: Move GL resource handling enablers to QtGui. Made resource handling more robust by attempting to free GL resources in the correct thread, and not forcing a context to become current to free resources. Change-Id: Ie81d4005b608972375755571d9b50ce82080709b Reviewed-on: http://codereview.qt.nokia.com/3258 Reviewed-by: Qt Sanity Bot Reviewed-by: Gunnar Sletta --- src/opengl/qglframebufferobject_p.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/opengl/qglframebufferobject_p.h') diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index f82361279d..61d39c6a07 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -130,8 +130,9 @@ private: class QGLFramebufferObjectPrivate { public: - QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_buffer(0), stencil_buffer(0) - , color_buffer(0), valid(false), engine(0) {} + QGLFramebufferObjectPrivate() : fbo_guard(0), texture_guard(0), depth_buffer_guard(0) + , stencil_buffer_guard(0), color_buffer_guard(0) + , valid(false), engine(0) {} ~QGLFramebufferObjectPrivate() {} void init(QGLFramebufferObject *q, const QSize& sz, @@ -139,11 +140,11 @@ public: GLenum internal_format, GLenum texture_target, GLint samples = 0, bool mipmap = false); bool checkFramebufferStatus() const; - QGLSharedResourceGuard fbo_guard; - GLuint texture; - GLuint depth_buffer; - GLuint stencil_buffer; - GLuint color_buffer; + QGLSharedResourceGuardBase *fbo_guard; + QGLSharedResourceGuardBase *texture_guard; + QGLSharedResourceGuardBase *depth_buffer_guard; + QGLSharedResourceGuardBase *stencil_buffer_guard; + QGLSharedResourceGuardBase *color_buffer_guard; GLenum target; QSize size; QGLFramebufferObjectFormat format; @@ -152,7 +153,7 @@ public: mutable QPaintEngine *engine; QGLFBOGLPaintDevice glDevice; - inline GLuint fbo() const { return fbo_guard.id(); } + inline GLuint fbo() const { return fbo_guard ? fbo_guard->id() : 0; } }; -- cgit v1.2.1