MCPcopy Create free account
hub / github.com/microsoft/SandDance / getDebugContext

Function getDebugContext

docs/tests/v2/es6/js/sanddance.js:9060–9100  ·  view source on GitHub ↗
(gl)

Source from the content-addressed store, hash-verified

9058
9059
9060function getDebugContext(gl) {
9061 if (gl === null) {
9062 // Return to ensure we don't create a context in this case.
9063 return null;
9064 }
9065
9066 if (!_globals.global.WebGLDebug) {
9067 _utils.log.warn('WebGL debug mode not activated. import "luma.gl/debug" to enable.')();
9068
9069 return gl;
9070 }
9071
9072 var data = getContextData(gl); // If this *is* a debug context, return itself
9073
9074 if (data.realContext) {
9075 return gl;
9076 } // If this already has a debug context, return it.
9077
9078
9079 if (data.debugContext) {
9080 return data.debugContext;
9081 } // Create a new debug context
9082
9083
9084 var WebGLDebugContext = function WebGLDebugContext() {
9085 (0, _classCallCheck2.default)(this, WebGLDebugContext);
9086 };
9087
9088 var debugContext = _globals.global.WebGLDebug.makeDebugContext(gl, onGLError, onValidateGLFunc);
9089
9090 Object.assign(WebGLDebugContext.prototype, debugContext); // Store the debug context
9091
9092 data.debugContext = debugContext;
9093 debugContext.debug = true;
9094 debugContext.gl = gl;
9095
9096 _utils.log.info('debug context actived.'); // Return it
9097
9098
9099 return debugContext;
9100} // DEBUG TRACING
9101
9102
9103function getFunctionString(functionName, functionArgs) {

Callers 1

makeDebugContextFunction · 0.85

Calls 3

getContextDataFunction · 0.85
warnMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected