summaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-11-06 18:31:17 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-11-06 18:31:25 +0100
commited44ea64a8928d0df162a5cce932eef9bbb5ff55 (patch)
tree0137c080b40b8d1b6047d812b8ea9b62f3568234 /bench
parent4cb9250e55e389b05162cfc0ec44e8a8d508f0ee (diff)
bbb
Diffstat (limited to 'bench')
-rw-r--r--bench/03-bitmask.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/bench/03-bitmask.cpp b/bench/03-bitmask.cpp
new file mode 100644
index 00000000..c8c698a6
--- /dev/null
+++ b/bench/03-bitmask.cpp
@@ -0,0 +1,27 @@
+#include "compat/assert.hpp"
+#include "src/anim-atlas.hpp"
+#include "loader/loader.hpp"
+#include <Corrade/Containers/Optional.h>
+#include <Magnum/Math/Functions.h>
+#include <Magnum/Trade/ImageData.h>
+#include <benchmark/benchmark.h>
+
+namespace floormat {
+
+namespace {
+
+[[maybe_unused]] void Bitmask(benchmark::State& state)
+{
+ auto img = loader.texture(loader.SCENERY_PATH, "door-close"_s);
+ auto bitmask = anim_atlas::make_bitmask(img);
+ anim_atlas::make_bitmask_(img, bitmask);
+
+ for (auto _ : state)
+ anim_atlas::make_bitmask_(img, bitmask);
+}
+
+BENCHMARK(Bitmask)->Unit(benchmark::kMicrosecond)->ReportAggregatesOnly();
+
+} // namespace
+
+} // namespace floormat