mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-21 10:55:03 +00:00
tracy: basic markup and project palette
This commit is contained in:
parent
e89b2d1cdd
commit
04b1226e9c
6 changed files with 89 additions and 0 deletions
|
@ -12,3 +12,40 @@
|
|||
#endif
|
||||
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
static inline bool IsProfilerConnected() {
|
||||
return tracy::GetProfiler().IsConnected();
|
||||
}
|
||||
|
||||
#define CUSTOM_LOCK(type, varname) \
|
||||
tracy::LockableCtx varname { \
|
||||
[]() -> const tracy::SourceLocationData* { \
|
||||
static constexpr tracy::SourceLocationData srcloc{nullptr, #type " " #varname, \
|
||||
TracyFile, TracyLine, 0}; \
|
||||
return &srcloc; \
|
||||
}() \
|
||||
}
|
||||
|
||||
#define TRACK_ALLOC(ptr, size, pool) TracyAllocN(std::bit_cast<void*>(ptr), (size), (pool))
|
||||
#define TRACK_FREE(ptr, pool) TracyFreeN(std::bit_cast<void*>(ptr), (pool))
|
||||
|
||||
enum MarkersPallete : int {
|
||||
EmulatorMarkerColor = 0x264653,
|
||||
RendererMarkerColor = 0x2a9d8f,
|
||||
HleMarkerColor = 0xe9c46a,
|
||||
Reserved0 = 0xf4a261,
|
||||
Reserved1 = 0xe76f51,
|
||||
};
|
||||
|
||||
#define EMULATOR_TRACE ZoneScopedC(EmulatorMarkerColor)
|
||||
#define RENDERER_TRACE ZoneScopedC(RendererMarkerColor)
|
||||
#define HLE_TRACE ZoneScopedC(HleMarkerColor)
|
||||
|
||||
#define TRACE_WARN(msg) \
|
||||
[](const auto& msg) { TracyMessageC(msg.c_str(), msg.size(), tracy::Color::DarkOrange); }(msg);
|
||||
#define TRACE_ERROR(msg) \
|
||||
[](const auto& msg) { TracyMessageC(msg.c_str(), msg.size(), tracy::Color::Red); }(msg)
|
||||
#define TRACE_CRIT(msg) \
|
||||
[](const auto& msg) { TracyMessageC(msg.c_str(), msg.size(), tracy::Color::HotPink); }(msg)
|
||||
|
||||
#define FRAME_END FrameMark
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "common/bounded_threadsafe_queue.h"
|
||||
#include "common/config.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/io_file.h"
|
||||
#include "common/logging/backend.h"
|
||||
#include "common/logging/log.h"
|
||||
|
@ -167,6 +168,24 @@ public:
|
|||
|
||||
void PushEntry(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
||||
const char* function, std::string message) {
|
||||
// Propagate important log messages to the profiler
|
||||
if (IsProfilerConnected()) {
|
||||
const auto& msg_str = std::format("[{}] {}", GetLogClassName(log_class), message);
|
||||
switch (log_level) {
|
||||
case Level::Warning:
|
||||
TRACE_WARN(msg_str);
|
||||
break;
|
||||
case Level::Error:
|
||||
TRACE_ERROR(msg_str);
|
||||
break;
|
||||
case Level::Critical:
|
||||
TRACE_CRIT(msg_str);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!filter.CheckMessage(log_class, log_level)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue