summaryrefslogtreecommitdiff
path: root/benchmark/api/query.benchmark.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-07-21 16:36:31 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-07-26 09:50:38 -0700
commit32bd1d54fa777035920b58e653905e4592ef187c (patch)
tree3f6fa84d6c9369bdd312ba630538a0c7504fce3a /benchmark/api/query.benchmark.cpp
parent11933f6ab81248a884db3b1f69be714a60b6a86c (diff)
downloadqtlocation-mapboxgl-32bd1d54fa777035920b58e653905e4592ef187c.tar.gz
[node, tests] Consolidate headless rendering logic in HeadlessFrontend
Diffstat (limited to 'benchmark/api/query.benchmark.cpp')
-rw-r--r--benchmark/api/query.benchmark.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp
index 8b96d02163..75695c1ad7 100644
--- a/benchmark/api/query.benchmark.cpp
+++ b/benchmark/api/query.benchmark.cpp
@@ -1,13 +1,9 @@
#include <benchmark/benchmark.h>
-#include <mbgl/benchmark/util.hpp>
#include <mbgl/map/map.hpp>
-#include <mbgl/gl/headless_backend.hpp>
-#include <mbgl/gl/offscreen_view.hpp>
+#include <mbgl/gl/headless_frontend.hpp>
#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/renderer/renderer.hpp>
-#include <mbgl/renderer/backend_scope.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>
@@ -31,17 +27,14 @@ public:
map.getStyle().addImage(std::make_unique<style::Image>("test-icon",
decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")), 1.0));
- mbgl::benchmark::render(map, view);
+ frontend.render(map);
}
util::RunLoop loop;
- HeadlessBackend backend;
- BackendScope scope { backend };
- OffscreenView view{ backend.getContext(), { 1000, 1000 } };
DefaultFileSource fileSource{ "benchmark/fixtures/api/cache.db", "." };
ThreadPool threadPool{ 4 };
- AsyncRendererFrontend rendererFrontend { std::make_unique<Renderer>(backend, 1, fileSource, threadPool), backend, view };
- Map map { rendererFrontend, MapObserver::nullObserver(), view.getSize(), 1, fileSource, threadPool, MapMode::Still };
+ HeadlessFrontend frontend { { 1000, 1000 }, 1, fileSource, threadPool };
+ Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, fileSource, threadPool, MapMode::Still };
ScreenBox box{{ 0, 0 }, { 1000, 1000 }};
};
@@ -51,7 +44,7 @@ static void API_queryRenderedFeaturesAll(::benchmark::State& state) {
QueryBenchmark bench;
while (state.KeepRunning()) {
- bench.rendererFrontend.getRenderer()->queryRenderedFeatures(bench.box, {});
+ bench.frontend.getRenderer()->queryRenderedFeatures(bench.box, {});
}
}
@@ -59,7 +52,7 @@ static void API_queryRenderedFeaturesLayerFromLowDensity(::benchmark::State& sta
QueryBenchmark bench;
while (state.KeepRunning()) {
- bench.rendererFrontend.getRenderer()->queryRenderedFeatures(bench.box, {{{ "testlayer" }}, {}});
+ bench.frontend.getRenderer()->queryRenderedFeatures(bench.box, {{{ "testlayer" }}, {}});
}
}
@@ -67,7 +60,7 @@ static void API_queryRenderedFeaturesLayerFromHighDensity(::benchmark::State& st
QueryBenchmark bench;
while (state.KeepRunning()) {
- bench.rendererFrontend.getRenderer()->queryRenderedFeatures(bench.box, {{{"road-street" }}, {}});
+ bench.frontend.getRenderer()->queryRenderedFeatures(bench.box, {{{"road-street" }}, {}});
}
}