diff --git a/src/filters/webgl_backend.class.js b/src/filters/webgl_backend.class.js index e69484e3..f352b242 100644 --- a/src/filters/webgl_backend.class.js +++ b/src/filters/webgl_backend.class.js @@ -219,51 +219,6 @@ return pipelineState; }, - /** - * The same as the applyFilter method but with additional logging of WebGL - * errors. - */ - applyFiltersDebug: function(filters, source, width, height, targetCanvas, cacheKey) { - // The following code is useful when debugging a specific issue but adds ~10x slowdown. - var gl = this.gl; - var ret = this.applyFilters(filters, source, width, height, targetCanvas, cacheKey); - var glError = gl.getError(); - if (glError !== gl.NO_ERROR) { - var errorString = this.glErrorToString(gl, glError); - var error = new Error('WebGL Error ' + errorString); - error.glErrorCode = glError; - throw error; - } - return ret; - }, - - glErrorToString: function(context, errorCode) { - if (!context) { - return 'Context undefined for error code: ' + errorCode; - } - else if (typeof errorCode !== 'number') { - return 'Error code is not a number'; - } - switch (errorCode) { - case context.NO_ERROR: - return 'NO_ERROR'; - case context.INVALID_ENUM: - return 'INVALID_ENUM'; - case context.INVALID_VALUE: - return 'INVALID_VALUE'; - case context.INVALID_OPERATION: - return 'INVALID_OPERATION'; - case context.INVALID_FRAMEBUFFER_OPERATION: - return 'INVALID_FRAMEBUFFER_OPERATION'; - case context.OUT_OF_MEMORY: - return 'OUT_OF_MEMORY'; - case context.CONTEXT_LOST_WEBGL: - return 'CONTEXT_LOST_WEBGL'; - default: - return 'UNKNOWN_ERROR'; - } - }, - /** * Detach event listeners, remove references, and clean up caches. */ @@ -357,9 +312,11 @@ if (this.gpuInfo) { return this.gpuInfo; } - var gl = this.gl; + var gl = this.gl, gpuInfo = { renderer: '', vendor: '' }; + if (!gl) { + return gpuInfo; + } var ext = gl.getExtension('WEBGL_debug_renderer_info'); - var gpuInfo = { renderer: '', vendor: '' }; if (ext) { var renderer = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL); var vendor = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);