Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"inherits": "win32",
"displayName": "Windows 32bit Profile",
"cacheVariables": {
"RTS_BUILD_OPTION_PROFILE": "ON"
"RTS_BUILD_OPTION_PROFILE": "ON",
"RTS_BUILD_OPTION_PROFILE_TRACY": "ON"
}
},
{
Expand Down Expand Up @@ -143,7 +144,8 @@
"inherits": "win32-vcpkg",
"displayName": "Windows 32bit VCPKG Profile",
"cacheVariables": {
"RTS_BUILD_OPTION_PROFILE": "ON"
"RTS_BUILD_OPTION_PROFILE": "ON",
"RTS_BUILD_OPTION_PROFILE_TRACY": "ON"
}
},
{
Expand Down Expand Up @@ -488,4 +490,4 @@
]
}
]
}
}
4 changes: 4 additions & 0 deletions Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ target_link_libraries(corei_always_no_pch INTERFACE
resources
)

if(RTS_BUILD_OPTION_PROFILE AND RTS_BUILD_OPTION_PROFILE_TRACY)
target_link_libraries(corei_libraries_include INTERFACE Tracy::TracyClient)
endif()

# Set where the build results will end up
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

Expand Down
2 changes: 2 additions & 0 deletions Core/GameEngine/Source/Common/FrameRateLimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "PreRTS.h"
#include "Common/FrameRateLimit.h"

#include "rts/profile.h"

