summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp39
-rw-r--r--src/mbgl/renderer/painter.cpp56
2 files changed, 42 insertions, 53 deletions
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
index f33a039981..e06c43c112 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
@@ -49,6 +49,18 @@ void RenderFillExtrusionLayer::render(Painter& painter, PaintParameters& paramet
return;
}
+ const auto size = painter.context.viewport.getCurrentValue().size;
+
+ if (!painter.extrusionTexture || painter.extrusionTexture->getSize() != size) {
+ painter.extrusionTexture = OffscreenTexture(painter.context, size, OffscreenTextureAttachment::Depth);
+ }
+
+ painter.extrusionTexture->bind();
+
+ painter.context.setStencilMode(gl::StencilMode::disabled());
+ painter.context.setDepthMode(painter.depthModeForSublayer(0, gl::DepthMode::ReadWrite));
+ painter.context.clear(Color{ 0.0f, 0.0f, 0.0f, 0.0f }, 1.0f, {});
+
if (evaluated.get<FillExtrusionPattern>().from.empty()) {
for (const RenderTile& tile : renderTiles) {
assert(dynamic_cast<FillExtrusionBucket*>(tile.tile.getBucket(*baseImpl)));
@@ -117,6 +129,33 @@ void RenderFillExtrusionLayer::render(Painter& painter, PaintParameters& paramet
getID());
}
}
+
+ parameters.view.bind();
+ painter.context.bindTexture(painter.extrusionTexture->getTexture());
+
+ mat4 viewportMat;
+ matrix::ortho(viewportMat, 0, size.width, size.height, 0, 0, 1);
+
+ const Properties<>::PossiblyEvaluated properties;
+
+ parameters.programs.extrusionTexture.draw(
+ painter.context,
+ gl::Triangles(),
+ gl::DepthMode::disabled(),
+ gl::StencilMode::disabled(),
+ painter.colorModeForRenderPass(),
+ ExtrusionTextureProgram::UniformValues{
+ uniforms::u_matrix::Value{ viewportMat }, uniforms::u_world::Value{ size },
+ uniforms::u_image::Value{ 0 },
+ uniforms::u_opacity::Value{ evaluated.get<FillExtrusionOpacity>() }
+ },
+ painter.extrusionTextureVertexBuffer,
+ painter.quadTriangleIndexBuffer,
+ painter.extrusionTextureSegments,
+ ExtrusionTextureProgram::PaintPropertyBinders{ properties, 0 },
+ properties,
+ painter.state.getZoom(),
+ getID());
}
bool RenderFillExtrusionLayer::queryIntersectsFeature(
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index 78bac8b44c..903229dfeb 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -341,59 +341,9 @@ void Painter::renderPass(PaintParameters& parameters,
for (; it != end; ++it, i += increment) {
currentLayer = i;
-
- const auto& item = *it;
- const RenderLayer& layer = item.layer;
-
- if (!layer.hasRenderPass(pass))
- continue;
-
- if (layer.is<RenderFillExtrusionLayer>()) {
- MBGL_DEBUG_GROUP(context, item.layer.getID());
-
- const auto size = context.viewport.getCurrentValue().size;
-
- if (!extrusionTexture || extrusionTexture->getSize() != size) {
- extrusionTexture = OffscreenTexture(context, size, OffscreenTextureAttachment::Depth);
- }
-
- extrusionTexture->bind();
-
- context.setStencilMode(gl::StencilMode::disabled());
- context.setDepthMode(depthModeForSublayer(0, gl::DepthMode::ReadWrite));
- context.clear(Color{ 0.0f, 0.0f, 0.0f, 0.0f }, 1.0f, {});
-
- item.layer.render(*this, parameters, item.source);
-
- parameters.view.bind();
- context.bindTexture(extrusionTexture->getTexture());
-
- mat4 viewportMat;
- matrix::ortho(viewportMat, 0, size.width, size.height, 0, 0, 1);
-
- const Properties<>::PossiblyEvaluated properties;
-
- parameters.programs.extrusionTexture.draw(
- context,
- gl::Triangles(),
- gl::DepthMode::disabled(),
- gl::StencilMode::disabled(),
- colorModeForRenderPass(),
- ExtrusionTextureProgram::UniformValues{
- uniforms::u_matrix::Value{ viewportMat }, uniforms::u_world::Value{ size },
- uniforms::u_image::Value{ 0 },
- uniforms::u_opacity::Value{ layer.as<RenderFillExtrusionLayer>()
- ->evaluated.get<FillExtrusionOpacity>() } },
- extrusionTextureVertexBuffer,
- quadTriangleIndexBuffer,
- extrusionTextureSegments,
- ExtrusionTextureProgram::PaintPropertyBinders{ properties, 0 },
- properties,
- state.getZoom(),
- layer.getID());
- } else {
- MBGL_DEBUG_GROUP(context, item.layer.getID());
- item.layer.render(*this, parameters, item.source);
+ if (it->layer.hasRenderPass(pass)) {
+ MBGL_DEBUG_GROUP(context, it->layer.getID());
+ it->layer.render(*this, parameters, it->source);
}
}