Skip to content

Commit

Permalink
Tracy zones2 Add further once-per-frame zones, colorize top-level zon…
Browse files Browse the repository at this point in the history
…es consistently (#1198)

* Tracy: Separate Sim::Projectiles::Update into synced and unsynced zones
* Correclty color top-level tracy zones, add some minor once-per-frame zones.
* Add Tracy Zones to Minimap drawing, and to ProjectileDrawer
  • Loading branch information
Beherith authored Dec 16, 2024
1 parent d7f4de7 commit 6d3e02f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rts/Game/GameHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void CGameHelper::Kill()

void CGameHelper::Update()
{
RECOIL_DETAILED_TRACY_ZONE;
ZoneScopedC(tracy::Color::Goldenrod);
const int wdIdx = gs->frameNum & (waitingDamages.size() - 1);

// need to use explicit indexing because CUnit::DoDamage
Expand Down
4 changes: 2 additions & 2 deletions rts/Game/UI/MiniMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ void CMiniMap::DrawMinimizedButtonLoop() const

void CMiniMap::DrawForReal(bool useNormalizedCoors, bool updateTex, bool luaCall)
{
ZoneScopedN("MiniMap::DrawForReal");
ZoneScopedNC("MiniMap::DrawForReal", tracy::Color::Goldenrod);
if (minimized)
return;

Expand Down Expand Up @@ -1915,7 +1915,7 @@ void CMiniMap::DrawUnitRanges() const

void CMiniMap::DrawWorldStuff() const
{
RECOIL_DETAILED_TRACY_ZONE;
ZoneScoped;
glPushMatrix();

if (flipped) {
Expand Down
10 changes: 8 additions & 2 deletions rts/Rendering/Env/Particles/ProjectileDrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,14 @@ void CProjectileDrawer::DrawProjectilesMiniMap()
glDisable(GL_PROGRAM_POINT_SIZE);

sh.Enable();
CProjectile::GetMiniMapLinesRB().DrawArrays(GL_LINES);
CProjectile::GetMiniMapPointsRB().DrawArrays(GL_POINTS);
{
ZoneScopedN("DrawProjectilesMiniMap::MiniMapLinesRB");
CProjectile::GetMiniMapLinesRB().DrawArrays(GL_LINES);
}
{
ZoneScopedN("DrawProjectilesMiniMap::MiniMapPointsRB");
CProjectile::GetMiniMapPointsRB().DrawArrays(GL_POINTS);
}
sh.Disable();

if (pntsz)
Expand Down
5 changes: 4 additions & 1 deletion rts/Sim/Projectiles/ProjectileHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ void CProjectileHandler::UpdateProjectilesImpl()

// WARNING: same as above but for p->Update()
if constexpr (synced) {

SCOPED_TIMER("Sim::Projectiles::UpdateSyncedST");
for (size_t i = 0; i < pc.size(); ++i) {
CProjectile* p = pc[i];
assert(p != nullptr);
Expand All @@ -204,6 +206,7 @@ void CProjectileHandler::UpdateProjectilesImpl()
}
}
else {
SCOPED_TIMER("Sim::Projectiles::UpdateUnsyncedMT");
for_mt_chunk(0, pc.size(), [&pc](int i) {
CProjectile* p = pc[i];
assert(p != nullptr);
Expand Down Expand Up @@ -338,7 +341,7 @@ void CProjectileHandler::Update()

// precache part of particles count calculation that else becomes very heavy
{
ZoneScopedN("ProjectileHandler::CountParticles");
ZoneScopedNC("ProjectileHandler::CountParticles", tracy::Color::Goldenrod);
frameCurrentParticles = 0;

for (const CProjectile* p : projectiles[true]) {
Expand Down
4 changes: 2 additions & 2 deletions rts/Sim/Units/UnitHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ bool CUnitHandler::QueueDeleteUnit(CUnit* unit)

void CUnitHandler::DeleteUnits()
{
RECOIL_DETAILED_TRACY_ZONE;
ZoneScopedC(tracy::Color::Goldenrod);
while (!unitsToBeRemoved.empty()) {
DeleteUnit(unitsToBeRemoved.back());
unitsToBeRemoved.pop_back();
Expand Down Expand Up @@ -343,7 +343,7 @@ void CUnitHandler::UpdateUnitMoveTypes()

void CUnitHandler::UpdateUnitLosStates()
{
ZoneScoped;
ZoneScopedC(tracy::Color::Goldenrod);
for (CUnit* unit: activeUnits) {
for (int at = 0; at < teamHandler.ActiveAllyTeams(); ++at) {
unit->UpdateLosStatus(at);
Expand Down

0 comments on commit 6d3e02f

Please sign in to comment.