@luma.gl/webgl 9.0.0-beta.2 → 9.0.0-beta.3

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.
@@ -83,7 +83,7 @@ export declare class WebGLDevice extends Device {
83
83
  sourceType?: number;
84
84
  }): Uint8Array | Uint16Array | Float32Array;
85
85
  /** @deprecated - should use command encoder */
86
- readPixelsToBufferWebGL2(source: Framebuffer | Texture, options?: {
86
+ readPixelsToBufferWebGL(source: Framebuffer | Texture, options?: {
87
87
  sourceX?: number;
88
88
  sourceY?: number;
89
89
  sourceFormat?: number;
@@ -94,6 +94,7 @@ export declare class WebGLDevice extends Device {
94
94
  sourceType?: number;
95
95
  }): Buffer;
96
96
  setParametersWebGL(parameters: any): void;
97
+ getParametersWebGL(parameters: any): any;
97
98
  withParametersWebGL(parameters: any, func: any): any;
98
99
  clearWebGL(options?: {
99
100
  framebuffer?: Framebuffer;
@@ -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,MAAM,eAAe,CAAC;AAgBtE,OAAO,EAAkC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAU1D,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAEX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAEhB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EAEpB,eAAe,EACf,WAAW,EACX,gBAAgB,EAEhB,mBAAmB,EACnB,s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;;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,7 +22,7 @@ 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";
25
+ import { setGLParameters, getGLParameters } from "../context/parameters/unified-parameter-api.js";
26
26
  import { withGLParameters } from "../context/state-tracker/with-parameters.js";
27
27
  import { clear } from "../classic/clear.js";
28
28
  const LOG_LEVEL = 1;
@@ -267,12 +267,15 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
267
267
  readPixelsToArrayWebGL(source, options) {
268
268
  return readPixelsToArray(source, options);
269
269
  }
270
- readPixelsToBufferWebGL2(source, options) {
270
+ readPixelsToBufferWebGL(source, options) {
271
271
  return readPixelsToBuffer(source, options);
272
272
  }
273
273
  setParametersWebGL(parameters) {
274
274
  setGLParameters(this, parameters);
275
275
  }
276
+ getParametersWebGL(parameters) {
277
+ return getGLParameters(this, parameters);
278
+ }
276
279
  withParametersWebGL(parameters, func) {
277
280
  withGLParameters(this, parameters, func);
278
281
  }
@@ -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","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,e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,UAAA,GAAA5I,MAAM,CAAC+B,GAAG,cAAA6G,UAAA,uBAAVA,UAAA,CAAYC,gBAAgB,CAACrB,QAAQ,EAAEe,KAAK,CAAC;AAiB/C;AAGA,SAASJ,oBAAoBA,CAACnI,MAAmB,EAAEwH,QAAgB,EAAEe,KAAkB,EAAE;EAAA,IAAAO,WAAA;EACvF9I,MAAM,CAACwE,YAAY,CAAC,CAAC;EACrB,CAAAsE,WAAA,GAAA9I,MAAM,CAAC+B,GAAG,cAAA+G,WAAA,uBAAVA,WAAA,CAAYC,iBAAiB,CAACvB,QAAQ,EAAEe,KAAK,CAAC;AAkBhD;AAMA,SAASV,0BAA0BA,CAACmB,EAAc,EAAEC,EAAc,EAAW;EAC3E,IAAI,CAACD,EAAE,IAAI,CAACC,EAAE,IAAID,EAAE,CAAC1I,MAAM,KAAK2I,EAAE,CAAC3I,MAAM,IAAI0I,EAAE,CAACxH,WAAW,KAAKyH,EAAE,CAACzH,WAAW,EAAE;IAC9E,OAAO,KAAK;EACd;EACA,KAAK,IAAI0H,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,EAAE,CAAC1I,MAAM,EAAE,EAAE4I,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","getGLParameters","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","readPixelsToBufferWebGL","setParametersWebGL","parameters","getParametersWebGL","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, getGLParameters} 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 readPixelsToBufferWebGL(\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 getParametersWebGL(parameters: any): any {\n return getGLParameters(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;A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B/C;AAGA,SAASJ,oBAAoBA,CAACpI,MAAmB,EAAEyH,QAAgB,EAAEe,KAAkB,EAAE;EAAA,IAAAO,WAAA;EACvF/I,MAAM,CAACwE,YAAY,CAAC,CAAC;EACrB,CAAAuE,WAAA,GAAA/I,MAAM,CAAC+B,GAAG,cAAAgH,WAAA,uBAAVA,WAAA,CAAYC,iBAAiB,CAACvB,QAAQ,EAAEe,KAAK,CAAC;AAkBhD;AAMA,SAASV,0BAA0BA,CAACmB,EAAc,EAAEC,EAAc,EAAW;EAC3E,IAAI,CAACD,EAAE,IAAI,CAACC,EAAE,IAAID,EAAE,CAAC3I,MAAM,KAAK4I,EAAE,CAAC5I,MAAM,IAAI2I,EAAE,CAACzH,WAAW,KAAK0H,EAAE,CAAC1H,WAAW,EAAE;IAC9E,OAAO,KAAK;EACd;EACA,KAAK,IAAI2H,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,EAAE,CAAC3I,MAAM,EAAE,EAAE6I,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
@@ -1123,12 +1123,15 @@ var __exports__ = (() => {
1123
1123
  readPixelsToArrayWebGL(source, options) {
1124
1124
  throw new Error("not implemented");
1125
1125
  }
1126
- readPixelsToBufferWebGL2(source, options) {
1126
+ readPixelsToBufferWebGL(source, options) {
1127
1127
  throw new Error("not implemented");
1128
1128
  }
1129
1129
  setParametersWebGL(parameters) {
1130
1130
  throw new Error("not implemented");
1131
1131
  }
1132
+ getParametersWebGL(parameters) {
1133
+ throw new Error("not implemented");
1134
+ }
1132
1135
  withParametersWebGL(parameters, func) {
1133
1136
  throw new Error("not implemented");
1134
1137
  }
@@ -9157,12 +9160,15 @@ ${source2}`;
9157
9160
  readPixelsToArrayWebGL(source, options) {
9158
9161
  return readPixelsToArray(source, options);
9159
9162
  }
9160
- readPixelsToBufferWebGL2(source, options) {
9163
+ readPixelsToBufferWebGL(source, options) {
9161
9164
  return readPixelsToBuffer(source, options);
9162
9165
  }
9163
9166
  setParametersWebGL(parameters) {
9164
9167
  setGLParameters(this, parameters);
9165
9168
  }
9169
+ getParametersWebGL(parameters) {
9170
+ return getGLParameters(this, parameters);
9171
+ }
9166
9172
  withParametersWebGL(parameters, func) {
9167
9173
  withGLParameters(this, parameters, func);
9168
9174
  }
package/dist/index.cjs CHANGED
@@ -6293,12 +6293,15 @@ var _WebGLDevice = class extends import_core29.Device {
6293
6293
  return readPixelsToArray(source, options);
6294
6294
  }
6295
6295
  /** @deprecated - should use command encoder */
6296
- readPixelsToBufferWebGL2(source, options) {
6296
+ readPixelsToBufferWebGL(source, options) {
6297
6297
  return readPixelsToBuffer(source, options);
6298
6298
  }
6299
6299
  setParametersWebGL(parameters) {
6300
6300
  setGLParameters(this, parameters);
6301
6301
  }
6302
+ getParametersWebGL(parameters) {
6303
+ return getGLParameters(this, parameters);
6304
+ }
6302
6305
  withParametersWebGL(parameters, func) {
6303
6306
  withGLParameters(this, parameters, func);
6304
6307
  }