diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2017-08-07 15:04:08 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2017-08-07 17:20:33 +0300 |
commit | 761f506578ce8e32451d1980ed84d3bd0a05a504 (patch) | |
tree | a02d2ccbd3213eb00686469d4ce50dd2ea3271ac | |
parent | 897824273ffde777b9d7ae86c3c8178f6075ee26 (diff) | |
download | qtlocation-mapboxgl-761f506578ce8e32451d1980ed84d3bd0a05a504.tar.gz |
[core] Do not use polymorphic lambda
Crashes with GCC 5.2.0 needed by Qt Automotive.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68278
-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" + ); } } |