Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove direct use of glContext under node ( mainly for project testing ) #5478

Merged
merged 1 commit into from
Jan 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 4 additions & 47 deletions src/filters/webgl_backend.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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);
Expand Down