Merge pull request #7 from danteruiz/interstitialMerged

Interstitial merged
This commit is contained in:
Wayne Chen 2018-10-04 17:10:27 -07:00 committed by GitHub
commit 89e2cf7153
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 13 deletions

View file

@ -6597,6 +6597,7 @@ bool Application::gpuTextureMemSizeStable() {
qint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize; qint64 textureResourceGPUMemSize = renderStats->textureResourceGPUMemSize;
qint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize; qint64 texturePopulatedGPUMemSize = renderStats->textureResourcePopulatedGPUMemSize;
qint64 textureTransferSize = renderStats->texturePendingGPUTransferSize;
if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) { if (_gpuTextureMemSizeAtLastCheck == textureResourceGPUMemSize) {
_gpuTextureMemSizeStabilityCount++; _gpuTextureMemSizeStabilityCount++;
@ -6606,8 +6607,10 @@ bool Application::gpuTextureMemSizeStable() {
_gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize; _gpuTextureMemSizeAtLastCheck = textureResourceGPUMemSize;
if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) { if (_gpuTextureMemSizeStabilityCount >= _minimumGPUTextureMemSizeStabilityCount) {
return (textureResourceGPUMemSize == texturePopulatedGPUMemSize); qDebug() << "GPU checking";
return (textureResourceGPUMemSize == texturePopulatedGPUMemSize) && (textureTransferSize == 0);
} }
qDebug() << "GPU not ready";
return false; return false;
} }

View file

@ -583,7 +583,7 @@ private:
QElapsedTimer _lastTimeUpdated; QElapsedTimer _lastTimeUpdated;
QElapsedTimer _lastTimeRendered; QElapsedTimer _lastTimeRendered;
int _minimumGPUTextureMemSizeStabilityCount { 15 }; int _minimumGPUTextureMemSizeStabilityCount { 30 };
ShapeManager _shapeManager; ShapeManager _shapeManager;
PhysicalEntitySimulationPointer _entitySimulation; PhysicalEntitySimulationPointer _entitySimulation;

View file

@ -83,8 +83,6 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) {
} }
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName(); 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() { bool SafeLanding::isLoadSequenceComplete() {
qDebug() << "is sequence complete" << isSequenceNumbersComplete();
if (isEntityLoadingComplete() && isSequenceNumbersComplete()) { if (isEntityLoadingComplete() && isSequenceNumbersComplete()) {
Locker lock(_lock); Locker lock(_lock);
_trackedEntities.clear();
_initialStart = INVALID_SEQUENCE; _initialStart = INVALID_SEQUENCE;
_initialEnd = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE;
_entityTree = nullptr; _entityTree = nullptr;
_trackingEntities = false; // Don't track anything else that comes in.
EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority); EntityTreeRenderer::setEntityLoadingPriorityFunction(StandardPriority);
} }
@ -148,7 +147,10 @@ bool SafeLanding::isSequenceNumbersComplete() {
(startIter != _sequenceNumbers.end() (startIter != _sequenceNumbers.end()
&& endIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end()
&& distance(startIter, endIter) == sequenceSize - 1)) { && distance(startIter, endIter) == sequenceSize - 1)) {
_trackingEntities = false; // Don't track anything else that comes in. bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
if (!enableInterstitial) {
_trackingEntities = false; // Don't track anything else that comes in.
}
return true; return true;
} }
} }
@ -188,7 +190,14 @@ bool SafeLanding::isEntityLoadingComplete() {
bool isVisuallyReady = true; bool isVisuallyReady = true;
if (enableInterstitial) { if (enableInterstitial) {
isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first)); 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());
} }
if (isEntityPhysicsReady(entity) && isVisuallyReady) { if (isEntityPhysicsReady(entity) && isVisuallyReady) {
@ -202,6 +211,10 @@ bool SafeLanding::isEntityLoadingComplete() {
} }
} }
if (!_trackedEntities.empty()) {
qDebug() << "\n";
}
if (enableInterstitial) { if (enableInterstitial) {
_trackedEntityStabilityCount++; _trackedEntityStabilityCount++;
} }

