aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgcontext_p.h
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-10-17 14:53:33 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-30 08:29:49 +0100
commit906d5c5c40183468f9521277c6244a6c46730de6 (patch)
tree0eb46a8f88d59993ab659e2dc07970d1ce2f0d73 /src/quick/scenegraph/qsgcontext_p.h
parentc084d32d92b2df55532fa1599e590c29bf2b5bfb (diff)
Use one render loop per QQuickWindow
See the task for the full reasoning behind this patch. The threaded renderloop has been refactored to have one window per thread. This is mostly a simplification of the current code path where for loops over multiple windows are turned into if (window). The QSGContext has been split into two classes, QSGRenderContext for which there is one per OpenGLContext. The rest of the patch is name changes and a couple of cleanups in the hopes of simplifying this change. Task-number: QTBUG-33993 Change-Id: I31c81f9694d7da7474a72333169be38de62613c4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick/scenegraph/qsgcontext_p.h')
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h102
1 files changed, 67 insertions, 35 deletions
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index 2057c0031d..a11a4856c4 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -56,6 +56,9 @@
QT_BEGIN_NAMESPACE
+namespace QSGAtlasTexture {
+ class Manager;
+}
class QSGContextPrivate;
class QSGRectangleNode;
@@ -73,66 +76,95 @@ class QOpenGLContext;
class QOpenGLFramebufferObject;
class QQuickTextureFactory;
+class QSGDistanceFieldGlyphCacheManager;
+class QSGContext;
-class Q_QUICK_PRIVATE_EXPORT QSGContext : public QObject
+
+class Q_QUICK_PRIVATE_EXPORT QSGRenderContext : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QSGContext)
-
public:
- explicit QSGContext(QObject *parent = 0);
- ~QSGContext();
+ QSGRenderContext(QSGContext *context);
+ ~QSGRenderContext();
+
+ QOpenGLContext *openglContext() const { return m_gl; }
+ QSGContext *sceneGraphContext() const { return m_sg; }
virtual void initialize(QOpenGLContext *context);
virtual void invalidate();
- QOpenGLContext *glContext() const;
-
- bool isReady() const;
-
virtual void renderNextFrame(QSGRenderer *renderer, GLuint fboId);
- virtual QSGDistanceFieldGlyphCache *distanceFieldGlyphCache(const QRawFont &font);
+ virtual QSharedPointer<QSGDepthStencilBuffer> depthStencilBufferForFbo(QOpenGLFramebufferObject *fbo);
+ QSGDepthStencilBufferManager *depthStencilBufferManager();
- virtual QSGRectangleNode *createRectangleNode();
- virtual QSGImageNode *createImageNode();
- virtual QSGGlyphNode *createGlyphNode();
- virtual QSGGlyphNode *createNativeGlyphNode();
- virtual QSGRenderer *createRenderer();
+ virtual QSGDistanceFieldGlyphCache *distanceFieldGlyphCache(const QRawFont &font);
+ QSGTexture *textureForFactory(QQuickTextureFactory *factory, QQuickWindow *window);
virtual QSGTexture *createTexture(const QImage &image) const;
virtual QSGTexture *createTextureNoAtlas(const QImage &image) const;
- virtual QSize minimumFBOSize() const;
- virtual QSharedPointer<QSGDepthStencilBuffer> depthStencilBufferForFbo(QOpenGLFramebufferObject *fbo);
- QSGDepthStencilBufferManager *depthStencilBufferManager();
+ virtual QSGRenderer *createRenderer();
- virtual QSurfaceFormat defaultSurfaceFormat() const;
+ void registerFontengineForCleanup(QFontEngine *engine);
- QSGTexture *textureForFactory(QQuickTextureFactory *factory, QQuickWindow *window);
+ static QSGRenderContext *from(QOpenGLContext *context);
- static QSGContext *createDefaultContext();
+Q_SIGNALS:
+ void initialized();
+ void invalidated();
- void setFlashModeEnabled(bool enabled);
- bool isFlashModeEnabled() const;
- void setRenderAlpha(qreal renderAlpha);
- qreal renderAlpha() const;
+public Q_SLOTS:
+ void textureFactoryDestroyed(QObject *o);
- void setDistanceFieldEnabled(bool enabled);
- bool isDistanceFieldEnabled() const;
+protected:
+ QOpenGLContext *m_gl;
+ QSGContext *m_sg;
- virtual QAnimationDriver *createAnimationDriver(QObject *parent);
+ QMutex m_mutex;
+ QHash<QQuickTextureFactory *, QSGTexture *> m_textures;
+ QSGAtlasTexture::Manager *m_atlasManager;
- static QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image);
- static QSGRenderLoop *createWindowManager();
+ QSGDepthStencilBufferManager *m_depthStencilManager;
+ QSGDistanceFieldGlyphCacheManager *m_distanceFieldCacheManager;
+ QSet<QFontEngine *> m_fontEnginesToClean;
+};
-public Q_SLOTS:
- void textureFactoryDestroyed(QObject *o);
-Q_SIGNALS:
- void initialized();
- void invalidated();
+class Q_QUICK_PRIVATE_EXPORT QSGContext : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QSGContext)
+
+public:
+ enum AntialiasingMethod {
+ UndecidedAntialiasing,
+ VertexAntialiasing,
+ MsaaAntialiasing
+ };
+
+ explicit QSGContext(QObject *parent = 0);
+ ~QSGContext();
+
+ virtual void renderContextInitialized(QSGRenderContext *renderContext);
+ virtual void renderContextInvalidated(QSGRenderContext *renderContext);
+
+ virtual QSGRectangleNode *createRectangleNode();
+ virtual QSGImageNode *createImageNode();
+ virtual QSGGlyphNode *createGlyphNode(QSGRenderContext *rc);
+ virtual QSGGlyphNode *createNativeGlyphNode(QSGRenderContext *rc);
+ virtual QAnimationDriver *createAnimationDriver(QObject *parent);
+
+ virtual QSize minimumFBOSize() const;
+ virtual QSurfaceFormat defaultSurfaceFormat() const;
+
+ void setDistanceFieldEnabled(bool enabled);
+ bool isDistanceFieldEnabled() const;
+
+ static QSGContext *createDefaultContext();
+ static QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image);
+ static QSGRenderLoop *createWindowManager();
};
QT_END_NAMESPACE