From 2c0991cebcf713421dac7b37117dc02b0983b9de Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sun, 17 Sep 2023 00:45:34 -0500 Subject: [PATCH] Add texture atlas build timing --- scwx-qt/source/scwx/qt/util/texture_atlas.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scwx-qt/source/scwx/qt/util/texture_atlas.cpp b/scwx-qt/source/scwx/qt/util/texture_atlas.cpp index 64ecc9e4..fbb4f187 100644 --- a/scwx-qt/source/scwx/qt/util/texture_atlas.cpp +++ b/scwx-qt/source/scwx/qt/util/texture_atlas.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -108,6 +109,9 @@ void TextureAtlas::BuildAtlas(std::size_t width, std::size_t height) { logger_->debug("Building {}x{} texture atlas", width, height); + boost::timer::cpu_timer timer {}; + timer.start(); + if (width > INT_MAX || height > INT_MAX) { logger_->error("Cannot build texture atlas of size {}x{}", width, height); @@ -297,6 +301,9 @@ void TextureAtlas::BuildAtlas(std::size_t width, std::size_t height) // Mark the need to buffer the atlas ++p->buildCount_; + + timer.stop(); + logger_->debug("Texture atlas built in {}", timer.format(6, "%ws")); } void TextureAtlas::BufferAtlas(gl::OpenGLFunctions& gl, GLuint texture)