diff --git a/CMakeLists.txt b/CMakeLists.txt index 66c86bb5f4..dd848c776f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ set(GAME_INCLUDE_DIRS extern) set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd - aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json) + aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient) if (DUSK_MOVIE_SUPPORT_REAL) if (TARGET libjpeg-turbo::turbojpeg-static) diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index fc60c5d107..78ab356500 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -17,6 +17,8 @@ #include "m_Do/m_Do_graphic.h" #include +#include "tracy/Tracy.hpp" + enum dComIfG_ButtonStatus { /* 0x00 */ BUTTON_STATUS_NONE, /* 0x01 */ BUTTON_STATUS_LET_GO, @@ -3109,114 +3111,133 @@ inline void dComIfGp_particle_calcMenu() { } inline void dComIfGp_particle_draw(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawNormal(i_drawInfo); } } inline void dComIfGp_particle_drawFog(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawNormalFog(i_drawInfo); } } inline void dComIfGp_particle_drawP1(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawNormalP1(i_drawInfo); } } inline void dComIfGp_particle_drawProjection(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawProjection(i_drawInfo); } } inline void dComIfGp_particle_drawNormalPri0_A(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawNormalPri0_A(i_drawInfo); } } inline void dComIfGp_particle_drawNormalPri0_B(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawNormalPri0_B(i_drawInfo); } } inline void dComIfGp_particle_drawFogPri0_A(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawFogPri0_A(i_drawInfo); } } inline void dComIfGp_particle_drawFogPri0_B(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawFogPri0_B(i_drawInfo); } } inline void dComIfGp_particle_drawFogPri1(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawFogPri1(i_drawInfo); } } inline void dComIfGp_particle_drawFogPri2(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawFogPri2(i_drawInfo); } } inline void dComIfGp_particle_drawFogPri3(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawFogPri3(i_drawInfo); } } inline void dComIfGp_particle_drawFogPri4(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawFogPri4(i_drawInfo); } } inline void dComIfGp_particle_drawDarkworld(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawDarkworld(i_drawInfo); } } inline void dComIfGp_particle_drawScreen(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->drawFogScreen(i_drawInfo); } } inline void dComIfGp_particle_draw2Dgame(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->draw2Dgame(i_drawInfo); } } inline void dComIfGp_particle_draw2Dfore(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->draw2Dfore(i_drawInfo); } } inline void dComIfGp_particle_draw2Dback(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->draw2Dback(i_drawInfo); } } inline void dComIfGp_particle_draw2DmenuFore(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->draw2DmenuFore(i_drawInfo); } } inline void dComIfGp_particle_draw2DmenuBack(JPADrawInfo* i_drawInfo) { + ZoneScoped; if (g_dComIfG_gameInfo.play.getParticle() != NULL) { g_dComIfG_gameInfo.play.getParticle()->draw2DmenuBack(i_drawInfo); } @@ -4736,114 +4757,142 @@ inline void dComIfGd_setViewport(view_port_class* port) { } inline void dComIfGd_entryZSortListZxlu(J3DPacket* i_packet, cXyz& param_1) { + ZoneScoped; g_dComIfG_gameInfo.drawlist.entryZSortListZxlu(i_packet, param_1); } inline void dComIfGd_entryZSortXluList(J3DPacket* i_packet, cXyz& param_1) { + ZoneScoped; g_dComIfG_gameInfo.drawlist.entryZSortXluList(i_packet, param_1); } inline void dComIfGd_drawCopy2D() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawCopy2D(); } inline void dComIfGd_drawOpaListSky() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListSky(); } inline void dComIfGd_drawXluListSky() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluListSky(); } inline void dComIfGd_drawOpaListBG() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListBG(); } inline void dComIfGd_drawOpaListDarkBG() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListDarkBG(); } inline void dComIfGd_drawOpaListMiddle() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListMiddle(); } inline void dComIfGd_drawOpaList() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaList(); } inline void dComIfGd_drawOpaListDark() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListDark(); } inline void dComIfGd_drawOpaListPacket() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListPacket(); } inline void dComIfGd_drawXluListBG() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluListBG(); } inline void dComIfGd_drawXluListDarkBG() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluListDarkBG(); } inline void dComIfGd_drawXluList() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluList(); } inline void dComIfGd_drawXluListDark() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluListDark(); } inline void dComIfGd_drawXluListInvisible() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluListInvisible(); } inline void dComIfGd_drawOpaListInvisible() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListInvisible(); } inline void dComIfGd_drawXluListZxlu() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluListZxlu(); } inline void dComIfGd_drawXluList2DScreen() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluList2DScreen(); } inline void dComIfGd_drawOpaList3Dlast() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaList3Dlast(); } inline void dComIfGd_draw2DOpa() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.draw2DOpa(); } inline void dComIfGd_draw2DOpaTop() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.draw2DOpaTop(); } inline void dComIfGd_draw2DXlu() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.draw2DXlu(); } inline void dComIfGd_drawOpaListFilter() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListFilter(); } inline void dComIfGd_drawIndScreen() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawOpaListP0(); } inline void dComIfGd_drawListZxlu() { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawXluListZxlu(); } inline void dComIfGd_drawShadow(Mtx param_0) { + ZoneScoped; g_dComIfG_gameInfo.drawlist.drawShadow(param_0); } inline void dComIfGd_imageDrawShadow(Mtx param_0) { + ZoneScoped; g_dComIfG_gameInfo.drawlist.imageDrawShadow(param_0); } diff --git a/libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp b/libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp index b18a53b8c1..c533face96 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp @@ -8,6 +8,7 @@ #include "JSystem/J3DGraphBase/J3DDrawBuffer.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" #include "JSystem/JKernel/JKRHeap.h" +#include "tracy/Tracy.hpp" void J3DDrawBuffer::calcZRatio() { mZRatio = (mZFar - mZNear) / (f32)mEntryTableSize; @@ -224,6 +225,7 @@ void J3DDrawBuffer::draw() const { } void J3DDrawBuffer::drawHead() const { + ZoneScoped; u32 size = mEntryTableSize; J3DPacket** buf = mpBuffer; @@ -235,6 +237,7 @@ void J3DDrawBuffer::drawHead() const { } void J3DDrawBuffer::drawTail() const { + ZoneScoped; for (int i = mEntryTableSize - 1; i >= 0; i--) { for (J3DPacket* packet = mpBuffer[i]; packet != NULL; packet = packet->getNextPacket()) { packet->draw(); diff --git a/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp b/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp index a702ff5523..bf2348020a 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp @@ -1,14 +1,15 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/J3DGraphBase/J3DPacket.h" +#include +#include #include "JSystem/J3DGraphAnimator/J3DModel.h" #include "JSystem/J3DGraphBase/J3DDrawBuffer.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "JSystem/J3DGraphBase/J3DPacket.h" #include "JSystem/J3DGraphBase/J3DShapeMtx.h" #include "JSystem/JKernel/JKRHeap.h" -#include -#include #include "global.h" +#include "tracy/Tracy.hpp" J3DError J3DDisplayListObj::newDisplayList(u32 maxSize) { mMaxSize = ALIGN_NEXT(maxSize, 0x20); @@ -207,12 +208,13 @@ bool J3DMatPacket::isSame(J3DMatPacket* pOther) const { } void J3DMatPacket::draw() { + ZoneScoped; #if TARGET_PC j3dSys.setTexture(mpTexture); #endif mpMaterial->load(); -#if TARGET_PC +#if DEBUG && TARGET_PC if (mpMaterial->mMaterialName != nullptr) { char buf[64]; snprintf(buf, sizeof(buf), "Mat: %s", mpMaterial->mMaterialName); @@ -239,7 +241,7 @@ void J3DMatPacket::draw() { J3DShape::resetVcdVatCache(); -#if TARGET_PC +#if DEBUG && TARGET_PC if (mpMaterial->mMaterialName != nullptr) { GXPopDebugGroup(); } @@ -388,6 +390,7 @@ void J3DShapePacket::draw() { } void J3DShapePacket::drawFast() { + ZoneScoped; if (!checkFlag(J3DShpFlag_Hidden) && mpShape != NULL) { prepareDraw(); diff --git a/libs/JSystem/src/J3DGraphBase/J3DShape.cpp b/libs/JSystem/src/J3DGraphBase/J3DShape.cpp index 76f58b7586..fc7ac5b727 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DShape.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DShape.cpp @@ -3,13 +3,13 @@ #include "JSystem/J3DGraphBase/J3DShape.h" #include +#include +#include #include "JSystem/J3DGraphBase/J3DFifo.h" #include "JSystem/J3DGraphBase/J3DPacket.h" #include "JSystem/J3DGraphBase/J3DVertex.h" -#include "JSystem/J3DGraphBase/J3DFifo.h" -#include -#include #include "JSystem/JKernel/JKRHeap.h" +#include "tracy/Tracy.hpp" void J3DGDSetVtxAttrFmtv(GXVtxFmt, GXVtxAttrFmtList const*, bool); void J3DFifoLoadPosMtxImm(Mtx, u32); @@ -318,6 +318,7 @@ void J3DShape::setArrayAndBindPipeline() const { } void J3DShape::drawFast() const { + ZoneScoped; if (sOldVcdVatCmd != mVcdVatCmd) { GXCallDisplayList(mVcdVatCmd, kVcdVatDLSize); sOldVcdVatCmd = mVcdVatCmd; diff --git a/libs/JSystem/src/J3DGraphBase/J3DSys.cpp b/libs/JSystem/src/J3DGraphBase/J3DSys.cpp index 2f9cf51a89..b4598bfa7a 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DSys.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DSys.cpp @@ -6,6 +6,7 @@ #include "JSystem/J3DGraphBase/J3DTexture.h" #include "dusk/gx_helper.h" #include "global.h" +#include "tracy/Tracy.hpp" J3DSys j3dSys; @@ -121,6 +122,8 @@ void J3DSys::setTexCacheRegion(GXTexCacheSize size) { } void J3DSys::drawInit() { + ZoneScoped; + GXInvalidateVtxCache(); GXSetCurrentMtx(GX_PNMTX0); GXSetCullMode(GX_CULL_BACK); @@ -226,6 +229,7 @@ void J3DSys::drawInit() { } void J3DSys::reinitGX() { + ZoneScoped; reinitGenMode(); reinitLighting(); reinitTransform(); diff --git a/libs/JSystem/src/JAudio2/JASAiCtrl.cpp b/libs/JSystem/src/JAudio2/JASAiCtrl.cpp index ede7c1d267..75b475342b 100644 --- a/libs/JSystem/src/JAudio2/JASAiCtrl.cpp +++ b/libs/JSystem/src/JAudio2/JASAiCtrl.cpp @@ -18,6 +18,8 @@ #include #include +#include "tracy/Tracy.hpp" + s16* JASDriver::sDmaDacBuffer[3]; static u8 data_804507A8 = 3; @@ -143,6 +145,7 @@ void JASDriver::updateDac() { } void JASDriver::updateDSP() { + ZoneScoped; JASProbe::start(3, "SFR-UPDATE"); JASDsp::invalChannelAll(); diff --git a/libs/JSystem/src/JFramework/JFWDisplay.cpp b/libs/JSystem/src/JFramework/JFWDisplay.cpp index a726889863..27873ecbe3 100644 --- a/libs/JSystem/src/JFramework/JFWDisplay.cpp +++ b/libs/JSystem/src/JFramework/JFWDisplay.cpp @@ -19,6 +19,7 @@ #include "dusk/logging.h" #include "dusk/settings.h" #include "global.h" +#include "tracy/Tracy.hpp" void JFWDisplay::ctor_subroutine(bool enableAlpha) { mEnableAlpha = enableAlpha; @@ -350,6 +351,7 @@ void JFWDisplay::waitBlanking(int param_0) { } static void waitForTick(u32 p1, u16 p2) { + ZoneScopedC(tracy::Color::DimGray); #if TARGET_PC if (dusk::getTransientSettings().skipFrameRateLimit) { p1 = OS_TIMER_CLOCK / 120; diff --git a/libs/JSystem/src/JParticle/JPABaseShape.cpp b/libs/JSystem/src/JParticle/JPABaseShape.cpp index f28add564e..178606a687 100644 --- a/libs/JSystem/src/JParticle/JPABaseShape.cpp +++ b/libs/JSystem/src/JParticle/JPABaseShape.cpp @@ -9,6 +9,8 @@ #include #include +#include "tracy/Tracy.hpp" + void JPASetPointSize(JPAEmitterWorkData* work) { GXSetPointSize((u8)(25.0f * work->mGlobalPtclScl.x), GX_TO_ONE); } @@ -684,6 +686,8 @@ void JPADrawDirection(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) { return; } + ZoneScoped; + JGeometry::TVec3 local_6c; JGeometry::TVec3 local_78; p_direction[param_0->mDirType](param_0, param_1, &local_6c); @@ -729,6 +733,8 @@ void JPADrawRotDirection(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) return; } + ZoneScoped; + f32 sinRot = JMASSin(param_1->mRotateAngle); f32 cosRot = JMASCos(param_1->mRotateAngle); JGeometry::TVec3 local_6c; @@ -779,6 +785,8 @@ void JPADrawDBillboard(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) { return; } + ZoneScoped; + JGeometry::TVec3 local_70; p_direction[param_0->mDirType](param_0, param_1, &local_70); JGeometry::TVec3 aTStack_7c(param_0->mPosCamMtx[2][0], param_0->mPosCamMtx[2][1], param_0->mPosCamMtx[2][2]); @@ -814,6 +822,8 @@ void JPADrawRotation(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) { return; } + ZoneScoped; + f32 sinRot = JMASSin(param_1->mRotateAngle); f32 cosRot = JMASCos(param_1->mRotateAngle); f32 particleX = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX; @@ -835,6 +845,8 @@ void JPADrawPoint(JPAEmitterWorkData* work, JPABaseParticle* ptcl) { return; } + ZoneScoped; + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); GXBegin(GX_POINTS, GX_VTXFMT1, 1); @@ -850,6 +862,8 @@ void JPADrawLine(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) { return; } + ZoneScoped; + JGeometry::TVec3 local_1c(param_1->mPosition); JGeometry::TVec3 local_28; param_1->getVelVec(&local_28); @@ -883,6 +897,8 @@ JPANode* getPrev(JPANode* param_0) { typedef JPANode* (*getNodeFunc)(JPANode*); void JPADrawStripe(JPAEmitterWorkData* param_0) { + ZoneScoped; + JPABaseShape* shape = param_0->mpRes->getBsp(); u32 ptcl_num = param_0->mpAlivePtcl->getNum(); if (ptcl_num < 2) { @@ -969,6 +985,8 @@ void JPADrawStripe(JPAEmitterWorkData* param_0) { } void JPADrawStripeX(JPAEmitterWorkData* param_0) { + ZoneScoped; + JPABaseShape* shape = param_0->mpRes->getBsp(); u32 ptcl_num = param_0->mpAlivePtcl->getNum(); if (ptcl_num < 2) { diff --git a/libs/JSystem/src/JParticle/JPAEmitterManager.cpp b/libs/JSystem/src/JParticle/JPAEmitterManager.cpp index 5cefe85329..3a793000ed 100644 --- a/libs/JSystem/src/JParticle/JPAEmitterManager.cpp +++ b/libs/JSystem/src/JParticle/JPAEmitterManager.cpp @@ -8,6 +8,8 @@ #include "JSystem/JUtility/JUTAssert.h" #include +#include "tracy/Tracy.hpp" + JPAEmitterManager::JPAEmitterManager(u32 i_ptclNum, u32 i_emtrNum, JKRHeap* pHeap, u8 i_gidMax, u8 i_ridMax) { emtrNum = i_emtrNum; @@ -85,6 +87,7 @@ void JPAEmitterManager::calc(u8 group_id) { } void JPAEmitterManager::draw(JPADrawInfo const* drawInfo, u8 group_id) { + ZoneScoped; JUT_ASSERT(192, group_id < gidMax); drawInfo->getCamMtx(pWd->mPosCamMtx); drawInfo->getPrjMtx(pWd->mPrjMtx); diff --git a/libs/JSystem/src/JParticle/JPAResource.cpp b/libs/JSystem/src/JParticle/JPAResource.cpp index 4a33ed0aab..2ae4709fc3 100644 --- a/libs/JSystem/src/JParticle/JPAResource.cpp +++ b/libs/JSystem/src/JParticle/JPAResource.cpp @@ -16,6 +16,7 @@ #include "JSystem/JParticle/JPAParticle.h" #include "JSystem/JParticle/JPAResourceManager.h" #include "global.h" +#include "tracy/Tracy.hpp" JPAResource::JPAResource() { mpCalcEmitterFuncList = mpDrawEmitterFuncList = mpDrawEmitterChildFuncList = NULL; @@ -782,6 +783,7 @@ bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) { } void JPAResource::draw(JPAEmitterWorkData* work, JPABaseEmitter* emtr) { + ZoneScoped; work->mpEmtr = emtr; work->mpRes = this; work->mDrawCount = 0; @@ -798,6 +800,7 @@ void JPAResource::draw(JPAEmitterWorkData* work, JPABaseEmitter* emtr) { } void JPAResource::drawP(JPAEmitterWorkData* work) { + ZoneScoped; work->mpEmtr->clearStatus(0x80); work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * pBsp->getBaseSizeX(); @@ -860,6 +863,7 @@ void JPAResource::drawP(JPAEmitterWorkData* work) { } void JPAResource::drawC(JPAEmitterWorkData* work) { + ZoneScoped; work->mpEmtr->setStatus(0x80); if (pCsp->isScaleInherited()) { diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index c1927c5875..d91e0c03ba 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -4041,6 +4041,7 @@ void dKyr_drawSnow(Mtx drawMtx, u8** tex) { } void dKyr_drawStar(Mtx drawMtx, u8** tex) { + ZoneScoped; dScnKy_env_light_c* envlight = dKy_getEnvlight(); dKankyo_star_Packet* star_packet = g_env_light.mpStarPacket; camera_class* camera = (camera_class*)dComIfGp_getCamera(0); diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index 6c8d6e3f75..248424e9a2 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -8,22 +8,23 @@ // weak data from it (unlike here). #include "d/d_particle.h" -#include "d/d_jnt_col.h" +#include +#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h" +#include "JSystem/J3DGraphBase/J3DMaterial.h" #include "JSystem/JKernel/JKRExpHeap.h" #include "JSystem/JKernel/JKRSolidHeap.h" -#include "JSystem/J3DGraphBase/J3DMaterial.h" -#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h" +#include "JSystem/JMath/JMATrigonometric.h" #include "JSystem/JParticle/JPAEmitterManager.h" #include "JSystem/JParticle/JPAResourceManager.h" -#include "JSystem/JMath/JMATrigonometric.h" -#include "d/d_s_play.h" -#include -#include "d/d_com_inf_game.h" -#include "m_Do/m_Do_lib.h" -#include "m_Do/m_Do_graphic.h" -#include "f_op/f_op_actor_mng.h" -#include "d/actor/d_a_player.h" #include "SSystem/SComponent/c_math.h" +#include "d/actor/d_a_player.h" +#include "d/d_com_inf_game.h" +#include "d/d_jnt_col.h" +#include "d/d_s_play.h" +#include "f_op/f_op_actor_mng.h" +#include "m_Do/m_Do_graphic.h" +#include "m_Do/m_Do_lib.h" +#include "tracy/Tracy.hpp" #ifndef __MWERKS__ #include "dusk/math.h" @@ -1325,6 +1326,7 @@ void dPa_control_c::cleanup() { } void dPa_control_c::calc3D() { + ZoneScoped; if (isStatus(2)) { offStatus(2); } else { @@ -1336,12 +1338,14 @@ void dPa_control_c::calc3D() { } void dPa_control_c::calc2D() { + ZoneScoped; for (u8 i = 14; i <= 16; i++) { mEmitterMng->calc(i); } } void dPa_control_c::calcMenu() { + ZoneScoped; if (mEmitterMng != NULL) { for (u8 i = 17; i <= 18; i++) { mEmitterMng->calc(i); diff --git a/src/dusk/OSThread.cpp b/src/dusk/OSThread.cpp index d5d73df243..7b97026e13 100644 --- a/src/dusk/OSThread.cpp +++ b/src/dusk/OSThread.cpp @@ -17,6 +17,7 @@ #include #include "JSystem/JKernel/JKRHeap.h" +#include "common/TracySystem.hpp" #include "dusk/main.h" #include "dusk/os.h" @@ -667,6 +668,9 @@ void OSSetCurrentThreadName(const char* name) { // "Why is this current thread only?", you might ask? // Because macOS requires that. For some reason. +#if TRACY_ENABLE + tracy::SetThreadName(name); +#else #if _WIN32 wchar_t buffer[256]; const auto converted = MultiByteToWideChar( @@ -687,6 +691,7 @@ void OSSetCurrentThreadName(const char* name) { #elif __APPLE__ pthread_setname_np(name); #endif +#endif } #ifdef __cplusplus diff --git a/src/dusk/audio/DuskAudioSystem.cpp b/src/dusk/audio/DuskAudioSystem.cpp index 7b464e4f0e..c818e46738 100644 --- a/src/dusk/audio/DuskAudioSystem.cpp +++ b/src/dusk/audio/DuskAudioSystem.cpp @@ -14,6 +14,7 @@ #include "DuskDsp.hpp" #include "JSystem/JAudio2/JASAudioThread.h" #include "JSystem/JAudio2/JASDriverIF.h" +#include "tracy/Tracy.hpp" using namespace dusk::audio; @@ -82,18 +83,25 @@ void dusk::audio::SetEnableReverb(const bool value) { EnableReverb = value; } +#ifdef TRACY_ENABLE +static auto FrameName = "GetNewAudio"; +#endif + void SDLCALL GetNewAudio( void*, SDL_AudioStream*, int needed, int) { + FrameMarkStart(FrameName); while (needed > 0) { const int rendered = RenderNewAudioFrame(); needed -= rendered; } + FrameMarkEnd(FrameName); } int RenderNewAudioFrame() { + ZoneScoped; JASCriticalSection section; const u32 countSubframes = JASDriver::getSubFrames(); @@ -120,6 +128,7 @@ static void InterleaveOutputData(const OutputSubframe& data, std::span targ } void RenderAudioSubframe() { + ZoneScoped; OutBuffer = {}; JASDriver::updateDSP(); diff --git a/src/dusk/audio/DuskDsp.cpp b/src/dusk/audio/DuskDsp.cpp index b5c3e2588c..bcad272a47 100644 --- a/src/dusk/audio/DuskDsp.cpp +++ b/src/dusk/audio/DuskDsp.cpp @@ -14,6 +14,7 @@ #include "dusk/audio/DuskAudioSystem.h" #include "dusk/endian.h" #include "global.h" +#include "tracy/Tracy.hpp" using namespace dusk::audio; @@ -141,6 +142,7 @@ static void MixSubframe(DspSubframe& dst, const DspSubframe& src) { } void dusk::audio::DspRender(OutputSubframe& subframe) { + ZoneScoped; if (DumpAudio != sDumpWasActive) { sDumpWasActive = DumpAudio; if (DumpAudio) { diff --git a/src/dusk/audio/JASCriticalSection.cpp b/src/dusk/audio/JASCriticalSection.cpp index 9b315b9d0b..9baf2d9bac 100644 --- a/src/dusk/audio/JASCriticalSection.cpp +++ b/src/dusk/audio/JASCriticalSection.cpp @@ -2,7 +2,9 @@ #include -static std::recursive_mutex gAudioThreadMutex; +#include "tracy/Tracy.hpp" + +static TracyLockable(std::recursive_mutex, gAudioThreadMutex); JASCriticalSection::JASCriticalSection() { gAudioThreadMutex.lock(); diff --git a/src/dusk/imgui/ImGuiConsole.cpp b/src/dusk/imgui/ImGuiConsole.cpp index fa47e53da3..a238bb7c7a 100644 --- a/src/dusk/imgui/ImGuiConsole.cpp +++ b/src/dusk/imgui/ImGuiConsole.cpp @@ -17,6 +17,7 @@ #include "dusk/settings.h" #include "dusk/audio/DuskAudioSystem.h" #include "dusk/dusk.h" +#include "tracy/Tracy.hpp" #if _WIN32 #define NOMINMAX @@ -200,6 +201,7 @@ namespace dusk { } void ImGuiConsole::PreDraw() { + ZoneScoped; if (!m_isLaunchInitialized) { InitSettings(); diff --git a/src/dusk/logging.cpp b/src/dusk/logging.cpp index 1a92f9ac37..37d1d4f55f 100644 --- a/src/dusk/logging.cpp +++ b/src/dusk/logging.cpp @@ -2,6 +2,8 @@ #include #include +#include "tracy/Tracy.hpp" + bool StubLogEnabled = true; using namespace std::literals::string_view_literals; @@ -32,6 +34,7 @@ static bool IsForStubLog(const char* message) { void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message, unsigned int len) { + ZoneScoped; if (StubLogEnabled && level != LOG_FATAL && IsForStubLog(message)) { dusk::SendToStubLog(level, module, message); return; diff --git a/src/dusk/stubs.cpp b/src/dusk/stubs.cpp index e655ed6d7d..668541f49c 100644 --- a/src/dusk/stubs.cpp +++ b/src/dusk/stubs.cpp @@ -13,6 +13,8 @@ #include #include +#include "tracy/Tracy.hpp" + #ifndef _WIN32 #include #include @@ -355,6 +357,7 @@ void VISetNextFrameBuffer(void* fb) { } void VIWaitForRetrace() { + ZoneScoped; sRetraceCount++; if (sVIPreRetraceCallback) { sVIPreRetraceCallback(sRetraceCount); diff --git a/src/f_ap/f_ap_game.cpp b/src/f_ap/f_ap_game.cpp index b1edb7fa23..180e6bc361 100644 --- a/src/f_ap/f_ap_game.cpp +++ b/src/f_ap/f_ap_game.cpp @@ -1,26 +1,27 @@ #include "f_ap/f_ap_game.h" +#include +#include "DynamicLink.h" +#include "JSystem/J3DGraphLoader/J3DModelLoader.h" +#include "JSystem/J3DGraphLoader/J3DModelSaver.h" +#include "JSystem/JHostIO/JORFile.h" +#include "JSystem/JKernel/JKRAram.h" +#include "JSystem/JKernel/JKRAramArchive.h" +#include "JSystem/JKernel/JKRSolidHeap.h" +#include "JSystem/JUtility/JUTDbPrint.h" #include "SSystem/SComponent/c_counter.h" +#include "d/actor/d_a_alink.h" +#include "d/actor/d_a_grass.h" +#include "d/actor/d_a_midna.h" +#include "d/d_model.h" +#include "d/d_tresure.h" +#include "dusk/logging.h" #include "f_op/f_op_camera_mng.h" #include "f_op/f_op_draw_tag.h" #include "f_op/f_op_overlap_mng.h" #include "f_op/f_op_scene_mng.h" -#include "m_Do/m_Do_main.h" #include "m_Do/m_Do_graphic.h" -#include "DynamicLink.h" -#include "JSystem/JKernel/JKRSolidHeap.h" -#include "JSystem/JKernel/JKRAram.h" -#include "JSystem/JKernel/JKRAramArchive.h" -#include "JSystem/JUtility/JUTDbPrint.h" -#include "JSystem/JHostIO/JORFile.h" -#include "JSystem/J3DGraphLoader/J3DModelLoader.h" -#include "JSystem/J3DGraphLoader/J3DModelSaver.h" -#include "d/actor/d_a_alink.h" -#include "d/actor/d_a_midna.h" -#include "d/d_model.h" -#include "d/actor/d_a_grass.h" -#include "d/d_tresure.h" -#include -#include "dusk/logging.h" +#include "m_Do/m_Do_main.h" +#include "tracy/Tracy.hpp" fapGm_HIO_c::fapGm_HIO_c() { mUsingHostIO = true; @@ -722,6 +723,7 @@ void fapGm_After() { } void fapGm_Execute() { + ZoneScoped; static u32 sExecCount = 0; if (sExecCount < 10 || (sExecCount % 300 == 0)) { DuskLog.debug("fapGm_Execute frame={}", sExecCount); diff --git a/src/f_pc/f_pc_manager.cpp b/src/f_pc/f_pc_manager.cpp index 4f676c242f..a3d85d4df6 100644 --- a/src/f_pc/f_pc_manager.cpp +++ b/src/f_pc/f_pc_manager.cpp @@ -22,6 +22,8 @@ #include "m_Do/m_Do_controller_pad.h" #include +#include "tracy/Tracy.hpp" + void fpcM_Draw(void* i_proc) { fpcDw_Execute((base_process_class*)i_proc); } @@ -43,6 +45,7 @@ BOOL fpcM_IsCreating(fpc_ProcID i_id) { } void fpcM_Management(fpcM_ManagementFunc i_preExecuteFn, fpcM_ManagementFunc i_postExecuteFn) { + ZoneScoped; MtxInit(); if (!fapGm_HIO_c::isCaptureScreen()) { dComIfGd_peekZdata(); diff --git a/src/m_Do/m_Do_audio.cpp b/src/m_Do/m_Do_audio.cpp index fc386bda88..fc44eb7fb6 100644 --- a/src/m_Do/m_Do_audio.cpp +++ b/src/m_Do/m_Do_audio.cpp @@ -12,6 +12,7 @@ #include "d/d_debug_viewer.h" #include "m_Do/m_Do_Reset.h" #include "m_Do/m_Do_dvd_thread.h" +#include "tracy/Tracy.hpp" #if PLATFORM_WII || PLATFORM_SHIELD #include "Z2AudioCS/Z2AudioCS.h" @@ -157,6 +158,7 @@ static void mDoAud_Create() { void mDoAud_Execute() { DUSK_AUDIO_SKIP() + ZoneScoped; if (!mDoAud_zelAudio_c::isInitFlag()) { if (!mDoRst::isShutdown() && !mDoRst::isReturnToMenu()) { diff --git a/src/m_Do/m_Do_controller_pad.cpp b/src/m_Do/m_Do_controller_pad.cpp index c8a8566313..8ba03fc63b 100644 --- a/src/m_Do/m_Do_controller_pad.cpp +++ b/src/m_Do/m_Do_controller_pad.cpp @@ -10,6 +10,7 @@ #include "f_ap/f_ap_game.h" #include "m_Do/m_Do_Reset.h" #include "m_Do/m_Do_main.h" +#include "tracy/Tracy.hpp" JUTGamePad* mDoCPd_c::m_gamePad[4]; @@ -56,6 +57,7 @@ void mDoCPd_c::create() { } void mDoCPd_c::read() { + ZoneScoped; JUTGamePad::read(); if (!mDoRst::isReset() && mDoRst::is3ButtonReset()) { diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 5887c22495..a5bd4640c8 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -7,6 +7,9 @@ #include "d/dolzel.h" // IWYU pragma: keep +#include +#include +#include "DynamicLink.h" #include "JSystem/J2DGraph/J2DOrthoGraph.h" #include "JSystem/J2DGraph/J2DPrint.h" #include "JSystem/JAWExtSystem/JAWExtSystem.h" @@ -19,24 +22,22 @@ #include "SSystem/SComponent/c_math.h" #include "d/actor/d_a_player.h" #include "d/d_com_inf_game.h" -#include "d/d_menu_collect.h" +#include "d/d_debug_viewer.h" #include "d/d_jcam_editor.h" #include "d/d_jpreviewer.h" -#include +#include "d/d_menu_collect.h" +#include "d/d_meter2_info.h" +#include "d/d_s_play.h" +#include "dusk/endian.h" +#include "dusk/gx_helper.h" +#include "dusk/logging.h" #include "f_ap/f_ap_game.h" #include "f_op/f_op_camera_mng.h" #include "m_Do/m_Do_controller_pad.h" #include "m_Do/m_Do_graphic.h" #include "m_Do/m_Do_machine.h" #include "m_Do/m_Do_main.h" -#include "d/d_debug_viewer.h" -#include "d/d_meter2_info.h" -#include "d/d_s_play.h" -#include "DynamicLink.h" -#include -#include "dusk/endian.h" -#include "dusk/logging.h" -#include "dusk/gx_helper.h" +#include "tracy/Tracy.hpp" #if PLATFORM_WII || PLATFORM_SHIELD #include @@ -348,6 +349,8 @@ void mDoGph_gInf_c::create() { static bool data_80450BE8; void mDoGph_gInf_c::beginRender() { + ZoneScoped; + #if PLATFORM_WII || PLATFORM_SHIELD VISetTrapFilter(fapGmHIO_getTrapFilter() ? 1 : 0); VISetGamma((VIGamma)fapGmHIO_getGamma()); @@ -416,6 +419,7 @@ void mDoGph_gInf_c::fadeOut(f32 fadeSpeed) { } void darwFilter(GXColor matColor) { + ZoneScoped; GXSetNumChans(1); GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); @@ -834,6 +838,7 @@ void mDoGph_drawFilterQuad(s8 param_0, s8 param_1) { #endif static void drawDepth2(view_class* param_0, view_port_class* param_1, int param_2) { + ZoneScoped; static GXColorS10 l_tevColor0 = {0, 0, 0, 0}; if (daPy_getLinkPlayerActorClass() != NULL) { @@ -1087,6 +1092,7 @@ static void drawDepth2(view_class* param_0, view_port_class* param_1, int param_ } static void trimming(view_class* param_0, view_port_class* param_1) { + ZoneScoped; UNUSED(param_0); s16 y_orig = (int)param_1->y_orig & ~7; @@ -1199,6 +1205,7 @@ void mDoGph_gInf_c::bloom_c::remove() { void mDoGph_gInf_c::bloom_c::draw() { #if TARGET_PC + ZoneScoped; if (!dusk::getSettings().game.enableBloom) { return; } @@ -1473,6 +1480,7 @@ static void retry_captue_frame(view_class* param_0, view_port_class* param_1, in } static void motionBlure(view_class* param_0) { + ZoneScoped; if (g_env_light.is_blure) { GXLoadTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), GX_TEXMAP0); GXColor local_60; @@ -1652,6 +1660,7 @@ static void captureScreenPerspDrawInfo(JPADrawInfo& info) { #endif static void drawItem3D() { + ZoneScoped; Mtx item_mtx; dMenu_Collect3D_c::setupItem3D(item_mtx); @@ -1668,6 +1677,7 @@ static void drawItem3D() { } int mDoGph_Painter() { + ZoneScoped; // Diagnostic: log windowNum to track game state machine progress static bool sDiagLoggedWindow = false; if (!sDiagLoggedWindow) { diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index bcf958780e..31833cf0e8 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -60,6 +60,7 @@ #include "SDL3/SDL_filesystem.h" #include "cxxopts.hpp" #include "dusk/config.hpp" +#include "tracy/Tracy.hpp" // --- GLOBALS --- s8 mDoMain::developmentMode = -1; @@ -198,6 +199,8 @@ void main01(void) { mDoAud_Execute(); aurora_end_frame(); + + FrameMark; } while (true); exit:;