@luma.gl/webgl 9.0.0-alpha.51 → 9.0.0-alpha.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +5 -4
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/dist.dev.js +676 -6
- package/dist.min.js +38 -38
- package/package.json +5 -5
- package/src/context/debug/webgl-developer-tools.ts +7 -6
- package/src/adapter/resources/.webgl-render-pipeline.ts.swp +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-developer-tools.d.ts","sourceRoot":"","sources":["../../../src/context/debug/webgl-developer-tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-developer-tools.d.ts","sourceRoot":"","sources":["../../../src/context/debug/webgl-developer-tools.ts"],"names":[],"mappings":"AAUA,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAoBF,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,eAAe,EAAE,GAAG,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CAO7D;AAID,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,qBAAqB,EAAE,KAAK,GAAE,iBAAsB,GAAG,qBAAqB,GAAG,IAAI,CAOvH"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { log, loadScript } from '@luma.gl/core';
|
|
2
|
+
import { GL as GLEnum } from '@luma.gl/constants';
|
|
2
3
|
import { isBrowser } from '@probe.gl/env';
|
|
3
4
|
const WEBGL_DEBUG_CDN_URL = 'https://unpkg.com/webgl-debug@2.0.1/index.js';
|
|
4
5
|
function getContextData(gl) {
|
|
@@ -33,13 +34,13 @@ function getDebugContext(gl, props) {
|
|
|
33
34
|
return data.debugContext;
|
|
34
35
|
}
|
|
35
36
|
globalThis.WebGLDebugUtils.init({
|
|
36
|
-
...
|
|
37
|
+
...GLEnum,
|
|
37
38
|
...gl
|
|
38
39
|
});
|
|
39
40
|
const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(gl, onGLError.bind(null, props), onValidateGLFunc.bind(null, props));
|
|
40
|
-
for (const key in
|
|
41
|
-
if (!(key in glDebug) && typeof
|
|
42
|
-
glDebug[key] =
|
|
41
|
+
for (const key in GLEnum) {
|
|
42
|
+
if (!(key in glDebug) && typeof GLEnum[key] === 'number') {
|
|
43
|
+
glDebug[key] = GLEnum[key];
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
class WebGLDebugContext {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-developer-tools.js","names":["log","loadScript","isBrowser","WEBGL_DEBUG_CDN_URL","getContextData","gl","luma","loadWebGLDeveloperTools","globalThis","WebGLDebugUtils","global","module","makeDebugContext","props","arguments","length","undefined","debug","getDebugContext","getRealContext","data","realContext","warn","debugContext","init","GL","glDebug","onGLError","bind","onValidateGLFunc","key","WebGLDebugContext","Object","setPrototypeOf","getPrototypeOf","create","getFunctionString","functionName","functionArgs","Array","from","map","arg","args","glFunctionArgsToString","slice","err","errorMessage","glEnumToString","glName","webgl2","message","error","throwOnError","Error","functionString","level","break","isBreakpoint","every","breakOn","indexOf"],"sources":["../../../src/context/debug/webgl-developer-tools.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {log, loadScript} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {isBrowser} from '@probe.gl/env'\n\nconst WEBGL_DEBUG_CDN_URL = 'https://unpkg.com/webgl-debug@2.0.1/index.js';\n\ntype DebugContextProps = {\n debug?: boolean;\n throwOnError?: boolean;\n break?: string[];\n webgl2?: boolean;\n};\n\n// const DEFAULT_DEBUG_CONTEXT_PROPS: Required<DebugContextProps> = {\n// debug: true,\n// throwOnError: false,\n// break: [],\n// webgl2: false,\n// }\n\ntype ContextData = {\n realContext?: WebGLRenderingContext;\n debugContext?: WebGLRenderingContext;\n}\n\n// Helper to get shared context data\nfunction getContextData(gl: any): ContextData {\n gl.luma = gl.luma || {};\n return gl.luma;\n}\n\ndeclare global {\n // eslint-disable-next-line no-var\n var WebGLDebugUtils: any;\n}\n\n/**\n * Loads Khronos WebGLDeveloperTools from CDN if not already installed \n * const WebGLDebugUtils = require('webgl-debug');\n * @see https://github.com/KhronosGroup/WebGLDeveloperTools\n * @see https://github.com/vorg/webgl-debug\n */\nexport async function loadWebGLDeveloperTools(): Promise<void> {\n if (isBrowser() && !globalThis.WebGLDebugUtils) {\n globalThis.global = globalThis.global || globalThis;\n // @ts-expect-error Developer tools expects global to be set\n globalThis.global.module = {};\n await loadScript(WEBGL_DEBUG_CDN_URL);\n }\n}\n\n// Returns (a potentially new) context with debug instrumentation turned off or on.\n// Note that this actually returns a new context\nexport function makeDebugContext(gl: WebGLRenderingContext, props: DebugContextProps = {}): WebGLRenderingContext | null {\n // Return null to ensure we don't try to create a context in this case (TODO what case is that?)\n if (!gl) {\n return null;\n }\n\n return props.debug ? getDebugContext(gl, props) : getRealContext(gl);\n}\n\n// Returns the real context from either of the real/debug contexts\nfunction getRealContext(gl: WebGLRenderingContext): WebGLRenderingContext {\n const data = getContextData(gl);\n // If the context has a realContext member, it is a debug context so return the realContext\n return data.realContext ? data.realContext : gl;\n}\n\n// Returns the debug context from either of the real/debug contexts\nfunction getDebugContext(gl: WebGLRenderingContext, props: DebugContextProps): WebGLRenderingContext {\n if (!globalThis.WebGLDebugUtils) {\n log.warn('webgl-debug not loaded')();\n return gl;\n }\n\n const data = getContextData(gl);\n\n // If this already has a debug context, return it.\n if (data.debugContext) {\n return data.debugContext;\n }\n\n // Create a new debug context\n globalThis.WebGLDebugUtils.init({...GL, ...gl});\n const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(\n gl,\n onGLError.bind(null, props),\n onValidateGLFunc.bind(null, props)\n );\n\n // Make sure we have all WebGL2 and extension constants (todo dynamic import to circumvent minification?)\n for (const key in GL) {\n if (!(key in glDebug) && typeof GL[key] === 'number') {\n glDebug[key] = GL[key];\n }\n }\n \n // Ensure we have a clean prototype on the instrumented object\n // Note: setPrototypeOf does come with perf warnings, but we already take a bigger perf reduction\n // by synchronizing the WebGL errors after each WebGL call.\n class WebGLDebugContext {}\n Object.setPrototypeOf(glDebug, Object.getPrototypeOf(gl));\n Object.setPrototypeOf(WebGLDebugContext, glDebug);\n const debugContext = Object.create(WebGLDebugContext);\n // Store the debug context\n data.realContext = gl;\n data.debugContext = debugContext;\n debugContext.debug = true;\n\n // Return it\n return debugContext;\n}\n\n// DEBUG TRACING\n\nfunction getFunctionString(functionName: string, functionArgs): string {\n // Cover bug in webgl-debug-tools\n functionArgs = Array.from(functionArgs).map(arg => arg === undefined ? 'undefined' : arg);\n let args = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, functionArgs);\n args = `${args.slice(0, 100)}${args.length > 100 ? '...' : ''}`;\n return `gl.${functionName}(${args})`;\n}\n\nfunction onGLError(props: DebugContextProps, err, functionName: string, args: any[]): void {\n // Cover bug in webgl-debug-tools\n args = Array.from(args).map(arg => arg === undefined ? 'undefined' : arg);\n const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);\n const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);\n const glName = props.webgl2 ? 'gl2' : 'gl1';\n const message = `${errorMessage} in ${glName}.${functionName}(${functionArgs})`;\n log.error(message)();\n debugger; // eslint-disable-line\n if (props.throwOnError) {\n throw new Error(message);\n }\n}\n\n// Don't generate function string until it is needed\nfunction onValidateGLFunc(props: DebugContextProps, functionName: string, functionArgs: any[]): void {\n let functionString: string = '';\n if (log.level >= 1) {\n functionString = getFunctionString(functionName, functionArgs);\n log.log(1, functionString)();\n }\n\n // If array of breakpoint strings supplied, check if any of them is contained in current GL function\n if (props.break && props.break.length > 0) {\n functionString = functionString || getFunctionString(functionName, functionArgs);\n const isBreakpoint = props.break.every((breakOn: string) => functionString.indexOf(breakOn) !== -1);\n if (isBreakpoint) {\n debugger; // eslint-disable-line\n }\n }\n\n for (const arg of functionArgs) {\n if (arg === undefined) {\n functionString = functionString || getFunctionString(functionName, functionArgs);\n if (props.throwOnError) {\n throw new Error(`Undefined argument: ${functionString}`);\n } else {\n log.error(`Undefined argument: ${functionString}`)();\n debugger; // eslint-disable-line\n }\n }\n }\n}\n"],"mappings":"AAGA,SAAQA,GAAG,EAAEC,UAAU,QAAO,eAAe;AAE7C,SAAQC,SAAS,QAAO,eAAe;AAEvC,MAAMC,mBAAmB,GAAG,8CAA8C;AAsB1E,SAASC,cAAcA,CAACC,EAAO,EAAe;EAC5CA,EAAE,CAACC,IAAI,GAAGD,EAAE,CAACC,IAAI,IAAI,CAAC,CAAC;EACvB,OAAOD,EAAE,CAACC,IAAI;AAChB;AAaA,OAAO,eAAeC,uBAAuBA,CAAA,EAAkB;EAC7D,IAAIL,SAAS,CAAC,CAAC,IAAI,CAACM,UAAU,CAACC,eAAe,EAAE;IAC9CD,UAAU,CAACE,MAAM,GAAGF,UAAU,CAACE,MAAM,IAAIF,UAAU;IAEnDA,UAAU,CAACE,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;IAC7B,MAAMV,UAAU,CAACE,mBAAmB,CAAC;EACvC;AACF;AAIA,OAAO,SAASS,gBAAgBA,CAACP,EAAyB,EAA+D;EAAA,IAA7DQ,KAAwB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEvF,IAAI,CAACT,EAAE,EAAE;IACP,OAAO,IAAI;EACb;EAEA,OAAOQ,KAAK,CAACI,KAAK,GAAGC,eAAe,CAACb,EAAE,EAA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-developer-tools.js","names":["log","loadScript","GL","GLEnum","isBrowser","WEBGL_DEBUG_CDN_URL","getContextData","gl","luma","loadWebGLDeveloperTools","globalThis","WebGLDebugUtils","global","module","makeDebugContext","props","arguments","length","undefined","debug","getDebugContext","getRealContext","data","realContext","warn","debugContext","init","glDebug","onGLError","bind","onValidateGLFunc","key","WebGLDebugContext","Object","setPrototypeOf","getPrototypeOf","create","getFunctionString","functionName","functionArgs","Array","from","map","arg","args","glFunctionArgsToString","slice","err","errorMessage","glEnumToString","glName","webgl2","message","error","throwOnError","Error","functionString","level","break","isBreakpoint","every","breakOn","indexOf"],"sources":["../../../src/context/debug/webgl-developer-tools.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {log, loadScript} from '@luma.gl/core';\n// Rename constant to prevent inlining. We need the full set of constants for generating debug strings.\nimport {GL as GLEnum} from '@luma.gl/constants';\nimport {isBrowser} from '@probe.gl/env'\n\nconst WEBGL_DEBUG_CDN_URL = 'https://unpkg.com/webgl-debug@2.0.1/index.js';\n\ntype DebugContextProps = {\n debug?: boolean;\n throwOnError?: boolean;\n break?: string[];\n webgl2?: boolean;\n};\n\n// const DEFAULT_DEBUG_CONTEXT_PROPS: Required<DebugContextProps> = {\n// debug: true,\n// throwOnError: false,\n// break: [],\n// webgl2: false,\n// }\n\ntype ContextData = {\n realContext?: WebGLRenderingContext;\n debugContext?: WebGLRenderingContext;\n}\n\n// Helper to get shared context data\nfunction getContextData(gl: any): ContextData {\n gl.luma = gl.luma || {};\n return gl.luma;\n}\n\ndeclare global {\n // eslint-disable-next-line no-var\n var WebGLDebugUtils: any;\n}\n\n/**\n * Loads Khronos WebGLDeveloperTools from CDN if not already installed \n * const WebGLDebugUtils = require('webgl-debug');\n * @see https://github.com/KhronosGroup/WebGLDeveloperTools\n * @see https://github.com/vorg/webgl-debug\n */\nexport async function loadWebGLDeveloperTools(): Promise<void> {\n if (isBrowser() && !globalThis.WebGLDebugUtils) {\n globalThis.global = globalThis.global || globalThis;\n // @ts-expect-error Developer tools expects global to be set\n globalThis.global.module = {};\n await loadScript(WEBGL_DEBUG_CDN_URL);\n }\n}\n\n// Returns (a potentially new) context with debug instrumentation turned off or on.\n// Note that this actually returns a new context\nexport function makeDebugContext(gl: WebGLRenderingContext, props: DebugContextProps = {}): WebGLRenderingContext | null {\n // Return null to ensure we don't try to create a context in this case (TODO what case is that?)\n if (!gl) {\n return null;\n }\n\n return props.debug ? getDebugContext(gl, props) : getRealContext(gl);\n}\n\n// Returns the real context from either of the real/debug contexts\nfunction getRealContext(gl: WebGLRenderingContext): WebGLRenderingContext {\n const data = getContextData(gl);\n // If the context has a realContext member, it is a debug context so return the realContext\n return data.realContext ? data.realContext : gl;\n}\n\n// Returns the debug context from either of the real/debug contexts\nfunction getDebugContext(gl: WebGLRenderingContext, props: DebugContextProps): WebGLRenderingContext {\n if (!globalThis.WebGLDebugUtils) {\n log.warn('webgl-debug not loaded')();\n return gl;\n }\n\n const data = getContextData(gl);\n\n // If this already has a debug context, return it.\n if (data.debugContext) {\n return data.debugContext;\n }\n\n // Create a new debug context\n globalThis.WebGLDebugUtils.init({...GLEnum, ...gl});\n const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(\n gl,\n onGLError.bind(null, props),\n onValidateGLFunc.bind(null, props)\n );\n\n // Make sure we have all WebGL2 and extension constants (todo dynamic import to circumvent minification?)\n for (const key in GLEnum) {\n if (!(key in glDebug) && typeof GLEnum[key] === 'number') {\n glDebug[key] = GLEnum[key];\n }\n }\n \n // Ensure we have a clean prototype on the instrumented object\n // Note: setPrototypeOf does come with perf warnings, but we already take a bigger perf reduction\n // by synchronizing the WebGL errors after each WebGL call.\n class WebGLDebugContext {}\n Object.setPrototypeOf(glDebug, Object.getPrototypeOf(gl));\n Object.setPrototypeOf(WebGLDebugContext, glDebug);\n const debugContext = Object.create(WebGLDebugContext);\n // Store the debug context\n data.realContext = gl;\n data.debugContext = debugContext;\n debugContext.debug = true;\n\n // Return it\n return debugContext;\n}\n\n// DEBUG TRACING\n\nfunction getFunctionString(functionName: string, functionArgs): string {\n // Cover bug in webgl-debug-tools\n functionArgs = Array.from(functionArgs).map(arg => arg === undefined ? 'undefined' : arg);\n let args = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, functionArgs);\n args = `${args.slice(0, 100)}${args.length > 100 ? '...' : ''}`;\n return `gl.${functionName}(${args})`;\n}\n\nfunction onGLError(props: DebugContextProps, err, functionName: string, args: any[]): void {\n // Cover bug in webgl-debug-tools\n args = Array.from(args).map(arg => arg === undefined ? 'undefined' : arg);\n const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);\n const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);\n const glName = props.webgl2 ? 'gl2' : 'gl1';\n const message = `${errorMessage} in ${glName}.${functionName}(${functionArgs})`;\n log.error(message)();\n debugger; // eslint-disable-line\n if (props.throwOnError) {\n throw new Error(message);\n }\n}\n\n// Don't generate function string until it is needed\nfunction onValidateGLFunc(props: DebugContextProps, functionName: string, functionArgs: any[]): void {\n let functionString: string = '';\n if (log.level >= 1) {\n functionString = getFunctionString(functionName, functionArgs);\n log.log(1, functionString)();\n }\n\n // If array of breakpoint strings supplied, check if any of them is contained in current GLEnum function\n if (props.break && props.break.length > 0) {\n functionString = functionString || getFunctionString(functionName, functionArgs);\n const isBreakpoint = props.break.every((breakOn: string) => functionString.indexOf(breakOn) !== -1);\n if (isBreakpoint) {\n debugger; // eslint-disable-line\n }\n }\n\n for (const arg of functionArgs) {\n if (arg === undefined) {\n functionString = functionString || getFunctionString(functionName, functionArgs);\n if (props.throwOnError) {\n throw new Error(`Undefined argument: ${functionString}`);\n } else {\n log.error(`Undefined argument: ${functionString}`)();\n debugger; // eslint-disable-line\n }\n }\n }\n}\n"],"mappings":"AAGA,SAAQA,GAAG,EAAEC,UAAU,QAAO,eAAe;AAE7C,SAAQC,EAAE,IAAIC,MAAM,QAAO,oBAAoB;AAC/C,SAAQC,SAAS,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