refactor: consolidate QueryTimer struct to shared header
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run

Move QueryTimer from m2_renderer.cpp and wmo_renderer.cpp to
vk_frame_data.hpp for reuse. Removes 13 lines of duplicate code.
This commit is contained in:
Kelsi 2026-03-11 11:42:01 -07:00
parent b5a2175269
commit 4be7910fdf
3 changed files with 20 additions and 33 deletions

View file

@ -2,6 +2,7 @@
#include <vulkan/vulkan.h>
#include <glm/glm.hpp>
#include <chrono>
namespace wowee {
namespace rendering {
@ -41,5 +42,22 @@ struct ShadowParamsUBO {
float foliageMotionDamp;
};
// Timer utility for performance profiling queries
struct QueryTimer {
double* totalMs = nullptr;
uint32_t* callCount = nullptr;
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
QueryTimer(double* total, uint32_t* calls) : totalMs(total), callCount(calls) {}
~QueryTimer() {
if (callCount) {
(*callCount)++;
}
if (totalMs) {
auto end = std::chrono::steady_clock::now();
*totalMs += std::chrono::duration<double, std::milli>(end - start).count();
}
}
};
} // namespace rendering
} // namespace wowee