ifdef out more per-frame-per-entity profiling

This commit is contained in:
Andrew Meadows 2017-10-16 17:27:53 -07:00
parent 1f09c10fb1
commit 339edc67c8
3 changed files with 28 additions and 3 deletions

View file

@ -32,6 +32,9 @@
#include "AnimUtil.h"
#include "IKTarget.h"
// uncomment WANT_DETAILED_PROFILING for profiling that would otherwise impact performance
//#define WANT_DETAILED_PROFILING
static int nextRigId = 1;
static std::map<int, Rig*> rigRegistry;
static std::mutex rigRegistryMutex;
@ -999,14 +1002,17 @@ void Rig::updateAnimationStateHandlers() { // called on avatar update thread (wh
}
void Rig::updateAnimations(float deltaTime, const glm::mat4& rootTransform, const glm::mat4& rigToWorldTransform) {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE_EX(simulation_animation_detail, __FUNCTION__, 0xffff00ff, 0);
PerformanceTimer perfTimer("updateAnimations");
#endif
setModelOffset(rootTransform);
if (_animNode && _enabledAnimations) {
#ifdef WANT_DETAILED_PROFILING
PerformanceTimer perfTimer("handleTriggers");
#endif
updateAnimationStateHandlers();
_animVars.setRigToGeometryTransform(_rigToGeometryTransform);
@ -1658,7 +1664,9 @@ bool Rig::getModelRegistrationPoint(glm::vec3& modelRegistrationPointOut) const
}
void Rig::applyOverridePoses() {
#ifdef WANT_DETAILED_PROFILING
PerformanceTimer perfTimer("override");
#endif
if (_numOverrides == 0 || !_animSkeleton) {
return;
}
@ -1675,7 +1683,9 @@ void Rig::applyOverridePoses() {
}
void Rig::buildAbsoluteRigPoses(const AnimPoseVec& relativePoses, AnimPoseVec& absolutePosesOut) {
#ifdef WANT_DETAILED_PROFILING
PerformanceTimer perfTimer("buildAbsolute");
#endif
if (!_animSkeleton) {
return;
}
@ -1730,8 +1740,10 @@ void Rig::copyJointsIntoJointData(QVector<JointData>& jointDataVec) const {
}
void Rig::copyJointsFromJointData(const QVector<JointData>& jointDataVec) {
PerformanceTimer perfTimer("copyJoints");
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_animation_detail, "copyJoints");
PerformanceTimer perfTimer("copyJoints");
#endif
if (!_animSkeleton) {
return;
}

View file

@ -352,7 +352,9 @@ bool RenderableModelEntityItem::isReadyToComputeShape() const {
// we have both URLs AND both geometries AND they are both fully loaded.
if (_needsInitialSimulation) {
// the _model's offset will be wrong until _needsInitialSimulation is false
#ifdef WANT_DETAILED_PROFILING
PerformanceTimer perfTimer("_model->simulate");
#endif
const_cast<RenderableModelEntityItem*>(this)->doInitialModelSimulation();
}
return true;
@ -898,7 +900,9 @@ void RenderableModelEntityItem::setJointTranslationsSet(const QVector<bool>& tra
}
void RenderableModelEntityItem::locationChanged(bool tellPhysics) {
#ifdef WANT_DETAILED_PROFILING
PerformanceTimer pertTimer("locationChanged");
#endif
EntityItem::locationChanged(tellPhysics);
auto model = getModel();
if (model && model->isLoaded()) {
@ -1317,8 +1321,8 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
void ModelEntityRenderer::doRender(RenderArgs* args) {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(render_detail, "MetaModelRender");
#endif
PerformanceTimer perfTimer("RMEIrender");
#endif
ModelPointer model;
withReadLock([&]{

View file

@ -32,6 +32,9 @@
#include "RenderUtilsLogging.h"
#include <Trace.h>
// uncomment WANT_DETAILED_PROFILING to enable profiling that causes measureable performance impact
//#define WANT_DETAILED_PROFILING
using namespace std;
int nakedModelPointerTypeId = qRegisterMetaType<ModelPointer>();
@ -963,7 +966,9 @@ Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointe
}
void Blender::run() {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE_EX(simulation_animation, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } });
#endif
QVector<glm::vec3> vertices, normals;
if (_model) {
int offset = 0;
@ -1084,8 +1089,10 @@ void Model::snapToRegistrationPoint() {
}
void Model::simulate(float deltaTime, bool fullUpdate) {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_detail, __FUNCTION__);
PerformanceTimer perfTimer("Model::simulate");
#endif
fullUpdate = updateGeometry() || fullUpdate || (_scaleToFit && !_scaledToFit)
|| (_snapModelToRegistrationPoint && !_snappedToRegistrationPoint);
@ -1123,7 +1130,9 @@ void Model::computeMeshPartLocalBounds() {
// virtual
void Model::updateClusterMatrices() {
#ifdef WANT_DETAILED_PROFILING
PerformanceTimer perfTimer("Model::updateClusterMatrices");
#endif
if (!_needsUpdateClusterMatrices || !isLoaded()) {
return;