@luma.gl/webgl 9.0.0-alpha.46 → 9.0.0-alpha.47
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/LICENSE +34 -0
- package/dist/adapter/resources/webgl-transform-feedback.d.ts +5 -11
- package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js +8 -4
- package/dist/adapter/resources/webgl-transform-feedback.js.map +1 -1
- package/dist/classic/typed-array-utils.d.ts +2 -0
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/dist.dev.js +8 -4
- package/dist/index.cjs +8 -4
- package/dist.min.js +22 -22
- package/package.json +5 -5
- package/src/adapter/resources/webgl-transform-feedback.ts +13 -16
- package/src/classic/typed-array-utils.ts +2 -0
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.47",
|
|
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/constants": "9.0.0-alpha.
|
|
48
|
-
"@luma.gl/core": "9.0.0-alpha.
|
|
47
|
+
"@luma.gl/constants": "9.0.0-alpha.47",
|
|
48
|
+
"@luma.gl/core": "9.0.0-alpha.47",
|
|
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.47"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7c6e28518021f98c7d0739f5cbdac386144206a1"
|
|
55
55
|
}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import type {PrimitiveTopology, ShaderLayout, TransformFeedbackProps} from '@luma.gl/core';
|
|
2
|
-
import {log, TransformFeedback, Buffer} from '@luma.gl/core';
|
|
2
|
+
import {log, TransformFeedback, Buffer, BufferRange} from '@luma.gl/core';
|
|
3
3
|
import {GL} from '@luma.gl/constants';
|
|
4
4
|
import {WebGLDevice} from '../webgl-device';
|
|
5
5
|
import {WEBGLBuffer} from '../..';
|
|
6
6
|
import {getGLPrimitive} from '../helpers/webgl-topology-utils';
|
|
7
7
|
|
|
8
|
-
/** For bindRange */
|
|
9
|
-
type BufferRange = {
|
|
10
|
-
buffer: Buffer;
|
|
11
|
-
byteOffset?: number;
|
|
12
|
-
byteLength?: number;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
8
|
export class WEBGLTransformFeedback extends TransformFeedback {
|
|
16
9
|
readonly device: WebGLDevice;
|
|
17
10
|
readonly gl2: WebGL2RenderingContext;
|
|
@@ -72,7 +65,7 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
72
65
|
|
|
73
66
|
// SUBCLASS
|
|
74
67
|
|
|
75
|
-
setBuffers(buffers: Record<string, Buffer | BufferRange>) {
|
|
68
|
+
setBuffers(buffers: Record<string, Buffer | BufferRange>): void {
|
|
76
69
|
this.buffers = {};
|
|
77
70
|
this.unusedBuffers = {};
|
|
78
71
|
|
|
@@ -81,17 +74,16 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
81
74
|
this.setBuffer(bufferName, buffers[bufferName]);
|
|
82
75
|
}
|
|
83
76
|
});
|
|
84
|
-
return this;
|
|
85
77
|
}
|
|
86
78
|
|
|
87
|
-
setBuffer(locationOrName: string | number, bufferOrRange: Buffer | BufferRange) {
|
|
79
|
+
setBuffer(locationOrName: string | number, bufferOrRange: Buffer | BufferRange): void {
|
|
88
80
|
const location = this._getVaryingIndex(locationOrName);
|
|
89
81
|
const {buffer, byteLength, byteOffset} = this._getBufferRange(bufferOrRange);
|
|
90
82
|
|
|
91
83
|
if (location < 0) {
|
|
92
84
|
this.unusedBuffers[locationOrName] = buffer;
|
|
93
85
|
log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
|
|
94
|
-
return
|
|
86
|
+
return;
|
|
95
87
|
}
|
|
96
88
|
|
|
97
89
|
this.buffers[location] = {buffer, byteLength, byteOffset};
|
|
@@ -101,8 +93,14 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
101
93
|
if (!this.bindOnUse) {
|
|
102
94
|
this._bindBuffer(location, buffer, byteOffset, byteLength);
|
|
103
95
|
}
|
|
96
|
+
}
|
|
104
97
|
|
|
105
|
-
|
|
98
|
+
getBuffer(locationOrName: string | number): Buffer | BufferRange | null {
|
|
99
|
+
if (isIndex(locationOrName)) {
|
|
100
|
+
return this.buffers[locationOrName] || null;
|
|
101
|
+
}
|
|
102
|
+
const location = this._getVaryingIndex(locationOrName);
|
|
103
|
+
return location >= 0 ? this.buffers[location] : null;
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
bind(funcOrHandle = this.handle) {
|
|
@@ -146,7 +144,7 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
146
144
|
return {buffer, byteOffset, byteLength};
|
|
147
145
|
}
|
|
148
146
|
|
|
149
|
-
protected _getVaryingIndex(locationOrName: string | number) {
|
|
147
|
+
protected _getVaryingIndex(locationOrName: string | number): number {
|
|
150
148
|
if (isIndex(locationOrName)) {
|
|
151
149
|
return Number(locationOrName);
|
|
152
150
|
}
|
|
@@ -182,14 +180,13 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
182
180
|
buffer: Buffer,
|
|
183
181
|
byteOffset = 0,
|
|
184
182
|
byteLength?: number
|
|
185
|
-
):
|
|
183
|
+
): void {
|
|
186
184
|
const handle = buffer && (buffer as WEBGLBuffer).handle;
|
|
187
185
|
if (!handle || byteLength === undefined) {
|
|
188
186
|
this.gl2.bindBufferBase(GL.TRANSFORM_FEEDBACK_BUFFER, index, handle);
|
|
189
187
|
} else {
|
|
190
188
|
this.gl2.bindBufferRange(GL.TRANSFORM_FEEDBACK_BUFFER, index, handle, byteOffset, byteLength);
|
|
191
189
|
}
|
|
192
|
-
return this;
|
|
193
190
|
}
|
|
194
191
|
}
|
|
195
192
|
|
|
@@ -9,6 +9,7 @@ const ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';
|
|
|
9
9
|
/**
|
|
10
10
|
* Converts TYPED ARRAYS to corresponding GL constant
|
|
11
11
|
* Used to auto deduce gl parameter types
|
|
12
|
+
* @deprecated Use getDataTypeFromTypedArray
|
|
12
13
|
* @param arrayOrType
|
|
13
14
|
* @returns
|
|
14
15
|
*/
|
|
@@ -40,6 +41,7 @@ export function getGLTypeFromTypedArray(arrayOrType: TypedArray): GLDataType {
|
|
|
40
41
|
/**
|
|
41
42
|
* Converts GL constant to corresponding TYPED ARRAY
|
|
42
43
|
* Used to auto deduce gl parameter types
|
|
44
|
+
* @deprecated Use getTypedArrayFromDataType
|
|
43
45
|
* @param glType
|
|
44
46
|
* @param param1
|
|
45
47
|
* @returns
|