summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-06-28 14:50:55 -0700
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-07-18 10:45:12 +0200
commit2e9fb06941720f7cc22fa8d8d54aa2d0b3fd71c0 (patch)
tree522a3efbd982bf7b15179b8948c2c8368346156e /benchmark
parent8401325a82a5affd9f4fe2348d065d8aa0aa0bc4 (diff)
downloadqtlocation-mapboxgl-2e9fb06941720f7cc22fa8d8d54aa2d0b3fd71c0.tar.gz
[benchmark] rendering interface changes
Diffstat (limited to 'benchmark')
-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
3 files changed, 17 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();
});