[core] reparse tiles when new data arrives
We're now reparsing tiles when they expire. We're also swapping out buckets atomically to avoid flickering data; i.e. we're displaying the old data as long as we don't have a new parsed bucket for that layer yet. The parsed buckets now live in the *TileData objects rather than in the TileWorker; only partially parsed == pending buckets will remain in the TileWorker. Once they're parsed, they're moved to the *TileData object.
This commit is contained in:
@@ -14,34 +14,38 @@ void Painter::renderTileDebug(const Tile& tile) {
|
||||
assert(tile.data);
|
||||
if (data.getDebug()) {
|
||||
prepareTile(tile);
|
||||
renderDebugText(tile.data->debugBucket, tile.matrix);
|
||||
renderDebugText(*tile.data, tile.matrix);
|
||||
renderDebugFrame(tile.matrix);
|
||||
}
|
||||
}
|
||||
|
||||
void Painter::renderDebugText(DebugBucket& bucket, const mat4 &matrix) {
|
||||
void Painter::renderDebugText(TileData& tileData, const mat4 &matrix) {
|
||||
MBGL_DEBUG_GROUP("debug text");
|
||||
|
||||
config.depthTest = false;
|
||||
|
||||
if (!tileData.debugBucket || tileData.debugBucket->state != tileData.getState()) {
|
||||
tileData.debugBucket = std::make_unique<DebugBucket>(tileData.id, tileData.getState());
|
||||
}
|
||||
|
||||
useProgram(plainShader->program);
|
||||
plainShader->u_matrix = matrix;
|
||||
|
||||
// Draw white outline
|
||||
plainShader->u_color = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
|
||||
lineWidth(4.0f * data.pixelRatio);
|
||||
bucket.drawLines(*plainShader);
|
||||
tileData.debugBucket->drawLines(*plainShader);
|
||||
|
||||
#ifndef GL_ES_VERSION_2_0
|
||||
// Draw line "end caps"
|
||||
MBGL_CHECK_ERROR(glPointSize(2));
|
||||
bucket.drawPoints(*plainShader);
|
||||
tileData.debugBucket->drawPoints(*plainShader);
|
||||
#endif
|
||||
|
||||
// Draw black text.
|
||||
plainShader->u_color = {{ 0.0f, 0.0f, 0.0f, 1.0f }};
|
||||
lineWidth(2.0f * data.pixelRatio);
|
||||
bucket.drawLines(*plainShader);
|
||||
tileData.debugBucket->drawLines(*plainShader);
|
||||
|
||||
config.depthTest = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user