QSGContext Class

The QSGContext holds the scene graph entry points for one QML engine. More...

Header: #include <QSGContext>
Inherits: QObject

Public Functions

virtual QAnimationDriver *createAnimationDriver(QObject *parent)
virtual QSGGuiThreadShaderEffectManager *createGuiThreadShaderEffectManager()
QSGInternalRectangleNode *createInternalRectangleNode(const QRectF &rect, const QColor &c)
virtual QSGShaderEffectNode *createShaderEffectNode(QSGRenderContext *renderContext)
virtual bool isVSyncDependent(QAnimationDriver *driver)
virtual QSGRendererInterface *rendererInterface(QSGRenderContext *renderContext)
virtual float vsyncIntervalForAnimationDriver(QAnimationDriver *driver)

Static Public Members

QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image)
QSGRenderLoop *createWindowManager()

Detailed Description

The context is not ready for use until it has a QRhi. Once that happens, the scene graph population can start.

\internal

Member Function Documentation

[virtual] QAnimationDriver *QSGContext::createAnimationDriver(QObject *parent)

Creates a new animation driver.

[virtual] QSGGuiThreadShaderEffectManager *QSGContext::createGuiThreadShaderEffectManager()

Creates a new shader effect helper instance. This function is called on the GUI thread, unlike the others. This is necessary in order to provide adaptable, backend-specific shader effect functionality to the GUI thread too.

QSGInternalRectangleNode *QSGContext::createInternalRectangleNode(const QRectF &rect, const QColor &c)

Convenience factory function for creating a colored rectangle with the given geometry.

[virtual] QSGShaderEffectNode *QSGContext::createShaderEffectNode(QSGRenderContext *renderContext)

Creates a new shader effect node. The default of returning nullptr is valid as long as the backend does not claim SupportsShaderEffectNode or ignoring ShaderEffect elements is acceptable.

[static] QQuickTextureFactory *QSGContext::createTextureFactoryFromImage(const QImage &image)

Calls into the scene graph adaptation if available and creates a texture factory. The primary purpose of this function is to reimplement hardware specific asynchronous texture frameskip-less uploads that can happen on the image providers thread.

[static] QSGRenderLoop *QSGContext::createWindowManager()

Calls into the scene graph adaptation if available and creates a hardware specific window manager.

[virtual] bool QSGContext::isVSyncDependent(QAnimationDriver *driver)

Returns true if driver relies on vsync-based throttling in some form.

[virtual] QSGRendererInterface *QSGContext::rendererInterface(QSGRenderContext *renderContext)

Returns a pointer to the (presumably) global renderer interface.

Note: This function may be called on the GUI thread in order to get access to QSGRendererInterface::graphicsApi() and other getters.

Note: it is expected that the simple queries (graphicsApi, shaderType, etc.) are available regardless of the render context validity (i.e. scenegraph status). This does not apply to engine-specific getters like getResource(). In the end this means that this function must always return a valid object in subclasses, even when renderContext->isValid() is false. The typical pattern is to implement the QSGRendererInterface in the QSGContext or QSGRenderContext subclass itself, whichever is more suitable.

[virtual] float QSGContext::vsyncIntervalForAnimationDriver(QAnimationDriver *driver)

Returns the vsync rate (such as, 16.68 ms or similar), if applicable, for the driver that was created by createAnimationDriver().