@luma.gl/webgl 9.0.0-alpha.24 → 9.0.0-alpha.26
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/converters/device-parameters.d.ts +1 -1
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +1 -1
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/converters/texture-formats.d.ts +1 -1
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +1 -1
- package/dist/adapter/converters/texture-formats.js.map +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +1 -1
- package/dist/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +1 -1
- package/dist/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js +1 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +1 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +1 -1
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/helpers/uniforms.js.map +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +1 -1
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +1 -1
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +1 -0
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.js +2 -2
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/accessor.d.ts +1 -1
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +1 -1
- package/dist/classic/accessor.js.map +1 -1
- package/dist/classic/{buffer.d.ts → buffer-with-accessor.d.ts} +8 -8
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -0
- package/dist/classic/{buffer.js → buffer-with-accessor.js} +3 -3
- package/dist/classic/buffer-with-accessor.js.map +1 -0
- package/dist/classic/clear.js.map +1 -1
- package/dist/classic/copy-and-blit.d.ts +18 -1
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +69 -3
- package/dist/classic/copy-and-blit.js.map +1 -1
- package/dist/classic/format-utils.js +1 -1
- package/dist/classic/format-utils.js.map +1 -1
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/context/context/create-browser-context.js.map +1 -1
- package/dist/context/debug/spector.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +1 -1
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/context/polyfill/get-parameter-polyfill.js +3 -3
- package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/context/polyfill/polyfill-table.js +1 -1
- package/dist/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/dist.dev.js +687 -649
- package/dist/index.cjs +1120 -1037
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist.min.js +22 -22
- package/package.json +5 -5
- package/src/adapter/converters/device-parameters.ts +1 -1
- package/src/adapter/converters/texture-formats.ts +1 -1
- package/src/adapter/converters/vertex-formats.ts +1 -1
- package/src/adapter/device-helpers/device-limits.ts +1 -1
- package/src/adapter/device-helpers/get-device-info.ts +1 -1
- package/src/adapter/helpers/get-shader-layout.ts +1 -1
- package/src/adapter/helpers/set-uniform.ts +1 -1
- package/src/adapter/objects/constants-to-keys.ts +1 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
- package/src/adapter/objects/webgl-resource.ts +1 -1
- package/src/adapter/objects/webgl-vertex-array-object.ts +1 -1
- package/src/adapter/resources/webgl-buffer.ts +1 -1
- package/src/adapter/resources/webgl-command-buffer.ts +1 -1
- package/src/adapter/resources/webgl-framebuffer.ts +1 -1
- package/src/adapter/resources/webgl-render-pipeline.ts +1 -1
- package/src/adapter/resources/webgl-shader.ts +1 -1
- package/src/adapter/webgl-canvas-context.ts +2 -1
- package/src/adapter/webgl-device.ts +2 -2
- package/src/classic/accessor.ts +1 -1
- package/src/classic/{buffer.ts → buffer-with-accessor.ts} +9 -9
- package/src/classic/copy-and-blit.ts +122 -2
- package/src/classic/format-utils.ts +1 -1
- package/src/context/debug/webgl-developer-tools.ts +1 -1
- package/src/context/polyfill/get-parameter-polyfill.ts +1 -1
- package/src/context/polyfill/polyfill-table.ts +1 -1
- package/src/index.ts +3 -3
- package/dist/classic/buffer.d.ts.map +0 -1
- package/dist/classic/buffer.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/webgl",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.26",
|
|
4
4
|
"description": "WebGL2 adapter for the luma.gl API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
|
-
"@luma.gl/api": "9.0.0-alpha.
|
|
48
|
-
"@luma.gl/constants": "9.0.0-alpha.
|
|
47
|
+
"@luma.gl/api": "9.0.0-alpha.26",
|
|
48
|
+
"@luma.gl/constants": "9.0.0-alpha.26",
|
|
49
49
|
"@probe.gl/env": "^4.0.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@luma.gl/test-utils": "9.0.0-alpha.
|
|
52
|
+
"@luma.gl/test-utils": "9.0.0-alpha.26"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e255f78c1c0a4555808c6e9282bcecb6accd147b"
|
|
55
55
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
log,
|
|
7
7
|
isObjectEmpty
|
|
8
8
|
} from '@luma.gl/api';
|
|
9
|
-
import GL from '@luma.gl/constants';
|
|
9
|
+
import {GL} from '@luma.gl/constants';
|
|
10
10
|
import type {GLParameters} from '@luma.gl/constants';
|
|
11
11
|
import {pushContextState, popContextState} from '../../context/state-tracker/track-context-state';
|
|
12
12
|
import {setParameters} from '../../context/parameters/unified-parameter-api';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {TextureFormat, DeviceFeature} from '@luma.gl/api';
|
|
2
2
|
import {decodeTextureFormat} from '@luma.gl/api';
|
|
3
|
-
import GL from '@luma.gl/constants';
|
|
3
|
+
import {GL} from '@luma.gl/constants';
|
|
4
4
|
import {isWebGL2} from '../../context/context/webgl-checks';
|
|
5
5
|
|
|
6
6
|
/* eslint-disable camelcase */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
2
|
import type {DeviceLimits} from '@luma.gl/api';
|
|
3
|
-
import GL from '@luma.gl/constants';
|
|
3
|
+
import {GL} from '@luma.gl/constants';
|
|
4
4
|
import {getWebGL2Context} from '../../context/context/webgl-checks';
|
|
5
5
|
|
|
6
6
|
/** Populate a WebGPU style device limits */
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
// AttributeLayout,
|
|
12
12
|
AccessorObject
|
|
13
13
|
} from '@luma.gl/api';
|
|
14
|
-
import GL from '@luma.gl/constants';
|
|
14
|
+
import {GL} from '@luma.gl/constants';
|
|
15
15
|
import {isWebGL2} from '../../context/context/webgl-checks';
|
|
16
16
|
import {Accessor} from '../../classic/accessor'; // TODO - should NOT depend on classic API
|
|
17
17
|
import {decodeUniformType, decodeAttributeType} from './uniforms';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {assert} from '@luma.gl/api';
|
|
2
|
-
import GL from '@luma.gl/constants';
|
|
2
|
+
import {GL} from '@luma.gl/constants';
|
|
3
3
|
|
|
4
4
|
// Resolve a WebGL enumeration name (returns itself if already a number)
|
|
5
5
|
export function getKeyValue(gl: WebGLRenderingContext, name: string | GL): GL {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {assert, ResourceProps, TextureFormat} from '@luma.gl/api';
|
|
2
|
-
import GL from '@luma.gl/constants';
|
|
2
|
+
import {GL} from '@luma.gl/constants';
|
|
3
3
|
import {WebGLDevice} from '../webgl-device';
|
|
4
4
|
import {WebGLResource} from './webgl-resource';
|
|
5
5
|
import {isRenderbufferFormatSupported} from '../converters/texture-formats';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
2
|
import {Resource, assert, uid, stubRemovedMethods} from '@luma.gl/api';
|
|
3
3
|
import type {Device, ResourceProps} from '@luma.gl/api';
|
|
4
|
-
import GL from '@luma.gl/constants';
|
|
4
|
+
import {GL} from '@luma.gl/constants';
|
|
5
5
|
import {isWebGL2, assertWebGLContext} from '../../context/context/webgl-checks';
|
|
6
6
|
import {WebGLDevice} from '../webgl-device';
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
// Buffer,
|
|
13
13
|
Framebuffer
|
|
14
14
|
} from '@luma.gl/api';
|
|
15
|
-
import GL from '@luma.gl/constants';
|
|
15
|
+
import {GL} from '@luma.gl/constants';
|
|
16
16
|
|
|
17
17
|
// import {getTypedArrayFromGLType, getGLTypeFromTypedArray} from '../../classic/typed-array-utils';
|
|
18
18
|
import {WebGLDevice} from '../webgl-device';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type {FramebufferProps, TextureFormat} from '@luma.gl/api';
|
|
4
4
|
import {Framebuffer, Texture, assert} from '@luma.gl/api';
|
|
5
|
-
import GL from '@luma.gl/constants';
|
|
5
|
+
import {GL} from '@luma.gl/constants';
|
|
6
6
|
import {WebGLDevice} from '../webgl-device';
|
|
7
7
|
import {WEBGLTexture} from './webgl-texture';
|
|
8
8
|
import {WEBGLRenderbuffer} from '../objects/webgl-renderbuffer';
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
AttributeLayout
|
|
10
10
|
} from '@luma.gl/api';
|
|
11
11
|
import {RenderPipeline, cast, log, decodeVertexFormat} from '@luma.gl/api';
|
|
12
|
-
import GL from '@luma.gl/constants';
|
|
12
|
+
import {GL} from '@luma.gl/constants';
|
|
13
13
|
|
|
14
14
|
import {getWebGLDataType} from '../converters/texture-formats';
|
|
15
15
|
import {getShaderLayout} from '../helpers/get-shader-layout';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
2
|
import {log, uid, Shader, ShaderProps, CompilerMessage, formatCompilerLog} from '@luma.gl/api';
|
|
3
|
-
import GL from '@luma.gl/constants';
|
|
3
|
+
import {GL} from '@luma.gl/constants';
|
|
4
4
|
import {getShaderInfo} from '../helpers/get-shader-info';
|
|
5
5
|
import {parseShaderCompilerLog} from '../helpers/parse-shader-compiler-log';
|
|
6
6
|
import {WebGLDevice} from '../webgl-device';
|
|
@@ -52,6 +52,7 @@ export class WebGLCanvasContext extends CanvasContext {
|
|
|
52
52
|
resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {
|
|
53
53
|
// Resize browser context .
|
|
54
54
|
if (this.canvas) {
|
|
55
|
+
const devicePixelRatio = this.getDevicePixelRatio(options?.useDevicePixels);
|
|
55
56
|
this.setDevicePixelRatio(devicePixelRatio, options);
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
@@ -64,7 +65,7 @@ export class WebGLCanvasContext extends CanvasContext {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
commit() {
|
|
67
|
-
// gl.commit was ultimately removed from standard??
|
|
68
|
+
// gl.commit was ultimately removed from the WebGL standard??
|
|
68
69
|
// if (this.offScreen && this.gl.commit) {
|
|
69
70
|
// // @ts-expect-error gl.commit is not officially part of WebGLRenderingContext
|
|
70
71
|
// this.gl.commit();
|
|
@@ -50,7 +50,7 @@ import type {
|
|
|
50
50
|
CommandEncoderProps
|
|
51
51
|
} from '@luma.gl/api';
|
|
52
52
|
|
|
53
|
-
import {
|
|
53
|
+
import {BufferWithAccessor} from '../classic/buffer-with-accessor';
|
|
54
54
|
import {WEBGLBuffer} from './resources/webgl-buffer';
|
|
55
55
|
import {WEBGLShader} from './resources/webgl-shader';
|
|
56
56
|
import {WEBGLSampler} from './resources/webgl-sampler';
|
|
@@ -284,7 +284,7 @@ ${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`
|
|
|
284
284
|
|
|
285
285
|
createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WEBGLBuffer {
|
|
286
286
|
const newProps = this._getBufferProps(props);
|
|
287
|
-
return new
|
|
287
|
+
return new BufferWithAccessor(this, newProps);
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
_createTexture(props: TextureProps): WEBGLTexture {
|
package/src/classic/accessor.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type {Device, BufferProps, TypedArray} from '@luma.gl/api';
|
|
4
4
|
import {assert, checkProps} from '@luma.gl/api';
|
|
5
|
-
import GL from '@luma.gl/constants';
|
|
5
|
+
import {GL} from '@luma.gl/constants';
|
|
6
6
|
import {assertWebGL2Context} from '../context/context/webgl-checks';
|
|
7
7
|
import {AccessorObject} from '../types';
|
|
8
8
|
import {Accessor} from './accessor';
|
|
@@ -42,7 +42,7 @@ const PROP_CHECKS_SET_PROPS = {
|
|
|
42
42
|
removedProps: DEPRECATED_PROPS
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
function getWEBGLBufferProps(props:
|
|
45
|
+
function getWEBGLBufferProps(props: BufferWithAccessorProps | ArrayBufferView | number): BufferProps {
|
|
46
46
|
// Signature `new Buffer(gl, new Float32Array(...)`
|
|
47
47
|
if (ArrayBuffer.isView(props)) {
|
|
48
48
|
return {data: props};
|
|
@@ -62,7 +62,7 @@ function getWEBGLBufferProps(props: ClassicBufferProps | ArrayBufferView | numbe
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/** WebGL Buffer interface */
|
|
65
|
-
export type
|
|
65
|
+
export type BufferWithAccessorProps = BufferProps & {
|
|
66
66
|
handle?: WebGLBuffer;
|
|
67
67
|
|
|
68
68
|
target?: number;
|
|
@@ -81,11 +81,11 @@ export type ClassicBufferProps = BufferProps & {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/** WebGL Buffer interface */
|
|
84
|
-
export class
|
|
84
|
+
export class BufferWithAccessor extends WEBGLBuffer {
|
|
85
85
|
usage: number;
|
|
86
86
|
accessor: Accessor;
|
|
87
87
|
|
|
88
|
-
constructor(device: Device | WebGLRenderingContext, props?:
|
|
88
|
+
constructor(device: Device | WebGLRenderingContext, props?: BufferWithAccessorProps);
|
|
89
89
|
constructor(device: Device | WebGLRenderingContext, data: ArrayBufferView | number[]);
|
|
90
90
|
constructor(device: Device | WebGLRenderingContext, byteLength: number);
|
|
91
91
|
|
|
@@ -96,7 +96,7 @@ export class ClassicBuffer extends WEBGLBuffer {
|
|
|
96
96
|
// this.initialize(props);
|
|
97
97
|
|
|
98
98
|
// Deprecated: Merge main props and accessor
|
|
99
|
-
this.setAccessor(Object.assign({}, props, (props as
|
|
99
|
+
this.setAccessor(Object.assign({}, props, (props as BufferWithAccessorProps).accessor));
|
|
100
100
|
|
|
101
101
|
// infer GL type from supplied typed array
|
|
102
102
|
if (this.props.data) {
|
|
@@ -126,7 +126,7 @@ export class ClassicBuffer extends WEBGLBuffer {
|
|
|
126
126
|
// Signature: `new Buffer(gl, {data: new Float32Array(...)})`
|
|
127
127
|
// Signature: `new Buffer(gl, new Float32Array(...))`
|
|
128
128
|
// Signature: `new Buffer(gl, 100)`
|
|
129
|
-
initialize(props:
|
|
129
|
+
initialize(props: BufferWithAccessorProps = {}): this {
|
|
130
130
|
// Signature `new Buffer(gl, new Float32Array(...)`
|
|
131
131
|
if (ArrayBuffer.isView(props)) {
|
|
132
132
|
props = {data: props};
|
|
@@ -157,7 +157,7 @@ export class ClassicBuffer extends WEBGLBuffer {
|
|
|
157
157
|
return this;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
setProps(props:
|
|
160
|
+
setProps(props: BufferWithAccessorProps): this {
|
|
161
161
|
props = checkProps('Buffer', props, PROP_CHECKS_SET_PROPS);
|
|
162
162
|
|
|
163
163
|
if ('accessor' in props) {
|
|
@@ -197,7 +197,7 @@ export class ClassicBuffer extends WEBGLBuffer {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
// Update with new data. Reinitializes the buffer
|
|
200
|
-
setData(props:
|
|
200
|
+
setData(props: BufferWithAccessorProps) {
|
|
201
201
|
return this.initialize(props);
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
2
|
import {assert, Texture, Framebuffer, FramebufferProps} from '@luma.gl/api';
|
|
3
|
-
import GL from '@luma.gl/constants';
|
|
3
|
+
import {GL} from '@luma.gl/constants';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {BufferWithAccessor as Buffer} from './buffer-with-accessor';
|
|
6
6
|
import {WEBGLTexture} from '../adapter/resources/webgl-texture';
|
|
7
7
|
import {WEBGLFramebuffer} from '../adapter/resources/webgl-framebuffer';
|
|
8
8
|
import {withParameters} from '../context/state-tracker/with-parameters';
|
|
@@ -80,6 +80,7 @@ export function readPixelsToArray(
|
|
|
80
80
|
/**
|
|
81
81
|
* Copies data from a Framebuffer or a Texture object into a Buffer object.
|
|
82
82
|
* NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.
|
|
83
|
+
* @deprecated Use CommandEncoder
|
|
83
84
|
* @param source
|
|
84
85
|
* @param options
|
|
85
86
|
*/
|
|
@@ -141,6 +142,125 @@ export function readPixelsToBuffer(
|
|
|
141
142
|
return target;
|
|
142
143
|
}
|
|
143
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)
|
|
147
|
+
* @deprecated Use CommandEncoder
|
|
148
|
+
*/
|
|
149
|
+
// eslint-disable-next-line complexity, max-statements
|
|
150
|
+
export function copyToTexture(
|
|
151
|
+
source: Framebuffer | Texture,
|
|
152
|
+
target: Texture | GL,
|
|
153
|
+
options?: {
|
|
154
|
+
sourceX?: number;
|
|
155
|
+
sourceY?: number;
|
|
156
|
+
|
|
157
|
+
targetX?: number;
|
|
158
|
+
targetY?: number;
|
|
159
|
+
targetZ?: number;
|
|
160
|
+
targetMipmaplevel?: number;
|
|
161
|
+
targetInternalFormat?: number;
|
|
162
|
+
|
|
163
|
+
width?: number; // defaults to target width
|
|
164
|
+
height?: number; // defaults to target height
|
|
165
|
+
}
|
|
166
|
+
): Texture {
|
|
167
|
+
const {
|
|
168
|
+
sourceX = 0,
|
|
169
|
+
sourceY = 0,
|
|
170
|
+
// attachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer
|
|
171
|
+
targetMipmaplevel = 0,
|
|
172
|
+
targetInternalFormat = GL.RGBA
|
|
173
|
+
} = options || {};
|
|
174
|
+
let {
|
|
175
|
+
targetX,
|
|
176
|
+
targetY,
|
|
177
|
+
targetZ,
|
|
178
|
+
width, // defaults to target width
|
|
179
|
+
height // defaults to target height
|
|
180
|
+
} = options || {};
|
|
181
|
+
|
|
182
|
+
const {framebuffer, deleteFramebuffer} = getFramebuffer(source);
|
|
183
|
+
assert(framebuffer);
|
|
184
|
+
const webglFramebuffer = framebuffer as WEBGLFramebuffer;
|
|
185
|
+
const {device, handle} = webglFramebuffer;
|
|
186
|
+
const isSubCopy =
|
|
187
|
+
typeof targetX !== 'undefined' ||
|
|
188
|
+
typeof targetY !== 'undefined' ||
|
|
189
|
+
typeof targetZ !== 'undefined';
|
|
190
|
+
targetX = targetX || 0;
|
|
191
|
+
targetY = targetY || 0;
|
|
192
|
+
targetZ = targetZ || 0;
|
|
193
|
+
const prevHandle = device.gl.bindFramebuffer(GL.FRAMEBUFFER, handle);
|
|
194
|
+
// TODO - support gl.readBuffer (WebGL2 only)
|
|
195
|
+
// const prevBuffer = gl.readBuffer(attachment);
|
|
196
|
+
assert(target);
|
|
197
|
+
let texture = null;
|
|
198
|
+
let textureTarget: GL;
|
|
199
|
+
if (target instanceof Texture) {
|
|
200
|
+
texture = target;
|
|
201
|
+
width = Number.isFinite(width) ? width : texture.width;
|
|
202
|
+
height = Number.isFinite(height) ? height : texture.height;
|
|
203
|
+
texture.bind(0);
|
|
204
|
+
textureTarget = texture.target;
|
|
205
|
+
} else {
|
|
206
|
+
textureTarget = target;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (!isSubCopy) {
|
|
210
|
+
device.gl.copyTexImage2D(
|
|
211
|
+
textureTarget,
|
|
212
|
+
targetMipmaplevel,
|
|
213
|
+
targetInternalFormat,
|
|
214
|
+
sourceX,
|
|
215
|
+
sourceY,
|
|
216
|
+
width,
|
|
217
|
+
height,
|
|
218
|
+
0 /* border must be 0 */
|
|
219
|
+
);
|
|
220
|
+
} else {
|
|
221
|
+
switch (textureTarget) {
|
|
222
|
+
case GL.TEXTURE_2D:
|
|
223
|
+
case GL.TEXTURE_CUBE_MAP:
|
|
224
|
+
device.gl.copyTexSubImage2D(
|
|
225
|
+
textureTarget,
|
|
226
|
+
targetMipmaplevel,
|
|
227
|
+
targetX,
|
|
228
|
+
targetY,
|
|
229
|
+
sourceX,
|
|
230
|
+
sourceY,
|
|
231
|
+
width,
|
|
232
|
+
height
|
|
233
|
+
);
|
|
234
|
+
break;
|
|
235
|
+
case GL.TEXTURE_2D_ARRAY:
|
|
236
|
+
case GL.TEXTURE_3D:
|
|
237
|
+
device.assertWebGL2();
|
|
238
|
+
device.gl2.copyTexSubImage3D(
|
|
239
|
+
textureTarget,
|
|
240
|
+
targetMipmaplevel,
|
|
241
|
+
targetX,
|
|
242
|
+
targetY,
|
|
243
|
+
targetZ,
|
|
244
|
+
sourceX,
|
|
245
|
+
sourceY,
|
|
246
|
+
width,
|
|
247
|
+
height
|
|
248
|
+
);
|
|
249
|
+
break;
|
|
250
|
+
default:
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (texture) {
|
|
254
|
+
texture.unbind();
|
|
255
|
+
}
|
|
256
|
+
// @ts-expect-error
|
|
257
|
+
gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
258
|
+
if (deleteFramebuffer) {
|
|
259
|
+
framebuffer.destroy();
|
|
260
|
+
}
|
|
261
|
+
return texture;
|
|
262
|
+
}
|
|
263
|
+
|
|
144
264
|
function getFramebuffer(source: Texture | Framebuffer): {
|
|
145
265
|
framebuffer: Framebuffer;
|
|
146
266
|
deleteFramebuffer: boolean;
|
package/src/index.ts
CHANGED
|
@@ -36,8 +36,8 @@ export {WEBGLVertexArrayObject} from './adapter/objects/webgl-vertex-array-objec
|
|
|
36
36
|
// WebGL adapter classes (Legacy, will be moved to webgl-legacy)
|
|
37
37
|
export {Accessor} from './classic/accessor';
|
|
38
38
|
export type {AccessorObject} from './types';
|
|
39
|
-
export type {
|
|
40
|
-
export {
|
|
39
|
+
export type {BufferWithAccessorProps} from './classic/buffer-with-accessor';
|
|
40
|
+
export {BufferWithAccessor} from './classic/buffer-with-accessor';
|
|
41
41
|
|
|
42
42
|
export {
|
|
43
43
|
isWebGL,
|
|
@@ -81,4 +81,4 @@ export {TEXTURE_FORMATS as _TEXTURE_FORMATS} from './adapter/converters/texture-
|
|
|
81
81
|
|
|
82
82
|
// DEPRECATED EXPORTS
|
|
83
83
|
export {clear} from './classic/clear';
|
|
84
|
-
export {readPixelsToBuffer, readPixelsToArray} from './classic/copy-and-blit';
|
|
84
|
+
export {readPixelsToBuffer, readPixelsToArray, copyToTexture} from './classic/copy-and-blit';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../src/classic/buffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpC,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,kBAAkB,GAAG,WAAW,GAAG;IAC7C,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,6BAA6B;AAC7B,qBAAa,aAAc,SAAQ,WAAW;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;gBAEP,MAAM,EAAE,MAAM,GAAG,qBAAqB,EAAE,KAAK,CAAC,EAAE,kBAAkB;gBAClE,MAAM,EAAE,MAAM,GAAG,qBAAqB,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,E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IAAI,EAAE,GAAG,CAAA;KAAC,GAAG,IAAI;IAwBhF,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,MAAM,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,CAAA;KAAC,GAAG,IAAI;IAcnD,YAAY,IAAI;QACd,IAAI,EAAE,GAAG,CAAC;QACV,OAAO,EAAE,OAAO,CAAC;KAChB;IAQH,mBAAmB;IAOnB,QAAQ,CAAC,IAAI,KAAA,EAAE,MAAM,GAAE,MAAU,EAAE,UAAU,GAAE,MAAiC,GAAG,IAAI;IAwBvF,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,SAAkB,GAAG,IAAI;IA8BtE,UAAU;IAKV,yBAAyB,CAAC,aAAa,EAAE,MAAM;IAQ/C,UAAU,CAAC,IAAI,KAAA;IAQf,YAAY,CAAC,KAAK,EAAE,EAAE,GAAG,GAAG;IAQ5B,2CAA2C;IAC3C,IAAI,IAAI,WAEP;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.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","ClassicBuffer","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.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: ClassicBufferProps | 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 ClassicBufferProps = 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 ClassicBuffer extends WEBGLBuffer {\n usage: number;\n accessor: Accessor;\n\n constructor(device: Device | WebGLRenderingContext, props?: ClassicBufferProps);\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 ClassicBufferProps).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: ClassicBufferProps = {}): 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: ClassicBufferProps): 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: ClassicBufferProps) {\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,OAAOC,EAAE,MAAM,oBAAoB;AAAC,SAC5BC,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,YAAY,EAAEX;AAChB,CAAC;AAED,SAASgB,mBAAmBA,CAACC,KAAoD,EAAe;EAE9F,IAAIC,WAAW,CAACC,MAAM,CAACF,KAAK,CAAC,EAAE;IAC7B,OAAO;MAACG,IAAI,EAAEH;IAAK,CAAC;EACtB,CAAC,MAGI,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAClC,OAAO;MAACI,UAAU,EAAEJ;IAAM,CAAC;EAC7B;EAEAA,KAAK,GAAG1B,UAAU,CAAC,QAAQ,EAAE0B,KAAK,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