Skip to content

Commit

Permalink
Merge pull request #5967 from fluffyfreak/Linux-de-profile-msvc-fix
Browse files Browse the repository at this point in the history
Linux de-profile and msvc compilation fix
  • Loading branch information
fluffyfreak authored Nov 15, 2024
2 parents d56c32e + 0473203 commit 2668aa8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_BUILD_TYPE": "Debug",
"PROFILER_ENABLED": "1"
"CMAKE_BUILD_TYPE": "Debug"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
Expand Down Expand Up @@ -138,8 +137,7 @@
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "/usr/bin/clang",
"CMAKE_CXX_COMPILER": "/usr/bin/clang++",
"PROFILER_ENABLED": "1"
"CMAKE_CXX_COMPILER": "/usr/bin/clang++"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
Expand Down
7 changes: 3 additions & 4 deletions contrib/profiler/Profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "Profiler.h"

#if defined(USE_CHRONO)
#undef __PROFILER_SMP__
#include <atomic>
#endif

Expand Down Expand Up @@ -115,7 +114,7 @@ namespace Profiler {
#if !defined(USE_CHRONO)
volatile u32 mLock;
#else
std::atomic_uint32_t mLock;
std::atomic_uint32_t mLock = { 0 };
#endif
};
#else
Expand Down Expand Up @@ -915,7 +914,7 @@ namespace Profiler {


#if defined(__PROFILER_ENABLED__)
threadlocal Caller::ThreadState Caller::thisThread = { {0}, 0, 0, 0, 0 };
threadlocal Caller::ThreadState Caller::thisThread = { {}, 0, 0, 0, 0 };
f64 Caller::mTimerOverhead = 0, Caller::mRdtscOverhead = 0;
u64 Caller::mGlobalDuration = 0;
Caller::Max Caller::maxStats;
Expand Down Expand Up @@ -999,7 +998,7 @@ namespace Profiler {

u64 globalStart = Timer::getticks();
u64 globalClockStart = Clock::getticks();
GlobalThreadList threads = { NULL, {0} };
GlobalThreadList threads = { NULL, {} };
threadlocal Caller *root = NULL;


Expand Down
3 changes: 2 additions & 1 deletion src/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ void Frame::CollideFrames(void (*callback)(CollisionContact *))
if (!frame.m_collisionSpace)
continue;

PROFILE_SCOPED_DESC(frame.m_label.c_str())
// Used to be frame.m_label.c_str() however the preprocessor is evaluated at compile time this fails on MSVC
PROFILE_SCOPED_DESC("Loop frame")
frame.m_collisionSpace->Collide(callback);
}
}
Expand Down

0 comments on commit 2668aa8

Please sign in to comment.