Skip to content

Commit 39c7a8f

Browse files
endankestepankuzmin
authored andcommitted
Only precompile shaders when all imports are loaded (internal-918)
1 parent 11a2884 commit 39c7a8f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/style/style.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ class Style extends Evented {
222222
_otherSourceCaches: {[_: string]: SourceCache};
223223
_symbolSourceCaches: {[_: string]: SourceCache};
224224
_loaded: boolean;
225+
_shouldPrecompile: boolean;
225226
_precompileDone: boolean;
226227
_rtlTextPluginCallback: Function;
227228
_changes: StyleChanges;
@@ -317,6 +318,7 @@ class Style extends Evented {
317318
this._symbolSourceCaches = {};
318319
this._loaded = false;
319320
this._precompileDone = false;
321+
this._shouldPrecompile = false;
320322
this._availableImages = [];
321323
this._order = [];
322324
this._markersNeedUpdate = false;
@@ -499,6 +501,7 @@ class Style extends Evented {
499501
options: this.options
500502
});
501503

504+
this._shouldPrecompile = this.importDepth === 0;
502505
this.fire(new Event('data', {dataType: 'style'}));
503506
this.fire(new Event(this.importDepth === 0 ? 'style.load' : 'style.import.load'));
504507
}
@@ -623,6 +626,7 @@ class Style extends Evented {
623626
options: this.options
624627
});
625628

629+
this._shouldPrecompile = this.importDepth === 0;
626630
this.fire(new Event(this.importDepth === 0 ? 'style.load' : 'style.import.load'));
627631
}
628632
}
@@ -1096,7 +1100,7 @@ class Style extends Evented {
10961100
if (sourceCache) sourceCache.used = true;
10971101
}
10981102

1099-
if (!this._precompileDone) {
1103+
if (!this._precompileDone && this._shouldPrecompile) {
11001104
for (let i = (layer.minzoom || DEFAULT_MIN_ZOOM); i < (layer.maxzoom || DEFAULT_MAX_ZOOM); i++) {
11011105
const painter = this.map.painter;
11021106
if (painter) {
@@ -1126,8 +1130,7 @@ class Style extends Evented {
11261130
}
11271131
}
11281132
}
1129-
1130-
if (this._order.length > 0) {
1133+
if (this._shouldPrecompile) {
11311134
this._precompileDone = true;
11321135
}
11331136

0 commit comments

Comments
 (0)