From 6431e6147a098c82ac5c96973309410a77b7dc40 Mon Sep 17 00:00:00 2001 From: Isaac Besora Date: Mon, 28 Oct 2024 14:00:55 +0100 Subject: [PATCH 1/2] Don't suppress WebGL errors --- src/render/program.ts | 6 +++--- src/ui/map.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/render/program.ts b/src/render/program.ts index 1d3638547c..b311dce51a 100644 --- a/src/render/program.ts +++ b/src/render/program.ts @@ -94,7 +94,7 @@ export class Program { gl.compileShader(fragmentShader); if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) { - throw new Error(`Could not compile fragment shader: ${gl.getShaderInfoLog(fragmentShader)}`); + throw new Error(`WebGL: Could not compile fragment shader: ${gl.getShaderInfoLog(fragmentShader)}`); } gl.attachShader(this.program, fragmentShader); @@ -108,7 +108,7 @@ export class Program { gl.compileShader(vertexShader); if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) { - throw new Error(`Could not compile vertex shader: ${gl.getShaderInfoLog(vertexShader)}`); + throw new Error(`WebGL: Could not compile vertex shader: ${gl.getShaderInfoLog(vertexShader)}`); } gl.attachShader(this.program, vertexShader); @@ -128,7 +128,7 @@ export class Program { gl.linkProgram(this.program); if (!gl.getProgramParameter(this.program, gl.LINK_STATUS)) { - throw new Error(`Program failed to link: ${gl.getProgramInfoLog(this.program)}`); + throw new Error(`WebGL: Program failed to link: ${gl.getProgramInfoLog(this.program)}`); } gl.deleteShader(vertexShader); diff --git a/src/ui/map.ts b/src/ui/map.ts index ef1bcc087f..1879b83918 100644 --- a/src/ui/map.ts +++ b/src/ui/map.ts @@ -3341,7 +3341,11 @@ export class Map extends Camera { PerformanceUtils.frame(paintStartTimeStamp); this._frameRequest = null; this._render(paintStartTimeStamp); - }).catch(() => {}); // ignore abort error + }).catch((error: Error) => { + if (error.message.startsWith('WebGL:')) { + throw error; + } + }); // ignore abort error } } From 01cf6ea6134749c7af2fbf11b1cc9d8b308dc1a1 Mon Sep 17 00:00:00 2001 From: Isaac Besora Date: Mon, 28 Oct 2024 15:51:52 +0100 Subject: [PATCH 2/2] Only supress abort error --- src/render/program.ts | 6 +++--- src/ui/map.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/render/program.ts b/src/render/program.ts index b311dce51a..1d3638547c 100644 --- a/src/render/program.ts +++ b/src/render/program.ts @@ -94,7 +94,7 @@ export class Program { gl.compileShader(fragmentShader); if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) { - throw new Error(`WebGL: Could not compile fragment shader: ${gl.getShaderInfoLog(fragmentShader)}`); + throw new Error(`Could not compile fragment shader: ${gl.getShaderInfoLog(fragmentShader)}`); } gl.attachShader(this.program, fragmentShader); @@ -108,7 +108,7 @@ export class Program { gl.compileShader(vertexShader); if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) { - throw new Error(`WebGL: Could not compile vertex shader: ${gl.getShaderInfoLog(vertexShader)}`); + throw new Error(`Could not compile vertex shader: ${gl.getShaderInfoLog(vertexShader)}`); } gl.attachShader(this.program, vertexShader); @@ -128,7 +128,7 @@ export class Program { gl.linkProgram(this.program); if (!gl.getProgramParameter(this.program, gl.LINK_STATUS)) { - throw new Error(`WebGL: Program failed to link: ${gl.getProgramInfoLog(this.program)}`); + throw new Error(`Program failed to link: ${gl.getProgramInfoLog(this.program)}`); } gl.deleteShader(vertexShader); diff --git a/src/ui/map.ts b/src/ui/map.ts index 1879b83918..185190a21f 100644 --- a/src/ui/map.ts +++ b/src/ui/map.ts @@ -64,6 +64,7 @@ import {MercatorTransform} from '../geo/projection/mercator_transform'; import {ITransform} from '../geo/transform_interface'; import {ICameraHelper} from '../geo/projection/camera_helper'; import {MercatorCameraHelper} from '../geo/projection/mercator_camera_helper'; +import {isAbortError} from '../util/abort_error'; const version = packageJSON.version; @@ -3342,7 +3343,7 @@ export class Map extends Camera { this._frameRequest = null; this._render(paintStartTimeStamp); }).catch((error: Error) => { - if (error.message.startsWith('WebGL:')) { + if (!isAbortError(error)) { throw error; } }); // ignore abort error