FrameRateLimit::FrameRateLimit()
{
Expand All @@ -32,6 +33,7 @@ FrameRateLimit::FrameRateLimit()

Real FrameRateLimit::wait(UnsignedInt maxFps)
{
ZoneScopedN("FrameRateLimit::wait");
LARGE_INTEGER tick;
QueryPerformanceCounter(&tick);
double elapsedSeconds = static_cast<double>(tick.QuadPart - m_start) / m_freq;
Expand Down
7 changes: 7 additions & 0 deletions Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
are using timeGetTime, but we can remove that
when we have our own timer */

#include <rts/profile.h>


// 30 fps
Expand Down Expand Up @@ -1550,6 +1551,7 @@ void W3DView::drawView( void )
void W3DView::draw( void )
{
//USE_PERF_TIMER(W3DView_drawView)
ZoneScopedN("Render::DisplayDraw::W3DView");
Bool skipRender = false;
Bool doExtraRender = false;
CustomScenePassModes customScenePassMode = SCENE_PASS_DEFAULT;
Expand All @@ -1559,6 +1561,7 @@ void W3DView::draw( void )
m_viewFilter > FT_NULL_FILTER &&
m_viewFilter < FT_MAX)
{
ZoneScopedN("Render::DisplayDraw::FilterPre");
// Most likely will redirect rendering to a texture.
preRenderResult=W3DShaderManager::filterPreRender(m_viewFilter, skipRender, customScenePassMode);
if (!skipRender && getCameraLock())
Expand All @@ -1574,6 +1577,7 @@ void W3DView::draw( void )

if (!skipRender)
{
ZoneScopedN("Render::DisplayDraw::SceneRender");
// Render 3D scene from our camera
W3DDisplay::m_3DScene->setCustomPassMode(customScenePassMode);
if (m_isWireFrameEnabled)
Expand All @@ -1587,6 +1591,7 @@ void W3DView::draw( void )
m_viewFilter > FT_NULL_FILTER &&
m_viewFilter < FT_MAX)
{
ZoneScopedN("Render::DisplayDraw::FilterPost");
Coord2D deltaScroll;
calcDeltaScroll(deltaScroll);
Bool continueTheEffect = false;
Expand Down Expand Up @@ -1620,6 +1625,7 @@ void W3DView::draw( void )
//was turned off by filterPostRender().
if (doExtraRender)
{
ZoneScopedN("Render::DisplayDraw::ExtraRender");
//Reset to normal scene rendering.
//The pass that rendered into a texture may have left the z-buffer in a weird state
//so clear it before rendering normal scene.
Expand All @@ -1633,6 +1639,7 @@ void W3DView::draw( void )

if( TheGlobalData->m_debugAI )
{
ZoneScopedN("Render::DisplayDraw::DebugAI");
if (TheAI->pathfinder()->getDebugPath())
{
// setup screen clipping region
Expand Down
14 changes: 13 additions & 1 deletion Core/Libraries/Include/rts/profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
// Proxy header for profile module
//////////////////////////////////////////////////////////////////////////////

# pragma once
#pragma once

#ifdef TRACY_ENABLE
#include <tracy/Tracy.hpp>
#define TRACY_FRAMEIMAGE_SIZE 256
#else
#include "../../Source/profile/profile.h"
#define ZoneScopedN(name) ((void)0)
#define ZoneScopedNC(name, color) ((void)0)
#define TracyPlot(name, value) ((void)0)
#define FrameMark ((void)0)
#define FrameMarkNamed(name) ((void)0)
#define FrameImage(image, width, height, offset, flip) ((void)0)
#define TracyMessage(txt, size) ((void)0)
#endif
6 changes: 6 additions & 0 deletions GeneralsMD/Code/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,12 @@ target_link_libraries(z_gameengine PRIVATE
zi_always
)

if(RTS_BUILD_OPTION_PROFILE AND RTS_BUILD_OPTION_PROFILE_TRACY)
target_link_libraries(z_gameengine PRIVATE
Tracy::TracyClient
)
endif()

target_link_libraries(z_gameengine PUBLIC
corei_gameengine_public
z_wwvegas
Expand Down
4 changes: 4 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
//#include "GameLogic/ScriptEngine.h"
//#include "GameLogic/GameLogic.h"

#include <rts/profile.h>

/// The Display singleton instance.
Display *TheDisplay = nullptr;

Expand Down Expand Up @@ -110,6 +112,7 @@ void Display::attachView( View *view )
*/
void Display::drawViews( void )
{
ZoneScopedN("Render::W3DDisplay::DrawViews");

for( View *v = m_viewList; v; v = v->getNextView() )
v->drawView();
Expand All @@ -122,6 +125,7 @@ void Display::drawViews( void )
*/
void Display::updateViews( void )
{
ZoneScopedN("Render::W3DDisplay::UpdateViews");

for( View *v = m_viewList; v; v = v->getNextView() )
v->updateView();
Expand Down
13 changes: 13 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
#include "GameLogic/Object.h"
#include "GameLogic/ScriptEngine.h" // For TheScriptEngine - jkmcd

#include <rts/profile.h>

#define DRAWABLE_HASH_SIZE 8192

/// The GameClient singleton instance
Expand Down Expand Up @@ -510,6 +512,7 @@ DECLARE_PERF_TIMER(GameClient_draw)
void GameClient::update( void )
{
USE_PERF_TIMER(GameClient_update)
FrameMark;
// create the FRAME_TICK message
GameMessage *frameMsg = TheMessageStream->appendMessage( GameMessage::MSG_FRAME_TICK );
frameMsg->appendTimestampArgument( getFrame() );
Expand Down Expand Up @@ -617,21 +620,26 @@ void GameClient::update( void )
TheInGameUI->setCameraTrackingDrawable( FALSE );
}

ZoneScopedNC("Render", 0x2196F3);

if(TheGlobalData->m_playIntro || TheGlobalData->m_afterIntro)
{
// redraw all views, update the GUI
ZoneScopedN("Render::IntroDisplay");
TheDisplay->DRAW();
TheDisplay->UPDATE();
return;
}

// update the window system itself
{
ZoneScopedN("Render::WindowManager");
TheWindowManager->UPDATE();
}

// update the video player
{
ZoneScopedN("Render::VideoPlayer");
TheVideoPlayer->UPDATE();
}

Expand Down Expand Up @@ -742,11 +750,13 @@ void GameClient::update( void )

// update the terrain visuals
{
ZoneScopedN("Render::TerrainVisual");
TheTerrainVisual->UPDATE();
}

// update display
{
ZoneScopedN("Render::DisplayUpdate");
TheDisplay->UPDATE();
}

Expand All @@ -761,16 +771,19 @@ void GameClient::update( void )

{
// let display string factory handle its update
ZoneScopedN("Render::DisplayStrings");
TheDisplayStringManager->update();
}

{
// update the shell
ZoneScopedN("Render::Shell");
TheShell->UPDATE();
}

{
// update the in game UI
ZoneScopedN("Render::InGameUI");
TheInGameUI->UPDATE();
}
}
Expand Down
14 changes: 9 additions & 5 deletions GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

#include "Common/UnitTimings.h" //Contains the DO_UNIT_TIMINGS define jba.

#include <rts/profile.h>

#define no_INTENSE_DEBUG

#define DEBUG_QPF
Expand Down Expand Up @@ -5754,6 +5756,7 @@ Path *Pathfinder::getAircraftPath( const Object *obj, const Coord3D *to )
void Pathfinder::processPathfindQueue(void)
{
//USE_PERF_TIMER(processPathfindQueue)
ZoneScopedN("Pathfinder::processPathfindQueue");
if (!m_isMapReady) {
return;
}
Expand All @@ -5775,6 +5778,7 @@ void Pathfinder::processPathfindQueue(void)
#endif
m_zoneManager.needToCalculateZones())
{
ZoneScopedN("Pathfinder::calculateZones");
m_zoneManager.calculateZones(m_map, m_layers, m_extent);
return;
}
Expand All @@ -5792,9 +5796,7 @@ void Pathfinder::processPathfindQueue(void)
m_logicalExtent = bounds;

m_cumulativeCellsAllocated = 0; // Number of pathfind cells examined.
#ifdef DEBUG_QPF
Int pathsFound = 0;
#endif
while (m_cumulativeCellsAllocated < PATHFIND_CELLS_PER_FRAME &&
m_queuePRTail!=m_queuePRHead) {
Object *obj = TheGameLogic->findObjectByID(m_queuedPathfindRequests[m_queuePRHead]);
Expand All @@ -5803,18 +5805,20 @@ void Pathfinder::processPathfindQueue(void)
AIUpdateInterface *ai = obj->getAIUpdateInterface();
if (ai) {
ai->doPathfind(this);
#ifdef DEBUG_QPF
pathsFound++;
#endif
}
}
m_queuePRHead = m_queuePRHead+1;
if (m_queuePRHead >= PATHFIND_QUEUE_LEN) {
m_queuePRHead = 0;
}
}
if (pathsFound>0) {
if (pathsFound > 0) {
TracyPlot("PathfindCells", (double)m_cumulativeCellsAllocated);
TracyPlot("PathfindPaths", (double)pathsFound);
}
#ifdef DEBUG_QPF
if (pathsFound>0) {
#ifdef DEBUG_LOGGING
QueryPerformanceCounter((LARGE_INTEGER *)&endTime64);
timeToUpdate = ((double)(endTime64-startTime64) / (double)(freq64));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
#include "GameLogic/Weapon.h"
#include "Common/Radar.h" // For TheRadar

#include <rts/profile.h>

#define SLEEPY_AI


Expand Down Expand Up @@ -395,6 +397,7 @@ except by the pathfinder during pathfind queue processing. jba */
//-------------------------------------------------------------------------------------------------
void AIUpdateInterface::doPathfind( PathfindServicesInterface *pathfinder )
{
ZoneScopedN("AIUpdateInterface::doPathfind");
if (!m_waitingForPath) {
return;
}
Expand Down Expand Up @@ -1667,6 +1670,7 @@ Bool AIUpdateInterface::computeQuickPath( const Coord3D *destination )
*/
Bool AIUpdateInterface::computePath( PathfindServicesInterface *pathServices, Coord3D *destination )
{
ZoneScopedN("AIUpdateInterface::computePath");

if (!m_isBlockedAndStuck) {
destroyPath();
Expand Down Expand Up @@ -1781,6 +1785,7 @@ Bool AIUpdateInterface::computePath( PathfindServicesInterface *pathServices, Co
*/
Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServices, const Object *victim, const Coord3D* victimPos )
{
ZoneScopedN("AIUpdateInterface::computeAttackPath");
//CRCDEBUG_LOG(("AIUpdateInterface::computeAttackPath() for object %d", getObject()->getID()));
// See if it has been too soon.
if (m_pathTimestamp >= TheGameLogic->getFrame()-2)
Expand Down
Loading
Loading