1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Delay expensive operations to get_perf_report

The function update_perf_report() is expensive and is called every
frame.
Most of it is not necessary unless the user calls get_perf_report

Affects #102173
This commit is contained in:
Matias N. Goldberg
2025-03-08 11:25:46 -03:00
parent 134da37497
commit 21133425cc
2 changed files with 9 additions and 7 deletions

View File

@@ -612,16 +612,17 @@ Error RenderingDevice::driver_callback_add(RDD::DriverCallback p_callback, void
}
String RenderingDevice::get_perf_report() const {
String perf_report_text;
perf_report_text += " gpu:" + String::num_int64(prev_gpu_copy_count);
perf_report_text += " bytes:" + String::num_int64(prev_copy_bytes_count);
perf_report_text += " lazily alloc:" + String::num_int64(driver->get_lazily_memory_used());
return perf_report_text;
}
void RenderingDevice::update_perf_report() {
perf_report_text = "";
perf_report_text += " gpu:" + String::num_int64(gpu_copy_count);
perf_report_text += " bytes:" + String::num_int64(copy_bytes_count);
perf_report_text += " lazily alloc:" + String::num_int64(driver->get_lazily_memory_used());
prev_gpu_copy_count = gpu_copy_count;
prev_copy_bytes_count = copy_bytes_count;
gpu_copy_count = 0;
copy_bytes_count = 0;
}