mirror of https://github.com/qt/qt3d.git
RenderThread: fix races with texture and buffer
Add dependencies to ensure we won't allow the RenderThread to proceed if we haven't completed the execution of the texture and buffer gatherer jobs. Change-Id: Iaad67be893738b948bf26ca903f3bff7f16a1b88 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
parent
bf0b3bdf5a
commit
461194b0aa
|
|
@ -210,6 +210,9 @@ public:
|
|||
inline SynchronizerJobPtr textureLoadSyncJob() const { return m_syncTextureLoadingJob; }
|
||||
inline UpdateSkinningPaletteJobPtr updateSkinningPaletteJob() const { return m_updateSkinningPaletteJob; }
|
||||
inline Qt3DCore::QAspectJobPtr shaderGathererJob() const { return m_shaderGathererJob; }
|
||||
inline Qt3DCore::QAspectJobPtr bufferGathererJob() const { return m_bufferGathererJob; }
|
||||
inline Qt3DCore::QAspectJobPtr textureGathererJob() const { return m_textureGathererJob; }
|
||||
|
||||
Qt3DCore::QAbstractFrameAdvanceService *frameAdvanceService() const override;
|
||||
|
||||
void registerEventFilter(Qt3DCore::QEventFilterService *service) override;
|
||||
|
|
|
|||
|
|
@ -556,7 +556,12 @@ QVector<Qt3DCore::QAspectJobPtr> RenderViewBuilder::buildJobHierachy() const
|
|||
m_syncRenderCommandBuildingJob->addDependency(m_filterProximityJob);
|
||||
m_syncRenderCommandBuildingJob->addDependency(m_lightGathererJob);
|
||||
m_syncRenderCommandBuildingJob->addDependency(m_frustumCullingJob);
|
||||
|
||||
// Ensure the RenderThread won't be able to process dirtyResources
|
||||
// before they have been completely gathered
|
||||
m_syncRenderCommandBuildingJob->addDependency(m_renderer->shaderGathererJob());
|
||||
m_syncRenderCommandBuildingJob->addDependency(m_renderer->bufferGathererJob());
|
||||
m_syncRenderCommandBuildingJob->addDependency(m_renderer->textureGathererJob());
|
||||
|
||||
for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) {
|
||||
renderViewCommandBuilder->addDependency(m_syncRenderCommandBuildingJob);
|
||||
|
|
|
|||
|
|
@ -306,7 +306,8 @@ private Q_SLOTS:
|
|||
QVERIFY(renderViewBuilder.frustumCullingJob()->dependencies().contains(renderViewBuilder.syncFrustumCullingJob()));
|
||||
QVERIFY(renderViewBuilder.frustumCullingJob()->dependencies().contains(testAspect.renderer()->expandBoundingVolumeJob()));
|
||||
|
||||
QCOMPARE(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().size(), renderViewBuilder.materialGathererJobs().size() + 7);
|
||||
|
||||
QCOMPARE(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().size(), renderViewBuilder.materialGathererJobs().size() + 9);
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.syncRenderViewInitializationJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.renderableEntityFilterJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.computableEntityFilterJob()));
|
||||
|
|
@ -314,6 +315,8 @@ private Q_SLOTS:
|
|||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.lightGathererJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.frustumCullingJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(testAspect.renderer()->shaderGathererJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(testAspect.renderer()->bufferGathererJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(testAspect.renderer()->textureGathererJob()));
|
||||
for (const auto materialGatherer : renderViewBuilder.materialGathererJobs()) {
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(materialGatherer));
|
||||
}
|
||||
|
|
@ -379,7 +382,7 @@ private Q_SLOTS:
|
|||
QVERIFY(renderViewBuilder.frustumCullingJob()->dependencies().contains(renderViewBuilder.syncFrustumCullingJob()));
|
||||
QVERIFY(renderViewBuilder.frustumCullingJob()->dependencies().contains(testAspect.renderer()->expandBoundingVolumeJob()));
|
||||
|
||||
QCOMPARE(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().size(), renderViewBuilder.materialGathererJobs().size() + 8);
|
||||
QCOMPARE(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().size(), renderViewBuilder.materialGathererJobs().size() + 10);
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.syncRenderViewInitializationJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.renderableEntityFilterJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.computableEntityFilterJob()));
|
||||
|
|
@ -388,6 +391,8 @@ private Q_SLOTS:
|
|||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.frustumCullingJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(renderViewBuilder.filterProximityJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(testAspect.renderer()->shaderGathererJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(testAspect.renderer()->bufferGathererJob()));
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(testAspect.renderer()->textureGathererJob()));
|
||||
for (const auto materialGatherer : renderViewBuilder.materialGathererJobs()) {
|
||||
QVERIFY(renderViewBuilder.syncRenderCommandBuildingJob()->dependencies().contains(materialGatherer));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue