diff options
Diffstat (limited to 'src/quick/scenegraph/qsgcontext_p.h')
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 107 |
1 files changed, 73 insertions, 34 deletions
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 2057c0031d..c562a909c5 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,102 @@ 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(); + bool hasBrokenIndexBufferObjects() const { return m_brokenIBOs; } - void setFlashModeEnabled(bool enabled); - bool isFlashModeEnabled() const; +Q_SIGNALS: + void initialized(); + void invalidated(); + +public Q_SLOTS: + void textureFactoryDestroyed(QObject *o); - void setRenderAlpha(qreal renderAlpha); - qreal renderAlpha() const; +protected: + QOpenGLContext *m_gl; + QSGContext *m_sg; - void setDistanceFieldEnabled(bool enabled); - bool isDistanceFieldEnabled() const; + QMutex m_mutex; + QHash<QQuickTextureFactory *, QSGTexture *> m_textures; + QSGAtlasTexture::Manager *m_atlasManager; + QSGDepthStencilBufferManager *m_depthStencilManager; + QSGDistanceFieldGlyphCacheManager *m_distanceFieldCacheManager; + + QSet<QFontEngine *> m_fontEnginesToClean; + + bool m_brokenIBOs; + bool m_serializedRender; +}; + + +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); - static QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image); - static QSGRenderLoop *createWindowManager(); + virtual QSize minimumFBOSize() const; + virtual QSurfaceFormat defaultSurfaceFormat() const; + static void setSharedOpenGLContext(QOpenGLContext *context); + static QOpenGLContext *sharedOpenGLContext(); -public Q_SLOTS: - void textureFactoryDestroyed(QObject *o); + void setDistanceFieldEnabled(bool enabled); + bool isDistanceFieldEnabled() const; -Q_SIGNALS: - void initialized(); - void invalidated(); + static QSGContext *createDefaultContext(); + static QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image); + static QSGRenderLoop *createWindowManager(); }; QT_END_NAMESPACE |