Log max batch count in ui painter

This commit is contained in:
Nikita Lisitsa 2022-02-19 19:40:19 +03:00
parent 742ae9e21e
commit 466aa717ad

View file

@ -4,6 +4,7 @@
#include <psemek/gfx/mesh.hpp>
#include <psemek/util/overload.hpp>
#include <psemek/log/log.hpp>
#include <variant>
@ -223,6 +224,8 @@ void main()
std::vector<std::variant<colored_batch, bitmap_text_batch, textured_batch, stencil_batch>> batches;
std::size_t max_batch_count = 0;
template <typename Batch>
Batch & batch(Batch && n)
{
@ -259,7 +262,10 @@ void main()
: pimpl_{make_impl()}
{}
painter_impl::~painter_impl() = default;
painter_impl::~painter_impl()
{
log::debug() << "UI painter max batch count: " << impl().max_batch_count;
}
void painter_impl::draw_rect(geom::box<float, 2> const & rect, gfx::color_rgba const & color)
{
@ -518,6 +524,9 @@ void main()
for (auto const & b : impl().batches)
std::visit(batch_visitor, b);
impl().max_batch_count = std::max(impl().max_batch_count, impl().batches.size());
impl().depth = 0;
impl().batches.clear();
impl().stencil_level = 0;