@luma.gl/webgl 9.0.0-alpha.27 → 9.0.0-alpha.29
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/helpers/get-shader-layout.d.ts +8 -5
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +59 -16
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +12 -0
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -0
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +84 -0
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -0
- package/dist/adapter/objects/webgl-vertex-array-object.js +2 -2
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +13 -4
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +23 -21
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +27 -4
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +25 -7
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +5 -2
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/buffer-with-accessor.d.ts +5 -15
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -1
- package/dist/classic/buffer-with-accessor.js +25 -30
- package/dist/classic/buffer-with-accessor.js.map +1 -1
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +2 -2
- package/dist/classic/copy-and-blit.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +2 -1
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +2 -2
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/dist.dev.js +164 -83
- package/dist/index.cjs +207 -146
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist.min.js +22 -22
- package/package.json +5 -5
- package/src/adapter/helpers/get-shader-layout.ts +93 -33
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +123 -0
- package/src/adapter/objects/webgl-vertex-array-object.ts +2 -2
- package/src/adapter/resources/webgl-buffer.ts +40 -41
- package/src/adapter/resources/webgl-external-texture.ts +1 -1
- package/src/adapter/resources/webgl-render-pipeline.ts +51 -35
- package/src/adapter/webgl-device.ts +4 -2
- package/src/classic/buffer-with-accessor.ts +42 -43
- package/src/classic/copy-and-blit.ts +2 -3
- package/src/context/debug/webgl-developer-tools.ts +8 -2
- package/src/context/parameters/webgl-parameter-tables.ts +2 -2
- package/src/index.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-device.js","names":["Device","CanvasContext","log","uid","isBrowser","polyfillContext","popContextState","pushContextState","trackContextState","createBrowserContext","createHeadlessContext","isHeadlessGLRegistered","getDeviceInfo","getDeviceFeatures","getDeviceLimits","getWebGLLimits","WebGLCanvasContext","loadSpectorJS","initializeSpectorJS","loadWebGLDeveloperTools","makeDebugContext","isTextureFormatSupported","isTextureFormatRenderable","isTextureFormatFilterable","BufferWithAccessor","WEBGLShader","WEBGLSampler","WEBGLTexture","WEBGLFramebuffer","WEBGLRenderPass","WEBGLRenderPipeline","WEBGLCommandEncoder","LOG_LEVEL","WebGLDevice","isSupported","WebGLRenderingContext","features","_features","gl","limits","_limits","attach","device","isWebGL","Error","create","props","arguments","length","undefined","groupCollapsed","canvas","pageLoaded","debug","spector","probe","constructor","_props$gl","id","_defineProperty","clientWidth","clientHeight","devicePixelRatio","concat","canvasContext","lost","Promise","resolve","_resolveContextLost","onContextLost","event","_this$_resolveContext","call","reason","message","handle","gl2","isWebGL2","isWebGL1","info","_version","enable","copyState","_len","args","Array","_key","webgl2","throwOnError","level","Math","max","warn","type","vendor","renderer","groupEnd","destroy","ext","getExtension","isLost","isContextLost","getSize","drawingBufferWidth","drawingBufferHeight","format","assertWebGL2","createCanvasContext","createBuffer","newProps","_getBufferProps","_createTexture","createExternalTexture","createSampler","createShader","createFramebuffer","createRenderPipeline","beginRenderPass","createComputePipeline","beginComputePass","getDefaultRenderPass","renderPass","framebuffer","getCurrentFramebuffer","createCommandEncoder","submit","_this$renderPass","end","webglLimits","_webglLimits","loseDevice","_this$_resolveContext2","deviceLossTriggered","loseContext","pushState","popState","setSpectorMetadata","__SPECTOR_Metadata","getGLKey","value","number","Number","key","String","WebGL2RenderingContext","Boolean","isFinite"],"sources":["../../src/adapter/webgl-device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n TextureFormat\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/api';\nimport {isBrowser} from '@probe.gl/env';\nimport {polyfillContext} from '../context/polyfill/polyfill-context';\nimport {popContextState, pushContextState, trackContextState} 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} from '@luma.gl/api';\n\nimport {BufferWithAccessor} from '../classic/buffer-with-accessor';\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';\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 (props.debug) {\n await loadWebGLDeveloperTools();\n }\n // @ts-expect-error spector not on props\n if (props.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 return new WebGLDevice(props);\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 this.canvasContext = new WebGLCanvasContext(this, props);\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() ? createBrowserContext(this.canvasContext.canvas, {...props, onContextLost}) : 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\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 // Log some debug info about the newly created context\n const message = `\\\nCreated ${this.info.type}${this.debug ? ' debug' : ''} context: \\\n${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;\n log.probe(LOG_LEVEL, message)();\n\n log.groupEnd(LOG_LEVEL)();\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 BufferWithAccessor(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 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('compute shaders not supported in WebGL');\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 // 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\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"],"mappings":";AASA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,QAAO,cAAc;AAC5D,SAAQC,SAAS,QAAO,eAAe;AAAC,SAChCC,eAAe;AAAA,SACfC,eAAe,EAAEC,gBAAgB,EAAEC,iBAAiB;AAAA,SACpDC,oBAAoB;AAAA,SAE1BC,qBAAqB,EACrBC,sBAAsB;AAAA,SAEhBC,aAAa;AAAA,SACbC,iBAAiB;AAAA,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AAW;EACjC,IAAI,OAAOH,qBAAqB,KAAK,WAAW,IAAIG,EAAE,YAAYH,qBAAqB,EAAE;IACvF,OAAO,IAAI;EACb;EACA,IAAI,OAAO6G,sBAAsB,KAAK,WAAW,IAAI1G,EAAE,YAAY0G,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAAC3G,EAAE,IAAIuG,MAAM,CAACK,QAAQ,CAAC5G,EAAE,CAAC0C,QAAQ,CAAC,CAAC;AACpD;AAGA,SAASH,QAAQA,CAACvC,EAAO,EAAW;EAClC,IAAI,OAAO0G,sBAAsB,KAAK,WAAW,IAAI1G,EAAE,YAAY0G,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAAC3G,EAAE,IAAIA,EAAE,CAAC0C,QAAQ,KAAK,CAAC,CAAC;AACzC"}
|
|
1
|
+
{"version":3,"file":"webgl-device.js","names":["Device","CanvasContext","log","uid","isBrowser","polyfillContext","popContextState","pushContextState","trackContextState","createBrowserContext","createHeadlessContext","isHeadlessGLRegistered","getDeviceInfo","getDeviceFeatures","getDeviceLimits","getWebGLLimits","WebGLCanvasContext","loadSpectorJS","initializeSpectorJS","loadWebGLDeveloperTools","makeDebugContext","isTextureFormatSupported","isTextureFormatRenderable","isTextureFormatFilterable","BufferWithAccessor","WEBGLShader","WEBGLSampler","WEBGLTexture","WEBGLFramebuffer","WEBGLRenderPass","WEBGLRenderPipeline","WEBGLCommandEncoder","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","constructor","_props$gl","id","_defineProperty","clientWidth","clientHeight","devicePixelRatio","concat","canvasContext","lost","Promise","resolve","_resolveContextLost","onContextLost","event","_this$_resolveContext","call","reason","message","handle","gl2","isWebGL2","isWebGL1","info","_version","enable","copyState","_len","args","Array","_key","webgl2","throwOnError","level","Math","max","warn","type","vendor","renderer","groupEnd","destroy","ext","getExtension","isLost","isContextLost","getSize","drawingBufferWidth","drawingBufferHeight","format","assertWebGL2","createCanvasContext","createBuffer","newProps","_getBufferProps","_createTexture","createExternalTexture","createSampler","createShader","createFramebuffer","createRenderPipeline","beginRenderPass","createComputePipeline","beginComputePass","getDefaultRenderPass","renderPass","framebuffer","getCurrentFramebuffer","createCommandEncoder","submit","_this$renderPass","end","webglLimits","_webglLimits","loseDevice","_this$_resolveContext2","deviceLossTriggered","loseContext","pushState","popState","setSpectorMetadata","__SPECTOR_Metadata","getGLKey","value","number","Number","key","String","WebGL2RenderingContext","Boolean","isFinite"],"sources":["../../src/adapter/webgl-device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n TextureFormat\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/api';\nimport {isBrowser} from '@probe.gl/env';\nimport {polyfillContext} from '../context/polyfill/polyfill-context';\nimport {popContextState, pushContextState, trackContextState} 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} from '@luma.gl/api';\n\nimport {BufferWithAccessor} from '../classic/buffer-with-accessor';\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';\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 return new WebGLDevice(props);\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 this.canvasContext = new WebGLCanvasContext(this, props);\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() ? createBrowserContext(this.canvasContext.canvas, {...props, onContextLost}) : 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\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 // Log some debug info about the newly created context\n const message = `\\\nCreated ${this.info.type}${this.debug ? ' debug' : ''} context: \\\n${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;\n log.probe(LOG_LEVEL, message)();\n\n log.groupEnd(LOG_LEVEL)();\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 BufferWithAccessor(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 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('compute shaders not supported in WebGL');\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 // 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\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"],"mappings":";AASA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,QAAO,cAAc;AAC5D,SAAQC,SAAS,QAAO,eAAe;AAAC,SAChCC,eAAe;AAAA,SACfC,eAAe,EAAEC,gBAAgB,EAAEC,iBAAiB;AAAA,SACpDC,oBAAoB;AAAA,SAE1BC,qBAAqB,EACrBC,sBAAsB;AAAA,SAEhBC,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,yBAA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qB,KAAK,WAAW,IAAIG,EAAE,YAAYH,qBAAqB,EAAE;IACvF,OAAO,IAAI;EACb;EACA,IAAI,OAAO8G,sBAAsB,KAAK,WAAW,IAAI3G,EAAE,YAAY2G,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAAC5G,EAAE,IAAIwG,MAAM,CAACK,QAAQ,CAAC7G,EAAE,CAAC2C,QAAQ,CAAC,CAAC;AACpD;AAGA,SAASH,QAAQA,CAACxC,EAAO,EAAW;EAClC,IAAI,OAAO2G,sBAAsB,KAAK,WAAW,IAAI3G,EAAE,YAAY2G,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAAC5G,EAAE,IAAIA,EAAE,CAAC2C,QAAQ,KAAK,CAAC,CAAC;AACzC"}
|
|
@@ -6,17 +6,7 @@ import { WEBGLBuffer } from '../adapter/resources/webgl-buffer';
|
|
|
6
6
|
/** WebGL Buffer interface */
|
|
7
7
|
export type BufferWithAccessorProps = BufferProps & {
|
|
8
8
|
handle?: WebGLBuffer;
|
|
9
|
-
target?: number;
|
|
10
|
-
webglUsage?: number;
|
|
11
9
|
accessor?: AccessorObject;
|
|
12
|
-
/** @deprecated */
|
|
13
|
-
index?: number;
|
|
14
|
-
/** @deprecated */
|
|
15
|
-
offset?: number;
|
|
16
|
-
/** @deprecated */
|
|
17
|
-
size?: number;
|
|
18
|
-
/** @deprecated */
|
|
19
|
-
type?: number;
|
|
20
10
|
};
|
|
21
11
|
/** WebGL Buffer interface */
|
|
22
12
|
export declare class BufferWithAccessor extends WEBGLBuffer {
|
|
@@ -67,13 +57,13 @@ export declare class BufferWithAccessor extends WEBGLBuffer {
|
|
|
67
57
|
* - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA.
|
|
68
58
|
*/
|
|
69
59
|
bind(options?: {
|
|
70
|
-
|
|
60
|
+
glTarget?: number;
|
|
71
61
|
index?: any;
|
|
72
62
|
offset?: number;
|
|
73
|
-
size
|
|
63
|
+
size?: any;
|
|
74
64
|
}): this;
|
|
75
65
|
unbind(options?: {
|
|
76
|
-
|
|
66
|
+
glTarget?: any;
|
|
77
67
|
index?: any;
|
|
78
68
|
}): this;
|
|
79
69
|
getDebugData(): {
|
|
@@ -82,8 +72,8 @@ export declare class BufferWithAccessor extends WEBGLBuffer {
|
|
|
82
72
|
};
|
|
83
73
|
invalidateDebugData(): void;
|
|
84
74
|
_setData(data: any, offset?: number, byteLength?: number): this;
|
|
85
|
-
_setByteLength(byteLength: number
|
|
86
|
-
_getTarget():
|
|
75
|
+
_setByteLength(byteLength: number): this;
|
|
76
|
+
_getTarget(): GL.ARRAY_BUFFER | GL.ELEMENT_ARRAY_BUFFER | GL.COPY_WRITE_BUFFER | GL.UNIFORM_BUFFER;
|
|
87
77
|
_getAvailableElementCount(srcByteOffset: number): number;
|
|
88
78
|
_inferType(data: any): void;
|
|
89
79
|
getParameter(pname: GL): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-with-accessor.d.ts","sourceRoot":"","sources":["../../src/classic/buffer-with-accessor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAElE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAIpC,OAAO,EAAC,WAAW,EAAC,MAAM,mCAAmC,CAAC;AAoD9D,6BAA6B;AAC7B,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG;IAClD,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB,
|
|
1
|
+
{"version":3,"file":"buffer-with-accessor.d.ts","sourceRoot":"","sources":["../../src/classic/buffer-with-accessor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC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A2C;IAC3C,IAAI,IAAI,WAEP;CACF"}
|
|
@@ -42,9 +42,6 @@ function getWEBGLBufferProps(props) {
|
|
|
42
42
|
const bufferProps = {
|
|
43
43
|
...props
|
|
44
44
|
};
|
|
45
|
-
if (bufferProps.offset) {
|
|
46
|
-
bufferProps.byteOffset = bufferProps.offset;
|
|
47
|
-
}
|
|
48
45
|
return bufferProps;
|
|
49
46
|
}
|
|
50
47
|
export class BufferWithAccessor extends WEBGLBuffer {
|
|
@@ -84,11 +81,11 @@ export class BufferWithAccessor extends WEBGLBuffer {
|
|
|
84
81
|
};
|
|
85
82
|
}
|
|
86
83
|
props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);
|
|
87
|
-
this.
|
|
84
|
+
this.glUsage = props.glUsage || GL.STATIC_DRAW;
|
|
88
85
|
this.debugData = null;
|
|
89
86
|
this.setAccessor(Object.assign({}, props, props.accessor));
|
|
90
87
|
if (props.data) {
|
|
91
|
-
this._setData(props.data, props.
|
|
88
|
+
this._setData(props.data, props.byteOffset, props.byteLength);
|
|
92
89
|
} else {
|
|
93
90
|
this._setByteLength(props.byteLength || 0);
|
|
94
91
|
}
|
|
@@ -131,15 +128,15 @@ export class BufferWithAccessor extends WEBGLBuffer {
|
|
|
131
128
|
} = options;
|
|
132
129
|
const byteLength = options.byteLength || options.length;
|
|
133
130
|
assert(data);
|
|
134
|
-
const
|
|
135
|
-
this.gl.bindBuffer(
|
|
131
|
+
const glTarget = this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;
|
|
132
|
+
this.gl.bindBuffer(glTarget, this.handle);
|
|
136
133
|
if (srcOffset !== 0 || byteLength !== undefined) {
|
|
137
134
|
assertWebGL2Context(this.gl);
|
|
138
|
-
this.gl.bufferSubData(this.
|
|
135
|
+
this.gl.bufferSubData(this.glTarget, offset, data, srcOffset, byteLength);
|
|
139
136
|
} else {
|
|
140
|
-
this.gl.bufferSubData(
|
|
137
|
+
this.gl.bufferSubData(glTarget, offset, data);
|
|
141
138
|
}
|
|
142
|
-
this.gl.bindBuffer(
|
|
139
|
+
this.gl.bindBuffer(glTarget, null);
|
|
143
140
|
this.debugData = null;
|
|
144
141
|
this._inferType(data);
|
|
145
142
|
return this;
|
|
@@ -200,36 +197,36 @@ export class BufferWithAccessor extends WEBGLBuffer {
|
|
|
200
197
|
}
|
|
201
198
|
bind(options) {
|
|
202
199
|
const {
|
|
203
|
-
|
|
200
|
+
glTarget = this.glTarget,
|
|
204
201
|
index = this.accessor && this.accessor.index,
|
|
205
202
|
offset = 0,
|
|
206
203
|
size
|
|
207
204
|
} = options || {};
|
|
208
|
-
if (
|
|
205
|
+
if (glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER) {
|
|
209
206
|
if (size !== undefined) {
|
|
210
207
|
var _this$gl2;
|
|
211
|
-
(_this$gl2 = this.gl2) === null || _this$gl2 === void 0 ? void 0 : _this$gl2.bindBufferRange(
|
|
208
|
+
(_this$gl2 = this.gl2) === null || _this$gl2 === void 0 ? void 0 : _this$gl2.bindBufferRange(glTarget, index, this.handle, offset, size);
|
|
212
209
|
} else {
|
|
213
210
|
var _this$gl3;
|
|
214
211
|
assert(offset === 0);
|
|
215
|
-
(_this$gl3 = this.gl2) === null || _this$gl3 === void 0 ? void 0 : _this$gl3.bindBufferBase(
|
|
212
|
+
(_this$gl3 = this.gl2) === null || _this$gl3 === void 0 ? void 0 : _this$gl3.bindBufferBase(glTarget, index, this.handle);
|
|
216
213
|
}
|
|
217
214
|
} else {
|
|
218
|
-
this.gl.bindBuffer(
|
|
215
|
+
this.gl.bindBuffer(glTarget, this.handle);
|
|
219
216
|
}
|
|
220
217
|
return this;
|
|
221
218
|
}
|
|
222
219
|
unbind(options) {
|
|
223
220
|
const {
|
|
224
|
-
|
|
221
|
+
glTarget = this.glTarget,
|
|
225
222
|
index = this.accessor && this.accessor.index
|
|
226
223
|
} = options || {};
|
|
227
|
-
const isIndexedBuffer =
|
|
224
|
+
const isIndexedBuffer = glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER;
|
|
228
225
|
if (isIndexedBuffer) {
|
|
229
226
|
var _this$gl4;
|
|
230
|
-
(_this$gl4 = this.gl2) === null || _this$gl4 === void 0 ? void 0 : _this$gl4.bindBufferBase(
|
|
227
|
+
(_this$gl4 = this.gl2) === null || _this$gl4 === void 0 ? void 0 : _this$gl4.bindBufferBase(glTarget, index, null);
|
|
231
228
|
} else {
|
|
232
|
-
this.gl.bindBuffer(
|
|
229
|
+
this.gl.bindBuffer(glTarget, null);
|
|
233
230
|
}
|
|
234
231
|
return this;
|
|
235
232
|
}
|
|
@@ -258,7 +255,7 @@ export class BufferWithAccessor extends WEBGLBuffer {
|
|
|
258
255
|
this.trackDeallocatedMemory();
|
|
259
256
|
const target = this._getTarget();
|
|
260
257
|
this.gl.bindBuffer(target, this.handle);
|
|
261
|
-
this.gl.bufferData(target, byteLength, this.
|
|
258
|
+
this.gl.bufferData(target, byteLength, this.glUsage);
|
|
262
259
|
this.gl.bufferSubData(target, offset, data);
|
|
263
260
|
this.gl.bindBuffer(target, null);
|
|
264
261
|
this.debugData = data.slice(0, DEBUG_DATA_LENGTH);
|
|
@@ -273,18 +270,16 @@ export class BufferWithAccessor extends WEBGLBuffer {
|
|
|
273
270
|
return this;
|
|
274
271
|
}
|
|
275
272
|
_setByteLength(byteLength) {
|
|
276
|
-
let webglUsage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.webglUsage;
|
|
277
273
|
assert(byteLength >= 0);
|
|
278
274
|
this.trackDeallocatedMemory();
|
|
279
275
|
let data = byteLength;
|
|
280
276
|
if (byteLength === 0) {
|
|
281
277
|
data = new Float32Array(0);
|
|
282
278
|
}
|
|
283
|
-
const
|
|
284
|
-
this.gl.bindBuffer(
|
|
285
|
-
this.gl.bufferData(
|
|
286
|
-
this.gl.bindBuffer(
|
|
287
|
-
this.webglUsage = webglUsage;
|
|
279
|
+
const glTarget = this._getTarget();
|
|
280
|
+
this.gl.bindBuffer(glTarget, this.handle);
|
|
281
|
+
this.gl.bufferData(glTarget, data, this.glUsage);
|
|
282
|
+
this.gl.bindBuffer(glTarget, null);
|
|
288
283
|
this.debugData = null;
|
|
289
284
|
this.bytesUsed = byteLength;
|
|
290
285
|
this.byteLength = byteLength;
|
|
@@ -292,7 +287,7 @@ export class BufferWithAccessor extends WEBGLBuffer {
|
|
|
292
287
|
return this;
|
|
293
288
|
}
|
|
294
289
|
_getTarget() {
|
|
295
|
-
return this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.
|
|
290
|
+
return this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;
|
|
296
291
|
}
|
|
297
292
|
_getAvailableElementCount(srcByteOffset) {
|
|
298
293
|
const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {
|
|
@@ -309,9 +304,9 @@ export class BufferWithAccessor extends WEBGLBuffer {
|
|
|
309
304
|
}
|
|
310
305
|
}
|
|
311
306
|
getParameter(pname) {
|
|
312
|
-
this.gl.bindBuffer(this.
|
|
313
|
-
const value = this.gl.getBufferParameter(this.
|
|
314
|
-
this.gl.bindBuffer(this.
|
|
307
|
+
this.gl.bindBuffer(this.glTarget, this.handle);
|
|
308
|
+
const value = this.gl.getBufferParameter(this.glTarget, pname);
|
|
309
|
+
this.gl.bindBuffer(this.glTarget, null);
|
|
315
310
|
return value;
|
|
316
311
|
}
|
|
317
312
|
get type() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-with-accessor.js","names":["assert","checkProps","GL","assertWebGL2Context","Accessor","getGLTypeFromTypedArray","getTypedArrayFromGLType","WebGLDevice","WEBGLBuffer","DEBUG_DATA_LENGTH","DEPRECATED_PROPS","offset","stride","type","size","divisor","normalized","integer","instanced","isInstanced","PROP_CHECKS_INITIALIZE","removedProps","replacedProps","bytes","deprecatedProps","PROP_CHECKS_SET_PROPS","getWEBGLBufferProps","props","ArrayBuffer","isView","data","byteLength","bufferProps","byteOffset","BufferWithAccessor","constructor","device","arguments","length","undefined","attach","_defineProperty","setAccessor","Object","assign","accessor","seal","getElementCount","Math","round","getBytesPerElement","getVertexCount","getBytesPerVertex","initialize","Number","isFinite","webglUsage","STATIC_DRAW","debugData","_setData","_setByteLength","setProps","buffer","reallocate","bytesUsed","setData","subData","options","srcOffset","target","gl","webgl2","COPY_WRITE_BUFFER","bindBuffer","handle","bufferSubData","_inferType","copyData","sourceBuffer","readOffset","writeOffset","gl2","COPY_READ_BUFFER","copyBufferSubData","getData","_this$gl","dstData","srcByteOffset","dstOffset","ArrayType","FLOAT","clamped","sourceAvailableElementCount","_getAvailableElementCount","dstElementOffset","dstAvailableElementCount","dstElementCount","min","copyElementCount","getBufferSubData","bind","index","UNIFORM_BUFFER","TRANSFORM_FEEDBACK_BUFFER","_this$gl2","bindBufferRange","_this$gl3","bindBufferBase","unbind","isIndexedBuffer","_this$gl4","getDebugData","changed","invalidateDebugData","trackDeallocatedMemory","_getTarget","bufferData","slice","trackAllocatedMemory","Float32Array","sourceElementOffset","BYTES_PER_ELEMENT","getParameter","pname","value","getBufferParameter"],"sources":["../../src/classic/buffer-with-accessor.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, BufferProps, TypedArray} from '@luma.gl/api';\nimport {assert, checkProps} from '@luma.gl/api';\nimport {GL} from '@luma.gl/constants';\nimport {assertWebGL2Context} from '../context/context/webgl-checks';\nimport {AccessorObject} from '../types';\nimport {Accessor} from './accessor';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\n\nimport {WebGLDevice} from '../adapter/webgl-device';\nimport {WEBGLBuffer} from '../adapter/resources/webgl-buffer';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n// Shared prop checks for constructor and setProps\nconst DEPRECATED_PROPS = {\n offset: 'accessor.offset',\n stride: 'accessor.stride',\n type: 'accessor.type',\n size: 'accessor.size',\n divisor: 'accessor.divisor',\n normalized: 'accessor.normalized',\n integer: 'accessor.integer',\n instanced: 'accessor.divisor',\n isInstanced: 'accessor.divisor'\n};\n\n// Prop checks for constructor\nconst PROP_CHECKS_INITIALIZE = {\n removedProps: {},\n replacedProps: {\n bytes: 'byteLength'\n },\n // new Buffer() with individual accessor props is still used in apps, emit warnings\n deprecatedProps: DEPRECATED_PROPS\n};\n\n// Prop checks for setProps\nconst PROP_CHECKS_SET_PROPS = {\n // Buffer.setProps() with individual accessor props is rare => emit errors\n removedProps: DEPRECATED_PROPS\n};\n\nfunction getWEBGLBufferProps(props: BufferWithAccessorProps | ArrayBufferView | number): BufferProps {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n return {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n else if (typeof props === 'number') {\n return {byteLength: props };\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n const bufferProps = {...props };\n if (bufferProps.offset) {\n bufferProps.byteOffset = bufferProps.offset;\n }\n return bufferProps;\n}\n\n/** WebGL Buffer interface */\nexport type BufferWithAccessorProps = BufferProps & {\n handle?: WebGLBuffer;\n\n target?: number;\n webglUsage?: number;\n\n accessor?: AccessorObject;\n\n /** @deprecated */\n index?: number;\n /** @deprecated */\n offset?: number;\n /** @deprecated */\n size?: number;\n /** @deprecated */\n type?: number\n}\n\n/** WebGL Buffer interface */\nexport class BufferWithAccessor extends WEBGLBuffer {\n usage: number;\n accessor: Accessor;\n\n constructor(device: Device | WebGLRenderingContext, props?: BufferWithAccessorProps);\n constructor(device: Device | WebGLRenderingContext, data: ArrayBufferView | number[]);\n constructor(device: Device | WebGLRenderingContext, byteLength: number);\n\n constructor(device: Device | WebGLRenderingContext, props = {}) {\n super(WebGLDevice.attach(device), getWEBGLBufferProps(props));\n\n // Base class initializes\n // this.initialize(props);\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, (props as BufferWithAccessorProps).accessor));\n\n // infer GL type from supplied typed array\n if (this.props.data) {\n const type = getGLTypeFromTypedArray(this.props.data as TypedArray);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n }\n\n Object.seal(this);\n }\n\n // override write(data: TypedArray, byteOffset: number = 0): void {\n // this.subData({data, offset: byteOffset});\n // }\n\n // returns number of elements in the buffer (assuming that the full buffer is used)\n getElementCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerElement(accessor));\n }\n\n // returns number of vertices in the buffer (assuming that the full buffer is used)\n getVertexCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerVertex(accessor));\n }\n\n // Creates and initializes the buffer object's data store.\n // Signature: `new Buffer(gl, {data: new Float32Array(...)})`\n // Signature: `new Buffer(gl, new Float32Array(...))`\n // Signature: `new Buffer(gl, 100)`\n initialize(props: BufferWithAccessorProps = {}): this {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n props = {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n if (Number.isFinite(props)) {\n // @ts-expect-error\n props = {byteLength: props};\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n\n // Initialize member fields\n this.webglUsage = props.webglUsage || GL.STATIC_DRAW;\n this.debugData = null;\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, props.accessor));\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._setData(props.data, props.offset, props.byteLength);\n } else {\n this._setByteLength(props.byteLength || 0);\n }\n\n return this;\n }\n\n setProps(props: BufferWithAccessorProps): this {\n props = checkProps('Buffer', props, PROP_CHECKS_SET_PROPS);\n\n if ('accessor' in props) {\n this.setAccessor(props.accessor);\n }\n\n return this;\n }\n\n // Optionally stores an accessor with the buffer, makes it easier to use it as an attribute later\n // {type, size = 1, offset = 0, stride = 0, normalized = false, integer = false, divisor = 0}\n setAccessor(accessor: AccessorObject | Accessor): this {\n // NOTE: From luma.gl v7.0, Accessors have an optional `buffer `field\n // (mainly to support \"interleaving\")\n // To avoid confusion, ensure `buffer.accessor` does not have a `buffer.accessor.buffer` field:\n accessor = Object.assign({}, accessor);\n // @ts-expect-error\n delete accessor.buffer;\n\n // This new statement ensures that an \"accessor object\" is re-packaged as an Accessor instance\n this.accessor = new Accessor(accessor);\n return this;\n }\n\n // Allocate a bigger GPU buffer (if the current buffer is not big enough).\n // If a reallocation is triggered it clears the buffer\n // Returns:\n // `true`: buffer was reallocated, data was cleared\n // `false`: buffer was big enough, data is intact\n reallocate(byteLength: number): boolean {\n if (byteLength > this.byteLength) {\n this._setByteLength(byteLength);\n return true;\n }\n this.bytesUsed = byteLength;\n return false;\n }\n\n // Update with new data. Reinitializes the buffer\n setData(props: BufferWithAccessorProps) {\n return this.initialize(props);\n }\n\n // Updates a subset of a buffer object's data store.\n // Data (Typed Array or ArrayBuffer), length is inferred unless provided\n // Offset into buffer\n // WebGL2 only: Offset into srcData\n // WebGL2 only: Number of bytes to be copied\n subData(options: TypedArray | {data: TypedArray, offset?: number; srcOffset?: number; byteLength?: number, length?: number}) {\n // Signature: buffer.subData(new Float32Array([...]))\n if (ArrayBuffer.isView(options)) {\n options = {data: options};\n }\n\n const {data, offset = 0, srcOffset = 0} = options;\n const byteLength = options.byteLength || options.length;\n\n assert(data);\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n // @ts-expect-error\n const target = this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.target;\n this.gl.bindBuffer(target, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n assertWebGL2Context(this.gl);\n // @ts-expect-error\n this.gl.bufferSubData(this.target, offset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(target, offset, data);\n }\n this.gl.bindBuffer(target, null);\n\n // TODO - update local `data` if offsets are right\n this.debugData = null;\n\n this._inferType(data);\n\n return this;\n }\n\n /**\n * Copies part of the data of another buffer into this buffer\n * @note WEBGL2 ONLY\n */\n copyData(options: {\n sourceBuffer: any;\n readOffset?: number;\n writeOffset?: number;\n size: any;\n }): this {\n const {sourceBuffer, readOffset = 0, writeOffset = 0, size} = options;\n const {gl, gl2} = this;\n assertWebGL2Context(gl);\n\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl.bindBuffer(GL.COPY_READ_BUFFER, sourceBuffer.handle);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, this.handle);\n gl2?.copyBufferSubData(GL.COPY_READ_BUFFER, GL.COPY_WRITE_BUFFER, readOffset, writeOffset, size);\n gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n this.debugData = null;\n\n return this;\n }\n\n /**\n * Reads data from buffer into an ArrayBufferView or SharedArrayBuffer.\n * @note WEBGL2 ONLY\n */\n override getData(options?: {\n dstData?: any;\n srcByteOffset?: number;\n dstOffset?: number;\n length?: number;\n }): any {\n let {dstData = null, length = 0} = options || {};\n const {srcByteOffset = 0, dstOffset = 0} = options || {};\n assertWebGL2Context(this.gl);\n\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);\n\n const dstElementOffset = dstOffset;\n\n let dstAvailableElementCount;\n let dstElementCount;\n if (dstData) {\n dstElementCount = dstData.length;\n dstAvailableElementCount = dstElementCount - dstElementOffset;\n } else {\n // Allocate ArrayBufferView with enough size to copy all eligible data.\n dstAvailableElementCount = Math.min(\n sourceAvailableElementCount,\n length || sourceAvailableElementCount\n );\n dstElementCount = dstElementOffset + dstAvailableElementCount;\n }\n\n const copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount);\n length = length || copyElementCount;\n assert(length <= copyElementCount);\n dstData = dstData || new ArrayType(dstElementCount);\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2?.getBufferSubData(GL.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n return dstData;\n }\n\n /**\n * Binds a buffer to a given binding point (target).\n * GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER take an index, and optionally a range.\n * - GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER need an index to affect state\n * - GL.UNIFORM_BUFFER: `offset` must be aligned to GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT.\n * - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA.\n */\n bind(options?: {target?: number; index?: any; offset?: number; size: any}): this {\n const {\n target = this.target, // target for the bind operation\n index = this.accessor && this.accessor.index, // index = index of target (indexed bind point)\n offset = 0,\n size\n } = options || {};\n // NOTE: While GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER could\n // be used as direct binding points, they will not affect transform feedback or\n // uniform buffer state. Instead indexed bindings need to be made.\n if (target === GL.UNIFORM_BUFFER || target === GL.TRANSFORM_FEEDBACK_BUFFER) {\n if (size !== undefined) {\n this.gl2?.bindBufferRange(target, index, this.handle, offset, size);\n } else {\n assert(offset === 0); // Make sure offset wasn't supplied\n this.gl2?.bindBufferBase(target, index, this.handle);\n }\n } else {\n this.gl.bindBuffer(target, this.handle);\n }\n\n return this;\n }\n\n unbind(options?: {target?: any; index?: any}): this {\n const {target = this.target, index = this.accessor && this.accessor.index} = options || {};\n const isIndexedBuffer = target === GL.UNIFORM_BUFFER || target === GL.TRANSFORM_FEEDBACK_BUFFER;\n if (isIndexedBuffer) {\n this.gl2?.bindBufferBase(target, index, null);\n } else {\n this.gl.bindBuffer(target, null);\n }\n return this;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n // Returns a short initial data array\n getDebugData(): {\n data: any;\n changed: boolean;\n } {\n if (!this.debugData) {\n this.debugData = this.getData({length: Math.min(DEBUG_DATA_LENGTH, this.byteLength)});\n return {data: this.debugData, changed: true};\n }\n return {data: this.debugData, changed: false};\n }\n\n invalidateDebugData() {\n this.debugData = null;\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _setData(data, offset: number = 0, byteLength: number = data.byteLength + offset): this {\n assert(ArrayBuffer.isView(data));\n\n this.trackDeallocatedMemory();\n\n const target = this._getTarget();\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.webglUsage);\n this.gl.bufferSubData(target, offset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n // infer GL type from supplied typed array\n const type = getGLTypeFromTypedArray(data);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _setByteLength(byteLength: number, webglUsage = this.webglUsage): this {\n assert(byteLength >= 0);\n\n this.trackDeallocatedMemory();\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const target = this._getTarget();\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, data, webglUsage);\n this.gl.bindBuffer(target, null);\n\n this.webglUsage = webglUsage;\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n _getTarget() {\n // @ts-expect-error\n return this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.target;\n }\n\n _getAvailableElementCount(srcByteOffset: number) {\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;\n return this.getElementCount() - sourceElementOffset;\n }\n\n // Automatically infers type from typed array passed to setData\n // Note: No longer that useful, since type is now autodeduced from the compiled shaders\n _inferType(data) {\n if (!this.accessor.type) {\n this.setAccessor(new Accessor(this.accessor, {type: getGLTypeFromTypedArray(data)}));\n }\n }\n\n // RESOURCE METHODS\n\n getParameter(pname: GL): any {\n this.gl.bindBuffer(this.target, this.handle);\n const value = this.gl.getBufferParameter(this.target, pname);\n this.gl.bindBuffer(this.target, null);\n return value;\n }\n\n // DEPRECATIONS - v7.0\n /** @deprecated Use Buffer.accessor.type */\n get type() {\n return this.accessor.type;\n }\n}\n"],"mappings":";AAGA,SAAQA,MAAM,EAAEC,UAAU,QAAO,cAAc;AAC/C,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAC9BC,mBAAmB;AAAA,SAEnBC,QAAQ;AAAA,SACRC,uBAAuB,EAAEC,uBAAuB;AAAA,SAEhDC,WAAW;AAAA,SACXC,WAAW;AAEnB,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAE,iBAAiB;EACzBC,MAAM,EAAE,iBAAiB;EACzBC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,eAAe;EACrBC,OAAO,EAAE,kBAAkB;EAC3BC,UAAU,EAAE,qBAAqB;EACjCC,OAAO,EAAE,kBAAkB;EAC3BC,SAAS,EAAE,kBAAkB;EAC7BC,WAAW,EAAE;AACf,CAAC;AAGD,MAAMC,sBAAsB,GAAG;EAC7BC,YAAY,EAAE,CAAC,CAAC;EAChBC,aAAa,EAAE;IACbC,KAAK,EAAE;EACT,CAAC;EAEDC,eAAe,EAAEd;AACnB,CAAC;AAGD,MAAMe,qBAAqB,GAAG;EAE5BJ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C,MAAM,GAAGrE,EAAE,CAACsE,iBAAiB,GAAG,IAAI,CAACH,MAAM;EAC5D;EAEAwB,yBAAyBA,CAACN,aAAqB,EAAE;IAC/C,MAAME,SAAS,GAAGnF,uBAAuB,CAAC,IAAI,CAACuC,QAAQ,CAAChC,IAAI,IAAIX,EAAE,CAACwF,KAAK,EAAE;MAACC,OAAO,EAAE;IAAK,CAAC,CAAC;IAC3F,MAAM6B,mBAAmB,GAAGjC,aAAa,GAAGE,SAAS,CAACgC,iBAAiB;IACvE,OAAO,IAAI,CAAC1E,eAAe,CAAC,CAAC,GAAGyE,mBAAmB;EACrD;EAIA5C,UAAUA,CAAC9C,IAAI,EAAE;IACf,IAAI,CAAC,IAAI,CAACe,QAAQ,CAAChC,IAAI,EAAE;MACvB,IAAI,CAAC6B,WAAW,CAAC,IAAItC,QAAQ,CAAC,IAAI,CAACyC,QAAQ,EAAE;QAAChC,IAAI,EAAER,uBAAuB,CAACyB,IAAI;MAAC,CAAC,CAAC,CAAC;IACtF;EACF;EAIA4F,YAAYA,CAACC,KAAS,EAAO;IAC3B,IAAI,CAACrD,EAAE,CAACG,UAAU,CAAC,IAAI,CAACJ,MAAM,EAAE,IAAI,CAACK,MAAM,CAAC;IAC5C,MAAMkD,KAAK,GAAG,IAAI,CAACtD,EAAE,CAACuD,kBAAkB,CAAC,IAAI,CAACxD,MAAM,EAAEsD,KAAK,CAAC;IAC5D,IAAI,CAACrD,EAAE,CAACG,UAAU,CAAC,IAAI,CAACJ,MAAM,EAAE,IAAI,CAAC;IACrC,OAAOuD,KAAK;EACd;EAIA,IAAI/G,IAAIA,CAAA,EAAG;IACT,OAAO,IAAI,CAACgC,QAAQ,CAAChC,IAAI;EAC3B;AACF"}
|
|
1
|
+
{"version":3,"file":"buffer-with-accessor.js","names":["assert","checkProps","GL","assertWebGL2Context","Accessor","getGLTypeFromTypedArray","getTypedArrayFromGLType","WebGLDevice","WEBGLBuffer","DEBUG_DATA_LENGTH","DEPRECATED_PROPS","offset","stride","type","size","divisor","normalized","integer","instanced","isInstanced","PROP_CHECKS_INITIALIZE","removedProps","replacedProps","bytes","deprecatedProps","PROP_CHECKS_SET_PROPS","getWEBGLBufferProps","props","ArrayBuffer","isView","data","byteLength","bufferProps","BufferWithAccessor","constructor","device","arguments","length","undefined","attach","_defineProperty","setAccessor","Object","assign","accessor","seal","getElementCount","Math","round","getBytesPerElement","getVertexCount","getBytesPerVertex","initialize","Number","isFinite","glUsage","STATIC_DRAW","debugData","_setData","byteOffset","_setByteLength","setProps","buffer","reallocate","bytesUsed","setData","subData","options","srcOffset","glTarget","gl","webgl2","COPY_WRITE_BUFFER","bindBuffer","handle","bufferSubData","_inferType","copyData","sourceBuffer","readOffset","writeOffset","gl2","COPY_READ_BUFFER","copyBufferSubData","getData","_this$gl","dstData","srcByteOffset","dstOffset","ArrayType","FLOAT","clamped","sourceAvailableElementCount","_getAvailableElementCount","dstElementOffset","dstAvailableElementCount","dstElementCount","min","copyElementCount","getBufferSubData","bind","index","UNIFORM_BUFFER","TRANSFORM_FEEDBACK_BUFFER","_this$gl2","bindBufferRange","_this$gl3","bindBufferBase","unbind","isIndexedBuffer","_this$gl4","getDebugData","changed","invalidateDebugData","trackDeallocatedMemory","target","_getTarget","bufferData","slice","trackAllocatedMemory","Float32Array","sourceElementOffset","BYTES_PER_ELEMENT","getParameter","pname","value","getBufferParameter"],"sources":["../../src/classic/buffer-with-accessor.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, BufferProps, TypedArray} from '@luma.gl/api';\nimport {assert, checkProps} from '@luma.gl/api';\nimport {GL} from '@luma.gl/constants';\nimport {assertWebGL2Context} from '../context/context/webgl-checks';\nimport {AccessorObject} from '../types';\nimport {Accessor} from './accessor';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\n\nimport {WebGLDevice} from '../adapter/webgl-device';\nimport {WEBGLBuffer} from '../adapter/resources/webgl-buffer';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n// Shared prop checks for constructor and setProps\nconst DEPRECATED_PROPS = {\n offset: 'accessor.offset',\n stride: 'accessor.stride',\n type: 'accessor.type',\n size: 'accessor.size',\n divisor: 'accessor.divisor',\n normalized: 'accessor.normalized',\n integer: 'accessor.integer',\n instanced: 'accessor.divisor',\n isInstanced: 'accessor.divisor'\n};\n\n// Prop checks for constructor\nconst PROP_CHECKS_INITIALIZE = {\n removedProps: {},\n replacedProps: {\n bytes: 'byteLength'\n },\n // new Buffer() with individual accessor props is still used in apps, emit warnings\n deprecatedProps: DEPRECATED_PROPS\n};\n\n// Prop checks for setProps\nconst PROP_CHECKS_SET_PROPS = {\n // Buffer.setProps() with individual accessor props is rare => emit errors\n removedProps: DEPRECATED_PROPS\n};\n\nfunction getWEBGLBufferProps(props: BufferWithAccessorProps | ArrayBufferView | number): BufferProps {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n return {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n else if (typeof props === 'number') {\n return {byteLength: props };\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n const bufferProps = {...props };\n // if (bufferProps.offset) {\n // bufferProps.byteOffset = bufferProps.offset;\n // }\n return bufferProps;\n}\n\n/** WebGL Buffer interface */\nexport type BufferWithAccessorProps = BufferProps & {\n handle?: WebGLBuffer;\n\n accessor?: AccessorObject;\n\n // target?: number;\n // glUsage?: number;\n // /** @deprecated */\n // index?: number;\n // /** @deprecated */\n // offset?: number;\n // /** @deprecated */\n // size?: number;\n // /** @deprecated */\n // type?: number\n}\n\n/** WebGL Buffer interface */\nexport class BufferWithAccessor extends WEBGLBuffer {\n usage: number;\n accessor: Accessor;\n\n constructor(device: Device | WebGLRenderingContext, props?: BufferWithAccessorProps);\n constructor(device: Device | WebGLRenderingContext, data: ArrayBufferView | number[]);\n constructor(device: Device | WebGLRenderingContext, byteLength: number);\n\n constructor(device: Device | WebGLRenderingContext, props = {}) {\n super(WebGLDevice.attach(device), getWEBGLBufferProps(props));\n\n // Base class initializes\n // this.initialize(props);\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, (props as BufferWithAccessorProps).accessor));\n\n // infer GL type from supplied typed array\n if (this.props.data) {\n const type = getGLTypeFromTypedArray(this.props.data as TypedArray);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n }\n\n Object.seal(this);\n }\n\n // override write(data: TypedArray, byteOffset: number = 0): void {\n // this.subData({data, offset: byteOffset});\n // }\n\n // returns number of elements in the buffer (assuming that the full buffer is used)\n getElementCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerElement(accessor));\n }\n\n // returns number of vertices in the buffer (assuming that the full buffer is used)\n getVertexCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerVertex(accessor));\n }\n\n // Creates and initializes the buffer object's data store.\n // Signature: `new Buffer(gl, {data: new Float32Array(...)})`\n // Signature: `new Buffer(gl, new Float32Array(...))`\n // Signature: `new Buffer(gl, 100)`\n initialize(props: BufferWithAccessorProps = {}): this {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n props = {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n if (Number.isFinite(props)) {\n // @ts-expect-error\n props = {byteLength: props};\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n\n // Initialize member fields\n // @ts-expect-error readonly field\n this.glUsage = props.glUsage || GL.STATIC_DRAW;\n this.debugData = null;\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, props.accessor));\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._setData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._setByteLength(props.byteLength || 0);\n }\n\n return this;\n }\n\n setProps(props: BufferWithAccessorProps): this {\n props = checkProps('Buffer', props, PROP_CHECKS_SET_PROPS);\n\n if ('accessor' in props) {\n this.setAccessor(props.accessor);\n }\n\n return this;\n }\n\n // Optionally stores an accessor with the buffer, makes it easier to use it as an attribute later\n // {type, size = 1, offset = 0, stride = 0, normalized = false, integer = false, divisor = 0}\n setAccessor(accessor: AccessorObject | Accessor): this {\n // NOTE: From luma.gl v7.0, Accessors have an optional `buffer `field\n // (mainly to support \"interleaving\")\n // To avoid confusion, ensure `buffer.accessor` does not have a `buffer.accessor.buffer` field:\n accessor = Object.assign({}, accessor);\n // @ts-expect-error\n delete accessor.buffer;\n\n // This new statement ensures that an \"accessor object\" is re-packaged as an Accessor instance\n this.accessor = new Accessor(accessor);\n return this;\n }\n\n // Allocate a bigger GPU buffer (if the current buffer is not big enough).\n // If a reallocation is triggered it clears the buffer\n // Returns:\n // `true`: buffer was reallocated, data was cleared\n // `false`: buffer was big enough, data is intact\n reallocate(byteLength: number): boolean {\n if (byteLength > this.byteLength) {\n this._setByteLength(byteLength);\n return true;\n }\n this.bytesUsed = byteLength;\n return false;\n }\n\n // Update with new data. Reinitializes the buffer\n setData(props: BufferWithAccessorProps) {\n return this.initialize(props);\n }\n\n // Updates a subset of a buffer object's data store.\n // Data (Typed Array or ArrayBuffer), length is inferred unless provided\n // Offset into buffer\n // WebGL2 only: Offset into srcData\n // WebGL2 only: Number of bytes to be copied\n subData(options: TypedArray | {data: TypedArray, offset?: number; srcOffset?: number; byteLength?: number, length?: number}) {\n // Signature: buffer.subData(new Float32Array([...]))\n if (ArrayBuffer.isView(options)) {\n options = {data: options};\n }\n\n const {data, offset = 0, srcOffset = 0} = options;\n const byteLength = options.byteLength || options.length;\n\n assert(data);\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n // @ts-expect-error\n const glTarget = this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n this.gl.bindBuffer(glTarget, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n assertWebGL2Context(this.gl);\n // @ts-expect-error\n this.gl.bufferSubData(this.glTarget, offset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(glTarget, offset, data);\n }\n this.gl.bindBuffer(glTarget, null);\n\n // TODO - update local `data` if offsets are right\n this.debugData = null;\n\n this._inferType(data);\n\n return this;\n }\n\n /**\n * Copies part of the data of another buffer into this buffer\n * @note WEBGL2 ONLY\n */\n copyData(options: {\n sourceBuffer: any;\n readOffset?: number;\n writeOffset?: number;\n size: any;\n }): this {\n const {sourceBuffer, readOffset = 0, writeOffset = 0, size} = options;\n const {gl, gl2} = this;\n assertWebGL2Context(gl);\n\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl.bindBuffer(GL.COPY_READ_BUFFER, sourceBuffer.handle);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, this.handle);\n gl2?.copyBufferSubData(GL.COPY_READ_BUFFER, GL.COPY_WRITE_BUFFER, readOffset, writeOffset, size);\n gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n this.debugData = null;\n\n return this;\n }\n\n /**\n * Reads data from buffer into an ArrayBufferView or SharedArrayBuffer.\n * @note WEBGL2 ONLY\n */\n override getData(options?: {\n dstData?: any;\n srcByteOffset?: number;\n dstOffset?: number;\n length?: number;\n }): any {\n let {dstData = null, length = 0} = options || {};\n const {srcByteOffset = 0, dstOffset = 0} = options || {};\n assertWebGL2Context(this.gl);\n\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);\n\n const dstElementOffset = dstOffset;\n\n let dstAvailableElementCount;\n let dstElementCount;\n if (dstData) {\n dstElementCount = dstData.length;\n dstAvailableElementCount = dstElementCount - dstElementOffset;\n } else {\n // Allocate ArrayBufferView with enough size to copy all eligible data.\n dstAvailableElementCount = Math.min(\n sourceAvailableElementCount,\n length || sourceAvailableElementCount\n );\n dstElementCount = dstElementOffset + dstAvailableElementCount;\n }\n\n const copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount);\n length = length || copyElementCount;\n assert(length <= copyElementCount);\n dstData = dstData || new ArrayType(dstElementCount);\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2?.getBufferSubData(GL.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n return dstData;\n }\n\n /**\n * Binds a buffer to a given binding point (target).\n * GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER take an index, and optionally a range.\n * - GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER need an index to affect state\n * - GL.UNIFORM_BUFFER: `offset` must be aligned to GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT.\n * - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA.\n */\n bind(options?: {glTarget?: number; index?: any; offset?: number; size?: any}): this {\n const {\n glTarget = this.glTarget, // target for the bind operation\n index = this.accessor && this.accessor.index, // index = index of target (indexed bind point)\n offset = 0,\n size\n } = options || {};\n // NOTE: While GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER could\n // be used as direct binding points, they will not affect transform feedback or\n // uniform buffer state. Instead indexed bindings need to be made.\n if (glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER) {\n if (size !== undefined) {\n this.gl2?.bindBufferRange(glTarget, index, this.handle, offset, size);\n } else {\n assert(offset === 0); // Make sure offset wasn't supplied\n this.gl2?.bindBufferBase(glTarget, index, this.handle);\n }\n } else {\n this.gl.bindBuffer(glTarget, this.handle);\n }\n\n return this;\n }\n\n unbind(options?: {glTarget?: any; index?: any}): this {\n const {glTarget = this.glTarget, index = this.accessor && this.accessor.index} = options || {};\n const isIndexedBuffer = glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER;\n if (isIndexedBuffer) {\n this.gl2?.bindBufferBase(glTarget, index, null);\n } else {\n this.gl.bindBuffer(glTarget, null);\n }\n return this;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n // Returns a short initial data array\n getDebugData(): {\n data: any;\n changed: boolean;\n } {\n if (!this.debugData) {\n this.debugData = this.getData({length: Math.min(DEBUG_DATA_LENGTH, this.byteLength)});\n return {data: this.debugData, changed: true};\n }\n return {data: this.debugData, changed: false};\n }\n\n invalidateDebugData() {\n this.debugData = null;\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _setData(data, offset: number = 0, byteLength: number = data.byteLength + offset): this {\n assert(ArrayBuffer.isView(data));\n\n this.trackDeallocatedMemory();\n\n const target = this._getTarget();\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.glUsage);\n this.gl.bufferSubData(target, offset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n // infer GL type from supplied typed array\n const type = getGLTypeFromTypedArray(data);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _setByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n this.trackDeallocatedMemory();\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const glTarget = this._getTarget();\n this.gl.bindBuffer(glTarget, this.handle);\n this.gl.bufferData(glTarget, data, this.glUsage);\n this.gl.bindBuffer(glTarget, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n _getTarget() {\n // @ts-expect-error\n return this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n }\n\n _getAvailableElementCount(srcByteOffset: number) {\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;\n return this.getElementCount() - sourceElementOffset;\n }\n\n // Automatically infers type from typed array passed to setData\n // Note: No longer that useful, since type is now autodeduced from the compiled shaders\n _inferType(data) {\n if (!this.accessor.type) {\n this.setAccessor(new Accessor(this.accessor, {type: getGLTypeFromTypedArray(data)}));\n }\n }\n\n // RESOURCE METHODS\n\n getParameter(pname: GL): any {\n this.gl.bindBuffer(this.glTarget, this.handle);\n const value = this.gl.getBufferParameter(this.glTarget, pname);\n this.gl.bindBuffer(this.glTarget, null);\n return value;\n }\n\n // DEPRECATIONS - v7.0\n /** @deprecated Use Buffer.accessor.type */\n get type() {\n return this.accessor.type;\n }\n}\n"],"mappings":";AAGA,SAAQA,MAAM,EAAEC,UAAU,QAAO,cAAc;AAC/C,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAC9BC,mBAAmB;AAAA,SAEnBC,QAAQ;AAAA,SACRC,uBAAuB,EAAEC,uBAAuB;AAAA,SAEhDC,WAAW;AAAA,SACXC,WAAW;AAEnB,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAE,iBAAiB;EACzBC,MAAM,EAAE,iBAAiB;EACzBC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,eAAe;EACrBC,OAAO,EAAE,kBAAkB;EAC3BC,UAAU,EAAE,qBAAqB;EACjCC,OAAO,EAAE,kBAAk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AE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAgGT;AAYD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAarF"}
|
|
@@ -79,7 +79,7 @@ export function readPixelsToBuffer(source, options) {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
target.bind({
|
|
82
|
-
|
|
82
|
+
glTarget: GL.PIXEL_PACK_BUFFER
|
|
83
83
|
});
|
|
84
84
|
withParameters(gl2, {
|
|
85
85
|
framebuffer
|
|
@@ -87,7 +87,7 @@ export function readPixelsToBuffer(source, options) {
|
|
|
87
87
|
gl2.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, targetByteOffset);
|
|
88
88
|
});
|
|
89
89
|
target.unbind({
|
|
90
|
-
|
|
90
|
+
glTarget: GL.PIXEL_PACK_BUFFER
|
|
91
91
|
});
|
|
92
92
|
if (deleteFramebuffer) {
|
|
93
93
|
framebuffer.destroy();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-and-blit.js","names":["assert","Texture","Framebuffer","GL","BufferWithAccessor","Buffer","withParameters","getGLTypeFromTypedArray","getTypedArrayFromGLType","glFormatToComponents","glTypeToBytes","readPixelsToArray","source","options","sourceX","sourceY","sourceFormat","RGBA","sourceAttachment","COLOR_ATTACHMENT0","target","sourceWidth","sourceHeight","sourceType","framebuffer","deleteFramebuffer","getFramebuffer","gl","handle","width","height","FRONT","attachment","colorAttachments","type","getPixelArray","prevHandle","bindFramebuffer","FRAMEBUFFER","readPixels","destroy","readPixelsToBuffer","targetByteOffset","webglFramebuffer","gl2","device","assertWebGL2","UNSIGNED_BYTE","components","byteCount","byteLength","accessor","size","bind","PIXEL_PACK_BUFFER","unbind","copyToTexture","targetMipmaplevel","targetInternalFormat","targetX","targetY","targetZ","isSubCopy","texture","textureTarget","Number","isFinite","copyTexImage2D","TEXTURE_2D","TEXTURE_CUBE_MAP","copyTexSubImage2D","TEXTURE_2D_ARRAY","TEXTURE_3D","copyTexSubImage3D","toFramebuffer","props","id","createFramebuffer","concat","pixelArray","format","ArrayType","clamped"],"sources":["../../src/classic/copy-and-blit.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {assert, Texture, Framebuffer, FramebufferProps} from '@luma.gl/api';\nimport {GL} from '@luma.gl/constants';\n\nimport {BufferWithAccessor as Buffer} from './buffer-with-accessor';\nimport {WEBGLTexture} from '../adapter/resources/webgl-texture';\nimport {WEBGLFramebuffer} from '../adapter/resources/webgl-framebuffer';\nimport {withParameters} from '../context/state-tracker/with-parameters';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\nimport {glFormatToComponents, glTypeToBytes} from './format-utils';\n\n/**\n * Copies data from a type or a Texture object into ArrayBuffer object.\n * App can provide targetPixelArray or have it auto allocated by this method\n * newly allocated by this method unless provided by app.\n * @deprecated Use CommandEncoder.copyTextureToBuffer and Buffer.read\n * @note Slow requires roundtrip to GPU\n *\n * @param source\n * @param options\n * @returns pixel array,\n */\nexport function readPixelsToArray(\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 const {sourceX = 0, sourceY = 0, sourceFormat = GL.RGBA} = options || {};\n let {\n sourceAttachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer\n target = null,\n // following parameters are auto deduced if not provided\n sourceWidth,\n sourceHeight,\n sourceType\n } = options || {};\n\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n const {gl, handle} = framebuffer as WEBGLFramebuffer;\n sourceWidth = sourceWidth || framebuffer.width;\n sourceHeight = sourceHeight || framebuffer.height;\n\n // TODO - Set and unset gl.readBuffer\n if (sourceAttachment === GL.COLOR_ATTACHMENT0 && handle === null) {\n sourceAttachment = GL.FRONT;\n }\n\n const attachment = sourceAttachment - GL.COLOR_ATTACHMENT0;\n // assert(attachments[sourceAttachment]);\n\n // Deduce the type from color attachment if not provided.\n sourceType = sourceType || (framebuffer.colorAttachments[attachment] as WEBGLTexture).type;\n\n // Deduce type and allocated pixelArray if needed\n target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);\n\n // Pixel array available, if necessary, deduce type from it.\n sourceType = sourceType || getGLTypeFromTypedArray(target);\n\n const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, handle);\n gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);\n // @ts-expect-error\n gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n return target;\n}\n\n/**\n * Copies data from a Framebuffer or a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.\n * @deprecated Use CommandEncoder\n * @param source\n * @param options\n */\nexport function readPixelsToBuffer(\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 const {sourceX = 0, sourceY = 0, sourceFormat = GL.RGBA, targetByteOffset = 0} = options || {};\n // following parameters are auto deduced if not provided\n let {target, sourceWidth, sourceHeight, sourceType} = options || {};\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n sourceWidth = sourceWidth || framebuffer.width;\n sourceHeight = sourceHeight || framebuffer.height;\n\n // Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature\n const webglFramebuffer = framebuffer as WEBGLFramebuffer;\n const gl2 = webglFramebuffer.device.assertWebGL2();\n\n // deduce type if not available.\n sourceType = sourceType || (target ? target.type : GL.UNSIGNED_BYTE);\n\n if (!target) {\n // Create new buffer with enough size\n const components = glFormatToComponents(sourceFormat);\n const byteCount = glTypeToBytes(sourceType);\n const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;\n target = new Buffer(gl2, {byteLength, accessor: {type: sourceType, size: components}});\n }\n\n // @ts-expect-error\n target.bind({target: GL.PIXEL_PACK_BUFFER});\n withParameters(gl2, {framebuffer}, () => {\n gl2.readPixels(\n sourceX,\n sourceY,\n sourceWidth,\n sourceHeight,\n sourceFormat,\n sourceType,\n targetByteOffset\n );\n });\n target.unbind({target: GL.PIXEL_PACK_BUFFER});\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n\n return target;\n}\n\n/**\n * Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)\n * @deprecated Use CommandEncoder\n */\n// eslint-disable-next-line complexity, max-statements\nexport function copyToTexture(\n source: Framebuffer | Texture,\n target: Texture | GL,\n options?: {\n sourceX?: number;\n sourceY?: number;\n\n targetX?: number;\n targetY?: number;\n targetZ?: number;\n targetMipmaplevel?: number;\n targetInternalFormat?: number;\n\n width?: number; // defaults to target width\n height?: number; // defaults to target height\n }\n): Texture {\n const {\n sourceX = 0,\n sourceY = 0,\n // attachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer\n targetMipmaplevel = 0,\n targetInternalFormat = GL.RGBA\n } = options || {};\n let {\n targetX,\n targetY,\n targetZ,\n width, // defaults to target width\n height // defaults to target height\n } = options || {};\n\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n const webglFramebuffer = framebuffer as WEBGLFramebuffer;\n const {device, handle} = webglFramebuffer;\n const isSubCopy =\n typeof targetX !== 'undefined' ||\n typeof targetY !== 'undefined' ||\n typeof targetZ !== 'undefined';\n targetX = targetX || 0;\n targetY = targetY || 0;\n targetZ = targetZ || 0;\n const prevHandle = device.gl.bindFramebuffer(GL.FRAMEBUFFER, handle);\n // TODO - support gl.readBuffer (WebGL2 only)\n // const prevBuffer = gl.readBuffer(attachment);\n assert(target);\n let texture = null;\n let textureTarget: GL;\n if (target instanceof Texture) {\n texture = target;\n width = Number.isFinite(width) ? width : texture.width;\n height = Number.isFinite(height) ? height : texture.height;\n texture.bind(0);\n textureTarget = texture.target;\n } else {\n textureTarget = target;\n }\n\n if (!isSubCopy) {\n device.gl.copyTexImage2D(\n textureTarget,\n targetMipmaplevel,\n targetInternalFormat,\n sourceX,\n sourceY,\n width,\n height,\n 0 /* border must be 0 */\n );\n } else {\n switch (textureTarget) {\n case GL.TEXTURE_2D:\n case GL.TEXTURE_CUBE_MAP:\n device.gl.copyTexSubImage2D(\n textureTarget,\n targetMipmaplevel,\n targetX,\n targetY,\n sourceX,\n sourceY,\n width,\n height\n );\n break;\n case GL.TEXTURE_2D_ARRAY:\n case GL.TEXTURE_3D:\n device.assertWebGL2();\n device.gl2.copyTexSubImage3D(\n textureTarget,\n targetMipmaplevel,\n targetX,\n targetY,\n targetZ,\n sourceX,\n sourceY,\n width,\n height\n );\n break;\n default:\n }\n }\n if (texture) {\n texture.unbind();\n }\n // @ts-expect-error\n gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n return texture;\n}\n\nfunction getFramebuffer(source: Texture | Framebuffer): {\n framebuffer: Framebuffer;\n deleteFramebuffer: boolean;\n} {\n if (!(source instanceof Framebuffer)) {\n return {framebuffer: toFramebuffer(source), deleteFramebuffer: true};\n }\n return {framebuffer: source, deleteFramebuffer: false};\n}\n\n/**\n * Wraps a given texture into a framebuffer object, that can be further used\n * to read data from the texture object.\n */\nexport function toFramebuffer(texture: Texture, props?: FramebufferProps): Framebuffer {\n const {device, width, height, id} = texture;\n const framebuffer = device.createFramebuffer({\n ...props,\n id: `framebuffer-for-${id}`,\n width,\n height,\n colorAttachments: [\n texture\n ]\n }\n );\n return framebuffer;\n}\n\nfunction getPixelArray(\n pixelArray,\n type,\n format,\n width: number,\n height: number\n): Uint8Array | Uint16Array | Float32Array {\n if (pixelArray) {\n return pixelArray;\n }\n // Allocate pixel array if not already available, using supplied type\n type = type || GL.UNSIGNED_BYTE;\n const ArrayType = getTypedArrayFromGLType(type, {clamped: false});\n const components = glFormatToComponents(format);\n // TODO - check for composite type (components = 1).\n return new ArrayType(width * height * components) as Uint8Array | Uint16Array | Float32Array;\n}\n"],"mappings":"AACA,SAAQA,MAAM,EAAEC,OAAO,EAAEC,WAAW,QAAyB,cAAc;AAC3E,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,kBAAkB,IAAIC,MAAM;AAAA,SAG5BC,cAAc;AAAA,SACdC,uBAAuB,EAAEC,uBAAuB;AAAA,SAChDC,oBAAoB,EAAEC,aAAa;AAa3C,OAAO,SAASC,iBAAiBA,CAC/BC,MAA6B,EAC7BC,OAUC,EACwC;EACzC,MAAM;IAACC,OAAO,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC,YAAY,GAAGb,EAAE,CAACc;EAAI,CAAC,GAAGJ,OAAO,IAAI,CAAC,CAAC;EACxE,IAAI;IACFK,gBAAgB,GAAGf,EAAE,CAACgB,iBAAiB;IACvCC,MAAM,GAAG,IAAI;IAEbC,WAAW;IACXC,YAAY;IACZC;EACF,CAAC,GAAGV,OAAO,IAAI,CAAC,CAAC;EAEjB,MAAM;IAACW,WAAW;IAAEC;EAAiB,CAAC,GAAGC,cAAc,CAACd,MAAM,CAAC;EAC/DZ,MAAM,CAACwB,WAAW,CAAC;EACnB,MAAM;IAACG,EAAE;I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Buffer","withParameters","getGLTypeFromTypedArray","getTypedArrayFromGLType","glFormatToComponents","glTypeToBytes","readPixelsToArray","source","options","sourceX","sourceY","sourceFormat","RGBA","sourceAttachment","COLOR_ATTACHMENT0","target","sourceWidth","sourceHeight","sourceType","framebuffer","deleteFramebuffer","getFramebuffer","gl","handle","width","height","FRONT","attachment","colorAttachments","type","getPixelArray","prevHandle","bindFramebuffer","FRAMEBUFFER","readPixels","destroy","readPixelsToBuffer","targetByteOffset","webglFramebuffer","gl2","device","assertWebGL2","UNSIGNED_BYTE","components","byteCount","byteLength","accessor","size","bind","glTarget","PIXEL_PACK_BUFFER","unbind","copyToTexture","targetMipmaplevel","targetInternalFormat","targetX","targetY","targetZ","isSubCopy","texture","textureTarget","Number","isFinite","copyTexImage2D","TEXTURE_2D","TEXTURE_CUBE_MAP","copyTexSubImage2D","TEXTURE_2D_ARRAY","TEXTURE_3D","copyTexSubImage3D","toFramebuffer","props","id","createFramebuffer","concat","pixelArray","format","ArrayType","clamped"],"sources":["../../src/classic/copy-and-blit.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {assert, Texture, Framebuffer, FramebufferProps} from '@luma.gl/api';\nimport {GL} from '@luma.gl/constants';\n\nimport {BufferWithAccessor as Buffer} from './buffer-with-accessor';\nimport {WEBGLTexture} from '../adapter/resources/webgl-texture';\nimport {WEBGLFramebuffer} from '../adapter/resources/webgl-framebuffer';\nimport {withParameters} from '../context/state-tracker/with-parameters';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\nimport {glFormatToComponents, glTypeToBytes} from './format-utils';\n\n/**\n * Copies data from a type or a Texture object into ArrayBuffer object.\n * App can provide targetPixelArray or have it auto allocated by this method\n * newly allocated by this method unless provided by app.\n * @deprecated Use CommandEncoder.copyTextureToBuffer and Buffer.read\n * @note Slow requires roundtrip to GPU\n *\n * @param source\n * @param options\n * @returns pixel array,\n */\nexport function readPixelsToArray(\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 const {sourceX = 0, sourceY = 0, sourceFormat = GL.RGBA} = options || {};\n let {\n sourceAttachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer\n target = null,\n // following parameters are auto deduced if not provided\n sourceWidth,\n sourceHeight,\n sourceType\n } = options || {};\n\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n const {gl, handle} = framebuffer as WEBGLFramebuffer;\n sourceWidth = sourceWidth || framebuffer.width;\n sourceHeight = sourceHeight || framebuffer.height;\n\n // TODO - Set and unset gl.readBuffer\n if (sourceAttachment === GL.COLOR_ATTACHMENT0 && handle === null) {\n sourceAttachment = GL.FRONT;\n }\n\n const attachment = sourceAttachment - GL.COLOR_ATTACHMENT0;\n // assert(attachments[sourceAttachment]);\n\n // Deduce the type from color attachment if not provided.\n sourceType = sourceType || (framebuffer.colorAttachments[attachment] as WEBGLTexture).type;\n\n // Deduce type and allocated pixelArray if needed\n target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);\n\n // Pixel array available, if necessary, deduce type from it.\n sourceType = sourceType || getGLTypeFromTypedArray(target);\n\n const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, handle);\n gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);\n // @ts-expect-error\n gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n return target;\n}\n\n/**\n * Copies data from a Framebuffer or a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.\n * @deprecated Use CommandEncoder\n * @param source\n * @param options\n */\nexport function readPixelsToBuffer(\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 const {sourceX = 0, sourceY = 0, sourceFormat = GL.RGBA, targetByteOffset = 0} = options || {};\n // following parameters are auto deduced if not provided\n let {target, sourceWidth, sourceHeight, sourceType} = options || {};\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n sourceWidth = sourceWidth || framebuffer.width;\n sourceHeight = sourceHeight || framebuffer.height;\n\n // Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature\n const webglFramebuffer = framebuffer as WEBGLFramebuffer;\n const gl2 = webglFramebuffer.device.assertWebGL2();\n\n // deduce type if not available.\n sourceType = sourceType || (target ? target.type : GL.UNSIGNED_BYTE);\n\n if (!target) {\n // Create new buffer with enough size\n const components = glFormatToComponents(sourceFormat);\n const byteCount = glTypeToBytes(sourceType);\n const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;\n target = new Buffer(gl2, {byteLength, accessor: {type: sourceType, size: components}});\n }\n\n target.bind({glTarget: GL.PIXEL_PACK_BUFFER});\n withParameters(gl2, {framebuffer}, () => {\n gl2.readPixels(\n sourceX,\n sourceY,\n sourceWidth,\n sourceHeight,\n sourceFormat,\n sourceType,\n targetByteOffset\n );\n });\n target.unbind({glTarget: GL.PIXEL_PACK_BUFFER});\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n\n return target;\n}\n\n/**\n * Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)\n * @deprecated Use CommandEncoder\n */\n// eslint-disable-next-line complexity, max-statements\nexport function copyToTexture(\n source: Framebuffer | Texture,\n target: Texture | GL,\n options?: {\n sourceX?: number;\n sourceY?: number;\n\n targetX?: number;\n targetY?: number;\n targetZ?: number;\n targetMipmaplevel?: number;\n targetInternalFormat?: number;\n\n width?: number; // defaults to target width\n height?: number; // defaults to target height\n }\n): Texture {\n const {\n sourceX = 0,\n sourceY = 0,\n // attachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer\n targetMipmaplevel = 0,\n targetInternalFormat = GL.RGBA\n } = options || {};\n let {\n targetX,\n targetY,\n targetZ,\n width, // defaults to target width\n height // defaults to target height\n } = options || {};\n\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n const webglFramebuffer = framebuffer as WEBGLFramebuffer;\n const {device, handle} = webglFramebuffer;\n const isSubCopy =\n typeof targetX !== 'undefined' ||\n typeof targetY !== 'undefined' ||\n typeof targetZ !== 'undefined';\n targetX = targetX || 0;\n targetY = targetY || 0;\n targetZ = targetZ || 0;\n const prevHandle = device.gl.bindFramebuffer(GL.FRAMEBUFFER, handle);\n // TODO - support gl.readBuffer (WebGL2 only)\n // const prevBuffer = gl.readBuffer(attachment);\n assert(target);\n let texture = null;\n let textureTarget: GL;\n if (target instanceof Texture) {\n texture = target;\n width = Number.isFinite(width) ? width : texture.width;\n height = Number.isFinite(height) ? height : texture.height;\n texture.bind(0);\n textureTarget = texture.target;\n } else {\n textureTarget = target;\n }\n\n if (!isSubCopy) {\n device.gl.copyTexImage2D(\n textureTarget,\n targetMipmaplevel,\n targetInternalFormat,\n sourceX,\n sourceY,\n width,\n height,\n 0 /* border must be 0 */\n );\n } else {\n switch (textureTarget) {\n case GL.TEXTURE_2D:\n case GL.TEXTURE_CUBE_MAP:\n device.gl.copyTexSubImage2D(\n textureTarget,\n targetMipmaplevel,\n targetX,\n targetY,\n sourceX,\n sourceY,\n width,\n height\n );\n break;\n case GL.TEXTURE_2D_ARRAY:\n case GL.TEXTURE_3D:\n device.assertWebGL2();\n device.gl2.copyTexSubImage3D(\n textureTarget,\n targetMipmaplevel,\n targetX,\n targetY,\n targetZ,\n sourceX,\n sourceY,\n width,\n height\n );\n break;\n default:\n }\n }\n if (texture) {\n texture.unbind();\n }\n // @ts-expect-error\n gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n return texture;\n}\n\nfunction getFramebuffer(source: Texture | Framebuffer): {\n framebuffer: Framebuffer;\n deleteFramebuffer: boolean;\n} {\n if (!(source instanceof Framebuffer)) {\n return {framebuffer: toFramebuffer(source), deleteFramebuffer: true};\n }\n return {framebuffer: source, deleteFramebuffer: false};\n}\n\n/**\n * Wraps a given texture into a framebuffer object, that can be further used\n * to read data from the texture object.\n */\nexport function toFramebuffer(texture: Texture, props?: FramebufferProps): Framebuffer {\n const {device, width, height, id} = texture;\n const framebuffer = device.createFramebuffer({\n ...props,\n id: `framebuffer-for-${id}`,\n width,\n height,\n colorAttachments: [\n texture\n ]\n }\n );\n return framebuffer;\n}\n\nfunction getPixelArray(\n pixelArray,\n type,\n format,\n width: number,\n height: number\n): Uint8Array | Uint16Array | Float32Array {\n if (pixelArray) {\n return pixelArray;\n }\n // Allocate pixel array if not already available, using supplied type\n type = type || GL.UNSIGNED_BYTE;\n const ArrayType = getTypedArrayFromGLType(type, {clamped: false});\n const components = glFormatToComponents(format);\n // TODO - check for composite type (components = 1).\n return new ArrayType(width * height * components) as Uint8Array | Uint16Array | Float32Array;\n}\n"],"mappings":"AACA,SAAQA,MAAM,EAAEC,OAAO,EAAEC,WAAW,QAAyB,cAAc;AAC3E,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,kBAAkB,IAAIC,MAAM;AAAA,SAG5BC,cAAc;AAAA,SACdC,uBAAuB,EAAEC,uBAAuB;AAAA,SAChDC,oBAAoB,EAAEC,aAAa;AAa3C,OAAO,SAASC,iBAAiBA,CAC/BC,MAA6B,EAC7BC,OAUC,EACwC;EACzC,MAAM;IAACC,OAAO,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC,YAAY,GAAGb,EAAE,CAACc;EAAI,CAAC,GAAGJ,OAAO,IAAI,CAAC,CAAC;EACxE,IAAI;IACFK,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AuB,CAAC0B,IAAI,EAAE;IAACiD,OAAO,EAAE;EAAK,CAAC,CAAC;EACjE,MAAMnC,UAAU,GAAGvC,oBAAoB,CAACwE,MAAM,CAAC;EAE/C,OAAO,IAAIC,SAAS,CAACrD,KAAK,GAAGC,MAAM,GAAGkB,UAAU,CAAC;AACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-developer-tools.d.ts","sourceRoot":"","sources":["../../../src/context/debug/webgl-developer-tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-developer-tools.d.ts","sourceRoot":"","sources":["../../../src/context/debug/webgl-developer-tools.ts"],"names":[],"mappings":"AAOA,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAoBF,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,eAAe,EAAE,GAAG,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CAO7D;AAID,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,qBAAqB,EAAE,KAAK,GAAE,iBAAsB,GAAG,qBAAqB,GAAG,IAAI,CAOvH"}
|