diff options
-rw-r--r-- | DEVELOPING.md | 11 | ||||
-rw-r--r-- | src/mbgl/renderer/render_tile.cpp | 86 |
2 files changed, 63 insertions, 34 deletions
diff --git a/DEVELOPING.md b/DEVELOPING.md index c5c5c53f8a..f70d1f94ea 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -110,3 +110,14 @@ constexpr bool test2(int i) { - Either remove `constexpr` specifier or replace it with `inline` in case of functions + + +## [Polymorphic lambdas](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68278) + +GCC 5.2.0 crashes with polymorphic lambdas and this version of the compiler +is currently used in Qt Automotive. Luckily polymorphic lambdas are rarely +used/needed but we had one incident fixed by #9665. + +### Workarounds + +- Copy & Paste™ the code. diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp index c9912f0563..8df31f8d7c 100644 --- a/src/mbgl/renderer/render_tile.cpp +++ b/src/mbgl/renderer/render_tile.cpp @@ -74,57 +74,75 @@ void RenderTile::finishRender(PaintParameters& parameters) { static const style::Properties<>::PossiblyEvaluated properties {}; static const DebugProgram::PaintPropertyBinders paintAttibuteData(properties, 0); - auto draw = [&] (Color color, const auto& vertexBuffer, const auto& indexBuffer, const auto& segments, auto drawMode) { + if (parameters.debugOptions & (MapDebugOptions::Timestamps | MapDebugOptions::ParseStatus)) { + if (!tile.debugBucket || tile.debugBucket->renderable != tile.isRenderable() || + tile.debugBucket->complete != tile.isComplete() || + !(tile.debugBucket->modified == tile.modified) || + !(tile.debugBucket->expires == tile.expires) || + tile.debugBucket->debugMode != parameters.debugOptions) { + tile.debugBucket = std::make_unique<DebugBucket>( + tile.id, tile.isRenderable(), tile.isComplete(), tile.modified, + tile.expires, parameters.debugOptions, parameters.context); + } + parameters.programs.debug.draw( parameters.context, - drawMode, + gl::Lines { 4.0f * parameters.pixelRatio }, gl::DepthMode::disabled(), parameters.stencilModeForClipping(clip), gl::ColorMode::unblended(), DebugProgram::UniformValues { uniforms::u_matrix::Value{ matrix }, - uniforms::u_color::Value{ color } + uniforms::u_color::Value{ Color::white() } }, - vertexBuffer, - indexBuffer, - segments, + *tile.debugBucket->vertexBuffer, + *tile.debugBucket->indexBuffer, + tile.debugBucket->segments, paintAttibuteData, properties, parameters.state.getZoom(), "debug" ); - }; - - if (parameters.debugOptions & (MapDebugOptions::Timestamps | MapDebugOptions::ParseStatus)) { - if (!tile.debugBucket || tile.debugBucket->renderable != tile.isRenderable() || - tile.debugBucket->complete != tile.isComplete() || - !(tile.debugBucket->modified == tile.modified) || - !(tile.debugBucket->expires == tile.expires) || - tile.debugBucket->debugMode != parameters.debugOptions) { - tile.debugBucket = std::make_unique<DebugBucket>( - tile.id, tile.isRenderable(), tile.isComplete(), tile.modified, - tile.expires, parameters.debugOptions, parameters.context); - } - draw(Color::white(), - *tile.debugBucket->vertexBuffer, - *tile.debugBucket->indexBuffer, - tile.debugBucket->segments, - gl::Lines { 4.0f * parameters.pixelRatio }); - - draw(Color::black(), - *tile.debugBucket->vertexBuffer, - *tile.debugBucket->indexBuffer, - tile.debugBucket->segments, - gl::Lines { 2.0f * parameters.pixelRatio }); + parameters.programs.debug.draw( + parameters.context, + gl::Lines { 2.0f * parameters.pixelRatio }, + gl::DepthMode::disabled(), + parameters.stencilModeForClipping(clip), + gl::ColorMode::unblended(), + DebugProgram::UniformValues { + uniforms::u_matrix::Value{ matrix }, + uniforms::u_color::Value{ Color::black() } + }, + *tile.debugBucket->vertexBuffer, + *tile.debugBucket->indexBuffer, + tile.debugBucket->segments, + paintAttibuteData, + properties, + parameters.state.getZoom(), + "debug" + ); } if (parameters.debugOptions & MapDebugOptions::TileBorders) { - draw(Color::red(), - parameters.staticData.tileVertexBuffer, - parameters.staticData.tileBorderIndexBuffer, - parameters.staticData.tileBorderSegments, - gl::LineStrip { 4.0f * parameters.pixelRatio }); + parameters.programs.debug.draw( + parameters.context, + gl::LineStrip { 4.0f * parameters.pixelRatio }, + gl::DepthMode::disabled(), + parameters.stencilModeForClipping(clip), + gl::ColorMode::unblended(), + DebugProgram::UniformValues { + uniforms::u_matrix::Value{ matrix }, + uniforms::u_color::Value{ Color::red() } + }, + parameters.staticData.tileVertexBuffer, + parameters.staticData.tileBorderIndexBuffer, + parameters.staticData.tileBorderSegments, + paintAttibuteData, + properties, + parameters.state.getZoom(), + "debug" + ); } } |