From 7fe2856516d9e0de0fda6ff389ad3cc977b2d309 Mon Sep 17 00:00:00 2001
From: Runitai Linden <davep@lindenlab.com>
Date: Mon, 13 Sep 2021 12:41:57 -0500
Subject: SL-15975 Add Tracy-only profile macros that are no-ops when Tracy is
 disabled.

---
 indra/llcommon/llprofiler.h        | 6 ++++++
 indra/newview/lldrawpoolavatar.cpp | 4 ++++
 2 files changed, 10 insertions(+)

(limited to 'indra')

diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h
index 062c9360dd..62e649913b 100644
--- a/indra/llcommon/llprofiler.h
+++ b/indra/llcommon/llprofiler.h
@@ -51,16 +51,22 @@
         #define LL_PROFILER_FRAME_END               FrameMark
         #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name )
         #define LL_RECORD_BLOCK_TIME(name)          ZoneNamedN( ___tracy_scoped_zone, #name, true );
+        #define LL_PROFILE_ZONE_NAMED(name)          ZoneNamedN( ___tracy_scoped_zone, name, true );  
+        #define LL_PROFILE_ZONE_SCOPED              ZoneScoped
     #endif
     #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER
         #define LL_PROFILER_FRAME_END
         #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name)
         #define LL_RECORD_BLOCK_TIME(name)                                                                  const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__);
+        #define LL_PROFILE_ZONE_NAMED(name) // LL_PROFILE_ZONE_NAMED is a no-op when Tracy is disabled
+        #define LL_PROFILE_ZONE_SCOPED      // LL_PROFILE_ZONE_SCOPED is a no-op when Tracy is disabled
     #endif
     #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER
         #define LL_PROFILER_FRAME_END               FrameMark
         #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name )
         #define LL_RECORD_BLOCK_TIME(name)          ZoneNamedN( ___tracy_scoped_zone, #timer_stat, true )   const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__);
+        #define LL_PROFILE_ZONE_NAMED(name)         ZoneNamedN( ___tracy_scoped_zone, #name, true );
+        #define LL_PROFILE_ZONE_SCOPED              ZoneScoped
     #endif
 #else
     #define LL_PROFILER_FRAME_END
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 687b13d2c8..c04142ab47 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -1840,6 +1840,8 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(
     LLVolume* volume,
     LLVolumeFace& vol_face)
 {
+    LL_PROFILE_ZONE_SCOPED;
+
 	LLVector4a* weights = vol_face.mWeights;
 	if (!weights)
 	{
@@ -2352,8 +2354,10 @@ void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)
 	//update rigged vertex buffers
 	for (U32 type = 0; type < NUM_RIGGED_PASSES; ++type)
 	{
+        LL_PROFILE_ZONE_NAMED("Pass");
 		for (U32 i = 0; i < mRiggedFace[type].size(); ++i)
 		{
+            LL_PROFILE_ZONE_NAMED("Face");
 			LLFace* face = mRiggedFace[type][i];
 			LLDrawable* drawable = face->getDrawable();
 			if (!drawable)
-- 
cgit v1.2.3