summaryrefslogtreecommitdiffstats
path: root/src/api/studio3dqml/q3dsrenderer_p.h
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2019-08-07 16:52:00 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2019-08-13 11:52:25 +0300
commit7ea21a4315b1c6df104d80a700680dd1f9d204dc (patch)
tree8b5dca8ca23a2acdab6f8ad1f911faad1fdb1ddc /src/api/studio3dqml/q3dsrenderer_p.h
parentd2a1092b93e9669288dc1d5825bfec849bec9f95 (diff)
Make runtime initialization optionally not block QML
Runtime initialization made non-blocking by offloading it to a worker thread. This causes various object thread affinities in runtime to be incorrect. This is relevant at least for the singaling, where having affinity to non-existing initialization thread would cause signals to not be delivered. To work around this issue, signal proxy thread affinitions and signal connections are set after initialization has completed. Similarly, behavior script QML engine initialization is deferred so that it can be done in correct thread. Task-number: QT3DS-3805 Change-Id: Ie8b64f4ecd93e4c422e369e625080652d67bde27 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/api/studio3dqml/q3dsrenderer_p.h')
-rw-r--r--src/api/studio3dqml/q3dsrenderer_p.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/api/studio3dqml/q3dsrenderer_p.h b/src/api/studio3dqml/q3dsrenderer_p.h
index 61e8770..f0b6cfe 100644
--- a/src/api/studio3dqml/q3dsrenderer_p.h
+++ b/src/api/studio3dqml/q3dsrenderer_p.h
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
class Q3DSViewerSettings;
class Q3DSPresentation;
+class Q3DSRuntimeInitializerThread;
class Q3DSRenderer : public QObject,
public QQuickFramebufferObject::Renderer
@@ -60,8 +61,8 @@ class Q3DSRenderer : public QObject,
public:
Q3DSRenderer(bool visibleFlag, qt3ds::Qt3DSAssetVisitor *assetVisitor,
- QElapsedTimer *startupTimer);
- ~Q3DSRenderer();
+ QElapsedTimer *startupTimer, bool asyncInit);
+ ~Q3DSRenderer() override;
QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) override;
@@ -80,6 +81,9 @@ Q_SIGNALS:
void meshesCreated(const QStringList &meshNames, const QString &error);
void dataOutputValueUpdated(const QString &name, const QVariant &newValue);
+protected Q_SLOTS:
+ void handleRuntimeInitializedAsync();
+
protected:
static void onInitHandler(void *userData);
static void onUpdateHandler(void *userData);
@@ -88,6 +92,7 @@ protected:
void render() override;
void synchronize(QQuickFramebufferObject *inView) override;
void releaseRuntime();
+ void registerCallbacks();
protected:
bool m_visibleFlag; // Is the plugin visible? Prevents rendering hidden content.
@@ -104,6 +109,8 @@ protected:
Q3DSPresentation *m_presentation;
QString m_error;
QElapsedTimer *m_startupTimer;
+ Q3DSRuntimeInitializerThread *m_runtimeInitializerThread = nullptr;
+ bool m_asyncInit = false;
friend class RuntimeInitializer;
};