summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmark/api/query.benchmark.cpp11
-rw-r--r--benchmark/api/render.benchmark.cpp12
-rw-r--r--benchmark/src/mbgl/benchmark/util.cpp2
-rw-r--r--cmake/benchmark.cmake2
4 files changed, 19 insertions, 8 deletions
diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp
index b88ecb7749..fa5f3f4d31 100644
--- a/benchmark/api/query.benchmark.cpp
+++ b/benchmark/api/query.benchmark.cpp
@@ -6,6 +6,8 @@
#include <mbgl/gl/headless_backend.hpp>
#include <mbgl/gl/offscreen_view.hpp>
#include <mbgl/util/default_thread_pool.hpp>
+#include <mbgl/renderer/renderer.hpp>
+#include <mbgl/renderer/async_renderer_frontend.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/image.hpp>
#include <mbgl/storage/default_file_source.hpp>
@@ -38,7 +40,8 @@ public:
OffscreenView view{ backend.getContext(), { 1000, 1000 } };
DefaultFileSource fileSource{ "benchmark/fixtures/api/cache.db", "." };
ThreadPool threadPool{ 4 };
- Map map{ backend, MapObserver::nullObserver(), view.getSize(), 1, fileSource, threadPool, MapMode::Still };
+ AsyncRendererFrontend rendererFrontend { std::make_unique<Renderer>(backend, 1, fileSource, threadPool), view };
+ Map map { rendererFrontend, MapObserver::nullObserver(), view.getSize(), 1, fileSource, threadPool, MapMode::Still };
ScreenBox box{{ 0, 0 }, { 1000, 1000 }};
};
@@ -48,7 +51,7 @@ static void API_queryRenderedFeaturesAll(::benchmark::State& state) {
QueryBenchmark bench;
while (state.KeepRunning()) {
- bench.map.queryRenderedFeatures(bench.box, {});
+ bench.rendererFrontend.getRenderer()->queryRenderedFeatures(bench.box, {});
}
}
@@ -56,7 +59,7 @@ static void API_queryRenderedFeaturesLayerFromLowDensity(::benchmark::State& sta
QueryBenchmark bench;
while (state.KeepRunning()) {
- bench.map.queryRenderedFeatures(bench.box, {{{ "testlayer" }}, {}});
+ bench.rendererFrontend.getRenderer()->queryRenderedFeatures(bench.box, {{{ "testlayer" }}, {}});
}
}
@@ -64,7 +67,7 @@ static void API_queryRenderedFeaturesLayerFromHighDensity(::benchmark::State& st
QueryBenchmark bench;
while (state.KeepRunning()) {
- bench.map.queryRenderedFeatures(bench.box, {{{"road-street" }}, {}});
+ bench.rendererFrontend.getRenderer()->queryRenderedFeatures(bench.box, {{{"road-street" }}, {}});
}
}
diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp
index aea2af745a..1a00d9df12 100644
--- a/benchmark/api/render.benchmark.cpp
+++ b/benchmark/api/render.benchmark.cpp
@@ -4,9 +4,12 @@
#include <mbgl/map/map.hpp>
#include <mbgl/map/map_observer.hpp>
#include <mbgl/map/backend_scope.hpp>
+#include <mbgl/map/map_observer.hpp>
#include <mbgl/gl/headless_backend.hpp>
#include <mbgl/gl/offscreen_view.hpp>
#include <mbgl/util/default_thread_pool.hpp>
+#include <mbgl/renderer/renderer.hpp>
+#include <mbgl/renderer/async_renderer_frontend.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/image.hpp>
#include <mbgl/storage/default_file_source.hpp>
@@ -45,7 +48,8 @@ static void prepare(Map& map, optional<std::string> json = {}) {
static void API_renderStill_reuse_map(::benchmark::State& state) {
RenderBenchmark bench;
- Map map { bench.backend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
+ AsyncRendererFrontend frontend { std::make_unique<Renderer>(bench.backend, 1, bench.fileSource, bench.threadPool), bench.view };
+ Map map { frontend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
prepare(map);
while (state.KeepRunning()) {
@@ -55,7 +59,8 @@ static void API_renderStill_reuse_map(::benchmark::State& state) {
static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) {
RenderBenchmark bench;
- Map map { bench.backend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
+ AsyncRendererFrontend frontend { std::make_unique<Renderer>(bench.backend, 1, bench.fileSource, bench.threadPool), bench.view };
+ Map map { frontend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
while (state.KeepRunning()) {
prepare(map, { "{}" });
@@ -69,7 +74,8 @@ static void API_renderStill_recreate_map(::benchmark::State& state) {
RenderBenchmark bench;
while (state.KeepRunning()) {
- Map map { bench.backend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
+ AsyncRendererFrontend frontend { std::make_unique<Renderer>(bench.backend, 1, bench.fileSource, bench.threadPool), bench.view };
+ Map map { frontend, MapObserver::nullObserver(), bench.view.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
prepare(map);
mbgl::benchmark::render(map, bench.view);
}
diff --git a/benchmark/src/mbgl/benchmark/util.cpp b/benchmark/src/mbgl/benchmark/util.cpp
index 87d68ea729..a56279886f 100644
--- a/benchmark/src/mbgl/benchmark/util.cpp
+++ b/benchmark/src/mbgl/benchmark/util.cpp
@@ -11,7 +11,7 @@ namespace benchmark {
void render(Map& map, OffscreenView& view) {
PremultipliedImage result;
- map.renderStill(view, [&](std::exception_ptr) {
+ map.renderStill([&](std::exception_ptr) {
result = view.readStillImage();
});
diff --git a/cmake/benchmark.cmake b/cmake/benchmark.cmake
index 1dfca27e6c..f89e034c4a 100644
--- a/cmake/benchmark.cmake
+++ b/cmake/benchmark.cmake
@@ -1,4 +1,6 @@
add_executable(mbgl-benchmark
+ platform/default/mbgl/renderer/async_renderer_frontend.cpp
+ platform/default/mbgl/renderer/async_renderer_frontend.hpp
${MBGL_BENCHMARK_FILES}
)