From 08bba5f45f221ea9d0ec3cce11a8d8526abfd08b Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 19 Jan 2017 17:31:29 -0800 Subject: [PATCH] add and remove some profile data points --- interface/src/avatar/Avatar.cpp | 44 ++++++++++++++-------------- libraries/animation/src/Rig.cpp | 1 + libraries/render-utils/src/Model.cpp | 2 -- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 6061812d2a..a3eaeab46a 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -308,6 +308,7 @@ void Avatar::setShouldDie() { } void Avatar::simulate(float deltaTime) { + PROFILE_RANGE(simulation, "simulate"); PerformanceTimer perfTimer("simulate"); if (!isDead() && !_motionState) { @@ -317,8 +318,8 @@ void Avatar::simulate(float deltaTime) { bool avatarInView = false; { // update the shouldAnimate flag to match whether or not we will render the avatar. - PerformanceTimer perfTimer("cull"); { + PROFILE_RANGE(simulation, "cull"); // simple frustum check PerformanceTimer perfTimer("inView"); ViewFrustum viewFrustum; @@ -326,7 +327,7 @@ void Avatar::simulate(float deltaTime) { avatarInView = viewFrustum.sphereIntersectsFrustum(getPosition(), getBoundingRadius()) || viewFrustum.boxIntersectsFrustum(_skeletonModel->getRenderableMeshBound()); } - PerformanceTimer lodPerfTimer("LOD"); + PROFILE_RANGE(simulation, "LOD"); if (avatarInView) { const float MINIMUM_VISIBILITY_FOR_ON = 0.4f; const float MAXIMUM_VISIBILITY_FOR_OFF = 0.6f; @@ -346,19 +347,17 @@ void Avatar::simulate(float deltaTime) { } } - uint64_t start = usecTimestampNow(); - // CRUFT? _shouldSkipRender is never set 'true' - if (_shouldAnimate && avatarInView && !_shouldSkipRender) { - { - PerformanceTimer perfTimer("skeleton"); + { + PROFILE_RANGE(simulation, "updateJoints"); + uint64_t start = usecTimestampNow(); + // CRUFT? _shouldSkipRender is never set 'true' + if (_shouldAnimate && avatarInView && !_shouldSkipRender) { _skeletonModel->getRig()->copyJointsFromJointData(_jointData); _skeletonModel->simulate(deltaTime, _hasNewJointRotations || _hasNewJointTranslations); locationChanged(); // joints changed, so if there are any children, update them. _hasNewJointRotations = false; _hasNewJointTranslations = false; - } - { - PerformanceTimer perfTimer("head"); + glm::vec3 headPosition = getPosition(); if (!_skeletonModel->getHeadPosition(headPosition)) { headPosition = getPosition(); @@ -367,15 +366,14 @@ void Avatar::simulate(float deltaTime) { head->setPosition(headPosition); head->setScale(getUniformScale()); head->simulate(deltaTime, false, !_shouldAnimate); + } else { + // a non-full update is still required so that the position, rotation, scale and bounds of the skeletonModel are updated. + getHead()->setPosition(getPosition()); + _skeletonModel->simulate(deltaTime, false); } - } else { - // a non-full update is still required so that the position, rotation, scale and bounds of the skeletonModel are updated. - getHead()->setPosition(getPosition()); - PerformanceTimer perfTimer("skeleton"); - _skeletonModel->simulate(deltaTime, false); + timeProcessingJoints += usecTimestampNow() - start; + numJointsProcessed += _jointData.size(); } - timeProcessingJoints += usecTimestampNow() - start; - numJointsProcessed += _jointData.size(); // update animation for display name fade in/out if ( _displayNameTargetAlpha != _displayNameAlpha) { @@ -394,11 +392,13 @@ void Avatar::simulate(float deltaTime) { _displayNameAlpha = abs(_displayNameAlpha - _displayNameTargetAlpha) < 0.01f ? _displayNameTargetAlpha : _displayNameAlpha; } - measureMotionDerivatives(deltaTime); - - simulateAttachments(deltaTime); - updatePalms(); - updateAvatarEntities(); + { + PROFILE_RANGE(simulation, "misc"); + measureMotionDerivatives(deltaTime); + simulateAttachments(deltaTime); + updatePalms(); + updateAvatarEntities(); + } } bool Avatar::isLookingAtMe(AvatarSharedPointer avatar) const { diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index fdeeb01739..ac16b16c1d 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1269,6 +1269,7 @@ void Rig::copyJointsIntoJointData(QVector& jointDataVec) const { void Rig::copyJointsFromJointData(const QVector& jointDataVec) { PerformanceTimer perfTimer("copyJoints"); + PROFILE_RANGE(simulation_animation_detail, "copyJoints"); if (_animSkeleton && jointDataVec.size() == (int)_internalPoseSet._relativePoses.size()) { // make a vector of rotations in absolute-geometry-frame const AnimPoseVec& absoluteDefaultPoses = _animSkeleton->getAbsoluteDefaultPoses(); diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index b79e69a9b7..d3fddc96d9 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -272,8 +272,6 @@ void Model::reset() { } bool Model::updateGeometry() { - PROFILE_RANGE(render_detail, __FUNCTION__); - PerformanceTimer perfTimer("Model::updateGeometry"); bool needFullUpdate = false; if (!isLoaded()) {