-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This way, changes to `OpenGlTracyCapture` don't invalidate the entire ccache
- Loading branch information
Showing
7 changed files
with
249 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
|
||
#ifdef HAVE_TRACY | ||
#include "tracy.hpp" | ||
#include "tracy/opengl.hpp" | ||
#endif | ||
|
||
namespace MelonDsDs { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/* | ||
Copyright 2024 Jesse Talavera | ||
melonDS DS is free software: you can redistribute it and/or modify it under | ||
the terms of the GNU General Public License as published by the Free | ||
Software Foundation, either version 3 of the License, or (at your option) | ||
any later version. | ||
melonDS DS is distributed in the hope that it will be useful, but WITHOUT ANY | ||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with melonDS DS. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
|
||
#pragma once | ||
|
||
|
||
#if defined(__clang__) || defined(__GNUC__) | ||
# define TracyFunction __PRETTY_FUNCTION__ | ||
#elif defined(_MSC_VER) | ||
# define TracyFunction __FUNCSIG__ | ||
#endif | ||
|
||
#ifdef HAVE_TRACY | ||
#include <tracy/Tracy.hpp> | ||
#else | ||
#define ZoneNamed(x,y) | ||
#define ZoneNamedN(x,y,z) | ||
#define ZoneNamedC(x,y,z) | ||
#define ZoneNamedNC(x,y,z,w) | ||
|
||
#define ZoneTransient(x,y) | ||
#define ZoneTransientN(x,y,z) | ||
|
||
#define ZoneScoped | ||
#define ZoneScopedN(x) | ||
#define ZoneScopedC(x) | ||
#define ZoneScopedNC(x,y) | ||
|
||
#define ZoneText(x,y) | ||
#define ZoneTextV(x,y,z) | ||
#define ZoneName(x,y) | ||
#define ZoneNameV(x,y,z) | ||
#define ZoneColor(x) | ||
#define ZoneColorV(x,y) | ||
#define ZoneValue(x) | ||
#define ZoneValueV(x,y) | ||
#define ZoneIsActive false | ||
#define ZoneIsActiveV(x) false | ||
|
||
#define FrameMark | ||
#define FrameMarkNamed(x) | ||
#define FrameMarkStart(x) | ||
#define FrameMarkEnd(x) | ||
|
||
#define FrameImage(x,y,z,w,a) | ||
|
||
#define TracyLockable( type, varname ) type varname | ||
#define TracyLockableN( type, varname, desc ) type varname | ||
#define TracySharedLockable( type, varname ) type varname | ||
#define TracySharedLockableN( type, varname, desc ) type varname | ||
#define LockableBase( type ) type | ||
#define SharedLockableBase( type ) type | ||
#define LockMark(x) (void)x | ||
#define LockableName(x,y,z) | ||
|
||
#define TracyPlot(x,y) | ||
#define TracyPlotConfig(x,y,z,w,a) | ||
|
||
#define TracyMessage(x,y) | ||
#define TracyMessageL(x) | ||
#define TracyMessageC(x,y,z) | ||
#define TracyMessageLC(x,y) | ||
#define TracyAppInfo(x,y) | ||
|
||
#define TracyAlloc(x,y) | ||
#define TracyFree(x) | ||
#define TracySecureAlloc(x,y) | ||
#define TracySecureFree(x) | ||
|
||
#define TracyAllocN(x,y,z) | ||
#define TracyFreeN(x,y) | ||
#define TracySecureAllocN(x,y,z) | ||
#define TracySecureFreeN(x,y) | ||
|
||
#define ZoneNamedS(x,y,z) | ||
#define ZoneNamedNS(x,y,z,w) | ||
#define ZoneNamedCS(x,y,z,w) | ||
#define ZoneNamedNCS(x,y,z,w,a) | ||
|
||
#define ZoneTransientS(x,y,z) | ||
#define ZoneTransientNS(x,y,z,w) | ||
|
||
#define ZoneScopedS(x) | ||
#define ZoneScopedNS(x,y) | ||
#define ZoneScopedCS(x,y) | ||
#define ZoneScopedNCS(x,y,z) | ||
|
||
#define TracyAllocS(x,y,z) | ||
#define TracyFreeS(x,y) | ||
#define TracySecureAllocS(x,y,z) | ||
#define TracySecureFreeS(x,y) | ||
|
||
#define TracyAllocNS(x,y,z,w) | ||
#define TracyFreeNS(x,y,z) | ||
#define TracySecureAllocNS(x,y,z,w) | ||
#define TracySecureFreeNS(x,y,z) | ||
|
||
#define TracyMessageS(x,y,z) | ||
#define TracyMessageLS(x,y) | ||
#define TracyMessageCS(x,y,z,w) | ||
#define TracyMessageLCS(x,y,z) | ||
|
||
#define TracySourceCallbackRegister(x,y) | ||
#define TracyParameterRegister(x,y) | ||
#define TracyParameterSetup(x,y,z,w) | ||
#define TracyIsConnected false | ||
#define TracySetProgramName(x) | ||
|
||
#define TracyFiberEnter(x) | ||
#define TracyFiberLeave | ||
#endif | ||
|
||
#if defined(HAVE_TRACY) && (defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)) | ||
#include "PlatformOGLPrivate.h" | ||
#include <tracy/TracyOpenGL.hpp> | ||
#else | ||
#define TracyGpuContext | ||
#define TracyGpuContextName(x,y) | ||
#define TracyGpuNamedZone(x,y,z) | ||
#define TracyGpuNamedZoneC(x,y,z,w) | ||
#define TracyGpuZone(x) | ||
#define TracyGpuZoneC(x,y) | ||
#define TracyGpuZoneTransient(x,y,z) | ||
#define TracyGpuCollect | ||
|
||
#define TracyGpuNamedZoneS(x,y,z,w) | ||
#define TracyGpuNamedZoneCS(x,y,z,w,a) | ||
#define TracyGpuZoneS(x,y) | ||
#define TracyGpuZoneCS(x,y,z) | ||
#define TracyGpuZoneTransientS(x,y,z,w) | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
Copyright 2024 Jesse Talavera | ||
melonDS DS is free software: you can redistribute it and/or modify it under | ||
the terms of the GNU General Public License as published by the Free | ||
Software Foundation, either version 3 of the License, or (at your option) | ||
any later version. | ||
melonDS DS is distributed in the hope that it will be useful, but WITHOUT ANY | ||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with melonDS DS. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
|
||
#include <tracy/Tracy.hpp> | ||
|
||
// Defining these functions in the global scope | ||
// overrides operator new and operator delete | ||
// for all linked translation units. | ||
|
||
void* operator new(std::size_t count) | ||
{ | ||
if (count == 0) | ||
++count; // avoid std::malloc(0) which may return nullptr on success | ||
|
||
if (void *ptr = std::malloc(count)) { | ||
TracySecureAlloc(ptr, count); | ||
return ptr; | ||
} | ||
|
||
throw std::bad_alloc{}; // required by [new.delete.single]/3 | ||
} | ||
|
||
void operator delete(void* ptr) noexcept | ||
{ | ||
TracySecureFree(ptr); | ||
std::free(ptr); | ||
} |
Oops, something went wrong.