diff --git a/js/ui/map.js b/js/ui/map.js index 933d2084ce0..341193546d0 100755 --- a/js/ui/map.js +++ b/js/ui/map.js @@ -1051,6 +1051,15 @@ class Map extends Camera { return; } + const MAX_RENDERBUFFER_SIZE = gl.MAX_RENDERBUFFER_SIZE / 2; + if (this._canvas.width > MAX_RENDERBUFFER_SIZE || + this._canvas.height > MAX_RENDERBUFFER_SIZE) { + this.fire('error', { + error: new Error('Map canvas is larger than allowed by gl.MAX_RENDERBUFFER_SIZE') + }); + return; + } + this.painter = new Painter(gl, this.transform); }