@luma.gl/webgl 9.0.0-beta.1 → 9.0.0-beta.2
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/adapter/webgl-device.d.ts +8 -0
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +12 -0
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/dist.dev.js +65 -113
- package/dist/index.cjs +65 -152
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist.min.js +38 -38
- package/package.json +5 -5
- package/src/adapter/webgl-device.ts +16 -0
- package/src/index.ts +9 -35
|
@@ -93,6 +93,14 @@ export declare class WebGLDevice extends Device {
|
|
|
93
93
|
sourceHeight?: number;
|
|
94
94
|
sourceType?: number;
|
|
95
95
|
}): Buffer;
|
|
96
|
+
setParametersWebGL(parameters: any): void;
|
|
97
|
+
withParametersWebGL(parameters: any, func: any): any;
|
|
98
|
+
clearWebGL(options?: {
|
|
99
|
+
framebuffer?: Framebuffer;
|
|
100
|
+
color?: any;
|
|
101
|
+
depth?: any;
|
|
102
|
+
stencil?: any;
|
|
103
|
+
}): void;
|
|
96
104
|
/** WebGL1 typed context. Can always be used. */
|
|
97
105
|
readonly gl: WebGLRenderingContext;
|
|
98
106
|
/** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,OAAO,EACP,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAE,aAAa,EAAmB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G7B;IAED;;;OAGG;IACM,UAAU,IAAI,OAAO;IAe9B,8DAA8D;IAC9D,SAAS,IAAI,IAAI;IAIjB,8CAA8C;IAC9C,QAAQ,IAAI,IAAI;IAIhB;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMlE;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,qBAAqB,GAAG,MAAM;IAc5D,sBAAsB;IACtB,UAAU,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;IAElC;;;;;OAKG;IACH,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI;CAsBnE"}
|
|
@@ -22,6 +22,9 @@ import { WEBGLCommandEncoder } from "./resources/webgl-command-encoder.js";
|
|
|
22
22
|
import { WEBGLVertexArray } from "./resources/webgl-vertex-array.js";
|
|
23
23
|
import { WEBGLTransformFeedback } from "./resources/webgl-transform-feedback.js";
|
|
24
24
|
import { readPixelsToArray, readPixelsToBuffer } from "../classic/copy-and-blit.js";
|
|
25
|
+
import { setGLParameters } from "../context/parameters/unified-parameter-api.js";
|
|
26
|
+
import { withGLParameters } from "../context/state-tracker/with-parameters.js";
|
|
27
|
+
import { clear } from "../classic/clear.js";
|
|
25
28
|
const LOG_LEVEL = 1;
|
|
26
29
|
export class WebGLDevice extends Device {
|
|
27
30
|
static isSupported() {
|
|
@@ -267,6 +270,15 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
|
|
|
267
270
|
readPixelsToBufferWebGL2(source, options) {
|
|
268
271
|
return readPixelsToBuffer(source, options);
|
|
269
272
|
}
|
|
273
|
+
setParametersWebGL(parameters) {
|
|
274
|
+
setGLParameters(this, parameters);
|
|
275
|
+
}
|
|
276
|
+
withParametersWebGL(parameters, func) {
|
|
277
|
+
withGLParameters(this, parameters, func);
|
|
278
|
+
}
|
|
279
|
+
clearWebGL(options) {
|
|
280
|
+
clear(this, options);
|
|
281
|
+
}
|
|
270
282
|
get webglLimits() {
|
|
271
283
|
this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);
|
|
272
284
|
return this._webglLimits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-device.js","names":["Device","CanvasContext","log","uid","assert","isBrowser","polyfillContext","popContextState","pushContextState","trackContextState","createBrowserContext","createHeadlessContext","isHeadlessGLRegistered","getDeviceInfo","getDeviceFeatures","getDeviceLimits","getWebGLLimits","WebGLCanvasContext","loadSpectorJS","initializeSpectorJS","loadWebGLDeveloperTools","makeDebugContext","isTextureFormatSupported","isTextureFormatRenderable","isTextureFormatFilterable","WEBGLBuffer","WEBGLShader","WEBGLSampler","WEBGLTexture","WEBGLFramebuffer","WEBGLRenderPass","WEBGLRenderPipeline","WEBGLCommandEncoder","WEBGLVertexArray","WEBGLTransformFeedback","readPixelsToArray","readPixelsToBuffer","LOG_LEVEL","WebGLDevice","isSupported","WebGLRenderingContext","features","_features","gl","limits","_limits","attach","device","isWebGL","Error","create","props","arguments","length","undefined","groupCollapsed","canvas","pageLoaded","get","debug","spector","probe","message","info","type","vendor","renderer","canvasContext","id","table","groupEnd","constructor","_props$gl","_props$gl2","handle","lost","_resolveContextLost","renderPass","gl2","isWebGL1","isWebGL2","_canvasSizeInfo","clientWidth","clientHeight","devicePixelRatio","_extensions","_polyfilled","_webglLimits","_constants","Promise","resolve","onContextLost","event","_this$_resolveContext","call","reason","resize","_version","enable","copyState","_len","args","Array","_key","webgl2","throwOnError","level","Math","max","warn","destroy","ext","getExtension","isLost","isContextLost","getSize","drawingBufferWidth","drawingBufferHeight","format","assertWebGL2","createCanvasContext","createBuffer","newProps","_getBufferProps","_createTexture","createExternalTexture","createSampler","createShader","createFramebuffer","createRenderPipeline","createVertexArray","beginRenderPass","createComputePipeline","beginComputePass","createTransformFeedback","getDefaultRenderPass","framebuffer","getCurrentFramebuffer","createCommandEncoder","submit","_this$renderPass","end","readPixelsToArrayWebGL","source","options","readPixelsToBufferWebGL2","webglLimits","loseDevice","_this$_resolveContext2","deviceLossTriggered","loseContext","pushState","popState","setSpectorMetadata","__SPECTOR_Metadata","getGLKey","value","number","Number","key","String","setConstantAttribute","location","constant","maxVertexAttributes","fill","currentConstant","compareConstantArrayValues","Float32Array","setConstantFloatArray","Int32Array","setConstantIntArray","Uint32Array","setConstantUintArray","WebGL2RenderingContext","Boolean","isFinite","array","vertexAttrib1fv","vertexAttrib2fv","vertexAttrib3fv","vertexAttrib4fv","_device$gl","vertexAttribI4iv","_device$gl2","vertexAttribI4uiv","v1","v2","i"],"sources":["../../src/adapter/webgl-device.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n TextureFormat,\n VertexArray,\n VertexArrayProps,\n Framebuffer,\n Buffer,\n Texture,\n TypedArray\n} from '@luma.gl/core';\nimport {Device, CanvasContext, log, uid, assert} from '@luma.gl/core';\nimport {isBrowser} from '@probe.gl/env';\nimport {polyfillContext} from '../context/polyfill/polyfill-context';\nimport {\n popContextState,\n pushContextState,\n trackContextState\n} from '../context/state-tracker/track-context-state';\nimport {createBrowserContext} from '../context/context/create-browser-context';\nimport {\n createHeadlessContext,\n isHeadlessGLRegistered\n} from '../context/context/create-headless-context';\nimport {getDeviceInfo} from './device-helpers/get-device-info';\nimport {getDeviceFeatures} from './device-helpers/device-features';\nimport {getDeviceLimits, getWebGLLimits, WebGLLimits} from './device-helpers/device-limits';\nimport {WebGLCanvasContext} from './webgl-canvas-context';\nimport {loadSpectorJS, initializeSpectorJS} from '../context/debug/spector';\nimport {loadWebGLDeveloperTools, makeDebugContext} from '../context/debug/webgl-developer-tools';\nimport {\n isTextureFormatSupported,\n isTextureFormatRenderable,\n isTextureFormatFilterable\n} from './converters/texture-formats';\n\n// WebGL classes\nimport type {\n BufferProps,\n ShaderProps,\n // Sampler,\n SamplerProps,\n TextureProps,\n ExternalTexture,\n ExternalTextureProps,\n FramebufferProps,\n // RenderPipeline,\n RenderPipelineProps,\n ComputePipeline,\n ComputePipelineProps,\n // RenderPass,\n RenderPassProps,\n ComputePass,\n ComputePassProps,\n // CommandEncoder,\n CommandEncoderProps,\n TransformFeedbackProps\n} from '@luma.gl/core';\n\nimport {WEBGLBuffer} from './resources/webgl-buffer';\nimport {WEBGLShader} from './resources/webgl-shader';\nimport {WEBGLSampler} from './resources/webgl-sampler';\nimport {WEBGLTexture} from './resources/webgl-texture';\nimport {WEBGLFramebuffer} from './resources/webgl-framebuffer';\nimport {WEBGLRenderPass} from './resources/webgl-render-pass';\nimport {WEBGLRenderPipeline} from './resources/webgl-render-pipeline';\nimport {WEBGLCommandEncoder} from './resources/webgl-command-encoder';\nimport {WEBGLVertexArray} from './resources/webgl-vertex-array';\nimport {WEBGLTransformFeedback} from './resources/webgl-transform-feedback';\n\nimport {readPixelsToArray, readPixelsToBuffer} from '../classic/copy-and-blit';\n\nconst LOG_LEVEL = 1;\n\n/** WebGPU style Device API for a WebGL context */\nexport class WebGLDevice extends Device {\n //\n // Public `Device` API\n //\n\n static type: string = 'webgl';\n\n static isSupported(): boolean {\n return typeof WebGLRenderingContext !== 'undefined' || isHeadlessGLRegistered();\n }\n\n readonly info: DeviceInfo;\n readonly canvasContext: WebGLCanvasContext;\n\n readonly handle: WebGLRenderingContext;\n\n get features(): Set<DeviceFeature> {\n this._features = this._features || getDeviceFeatures(this.gl);\n return this._features;\n }\n\n get limits(): DeviceLimits {\n this._limits = this._limits || getDeviceLimits(this.gl);\n return this._limits;\n }\n\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n private _resolveContextLost?: (value: {reason: 'destroyed'; message: string}) => void;\n private _features?: Set<DeviceFeature>;\n private _limits?: DeviceLimits;\n\n //\n // Static methods, expected to be present by `luma.createDevice()`\n //\n\n /**\n * Get a device instance from a GL context\n * Creates and instruments the device if not already created\n * @param gl\n * @returns\n */\n static attach(gl: Device | WebGLRenderingContext | WebGL2RenderingContext): WebGLDevice {\n if (gl instanceof WebGLDevice) {\n return gl;\n }\n // @ts-expect-error\n if (gl?.device instanceof Device) {\n // @ts-expect-error\n return gl.device as WebGLDevice;\n }\n if (!isWebGL(gl)) {\n throw new Error('Invalid WebGLRenderingContext');\n }\n return new WebGLDevice({gl: gl as WebGLRenderingContext});\n }\n\n static async create(props: DeviceProps = {}): Promise<WebGLDevice> {\n log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created')();\n\n // Wait for page to load. Only wait when props. canvas is string\n // to avoid setting page onload callback unless necessary\n if (typeof props.canvas === 'string') {\n await CanvasContext.pageLoaded;\n }\n\n // Load webgl and spector debug scripts from CDN if requested\n if (log.get('debug') || props.debug) {\n await loadWebGLDeveloperTools();\n }\n\n // @ts-expect-error spector not on props\n const {spector} = props;\n if (log.get('spector') || spector) {\n await loadSpectorJS();\n }\n\n log.probe(LOG_LEVEL + 1, 'DOM is loaded')();\n\n // @ts-expect-error\n if (props.gl && props.gl.device) {\n return WebGLDevice.attach(props.gl);\n }\n\n const device = new WebGLDevice(props);\n\n // Log some debug info about the newly created context\n const message = `\\\nCreated ${device.info.type}${device.debug ? ' debug' : ''} context: \\\n${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;\n log.probe(LOG_LEVEL, message)();\n log.table(LOG_LEVEL, device.info)();\n\n log.groupEnd(LOG_LEVEL)();\n\n return device;\n }\n\n //\n // Public API\n //\n\n constructor(props: DeviceProps) {\n super({...props, id: props.id || uid('webgl-device')});\n\n // If attaching to an already attached context, return the attached device\n // @ts-expect-error device is attached to context\n const device: WebGLDevice | undefined = props.gl?.device;\n if (device) {\n throw new Error(`WebGL context already attached to device ${device.id}`);\n }\n\n // Create and instrument context\n const canvas = props.canvas || props.gl?.canvas;\n this.canvasContext = new WebGLCanvasContext(this, {...props, canvas});\n\n this.lost = new Promise<{reason: 'destroyed'; message: string}>(resolve => {\n this._resolveContextLost = resolve;\n });\n\n const onContextLost = (event: Event) =>\n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Computer entered sleep mode, or too many apps or browser tabs are using the GPU.'\n });\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext | null = props.gl || null;\n gl =\n gl ||\n (isBrowser()\n ? createBrowserContext(this.canvasContext.canvas, {...props, onContextLost})\n : null);\n gl = gl || (!isBrowser() ? createHeadlessContext({...props, onContextLost}) : null);\n\n if (!gl) {\n throw new Error('WebGL context creation failed');\n }\n\n this.handle = gl;\n this.gl = this.handle;\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.isWebGL2 = isWebGL2(this.gl);\n this.isWebGL1 = !this.isWebGL2;\n this.canvasContext.resize();\n\n // luma Device fields\n this.info = getDeviceInfo(this.gl);\n\n // @ts-expect-error Link webgl context back to device\n this.gl.device = this;\n // @ts-expect-error Annotate webgl context to handle\n this.gl._version = this.isWebGL2 ? 2 : 1;\n\n // Add subset of WebGL2 methods to WebGL1 context\n polyfillContext(this.gl);\n\n // Install context state tracking\n // @ts-expect-error - hidden parameters\n const {enable = true, copyState = false} = props;\n trackContextState(this.gl, {\n enable,\n copyState,\n log: (...args: any[]) => log.log(1, ...args)()\n });\n\n // DEBUG contexts: Add debug instrumentation to the context, force log level to at least 1\n if (isBrowser() && props.debug) {\n this.gl = makeDebugContext(this.gl, {...props, webgl2: this.isWebGL2, throwOnError: true});\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.debug = true;\n log.level = Math.max(log.level, 1);\n log.warn('WebGL debug mode activated. Performance reduced.')();\n }\n\n // @ts-expect-error spector not on props\n if (isBrowser() && props.spector) {\n const canvas = this.handle.canvas || (props.canvas as HTMLCanvasElement);\n this.spector = initializeSpectorJS({...this.props, canvas});\n }\n }\n\n /**\n * Destroys the context\n * @note Has no effect for browser contexts, there is no browser API for destroying contexts\n */\n destroy(): void {\n const ext = this.gl.getExtension('STACKGL_destroy_context');\n if (ext) {\n ext.destroy();\n }\n }\n\n get isLost(): boolean {\n return this.gl.isContextLost();\n }\n\n getSize(): [number, number] {\n return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];\n }\n\n isTextureFormatSupported(format: TextureFormat): boolean {\n return isTextureFormatSupported(this.gl, format);\n }\n\n isTextureFormatFilterable(format: TextureFormat): boolean {\n return isTextureFormatFilterable(this.gl, format);\n }\n\n isTextureFormatRenderable(format: TextureFormat): boolean {\n return isTextureFormatRenderable(this.gl, format);\n }\n\n // WEBGL SPECIFIC METHODS\n\n /** Returns a WebGL2RenderingContext or throws an error */\n assertWebGL2(): WebGL2RenderingContext {\n if (!this.gl2) {\n throw new Error('Requires WebGL2');\n }\n return this.gl2;\n }\n\n // IMPLEMENTATION OF ABSTRACT DEVICE\n\n createCanvasContext(props?: CanvasContextProps): CanvasContext {\n throw new Error('WebGL only supports a single canvas');\n }\n\n createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WEBGLBuffer {\n const newProps = this._getBufferProps(props);\n return new WEBGLBuffer(this, newProps);\n }\n\n _createTexture(props: TextureProps): WEBGLTexture {\n return new WEBGLTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): ExternalTexture {\n throw new Error('createExternalTexture() not implemented'); // return new Program(props);\n }\n\n createSampler(props: SamplerProps): WEBGLSampler {\n return new WEBGLSampler(this, props);\n }\n\n createShader(props: ShaderProps): WEBGLShader {\n return new WEBGLShader(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WEBGLFramebuffer {\n return new WEBGLFramebuffer(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline {\n return new WEBGLRenderPipeline(this, props);\n }\n\n override createVertexArray(props: VertexArrayProps): VertexArray {\n return new WEBGLVertexArray(this, props);\n }\n\n beginRenderPass(props: RenderPassProps): WEBGLRenderPass {\n return new WEBGLRenderPass(this, props);\n }\n\n createComputePipeline(props?: ComputePipelineProps): ComputePipeline {\n throw new Error('ComputePipeline not supported in WebGL');\n }\n\n beginComputePass(props: ComputePassProps): ComputePass {\n throw new Error('ComputePass not supported in WebGL');\n }\n\n createTransformFeedback(props: TransformFeedbackProps): WEBGLTransformFeedback {\n return new WEBGLTransformFeedback(this, props);\n }\n\n private renderPass: WEBGLRenderPass | null = null;\n\n getDefaultRenderPass(): WEBGLRenderPass {\n this.renderPass =\n this.renderPass ||\n this.beginRenderPass({\n framebuffer: this.canvasContext.getCurrentFramebuffer()\n });\n return this.renderPass;\n }\n\n override createCommandEncoder(props?: CommandEncoderProps): WEBGLCommandEncoder {\n return new WEBGLCommandEncoder(this, props);\n }\n\n /**\n * Offscreen Canvas Support: Commit the frame\n * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit\n * Chrome's offscreen canvas does not require gl.commit\n */\n submit(): void {\n this.renderPass?.end();\n this.renderPass = null;\n // this.canvasContext.commit();\n }\n\n //\n // TEMPORARY HACKS - will be removed in v9.1\n // \n\n /** @deprecated - should use command encoder */\n override readPixelsToArrayWebGL(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n sourceAttachment?: number;\n target?: Uint8Array | Uint16Array | Float32Array;\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n ): Uint8Array | Uint16Array | Float32Array {\n return readPixelsToArray(source, options);\n }\n\n /** @deprecated - should use command encoder */\n override readPixelsToBufferWebGL2(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n target?: Buffer; // A new Buffer object is created when not provided.\n targetByteOffset?: number; // byte offset in buffer object\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n ): Buffer {\n return readPixelsToBuffer(source, options);\n }\n\n //\n // WebGL-only API (not part of `Device` API)\n //\n\n /** WebGL1 typed context. Can always be used. */\n readonly gl: WebGLRenderingContext;\n /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */\n readonly gl2: WebGL2RenderingContext | null = null;\n readonly debug: boolean = false;\n\n /** `true` if this is a WebGL1 context. @note `false` if WebGL2 */\n readonly isWebGL1: boolean;\n /** `true` if this is a WebGL2 context. @note `false` if WebGL1 */\n readonly isWebGL2: boolean;\n\n /** State used by luma.gl classes: TODO - move to canvasContext*/\n readonly _canvasSizeInfo = {clientWidth: 0, clientHeight: 0, devicePixelRatio: 1};\n\n /** State used by luma.gl classes - TODO - not used? */\n readonly _extensions: Record<string, any> = {};\n _polyfilled: boolean = false;\n\n /** Instance of Spector.js (if initialized) */\n spector;\n\n private _webglLimits?: WebGLLimits;\n\n /** Return WebGL specific limits */\n get webglLimits(): WebGLLimits {\n this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);\n return this._webglLimits;\n }\n\n /**\n * Triggers device (or WebGL context) loss.\n * @note primarily intended for testing how application reacts to device loss\n */\n override loseDevice(): boolean {\n let deviceLossTriggered = false;\n const ext = this.gl.getExtension('WEBGL_lose_context');\n if (ext) {\n deviceLossTriggered = true;\n ext.loseContext();\n // ext.loseContext should trigger context loss callback but the platform may not do this, so do it explicitly\n }\n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Application triggered context loss'\n });\n return deviceLossTriggered;\n }\n\n /** Save current WebGL context state onto an internal stack */\n pushState(): void {\n pushContextState(this.gl);\n }\n\n /** Restores previously saved context state */\n popState(): void {\n popContextState(this.gl);\n }\n\n /**\n * Storing data on a special field on WebGLObjects makes that data visible in SPECTOR chrome debug extension\n * luma.gl ids and props can be inspected\n */\n setSpectorMetadata(handle: unknown, props: Record<string, unknown>) {\n // @ts-expect-error\n // eslint-disable-next-line camelcase\n handle.__SPECTOR_Metadata = props;\n }\n\n /**\n * Returns the GL.<KEY> constant that corresponds to a numeric value of a GL constant\n * Be aware that there are some duplicates especially for constants that are 0,\n * so this isn't guaranteed to return the right key in all cases.\n */\n getGLKey(value: unknown, gl?: WebGLRenderingContext): string {\n // @ts-ignore expect-error depends on settings\n gl = gl || this.gl2 || this.gl;\n const number = Number(value);\n for (const key in gl) {\n // @ts-ignore expect-error depends on settings\n if (gl[key] === number) {\n return `GL.${key}`;\n }\n }\n // No constant found. Stringify the value and return it.\n return String(value);\n }\n\n /** Store constants */\n _constants: (TypedArray | null)[];\n\n /**\n * Set a constant value for a location. Disabled attributes at that location will read from this value\n * @note WebGL constants are stored globally on the WebGL context, not the VertexArray\n * so they need to be updated before every render\n * @todo - remember/cache values to avoid setting them unnecessarily?\n */\n setConstantAttribute(location: number, constant: TypedArray): void {\n this._constants = this._constants || new Array(this.limits.maxVertexAttributes).fill(null);\n const currentConstant = this._constants[location];\n if (currentConstant && compareConstantArrayValues(currentConstant, constant)) {\n log.info(1, `setConstantAttribute(${location}) could have been skipped, value unchanged`)();\n }\n this._constants[location] = constant;\n\n switch (constant.constructor) {\n case Float32Array:\n setConstantFloatArray(this, location, constant as Float32Array);\n break;\n case Int32Array:\n setConstantIntArray(this, location, constant as Int32Array);\n break;\n case Uint32Array:\n setConstantUintArray(this, location, constant as Uint32Array);\n break;\n default:\n assert(false);\n }\n }\n}\n\n/** Check if supplied parameter is a WebGLRenderingContext */\nfunction isWebGL(gl: any): boolean {\n if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {\n return true;\n }\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && Number.isFinite(gl._version));\n}\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nfunction isWebGL2(gl: any): boolean {\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && gl._version === 2);\n}\n\n/** Set constant float array attribute */\nfunction setConstantFloatArray(device: WebGLDevice, location: number, array: Float32Array): void {\n switch (array.length) {\n case 1:\n device.gl.vertexAttrib1fv(location, array);\n break;\n case 2:\n device.gl.vertexAttrib2fv(location, array);\n break;\n case 3:\n device.gl.vertexAttrib3fv(location, array);\n break;\n case 4:\n device.gl.vertexAttrib4fv(location, array);\n break;\n default:\n assert(false);\n }\n}\n\n/** Set constant signed int array attribute */\nfunction setConstantIntArray(device: WebGLDevice, location: number, array: Int32Array): void {\n device.assertWebGL2();\n device.gl2?.vertexAttribI4iv(location, array);\n // TODO - not clear if we need to use the special forms, more testing needed\n // switch (array.length) {\n // case 1:\n // gl.vertexAttribI1iv(location, array);\n // break;\n // case 2:\n // gl.vertexAttribI2iv(location, array);\n // break;\n // case 3:\n // gl.vertexAttribI3iv(location, array);\n // break;\n // case 4:\n // break;\n // default:\n // assert(false);\n // }\n}\n\n/** Set constant unsigned int array attribute */\nfunction setConstantUintArray(device: WebGLDevice, location: number, array: Uint32Array) {\n device.assertWebGL2();\n device.gl2?.vertexAttribI4uiv(location, array);\n // TODO - not clear if we need to use the special forms, more testing needed\n // switch (array.length) {\n // case 1:\n // gl.vertexAttribI1uiv(location, array);\n // break;\n // case 2:\n // gl.vertexAttribI2uiv(location, array);\n // break;\n // case 3:\n // gl.vertexAttribI3uiv(location, array);\n // break;\n // case 4:\n // gl.vertexAttribI4uiv(location, array);\n // break;\n // default:\n // assert(false);\n // }\n}\n\n/**\n * Compares contents of two typed arrays\n * @todo max length?\n */\nfunction compareConstantArrayValues(v1: TypedArray, v2: TypedArray): boolean {\n if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {\n return false;\n }\n for (let i = 0; i < v1.length; ++i) {\n if (v1[i] !== v2[i]) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":"AAiBA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,EAAEC,MAAM,QAAO,eAAe;AACrE,SAAQC,SAAS,QAAO,eAAe;AAAC,SAChCC,eAAe;AAAA,SAErBC,eAAe,EACfC,gBAAgB,EAChBC,iBAAiB;AAAA,SAEXC,oBAA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A,CAACmB,EAAc,EAAEC,EAAc,EAAW;EAC3E,IAAI,CAACD,EAAE,IAAI,CAACC,EAAE,IAAID,EAAE,CAACrI,MAAM,KAAKsI,EAAE,CAACtI,MAAM,IAAIqI,EAAE,CAACnH,WAAW,KAAKoH,EAAE,CAACpH,WAAW,EAAE;IAC9E,OAAO,KAAK;EACd;EACA,KAAK,IAAIqH,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,EAAE,CAACrI,MAAM,EAAE,EAAEuI,CAAC,EAAE;IAClC,IAAIF,EAAE,CAACE,CAAC,CAAC,KAAKD,EAAE,CAACC,CAAC,CAAC,EAAE;MACnB,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb"}
|
|
1
|
+
{"version":3,"file":"webgl-device.js","names":["Device","CanvasContext","log","uid","assert","isBrowser","polyfillContext","popContextState","pushContextState","trackContextState","createBrowserContext","createHeadlessContext","isHeadlessGLRegistered","getDeviceInfo","getDeviceFeatures","getDeviceLimits","getWebGLLimits","WebGLCanvasContext","loadSpectorJS","initializeSpectorJS","loadWebGLDeveloperTools","makeDebugContext","isTextureFormatSupported","isTextureFormatRenderable","isTextureFormatFilterable","WEBGLBuffer","WEBGLShader","WEBGLSampler","WEBGLTexture","WEBGLFramebuffer","WEBGLRenderPass","WEBGLRenderPipeline","WEBGLCommandEncoder","WEBGLVertexArray","WEBGLTransformFeedback","readPixelsToArray","readPixelsToBuffer","setGLParameters","withGLParameters","clear","LOG_LEVEL","WebGLDevice","isSupported","WebGLRenderingContext","features","_features","gl","limits","_limits","attach","device","isWebGL","Error","create","props","arguments","length","undefined","groupCollapsed","canvas","pageLoaded","get","debug","spector","probe","message","info","type","vendor","renderer","canvasContext","id","table","groupEnd","constructor","_props$gl","_props$gl2","handle","lost","_resolveContextLost","renderPass","gl2","isWebGL1","isWebGL2","_canvasSizeInfo","clientWidth","clientHeight","devicePixelRatio","_extensions","_polyfilled","_webglLimits","_constants","Promise","resolve","onContextLost","event","_this$_resolveContext","call","reason","resize","_version","enable","copyState","_len","args","Array","_key","webgl2","throwOnError","level","Math","max","warn","destroy","ext","getExtension","isLost","isContextLost","getSize","drawingBufferWidth","drawingBufferHeight","format","assertWebGL2","createCanvasContext","createBuffer","newProps","_getBufferProps","_createTexture","createExternalTexture","createSampler","createShader","createFramebuffer","createRenderPipeline","createVertexArray","beginRenderPass","createComputePipeline","beginComputePass","createTransformFeedback","getDefaultRenderPass","framebuffer","getCurrentFramebuffer","createCommandEncoder","submit","_this$renderPass","end","readPixelsToArrayWebGL","source","options","readPixelsToBufferWebGL2","setParametersWebGL","parameters","withParametersWebGL","func","clearWebGL","webglLimits","loseDevice","_this$_resolveContext2","deviceLossTriggered","loseContext","pushState","popState","setSpectorMetadata","__SPECTOR_Metadata","getGLKey","value","number","Number","key","String","setConstantAttribute","location","constant","maxVertexAttributes","fill","currentConstant","compareConstantArrayValues","Float32Array","setConstantFloatArray","Int32Array","setConstantIntArray","Uint32Array","setConstantUintArray","WebGL2RenderingContext","Boolean","isFinite","array","vertexAttrib1fv","vertexAttrib2fv","vertexAttrib3fv","vertexAttrib4fv","_device$gl","vertexAttribI4iv","_device$gl2","vertexAttribI4uiv","v1","v2","i"],"sources":["../../src/adapter/webgl-device.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n TextureFormat,\n VertexArray,\n VertexArrayProps,\n Framebuffer,\n Buffer,\n Texture,\n TypedArray\n} from '@luma.gl/core';\nimport {Device, CanvasContext, log, uid, assert} from '@luma.gl/core';\nimport {isBrowser} from '@probe.gl/env';\nimport {polyfillContext} from '../context/polyfill/polyfill-context';\nimport {\n popContextState,\n pushContextState,\n trackContextState\n} from '../context/state-tracker/track-context-state';\nimport {createBrowserContext} from '../context/context/create-browser-context';\nimport {\n createHeadlessContext,\n isHeadlessGLRegistered\n} from '../context/context/create-headless-context';\n\nimport {getDeviceInfo} from './device-helpers/get-device-info';\nimport {getDeviceFeatures} from './device-helpers/device-features';\nimport {getDeviceLimits, getWebGLLimits, WebGLLimits} from './device-helpers/device-limits';\nimport {WebGLCanvasContext} from './webgl-canvas-context';\nimport {loadSpectorJS, initializeSpectorJS} from '../context/debug/spector';\nimport {loadWebGLDeveloperTools, makeDebugContext} from '../context/debug/webgl-developer-tools';\nimport {\n isTextureFormatSupported,\n isTextureFormatRenderable,\n isTextureFormatFilterable\n} from './converters/texture-formats';\n\n// WebGL classes\nimport type {\n BufferProps,\n ShaderProps,\n // Sampler,\n SamplerProps,\n TextureProps,\n ExternalTexture,\n ExternalTextureProps,\n FramebufferProps,\n // RenderPipeline,\n RenderPipelineProps,\n ComputePipeline,\n ComputePipelineProps,\n // RenderPass,\n RenderPassProps,\n ComputePass,\n ComputePassProps,\n // CommandEncoder,\n CommandEncoderProps,\n TransformFeedbackProps\n} from '@luma.gl/core';\n\nimport {WEBGLBuffer} from './resources/webgl-buffer';\nimport {WEBGLShader} from './resources/webgl-shader';\nimport {WEBGLSampler} from './resources/webgl-sampler';\nimport {WEBGLTexture} from './resources/webgl-texture';\nimport {WEBGLFramebuffer} from './resources/webgl-framebuffer';\nimport {WEBGLRenderPass} from './resources/webgl-render-pass';\nimport {WEBGLRenderPipeline} from './resources/webgl-render-pipeline';\nimport {WEBGLCommandEncoder} from './resources/webgl-command-encoder';\nimport {WEBGLVertexArray} from './resources/webgl-vertex-array';\nimport {WEBGLTransformFeedback} from './resources/webgl-transform-feedback';\n\nimport {readPixelsToArray, readPixelsToBuffer} from '../classic/copy-and-blit';\nimport {setGLParameters} from '../context/parameters/unified-parameter-api';\nimport {withGLParameters} from '../context/state-tracker/with-parameters';\nimport {clear} from '../classic/clear';\n\nconst LOG_LEVEL = 1;\n\n/** WebGPU style Device API for a WebGL context */\nexport class WebGLDevice extends Device {\n //\n // Public `Device` API\n //\n\n static type: string = 'webgl';\n\n static isSupported(): boolean {\n return typeof WebGLRenderingContext !== 'undefined' || isHeadlessGLRegistered();\n }\n\n readonly info: DeviceInfo;\n readonly canvasContext: WebGLCanvasContext;\n\n readonly handle: WebGLRenderingContext;\n\n get features(): Set<DeviceFeature> {\n this._features = this._features || getDeviceFeatures(this.gl);\n return this._features;\n }\n\n get limits(): DeviceLimits {\n this._limits = this._limits || getDeviceLimits(this.gl);\n return this._limits;\n }\n\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n private _resolveContextLost?: (value: {reason: 'destroyed'; message: string}) => void;\n private _features?: Set<DeviceFeature>;\n private _limits?: DeviceLimits;\n\n //\n // Static methods, expected to be present by `luma.createDevice()`\n //\n\n /**\n * Get a device instance from a GL context\n * Creates and instruments the device if not already created\n * @param gl\n * @returns\n */\n static attach(gl: Device | WebGLRenderingContext | WebGL2RenderingContext): WebGLDevice {\n if (gl instanceof WebGLDevice) {\n return gl;\n }\n // @ts-expect-error\n if (gl?.device instanceof Device) {\n // @ts-expect-error\n return gl.device as WebGLDevice;\n }\n if (!isWebGL(gl)) {\n throw new Error('Invalid WebGLRenderingContext');\n }\n return new WebGLDevice({gl: gl as WebGLRenderingContext});\n }\n\n static async create(props: DeviceProps = {}): Promise<WebGLDevice> {\n log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created')();\n\n // Wait for page to load. Only wait when props. canvas is string\n // to avoid setting page onload callback unless necessary\n if (typeof props.canvas === 'string') {\n await CanvasContext.pageLoaded;\n }\n\n // Load webgl and spector debug scripts from CDN if requested\n if (log.get('debug') || props.debug) {\n await loadWebGLDeveloperTools();\n }\n\n // @ts-expect-error spector not on props\n const {spector} = props;\n if (log.get('spector') || spector) {\n await loadSpectorJS();\n }\n\n log.probe(LOG_LEVEL + 1, 'DOM is loaded')();\n\n // @ts-expect-error\n if (props.gl && props.gl.device) {\n return WebGLDevice.attach(props.gl);\n }\n\n const device = new WebGLDevice(props);\n\n // Log some debug info about the newly created context\n const message = `\\\nCreated ${device.info.type}${device.debug ? ' debug' : ''} context: \\\n${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;\n log.probe(LOG_LEVEL, message)();\n log.table(LOG_LEVEL, device.info)();\n\n log.groupEnd(LOG_LEVEL)();\n\n return device;\n }\n\n //\n // Public API\n //\n\n constructor(props: DeviceProps) {\n super({...props, id: props.id || uid('webgl-device')});\n\n // If attaching to an already attached context, return the attached device\n // @ts-expect-error device is attached to context\n const device: WebGLDevice | undefined = props.gl?.device;\n if (device) {\n throw new Error(`WebGL context already attached to device ${device.id}`);\n }\n\n // Create and instrument context\n const canvas = props.canvas || props.gl?.canvas;\n this.canvasContext = new WebGLCanvasContext(this, {...props, canvas});\n\n this.lost = new Promise<{reason: 'destroyed'; message: string}>(resolve => {\n this._resolveContextLost = resolve;\n });\n\n const onContextLost = (event: Event) =>\n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Computer entered sleep mode, or too many apps or browser tabs are using the GPU.'\n });\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext | null = props.gl || null;\n gl =\n gl ||\n (isBrowser()\n ? createBrowserContext(this.canvasContext.canvas, {...props, onContextLost})\n : null);\n gl = gl || (!isBrowser() ? createHeadlessContext({...props, onContextLost}) : null);\n\n if (!gl) {\n throw new Error('WebGL context creation failed');\n }\n\n this.handle = gl;\n this.gl = this.handle;\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.isWebGL2 = isWebGL2(this.gl);\n this.isWebGL1 = !this.isWebGL2;\n this.canvasContext.resize();\n\n // luma Device fields\n this.info = getDeviceInfo(this.gl);\n\n // @ts-expect-error Link webgl context back to device\n this.gl.device = this;\n // @ts-expect-error Annotate webgl context to handle\n this.gl._version = this.isWebGL2 ? 2 : 1;\n\n // Add subset of WebGL2 methods to WebGL1 context\n polyfillContext(this.gl);\n\n // Install context state tracking\n // @ts-expect-error - hidden parameters\n const {enable = true, copyState = false} = props;\n trackContextState(this.gl, {\n enable,\n copyState,\n log: (...args: any[]) => log.log(1, ...args)()\n });\n\n // DEBUG contexts: Add debug instrumentation to the context, force log level to at least 1\n if (isBrowser() && props.debug) {\n this.gl = makeDebugContext(this.gl, {...props, webgl2: this.isWebGL2, throwOnError: true});\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.debug = true;\n log.level = Math.max(log.level, 1);\n log.warn('WebGL debug mode activated. Performance reduced.')();\n }\n\n // @ts-expect-error spector not on props\n if (isBrowser() && props.spector) {\n const canvas = this.handle.canvas || (props.canvas as HTMLCanvasElement);\n this.spector = initializeSpectorJS({...this.props, canvas});\n }\n }\n\n /**\n * Destroys the context\n * @note Has no effect for browser contexts, there is no browser API for destroying contexts\n */\n destroy(): void {\n const ext = this.gl.getExtension('STACKGL_destroy_context');\n if (ext) {\n ext.destroy();\n }\n }\n\n get isLost(): boolean {\n return this.gl.isContextLost();\n }\n\n getSize(): [number, number] {\n return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];\n }\n\n isTextureFormatSupported(format: TextureFormat): boolean {\n return isTextureFormatSupported(this.gl, format);\n }\n\n isTextureFormatFilterable(format: TextureFormat): boolean {\n return isTextureFormatFilterable(this.gl, format);\n }\n\n isTextureFormatRenderable(format: TextureFormat): boolean {\n return isTextureFormatRenderable(this.gl, format);\n }\n\n // WEBGL SPECIFIC METHODS\n\n /** Returns a WebGL2RenderingContext or throws an error */\n assertWebGL2(): WebGL2RenderingContext {\n if (!this.gl2) {\n throw new Error('Requires WebGL2');\n }\n return this.gl2;\n }\n\n // IMPLEMENTATION OF ABSTRACT DEVICE\n\n createCanvasContext(props?: CanvasContextProps): CanvasContext {\n throw new Error('WebGL only supports a single canvas');\n }\n\n createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WEBGLBuffer {\n const newProps = this._getBufferProps(props);\n return new WEBGLBuffer(this, newProps);\n }\n\n _createTexture(props: TextureProps): WEBGLTexture {\n return new WEBGLTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): ExternalTexture {\n throw new Error('createExternalTexture() not implemented'); // return new Program(props);\n }\n\n createSampler(props: SamplerProps): WEBGLSampler {\n return new WEBGLSampler(this, props);\n }\n\n createShader(props: ShaderProps): WEBGLShader {\n return new WEBGLShader(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WEBGLFramebuffer {\n return new WEBGLFramebuffer(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline {\n return new WEBGLRenderPipeline(this, props);\n }\n\n override createVertexArray(props: VertexArrayProps): VertexArray {\n return new WEBGLVertexArray(this, props);\n }\n\n beginRenderPass(props: RenderPassProps): WEBGLRenderPass {\n return new WEBGLRenderPass(this, props);\n }\n\n createComputePipeline(props?: ComputePipelineProps): ComputePipeline {\n throw new Error('ComputePipeline not supported in WebGL');\n }\n\n beginComputePass(props: ComputePassProps): ComputePass {\n throw new Error('ComputePass not supported in WebGL');\n }\n\n createTransformFeedback(props: TransformFeedbackProps): WEBGLTransformFeedback {\n return new WEBGLTransformFeedback(this, props);\n }\n\n private renderPass: WEBGLRenderPass | null = null;\n\n getDefaultRenderPass(): WEBGLRenderPass {\n this.renderPass =\n this.renderPass ||\n this.beginRenderPass({\n framebuffer: this.canvasContext.getCurrentFramebuffer()\n });\n return this.renderPass;\n }\n\n override createCommandEncoder(props?: CommandEncoderProps): WEBGLCommandEncoder {\n return new WEBGLCommandEncoder(this, props);\n }\n\n /**\n * Offscreen Canvas Support: Commit the frame\n * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit\n * Chrome's offscreen canvas does not require gl.commit\n */\n submit(): void {\n this.renderPass?.end();\n this.renderPass = null;\n // this.canvasContext.commit();\n }\n\n //\n // TEMPORARY HACKS - will be removed in v9.1\n // \n\n /** @deprecated - should use command encoder */\n override readPixelsToArrayWebGL(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n sourceAttachment?: number;\n target?: Uint8Array | Uint16Array | Float32Array;\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n ): Uint8Array | Uint16Array | Float32Array {\n return readPixelsToArray(source, options);\n }\n\n /** @deprecated - should use command encoder */\n override readPixelsToBufferWebGL2(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n target?: Buffer; // A new Buffer object is created when not provided.\n targetByteOffset?: number; // byte offset in buffer object\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n ): Buffer {\n return readPixelsToBuffer(source, options);\n }\n\n override setParametersWebGL(parameters: any): void {\n setGLParameters(this, parameters);\n }\n\n override withParametersWebGL(parameters: any, func: any): any {\n withGLParameters(this, parameters, func);\n }\n\n override clearWebGL(options?: {framebuffer?: Framebuffer; color?: any; depth?: any; stencil?: any}): void {\n clear(this, options);\n }\n \n //\n // WebGL-only API (not part of `Device` API)\n //\n\n /** WebGL1 typed context. Can always be used. */\n readonly gl: WebGLRenderingContext;\n /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */\n readonly gl2: WebGL2RenderingContext | null = null;\n readonly debug: boolean = false;\n\n /** `true` if this is a WebGL1 context. @note `false` if WebGL2 */\n readonly isWebGL1: boolean;\n /** `true` if this is a WebGL2 context. @note `false` if WebGL1 */\n readonly isWebGL2: boolean;\n\n /** State used by luma.gl classes: TODO - move to canvasContext*/\n readonly _canvasSizeInfo = {clientWidth: 0, clientHeight: 0, devicePixelRatio: 1};\n\n /** State used by luma.gl classes - TODO - not used? */\n readonly _extensions: Record<string, any> = {};\n _polyfilled: boolean = false;\n\n /** Instance of Spector.js (if initialized) */\n spector;\n\n private _webglLimits?: WebGLLimits;\n\n /** Return WebGL specific limits */\n get webglLimits(): WebGLLimits {\n this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);\n return this._webglLimits;\n }\n\n /**\n * Triggers device (or WebGL context) loss.\n * @note primarily intended for testing how application reacts to device loss\n */\n override loseDevice(): boolean {\n let deviceLossTriggered = false;\n const ext = this.gl.getExtension('WEBGL_lose_context');\n if (ext) {\n deviceLossTriggered = true;\n ext.loseContext();\n // ext.loseContext should trigger context loss callback but the platform may not do this, so do it explicitly\n }\n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Application triggered context loss'\n });\n return deviceLossTriggered;\n }\n\n /** Save current WebGL context state onto an internal stack */\n pushState(): void {\n pushContextState(this.gl);\n }\n\n /** Restores previously saved context state */\n popState(): void {\n popContextState(this.gl);\n }\n\n /**\n * Storing data on a special field on WebGLObjects makes that data visible in SPECTOR chrome debug extension\n * luma.gl ids and props can be inspected\n */\n setSpectorMetadata(handle: unknown, props: Record<string, unknown>) {\n // @ts-expect-error\n // eslint-disable-next-line camelcase\n handle.__SPECTOR_Metadata = props;\n }\n\n /**\n * Returns the GL.<KEY> constant that corresponds to a numeric value of a GL constant\n * Be aware that there are some duplicates especially for constants that are 0,\n * so this isn't guaranteed to return the right key in all cases.\n */\n getGLKey(value: unknown, gl?: WebGLRenderingContext): string {\n // @ts-ignore expect-error depends on settings\n gl = gl || this.gl2 || this.gl;\n const number = Number(value);\n for (const key in gl) {\n // @ts-ignore expect-error depends on settings\n if (gl[key] === number) {\n return `GL.${key}`;\n }\n }\n // No constant found. Stringify the value and return it.\n return String(value);\n }\n\n /** Store constants */\n _constants: (TypedArray | null)[];\n\n /**\n * Set a constant value for a location. Disabled attributes at that location will read from this value\n * @note WebGL constants are stored globally on the WebGL context, not the VertexArray\n * so they need to be updated before every render\n * @todo - remember/cache values to avoid setting them unnecessarily?\n */\n setConstantAttribute(location: number, constant: TypedArray): void {\n this._constants = this._constants || new Array(this.limits.maxVertexAttributes).fill(null);\n const currentConstant = this._constants[location];\n if (currentConstant && compareConstantArrayValues(currentConstant, constant)) {\n log.info(1, `setConstantAttribute(${location}) could have been skipped, value unchanged`)();\n }\n this._constants[location] = constant;\n\n switch (constant.constructor) {\n case Float32Array:\n setConstantFloatArray(this, location, constant as Float32Array);\n break;\n case Int32Array:\n setConstantIntArray(this, location, constant as Int32Array);\n break;\n case Uint32Array:\n setConstantUintArray(this, location, constant as Uint32Array);\n break;\n default:\n assert(false);\n }\n }\n}\n\n/** Check if supplied parameter is a WebGLRenderingContext */\nfunction isWebGL(gl: any): boolean {\n if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {\n return true;\n }\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && Number.isFinite(gl._version));\n}\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nfunction isWebGL2(gl: any): boolean {\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && gl._version === 2);\n}\n\n/** Set constant float array attribute */\nfunction setConstantFloatArray(device: WebGLDevice, location: number, array: Float32Array): void {\n switch (array.length) {\n case 1:\n device.gl.vertexAttrib1fv(location, array);\n break;\n case 2:\n device.gl.vertexAttrib2fv(location, array);\n break;\n case 3:\n device.gl.vertexAttrib3fv(location, array);\n break;\n case 4:\n device.gl.vertexAttrib4fv(location, array);\n break;\n default:\n assert(false);\n }\n}\n\n/** Set constant signed int array attribute */\nfunction setConstantIntArray(device: WebGLDevice, location: number, array: Int32Array): void {\n device.assertWebGL2();\n device.gl2?.vertexAttribI4iv(location, array);\n // TODO - not clear if we need to use the special forms, more testing needed\n // switch (array.length) {\n // case 1:\n // gl.vertexAttribI1iv(location, array);\n // break;\n // case 2:\n // gl.vertexAttribI2iv(location, array);\n // break;\n // case 3:\n // gl.vertexAttribI3iv(location, array);\n // break;\n // case 4:\n // break;\n // default:\n // assert(false);\n // }\n}\n\n/** Set constant unsigned int array attribute */\nfunction setConstantUintArray(device: WebGLDevice, location: number, array: Uint32Array) {\n device.assertWebGL2();\n device.gl2?.vertexAttribI4uiv(location, array);\n // TODO - not clear if we need to use the special forms, more testing needed\n // switch (array.length) {\n // case 1:\n // gl.vertexAttribI1uiv(location, array);\n // break;\n // case 2:\n // gl.vertexAttribI2uiv(location, array);\n // break;\n // case 3:\n // gl.vertexAttribI3uiv(location, array);\n // break;\n // case 4:\n // gl.vertexAttribI4uiv(location, array);\n // break;\n // default:\n // assert(false);\n // }\n}\n\n/**\n * Compares contents of two typed arrays\n * @todo max length?\n */\nfunction compareConstantArrayValues(v1: TypedArray, v2: TypedArray): boolean {\n if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {\n return false;\n }\n for (let i = 0; i < v1.length; ++i) {\n if (v1[i] !== v2[i]) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":"AAiBA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,EAAEC,MAAM,QAAO,eAAe;AACrE,SAAQC,SAAS,QAAO,eAAe;AAAC,SAChCC,eAAe;AAAA,SAErBC,eAAe,EACfC,gBAAgB,EAChBC,iBAAiB;AAAA,SAEXC,oBAAoB;AAAA,SAE1BC,qBAAqB,EACrBC,sBAAsB;AAAA,SAGhBC,aAAa;AAAA,SACbC,iBAAiB;AAAA,SACjBC,eAAe,EAAEC,cAAc;AAAA,SAC/BC,kBAAkB;AAAA,SAClBC,aAAa,EAAEC,mBAAmB;AAAA,SAClCC,uBAAuB,EAAEC,gBAAgB;AAAA,SAE/CC,wBAAwB,EACxBC,yBAAyB,EACzBC,yBAAyB;AAAA,SA0BnBC,WAAW;AAAA,SACXC,WAAW;AAAA,SACXC,YAAY;AAAA,SACZC,YAAY;AAAA,SACZC,gBAAgB;AAAA,SAChBC,eAAe;AAAA,SACfC,mBAAmB;AAAA,SACnBC,mBAAmB;AAAA,SACnBC,gBAAgB;AAAA,SAChBC,sBAAsB;AAAA,SAEtBC,iBAAiB,EAAEC,kBAAkB;AAAA,SACrCC,eAAe;AAAA,SACfC,gBAAgB;AAAA,SAChBC,KAAK;AAEb,MAAMC,SAAS,GAAG,CAAC;AAGnB,OAAO,MAAMC,WAAW,SAASzC,MAAM,CAAC;EAOtC,OAAO0C,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AAE,EAAE4I,CAAC,EAAE;IAClC,IAAIF,EAAE,CAACE,CAAC,CAAC,KAAKD,EAAE,CAACC,CAAC,CAAC,EAAE;MACnB,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -51,9 +51,7 @@ var __exports__ = (() => {
|
|
|
51
51
|
_checkFloat32ColorAttachment: () => _checkFloat32ColorAttachment,
|
|
52
52
|
assertWebGL2Context: () => assertWebGL2Context,
|
|
53
53
|
assertWebGLContext: () => assertWebGLContext,
|
|
54
|
-
clear: () => clear,
|
|
55
54
|
convertGLToTextureFormat: () => convertGLToTextureFormat,
|
|
56
|
-
copyToTexture: () => copyToTexture,
|
|
57
55
|
getGLParameters: () => getGLParameters,
|
|
58
56
|
getShaderLayout: () => getShaderLayout,
|
|
59
57
|
getWebGL2Context: () => getWebGL2Context,
|
|
@@ -62,8 +60,6 @@ var __exports__ = (() => {
|
|
|
62
60
|
polyfillContext: () => polyfillContext,
|
|
63
61
|
popContextState: () => popContextState,
|
|
64
62
|
pushContextState: () => pushContextState,
|
|
65
|
-
readPixelsToArray: () => readPixelsToArray,
|
|
66
|
-
readPixelsToBuffer: () => readPixelsToBuffer,
|
|
67
63
|
registerHeadlessGL: () => registerHeadlessGL,
|
|
68
64
|
resetGLParameters: () => resetGLParameters,
|
|
69
65
|
setDeviceParameters: () => setDeviceParameters,
|
|
@@ -1130,6 +1126,15 @@ var __exports__ = (() => {
|
|
|
1130
1126
|
readPixelsToBufferWebGL2(source, options) {
|
|
1131
1127
|
throw new Error("not implemented");
|
|
1132
1128
|
}
|
|
1129
|
+
setParametersWebGL(parameters) {
|
|
1130
|
+
throw new Error("not implemented");
|
|
1131
|
+
}
|
|
1132
|
+
withParametersWebGL(parameters, func) {
|
|
1133
|
+
throw new Error("not implemented");
|
|
1134
|
+
}
|
|
1135
|
+
clearWebGL(options) {
|
|
1136
|
+
throw new Error("not implemented");
|
|
1137
|
+
}
|
|
1133
1138
|
_getBufferProps(props) {
|
|
1134
1139
|
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
1135
1140
|
props = {
|
|
@@ -1505,7 +1510,8 @@ ${numberedLines}${positionIndicator}${message2.type.toUpperCase()}: ${message2.m
|
|
|
1505
1510
|
return numberedLines;
|
|
1506
1511
|
}
|
|
1507
1512
|
function getNumberedLine(line, lineNum, options) {
|
|
1508
|
-
|
|
1513
|
+
const escapedLine = options?.html ? escapeHTML(line) : line;
|
|
1514
|
+
return `${padLeft(String(lineNum), 4)}: ${escapedLine}${options?.html ? "<br/>" : "\n"}`;
|
|
1509
1515
|
}
|
|
1510
1516
|
function padLeft(string, paddedLength) {
|
|
1511
1517
|
let result = "";
|
|
@@ -1514,6 +1520,9 @@ ${numberedLines}${positionIndicator}${message2.type.toUpperCase()}: ${message2.m
|
|
|
1514
1520
|
}
|
|
1515
1521
|
return result + string;
|
|
1516
1522
|
}
|
|
1523
|
+
function escapeHTML(unsafe) {
|
|
1524
|
+
return unsafe.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1525
|
+
}
|
|
1517
1526
|
|
|
1518
1527
|
// ../core/src/lib/compiler-log/get-shader-info.ts
|
|
1519
1528
|
function getShaderInfo(source, defaultName) {
|
|
@@ -8858,72 +8867,6 @@ ${source2}`;
|
|
|
8858
8867
|
}
|
|
8859
8868
|
return webglBufferTarget;
|
|
8860
8869
|
}
|
|
8861
|
-
function copyToTexture(source, target, options) {
|
|
8862
|
-
const {
|
|
8863
|
-
sourceX = 0,
|
|
8864
|
-
sourceY = 0,
|
|
8865
|
-
targetMipmaplevel = 0,
|
|
8866
|
-
targetInternalFormat = 6408
|
|
8867
|
-
} = options || {};
|
|
8868
|
-
let {
|
|
8869
|
-
targetX,
|
|
8870
|
-
targetY,
|
|
8871
|
-
targetZ,
|
|
8872
|
-
width,
|
|
8873
|
-
height
|
|
8874
|
-
} = options || {};
|
|
8875
|
-
const {
|
|
8876
|
-
framebuffer,
|
|
8877
|
-
deleteFramebuffer
|
|
8878
|
-
} = getFramebuffer2(source);
|
|
8879
|
-
assert2(framebuffer);
|
|
8880
|
-
const webglFramebuffer = framebuffer;
|
|
8881
|
-
const {
|
|
8882
|
-
device,
|
|
8883
|
-
handle
|
|
8884
|
-
} = webglFramebuffer;
|
|
8885
|
-
const isSubCopy = typeof targetX !== "undefined" || typeof targetY !== "undefined" || typeof targetZ !== "undefined";
|
|
8886
|
-
targetX = targetX || 0;
|
|
8887
|
-
targetY = targetY || 0;
|
|
8888
|
-
targetZ = targetZ || 0;
|
|
8889
|
-
const prevHandle = device.gl.bindFramebuffer(36160, handle);
|
|
8890
|
-
assert2(target);
|
|
8891
|
-
let texture = null;
|
|
8892
|
-
let textureTarget;
|
|
8893
|
-
if (target instanceof Texture) {
|
|
8894
|
-
texture = target;
|
|
8895
|
-
width = Number.isFinite(width) ? width : texture.width;
|
|
8896
|
-
height = Number.isFinite(height) ? height : texture.height;
|
|
8897
|
-
texture.bind(0);
|
|
8898
|
-
textureTarget = texture.target;
|
|
8899
|
-
} else {
|
|
8900
|
-
textureTarget = target;
|
|
8901
|
-
}
|
|
8902
|
-
if (!isSubCopy) {
|
|
8903
|
-
device.gl.copyTexImage2D(textureTarget, targetMipmaplevel, targetInternalFormat, sourceX, sourceY, width, height, 0);
|
|
8904
|
-
} else {
|
|
8905
|
-
switch (textureTarget) {
|
|
8906
|
-
case 3553:
|
|
8907
|
-
case 34067:
|
|
8908
|
-
device.gl.copyTexSubImage2D(textureTarget, targetMipmaplevel, targetX, targetY, sourceX, sourceY, width, height);
|
|
8909
|
-
break;
|
|
8910
|
-
case 35866:
|
|
8911
|
-
case 32879:
|
|
8912
|
-
device.assertWebGL2();
|
|
8913
|
-
device.gl2.copyTexSubImage3D(textureTarget, targetMipmaplevel, targetX, targetY, targetZ, sourceX, sourceY, width, height);
|
|
8914
|
-
break;
|
|
8915
|
-
default:
|
|
8916
|
-
}
|
|
8917
|
-
}
|
|
8918
|
-
if (texture) {
|
|
8919
|
-
texture.unbind();
|
|
8920
|
-
}
|
|
8921
|
-
device.gl.bindFramebuffer(36160, prevHandle || null);
|
|
8922
|
-
if (deleteFramebuffer) {
|
|
8923
|
-
framebuffer.destroy();
|
|
8924
|
-
}
|
|
8925
|
-
return texture;
|
|
8926
|
-
}
|
|
8927
8870
|
function getFramebuffer2(source) {
|
|
8928
8871
|
if (!(source instanceof Framebuffer)) {
|
|
8929
8872
|
return {
|
|
@@ -8964,6 +8907,48 @@ ${source2}`;
|
|
|
8964
8907
|
return new ArrayType(width * height * components);
|
|
8965
8908
|
}
|
|
8966
8909
|
|
|
8910
|
+
// src/classic/clear.ts
|
|
8911
|
+
var GL_DEPTH_BUFFER_BIT2 = 256;
|
|
8912
|
+
var GL_STENCIL_BUFFER_BIT2 = 1024;
|
|
8913
|
+
var GL_COLOR_BUFFER_BIT2 = 16384;
|
|
8914
|
+
var ERR_ARGUMENTS = "clear: bad arguments";
|
|
8915
|
+
function clear(gl, options) {
|
|
8916
|
+
const device = WebGLDevice.attach(gl);
|
|
8917
|
+
const {
|
|
8918
|
+
framebuffer = null,
|
|
8919
|
+
color = null,
|
|
8920
|
+
depth = null,
|
|
8921
|
+
stencil = null
|
|
8922
|
+
} = options || {};
|
|
8923
|
+
const parameters = {};
|
|
8924
|
+
if (framebuffer) {
|
|
8925
|
+
parameters.framebuffer = framebuffer;
|
|
8926
|
+
}
|
|
8927
|
+
let clearFlags = 0;
|
|
8928
|
+
if (color) {
|
|
8929
|
+
clearFlags |= GL_COLOR_BUFFER_BIT2;
|
|
8930
|
+
if (color !== true) {
|
|
8931
|
+
parameters.clearColor = color;
|
|
8932
|
+
}
|
|
8933
|
+
}
|
|
8934
|
+
if (depth) {
|
|
8935
|
+
clearFlags |= GL_DEPTH_BUFFER_BIT2;
|
|
8936
|
+
if (depth !== true) {
|
|
8937
|
+
parameters.clearDepth = depth;
|
|
8938
|
+
}
|
|
8939
|
+
}
|
|
8940
|
+
if (stencil) {
|
|
8941
|
+
clearFlags |= GL_STENCIL_BUFFER_BIT2;
|
|
8942
|
+
if (depth !== true) {
|
|
8943
|
+
parameters.clearStencil = depth;
|
|
8944
|
+
}
|
|
8945
|
+
}
|
|
8946
|
+
assert2(clearFlags !== 0, ERR_ARGUMENTS);
|
|
8947
|
+
withGLParameters(device.gl, parameters, () => {
|
|
8948
|
+
device.gl.clear(clearFlags);
|
|
8949
|
+
});
|
|
8950
|
+
}
|
|
8951
|
+
|
|
8967
8952
|
// src/adapter/webgl-device.ts
|
|
8968
8953
|
var LOG_LEVEL2 = 1;
|
|
8969
8954
|
var _WebGLDevice = class extends Device {
|
|
@@ -9175,6 +9160,15 @@ ${source2}`;
|
|
|
9175
9160
|
readPixelsToBufferWebGL2(source, options) {
|
|
9176
9161
|
return readPixelsToBuffer(source, options);
|
|
9177
9162
|
}
|
|
9163
|
+
setParametersWebGL(parameters) {
|
|
9164
|
+
setGLParameters(this, parameters);
|
|
9165
|
+
}
|
|
9166
|
+
withParametersWebGL(parameters, func) {
|
|
9167
|
+
withGLParameters(this, parameters, func);
|
|
9168
|
+
}
|
|
9169
|
+
clearWebGL(options) {
|
|
9170
|
+
clear(this, options);
|
|
9171
|
+
}
|
|
9178
9172
|
gl2 = null;
|
|
9179
9173
|
debug = false;
|
|
9180
9174
|
_canvasSizeInfo = {
|
|
@@ -9296,48 +9290,6 @@ ${source2}`;
|
|
|
9296
9290
|
}
|
|
9297
9291
|
return true;
|
|
9298
9292
|
}
|
|
9299
|
-
|
|
9300
|
-
// src/classic/clear.ts
|
|
9301
|
-
var GL_DEPTH_BUFFER_BIT2 = 256;
|
|
9302
|
-
var GL_STENCIL_BUFFER_BIT2 = 1024;
|
|
9303
|
-
var GL_COLOR_BUFFER_BIT2 = 16384;
|
|
9304
|
-
var ERR_ARGUMENTS = "clear: bad arguments";
|
|
9305
|
-
function clear(gl, options) {
|
|
9306
|
-
const device = WebGLDevice.attach(gl);
|
|
9307
|
-
const {
|
|
9308
|
-
framebuffer = null,
|
|
9309
|
-
color = null,
|
|
9310
|
-
depth = null,
|
|
9311
|
-
stencil = null
|
|
9312
|
-
} = options || {};
|
|
9313
|
-
const parameters = {};
|
|
9314
|
-
if (framebuffer) {
|
|
9315
|
-
parameters.framebuffer = framebuffer;
|
|
9316
|
-
}
|
|
9317
|
-
let clearFlags = 0;
|
|
9318
|
-
if (color) {
|
|
9319
|
-
clearFlags |= GL_COLOR_BUFFER_BIT2;
|
|
9320
|
-
if (color !== true) {
|
|
9321
|
-
parameters.clearColor = color;
|
|
9322
|
-
}
|
|
9323
|
-
}
|
|
9324
|
-
if (depth) {
|
|
9325
|
-
clearFlags |= GL_DEPTH_BUFFER_BIT2;
|
|
9326
|
-
if (depth !== true) {
|
|
9327
|
-
parameters.clearDepth = depth;
|
|
9328
|
-
}
|
|
9329
|
-
}
|
|
9330
|
-
if (stencil) {
|
|
9331
|
-
clearFlags |= GL_STENCIL_BUFFER_BIT2;
|
|
9332
|
-
if (depth !== true) {
|
|
9333
|
-
parameters.clearStencil = depth;
|
|
9334
|
-
}
|
|
9335
|
-
}
|
|
9336
|
-
assert2(clearFlags !== 0, ERR_ARGUMENTS);
|
|
9337
|
-
withGLParameters(device.gl, parameters, () => {
|
|
9338
|
-
device.gl.clear(clearFlags);
|
|
9339
|
-
});
|
|
9340
|
-
}
|
|
9341
9293
|
return __toCommonJS(src_exports);
|
|
9342
9294
|
})();
|
|
9343
9295
|
return __exports__;
|