Add texture atlas build timing

This commit is contained in:
Dan Paulat 2023-09-17 00:45:34 -05:00
parent bbaae5d1ba
commit 2c0991cebc

View file

@ -15,6 +15,7 @@
#include <boost/gil/extension/io/png.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/timer/timer.hpp>
#include <cpr/cpr.h>
#include <stb_image.h>
#include <stb_rect_pack.h>
@ -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)