From c14d390b704aa0d48f3169396f048a060ae3da37 Mon Sep 17 00:00:00 2001 From: Stepan Kuzmin Date: Wed, 21 Dec 2016 01:03:02 +0300 Subject: [PATCH] Issue an error when map canvas is larger than allowed by gl.MAX_RENDERBUFFER_SIZE #2893 --- js/ui/map.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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); }