mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 13:49:54 +00:00
Make !configured checks in profiling.cpp soft checks, returning dummies.
This commit is contained in:
parent
2ecefada8d
commit
ab4e59dced
1 changed files with 6 additions and 1 deletions
|
|
@ -39,6 +39,9 @@
|
||||||
namespace TracyInternal {
|
namespace TracyInternal {
|
||||||
static bool configured = false;
|
static bool configured = false;
|
||||||
|
|
||||||
|
static const char dummy_string[] = "dummy";
|
||||||
|
static tracy::SourceLocationData dummy_source_location = tracy::SourceLocationData{ dummy_string, dummy_string, dummy_string, 0, 0 };
|
||||||
|
|
||||||
// Implementation similar to StringName.
|
// Implementation similar to StringName.
|
||||||
struct StringInternData {
|
struct StringInternData {
|
||||||
StringName name;
|
StringName name;
|
||||||
|
|
@ -109,12 +112,14 @@ const StringInternData *_intern_name(const StringName &p_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *intern_name(const StringName &p_name) {
|
const char *intern_name(const StringName &p_name) {
|
||||||
|
ERR_FAIL_COND_V(!configured, dummy_string);
|
||||||
|
|
||||||
MutexLock lock(TracyInternTable::mutex);
|
MutexLock lock(TracyInternTable::mutex);
|
||||||
return _intern_name(p_name)->name_utf8.get_data();
|
return _intern_name(p_name)->name_utf8.get_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
const tracy::SourceLocationData *intern_source_location(const void *p_function_ptr, const StringName &p_file, const StringName &p_function, uint32_t p_line) {
|
const tracy::SourceLocationData *intern_source_location(const void *p_function_ptr, const StringName &p_file, const StringName &p_function, uint32_t p_line) {
|
||||||
CRASH_COND(!configured);
|
ERR_FAIL_COND_V(!configured, &dummy_source_location);
|
||||||
|
|
||||||
const uint32_t hash = HashMapHasherDefault::hash(p_function_ptr);
|
const uint32_t hash = HashMapHasherDefault::hash(p_function_ptr);
|
||||||
const uint32_t idx = hash & TracyInternTable::TABLE_MASK;
|
const uint32_t idx = hash & TracyInternTable::TABLE_MASK;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue