summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-02 14:11:37 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-04-05 11:49:17 +0200
commit4f735db9d83aac7b105d8e7d3fea14159ad04fb5 (patch)
tree04dff7a042cc51c10b264d98830b2cf4d3f46948 /src
parentb0c012fdc5979c158be2203c0970ab3d8d399fa9 (diff)
downloadqtlocation-mapboxgl-4f735db9d83aac7b105d8e7d3fea14159ad04fb5.tar.gz
[core] move RenderParameters creation to a later stage
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index f5f87fc7fd..2f97e4fc33 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -224,19 +224,6 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
staticData = std::make_unique<RenderStaticData>(backend.getContext(), pixelRatio, programCacheDir);
}
- PaintParameters parameters {
- backend.getContext(),
- pixelRatio,
- contextMode,
- backend,
- updateParameters,
- renderLight.getEvaluated(),
- *staticData,
- *imageManager,
- *lineAtlas,
- placement->getVariableOffsets()
- };
-
Color backgroundColor;
struct RenderItem {
@@ -250,6 +237,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
std::vector<const RenderLayerSymbolInterface*> renderItemsWithSymbols;
// Update all sources and initialize renderItems.
+ staticData->has3D = false;
renderItems.reserve(layerImpls->size());
for (const auto& sourceImpl : *sourceImpls) {
RenderSource* source = renderSources.at(sourceImpl->id).get();
@@ -263,7 +251,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
const auto* layerInfo = layerImpl->getTypeInfo();
bool layerNeedsRendering = layer->needsRendering(zoomHistory.lastZoom);
- parameters.staticData.has3D = (parameters.staticData.has3D || layerInfo->pass3d == LayerTypeInfo::Pass3D::Required);
+ staticData->has3D = (staticData->has3D || layerInfo->pass3d == LayerTypeInfo::Pass3D::Required);
if (layerInfo->source != LayerTypeInfo::Source::NotRequired) {
if (layerImpl->source == sourceImpl->id) {
@@ -280,7 +268,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
// Handle layers without source.
if (layerNeedsRendering && sourceImpl.get() == sourceImpls->at(0).get()) {
- if (parameters.contextMode == GLContextMode::Unique
+ if (contextMode == GLContextMode::Unique
&& layerImpl.get() == layerImpls->at(0).get()) {
const auto& solidBackground = layer->getSolidBackground();
if (solidBackground) {
@@ -315,46 +303,49 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
continue;
}
- renderItem.layer.setRenderTiles(renderItem.source->getRenderTiles(), parameters.state);
+ renderItem.layer.setRenderTiles(renderItem.source->getRenderTiles(), updateParameters.transformState);
if (const RenderLayerSymbolInterface* symbolLayer = renderItem.layer.getSymbolInterface()) {
renderItemsWithSymbols.push_back(symbolLayer);
}
}
{
- if (parameters.mapMode != MapMode::Continuous) {
+ if (updateParameters.mode != MapMode::Continuous) {
// TODO: Think about right way for symbol index to handle still rendering
crossTileSymbolIndex.reset();
}
bool symbolBucketsChanged = false;
- const bool placementChanged = !placement->stillRecent(parameters.timePoint);
+ const bool placementChanged = !placement->stillRecent(updateParameters.timePoint);
std::set<std::string> usedSymbolLayers;
if (placementChanged) {
- placement = std::make_unique<Placement>(parameters.state, parameters.mapMode, updateParameters.transitionOptions, updateParameters.crossSourceCollisions, std::move(placement));
+ placement = std::make_unique<Placement>(
+ updateParameters.transformState, updateParameters.mode,
+ updateParameters.transitionOptions, updateParameters.crossSourceCollisions,
+ std::move(placement));
}
for (auto it = renderItemsWithSymbols.rbegin(); it != renderItemsWithSymbols.rend(); ++it) {
const RenderLayerSymbolInterface *symbolLayer = *it;
- if (crossTileSymbolIndex.addLayer(*symbolLayer, parameters.state.getLatLng().longitude())) symbolBucketsChanged = true;
+ if (crossTileSymbolIndex.addLayer(*symbolLayer, updateParameters.transformState.getLatLng().longitude())) symbolBucketsChanged = true;
if (placementChanged) {
usedSymbolLayers.insert(symbolLayer->layerID());
- placement->placeLayer(*symbolLayer, parameters.projMatrix, parameters.debugOptions & MapDebugOptions::Collision);
+ mat4 projMatrix;
+ updateParameters.transformState.getProjMatrix(projMatrix);
+ placement->placeLayer(*symbolLayer, projMatrix, updateParameters.debugOptions & MapDebugOptions::Collision);
}
}
if (placementChanged) {
- placement->commit(parameters.timePoint);
+ placement->commit(updateParameters.timePoint);
crossTileSymbolIndex.pruneUnusedLayers(usedSymbolLayers);
- parameters.variableOffsets = placement->getVariableOffsets();
updateFadingTiles();
} else {
placement->setStale();
}
- parameters.symbolFadeChange = placement->symbolFadeChange(parameters.timePoint);
if (placementChanged || symbolBucketsChanged) {
for (auto it = renderItemsWithSymbols.rbegin(); it != renderItemsWithSymbols.rend(); ++it) {
@@ -364,6 +355,21 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
}
}
+ PaintParameters parameters {
+ backend.getContext(),
+ pixelRatio,
+ contextMode,
+ backend,
+ updateParameters,
+ renderLight.getEvaluated(),
+ *staticData,
+ *imageManager,
+ *lineAtlas,
+ placement->getVariableOffsets()
+ };
+
+ parameters.symbolFadeChange = placement->symbolFadeChange(updateParameters.timePoint);
+
// TODO: remove cast
gl::Context& glContext = static_cast<gl::Context&>(parameters.context);