ifdef out detailed profiling

This commit is contained in:
Andrew Meadows 2017-10-16 16:02:11 -07:00
parent fb1c075a12
commit 102a1cb36b

View file

@ -34,6 +34,9 @@
#include "EntityTreeRenderer.h" #include "EntityTreeRenderer.h"
#include "EntitiesRendererLogging.h" #include "EntitiesRendererLogging.h"
// uncomment WANT_DETAILED_PROFILING to profile the interesting contexts
//#define WANT_DETAILED_PROFILING
static CollisionRenderMeshCache collisionMeshCache; static CollisionRenderMeshCache collisionMeshCache;
void ModelEntityWrapper::setModel(const ModelPointer& model) { void ModelEntityWrapper::setModel(const ModelPointer& model) {
@ -107,7 +110,9 @@ QVariantMap parseTexturesToMap(QString textures, const QVariantMap& defaultTextu
} }
void RenderableModelEntityItem::doInitialModelSimulation() { void RenderableModelEntityItem::doInitialModelSimulation() {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_physics, __FUNCTION__); PROFILE_RANGE(simulation_physics, __FUNCTION__);
#endif
ModelPointer model = getModel(); ModelPointer model = getModel();
if (!model) { if (!model) {
return; return;
@ -139,7 +144,9 @@ void RenderableModelEntityItem::autoResizeJointArrays() {
} }
bool RenderableModelEntityItem::needsUpdateModelBounds() const { bool RenderableModelEntityItem::needsUpdateModelBounds() const {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_physics, __FUNCTION__); PROFILE_RANGE(simulation_physics, __FUNCTION__);
#endif
ModelPointer model = getModel(); ModelPointer model = getModel();
if (!hasModel() || !model) { if (!hasModel() || !model) {
return false; return false;
@ -184,7 +191,9 @@ bool RenderableModelEntityItem::needsUpdateModelBounds() const {
} }
void RenderableModelEntityItem::updateModelBounds() { void RenderableModelEntityItem::updateModelBounds() {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_physics, "updateModelBounds"); PROFILE_RANGE(simulation_physics, "updateModelBounds");
#endif
if (!_dimensionsInitialized || !hasModel()) { if (!_dimensionsInitialized || !hasModel()) {
return; return;
@ -1169,7 +1178,9 @@ bool ModelEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoin
} }
void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) { void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_physics, __FUNCTION__); PROFILE_RANGE(simulation_physics, __FUNCTION__);
#endif
if (_hasModel != entity->hasModel()) { if (_hasModel != entity->hasModel()) {
_hasModel = entity->hasModel(); _hasModel = entity->hasModel();
} }
@ -1259,7 +1270,9 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
// TODO? early exit here when not visible? // TODO? early exit here when not visible?
{ {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_physics, "Fixup"); PROFILE_RANGE(simulation_physics, "Fixup");
#endif
if (model->needsFixupInScene()) { if (model->needsFixupInScene()) {
model->removeFromScene(scene, transaction); model->removeFromScene(scene, transaction);
render::Item::Status::Getters statusGetters; render::Item::Status::Getters statusGetters;
@ -1275,7 +1288,9 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
} }
{ {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_physics, "CheckAnimation"); PROFILE_RANGE(simulation_physics, "CheckAnimation");
#endif
// make a copy of the animation properites // make a copy of the animation properites
auto newAnimationProperties = entity->getAnimationProperties(); auto newAnimationProperties = entity->getAnimationProperties();
if (newAnimationProperties != _renderAnimationProperties) { if (newAnimationProperties != _renderAnimationProperties) {
@ -1287,7 +1302,9 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
} }
if (_animating) { if (_animating) {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(simulation_physics, "Animate"); PROFILE_RANGE(simulation_physics, "Animate");
#endif
if (!jointsMapped()) { if (!jointsMapped()) {
mapJoints(entity, model->getJointNames()); mapJoints(entity, model->getJointNames());
} }
@ -1298,7 +1315,9 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
// NOTE: this only renders the "meta" portion of the Model, namely it renders debugging items // NOTE: this only renders the "meta" portion of the Model, namely it renders debugging items
void ModelEntityRenderer::doRender(RenderArgs* args) { void ModelEntityRenderer::doRender(RenderArgs* args) {
#ifdef WANT_DETAILED_PROFILING
PROFILE_RANGE(render_detail, "MetaModelRender"); PROFILE_RANGE(render_detail, "MetaModelRender");
#endif
PerformanceTimer perfTimer("RMEIrender"); PerformanceTimer perfTimer("RMEIrender");
ModelPointer model; ModelPointer model;