View file

@ -310,10 +310,10 @@ void EntityTreeRenderer::addPendingEntities(const render::ScenePointer& scene, r
} }
auto entityID = entity->getEntityItemID(); auto entityID = entity->getEntityItemID();
processedIds.insert(entityID);
auto renderable = EntityRenderer::addToScene(*this, entity, scene, transaction); auto renderable = EntityRenderer::addToScene(*this, entity, scene, transaction);
if (renderable) { if (renderable) {
_entitiesInScene.insert({ entityID, renderable }); _entitiesInScene.insert({ entityID, renderable });
processedIds.insert(entityID);
} }
} }

View file

@ -104,6 +104,10 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi
_networkTexture.reset(); _networkTexture.reset();
}); });
} }
withWriteLock([&] {
entity->setVisuallyReady(true);
});
} else { } else {
bool textureNeedsUpdate = resultWithReadLock<bool>([&]{ bool textureNeedsUpdate = resultWithReadLock<bool>([&]{
return !_networkTexture || _networkTexture->getURL() != QUrl(_particleProperties.textures); return !_networkTexture || _networkTexture->getURL() != QUrl(_particleProperties.textures);
@ -113,6 +117,12 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi
_networkTexture = DependencyManager::get<TextureCache>()->getTexture(_particleProperties.textures); _networkTexture = DependencyManager::get<TextureCache>()->getTexture(_particleProperties.textures);
}); });
} }
if (_networkTexture) {
withWriteLock([&] {
entity->setVisuallyReady(_networkTexture->isFailed() || _networkTexture->isLoaded());
});
}
} }
void* key = (void*)this; void* key = (void*)this;

View file

@ -166,6 +166,7 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
{ {
_type = EntityTypes::ParticleEffect; _type = EntityTypes::ParticleEffect;
setColor(DEFAULT_COLOR); setColor(DEFAULT_COLOR);
_visuallyReady = false;
} }
void ParticleEffectEntityItem::setAlpha(float alpha) { void ParticleEffectEntityItem::setAlpha(float alpha) {
@ -777,4 +778,4 @@ particle::Properties ParticleEffectEntityItem::getParticleProperties() const {
} }
return result; return result;
} }

View file

@ -231,7 +231,7 @@ private:
QString _pendingPath; QString _pendingPath;
QTimer _settingsTimer; QTimer _settingsTimer;
mutable ReadWriteLockable _interstitialModeSettingLock; mutable ReadWriteLockable _interstitialModeSettingLock;
Setting::Handle<bool> _enableInterstitialMode{ "enableInterstitialMode", false }; Setting::Handle<bool> _enableInterstitialMode{ "enableInterstitialMode", true };
QSet<QString> _domainConnectionRefusals; QSet<QString> _domainConnectionRefusals;
bool _hasCheckedForAccessToken { false }; bool _hasCheckedForAccessToken { false };

View file

@ -40,8 +40,8 @@ var DEFAULT_SCRIPTS_SEPARATE = [
]; ];
if (Window.interstitialModeEnabled) { if (Window.interstitialModeEnabled) {
DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js"); DEFAULT_SCRIPTS_COMBINED.push("system/interstitialPage.js");
DEFAULT_SCRIPTS_SEPARATE.push("system/redirectOverlays.js"); DEFAULT_SCRIPTS_COMBINED.push("system/redirectOverlays.js");
} }
// add a menu item for debugging // add a menu item for debugging

View file

@ -472,7 +472,7 @@
textureMemSizeAtLastCheck = textureResourceGPUMemSize; textureMemSizeAtLastCheck = textureResourceGPUMemSize;
if (textureMemSizeStabilityCount >= 15) { if (textureMemSizeStabilityCount >= 20) {
if (textureResourceGPUMemSize > 0) { if (textureResourceGPUMemSize > 0) {
// print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); // print((texturePopulatedGPUMemSize / textureResourceGPUMemSize));