From bda9735b5dc077eec1ab246d8e0b8646b42b88ae Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 15:01:16 -0700 Subject: [PATCH 1/3] fix loading progress --- interface/src/Application.cpp | 5 ++++- interface/src/Application.h | 2 +- interface/src/octree/SafeLanding.cpp | 14 +++++++------- .../entities-renderer/src/EntityTreeRenderer.cpp | 2 +- .../src/RenderableParticleEffectEntityItem.cpp | 10 ++++++++++ .../entities/src/ParticleEffectEntityItem.cpp | 3 ++- libraries/networking/src/DomainHandler.h | 2 +- scripts/defaultScripts.js | 4 ++-- scripts/system/interstitialPage.js | 2 +- 9 files changed, 29 insertions(+), 15 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 757007267f..358b0c94ba 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6575,6 +6575,7 @@ bool Application::gpuTextureMemSizeStable() { qint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; qint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; + qint64 textureTransferSize = renderStats->texturePendingGPUTransferSize; if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) { _gpuTextureMemSizeStabilityCount++; @@ -6584,8 +6585,10 @@ bool Application::gpuTextureMemSizeStable() { _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) { - return (textureResourceGPUMemSize == texturePopulatedGPUMemSize); + qDebug() << "GPU checking"; + return (textureResourceGPUMemSize == texturePopulatedGPUMemSize) && (textureTransferSize == 0); } + qDebug() << "GPU not ready"; return false; } diff --git a/interface/src/Application.h b/interface/src/Application.h index cb37e655fc..01c0f3770c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -587,7 +587,7 @@ private: QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeRendered; - int _minimumGPUTextureMemSizeStabilityCount { 15 }; + int _minimumGPUTextureMemSizeStabilityCount { 20 }; ShapeManager _shapeManager; PhysicalEntitySimulationPointer _entitySimulation; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 6b28d9c713..a4dc086ad8 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -83,8 +83,6 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) { } qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName(); } - } else { - qCDebug(interfaceapp) << "Safe Landing: Null Entity: " << entityID; } } @@ -109,12 +107,13 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { + qDebug() << "is sequence complete" << isSequenceNumbersComplete(); if (isEntityLoadingComplete() && isSequenceNumbersComplete()) { Locker lock(_lock); - _trackedEntities.clear(); _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; _entityTree = nullptr; + _trackingEntities = false; // Don't track anything else that comes in. EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority); } @@ -148,7 +147,6 @@ bool SafeLanding::isSequenceNumbersComplete() { (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { - _trackingEntities = false; // Don't track anything else that comes in. return true; } } @@ -187,10 +185,12 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; - bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); - if (enableInterstitial) { - isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); + auto entityRenderable = entityTree->renderableForEntityId(entityMapIter->first); + if (!entityRenderable) { + entityTree->addingEntity(entityMapIter->first); + } + isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } if (isEntityPhysicsReady(entity) && isVisuallyReady) { diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index dbbf8af4b9..6e82d26f29 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -310,10 +310,10 @@ void EntityTreeRenderer::addPendingEntities(const render::ScenePointer& scene, r } auto entityID = entity->getEntityItemID(); - processedIds.insert(entityID); auto renderable = EntityRenderer::addToScene(*this, entity, scene, transaction); if (renderable) { _entitiesInScene.insert({ entityID, renderable }); + processedIds.insert(entityID); } } diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp index 1a263fba79..f51a3f7740 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp @@ -104,6 +104,10 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi _networkTexture.reset(); }); } + + withWriteLock([&] { + entity->setVisuallyReady(true); + }); } else { bool textureNeedsUpdate = resultWithReadLock([&]{ return !_networkTexture || _networkTexture->getURL() != QUrl(_particleProperties.textures); @@ -113,6 +117,12 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi _networkTexture = DependencyManager::get()->getTexture(_particleProperties.textures); }); } + + if (_networkTexture) { + withWriteLock([&] { + entity->setVisuallyReady(_networkTexture->isFailed() || _networkTexture->isLoaded()); + }); + } } void* key = (void*)this; diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp index 238f41b05f..a0c12d8ee0 100644 --- a/libraries/entities/src/ParticleEffectEntityItem.cpp +++ b/libraries/entities/src/ParticleEffectEntityItem.cpp @@ -166,6 +166,7 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte { _type = EntityTypes::ParticleEffect; setColor(DEFAULT_COLOR); + _visuallyReady = false; } void ParticleEffectEntityItem::setAlpha(float alpha) { @@ -777,4 +778,4 @@ particle::Properties ParticleEffectEntityItem::getParticleProperties() const { } return result; -} \ No newline at end of file +} diff --git a/libraries/networking/src/DomainHandler.h b/libraries/networking/src/DomainHandler.h index 1ff88b425d..ddd23339df 100644 --- a/libraries/networking/src/DomainHandler.h +++ b/libraries/networking/src/DomainHandler.h @@ -231,7 +231,7 @@ private: QString _pendingPath; QTimer _settingsTimer; mutable ReadWriteLockable _interstitialModeSettingLock; - Setting::Handle _enableInterstitialMode{ "enableInterstitialMode", false }; + Setting::Handle _enableInterstitialMode{ "enableInterstitialMode", true }; QSet _domainConnectionRefusals; bool _hasCheckedForAccessToken { false }; diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 42341a8484..b8dcd22923 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -39,8 +39,8 @@ var DEFAULT_SCRIPTS_SEPARATE = [ ]; if (Window.interstitialModeEnabled) { - DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); - DEFAULT_SCRIPTS_SEPARATE.push("system/redirectOverlays.js"); + DEFAULT_SCRIPTS_COMBINED.push("system/interstitialPage.js"); + DEFAULT_SCRIPTS_COMBINED.push("system/redirectOverlays.js"); } // add a menu item for debugging diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index bd542b298d..00db9b1909 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -472,7 +472,7 @@ textureMemSizeAtLastCheck = textureResourceGPUMemSize; - if (textureMemSizeStabilityCount >= 15) { + if (textureMemSizeStabilityCount >= 20) { if (textureResourceGPUMemSize > 0) { print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); From 2a3b4a85c7cffbf39883d7bfce39d2a763d60628 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 15:57:05 -0700 Subject: [PATCH 2/3] debugging --- interface/src/octree/SafeLanding.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index a4dc086ad8..3077762a08 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -186,10 +186,13 @@ bool SafeLanding::isEntityLoadingComplete() { bool isVisuallyReady = true; if (enableInterstitial) { + bool hasRenderable = true; auto entityRenderable = entityTree->renderableForEntityId(entityMapIter->first); if (!entityRenderable) { + hasRenderable = false; entityTree->addingEntity(entityMapIter->first); } + qDebug() << EntityTypes::getEntityTypeName(entity->getType()) << entity->isVisuallyReady() << hasRenderable << entity->isParentPathComplete(); isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } @@ -204,6 +207,10 @@ bool SafeLanding::isEntityLoadingComplete() { } } + if (!_trackedEntities.empty()) { + qDebug() << "\n"; + } + if (enableInterstitial) { _trackedEntityStabilityCount++; } From 5d011bafb26b3e034e0f4228b1231136c9187264 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 4 Oct 2018 17:02:44 -0700 Subject: [PATCH 3/3] small tweaks --- interface/src/Application.h | 2 +- interface/src/octree/SafeLanding.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.h b/interface/src/Application.h index 1ceae9cd02..750d9ce987 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -583,7 +583,7 @@ private: QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeRendered; - int _minimumGPUTextureMemSizeStabilityCount { 20 }; + int _minimumGPUTextureMemSizeStabilityCount { 30 }; ShapeManager _shapeManager; PhysicalEntitySimulationPointer _entitySimulation; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index 3077762a08..d5eb4c23c2 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -147,6 +147,10 @@ bool SafeLanding::isSequenceNumbersComplete() { (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() && distance(startIter, endIter) == sequenceSize - 1)) { + bool enableInterstitial = DependencyManager::get()->getDomainHandler().getInterstitialModeEnabled(); + if (!enableInterstitial) { + _trackingEntities = false; // Don't track anything else that comes in. + } return true; } } @@ -193,7 +197,7 @@ bool SafeLanding::isEntityLoadingComplete() { entityTree->addingEntity(entityMapIter->first); } qDebug() << EntityTypes::getEntityTypeName(entity->getType()) << entity->isVisuallyReady() << hasRenderable << entity->isParentPathComplete(); - isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); + isVisuallyReady = entity->isVisuallyReady() || (!entityRenderable && !entity->isParentPathComplete()); } if (isEntityPhysicsReady(entity) && isVisuallyReady) {