@luma.gl/webgl 9.0.3 → 9.0.5
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 +5 -5
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +8 -3
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +29 -56
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +3 -2
- package/dist/adapter/resources/webgl-render-pass.js +1 -1
- package/dist/adapter/webgl-device.d.ts +1 -0
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +6 -2
- package/dist/dist.dev.js +101 -55
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +43 -34
- package/dist/index.cjs.map +2 -2
- package/package.json +3 -3
- package/src/.DS_Store +0 -0
- package/src/adapter/.DS_Store +0 -0
- package/src/adapter/converters/device-parameters.ts +37 -28
- package/src/adapter/resources/webgl-command-buffer.ts +54 -67
- package/src/adapter/resources/webgl-framebuffer.ts +6 -2
- package/src/adapter/resources/webgl-render-pass.ts +1 -1
- package/src/adapter/webgl-device.ts +11 -2
- package/src/context/.DS_Store +0 -0
- package/dist.min.js +0 -19
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type { GLParameters } from '@luma.gl/constants';
|
|
1
|
+
import type { CompareFunction } from '@luma.gl/core';
|
|
2
|
+
import { Device, Parameters } from '@luma.gl/core';
|
|
3
|
+
import type { GLFunction, GLParameters } from '@luma.gl/constants';
|
|
4
4
|
/**
|
|
5
5
|
* Execute a function with a set of temporary WebGL parameter overrides
|
|
6
6
|
* - Saves current "global" WebGL context settings
|
|
@@ -31,6 +31,6 @@ export declare function withGLParameters<T = unknown>(device: Device, parameters
|
|
|
31
31
|
export declare function withDeviceParameters<T = unknown>(device: Device, parameters: Parameters, func: (device?: Device) => T): T;
|
|
32
32
|
/** Set WebGPU Style Parameters */
|
|
33
33
|
export declare function setDeviceParameters(device: Device, parameters: Parameters): void;
|
|
34
|
-
export declare function convertCompareFunction(parameter: string, value: CompareFunction):
|
|
35
|
-
export declare function convertToCompareFunction(parameter: string, value:
|
|
34
|
+
export declare function convertCompareFunction(parameter: string, value: CompareFunction): GLFunction;
|
|
35
|
+
export declare function convertToCompareFunction(parameter: string, value: GLFunction): CompareFunction;
|
|
36
36
|
//# sourceMappingURL=device-parameters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/device-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"device-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/device-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAgD,MAAM,eAAe,CAAC;AAClG,OAAO,EAAC,MAAM,EAAsB,UAAU,EAA+B,MAAM,eAAe,CAAC;AAEnG,OAAO,KAAK,EAGV,UAAU,EACV,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAO5B;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,OAAO,EACnD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAgBH;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,YAAY,EACxB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAeH;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,OAAO,EAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAgBH;AAED,kCAAkC;AAClC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,QAsMzE;AAyBD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,UAAU,CAW5F;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,CAW9F"}
|
|
@@ -135,9 +135,9 @@ export function setDeviceParameters(device, parameters) {
|
|
|
135
135
|
const extensions = webglDevice.getExtension('WEBGL_polygon_mode');
|
|
136
136
|
const ext = extensions.WEBGL_polygon_mode;
|
|
137
137
|
if (parameters.polygonMode) {
|
|
138
|
-
const mode = map('polygonMode', parameters.
|
|
138
|
+
const mode = map('polygonMode', parameters.polygonMode, {
|
|
139
139
|
fill: 6914,
|
|
140
|
-
|
|
140
|
+
line: 6913
|
|
141
141
|
});
|
|
142
142
|
ext?.polygonModeWEBGL(1028, mode);
|
|
143
143
|
ext?.polygonModeWEBGL(1029, mode);
|
|
@@ -305,7 +305,12 @@ function convertBlendFactorToFunction(parameter, value) {
|
|
|
305
305
|
'src-alpha': 770,
|
|
306
306
|
'one-minus-src-alpha': 771,
|
|
307
307
|
'dst-alpha': 772,
|
|
308
|
-
'one-minus-dst-alpha': 773
|
|
308
|
+
'one-minus-dst-alpha': 773,
|
|
309
|
+
'src-alpha-saturated': 776,
|
|
310
|
+
'constant-color': 32769,
|
|
311
|
+
'one-minus-constant-color': 32770,
|
|
312
|
+
'constant-alpha': 32771,
|
|
313
|
+
'one-minus-constant-alpha': 32772
|
|
309
314
|
});
|
|
310
315
|
}
|
|
311
316
|
function message(parameter, value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,aAAa,EAAuB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAU5C,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,yBAAyB,CAAC;CACpC,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,2BAA2B,CAAC;CACtC,CAAC;AAEF,KAAK,OAAO,GACR,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,2BAA2B,CAAC;AAEhC,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,OAAO,EAAE,CAAM;gBAEb,MAAM,EAAE,WAAW;IAK/B,cAAc,CAAC,QAAQ,GAAE,OAAO,EAAkB;CAkBnD;
|
|
1
|
+
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,aAAa,EAAuB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAU5C,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,yBAAyB,CAAC;CACpC,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,2BAA2B,CAAC;CACtC,CAAC;AAEF,KAAK,OAAO,GACR,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,2BAA2B,CAAC;AAEhC,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,OAAO,EAAE,CAAM;gBAEb,MAAM,EAAE,WAAW;IAK/B,cAAc,CAAC,QAAQ,GAAE,OAAO,EAAkB;CAkBnD;AAgPD,wBAAgB,oBAAoB,CAAC,MAAM,KAAA,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAmB1D;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAcjD"}
|
|
@@ -95,6 +95,7 @@ function _copyTextureToBuffer(device, options) {
|
|
|
95
95
|
}
|
|
96
96
|
// Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature
|
|
97
97
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
98
|
+
let prevHandle;
|
|
98
99
|
try {
|
|
99
100
|
const webglBuffer = destination;
|
|
100
101
|
const sourceWidth = width || framebuffer.width;
|
|
@@ -110,12 +111,16 @@ function _copyTextureToBuffer(device, options) {
|
|
|
110
111
|
// target = device.createBuffer({byteLength});
|
|
111
112
|
// }
|
|
112
113
|
device.gl.bindBuffer(35051, webglBuffer.handle);
|
|
113
|
-
|
|
114
|
+
// @ts-expect-error native bindFramebuffer is overridden by our state tracker
|
|
115
|
+
prevHandle = device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
114
116
|
device.gl.readPixels(origin[0], origin[1], sourceWidth, sourceHeight, sourceFormat, sourceType, byteOffset);
|
|
115
117
|
}
|
|
116
118
|
finally {
|
|
117
119
|
device.gl.bindBuffer(35051, null);
|
|
118
|
-
|
|
120
|
+
// prevHandle may be unassigned if the try block failed before binding
|
|
121
|
+
if (prevHandle !== undefined) {
|
|
122
|
+
device.gl.bindFramebuffer(36160, prevHandle);
|
|
123
|
+
}
|
|
119
124
|
if (destroyFramebuffer) {
|
|
120
125
|
framebuffer.destroy();
|
|
121
126
|
}
|
|
@@ -147,12 +152,14 @@ function _copyTextureToTexture(device, options) {
|
|
|
147
152
|
const {
|
|
148
153
|
/** Texture to copy to/from. */
|
|
149
154
|
source,
|
|
150
|
-
/** Mip-map level of the texture to copy to
|
|
151
|
-
|
|
155
|
+
/** Mip-map level of the texture to copy to (Default 0) */
|
|
156
|
+
destinationMipLevel = 0,
|
|
152
157
|
/** Defines which aspects of the texture to copy to/from. */
|
|
153
158
|
// aspect = 'all',
|
|
154
|
-
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy
|
|
159
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy from. */
|
|
155
160
|
origin = [0, 0],
|
|
161
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */
|
|
162
|
+
destinationOrigin = [0, 0],
|
|
156
163
|
/** Texture to copy to/from. */
|
|
157
164
|
destination
|
|
158
165
|
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
@@ -162,21 +169,14 @@ function _copyTextureToTexture(device, options) {
|
|
|
162
169
|
/** Defines which aspects of the texture to copy to/from. */
|
|
163
170
|
// destinationAspect = options.aspect,
|
|
164
171
|
} = options;
|
|
165
|
-
let { width = options.destination.width, height = options.destination.
|
|
172
|
+
let { width = options.destination.width, height = options.destination.height
|
|
166
173
|
// depthOrArrayLayers = 0
|
|
167
174
|
} = options;
|
|
168
|
-
const destinationMipmaplevel = 0;
|
|
169
|
-
const destinationInternalFormat = 6408;
|
|
170
175
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
171
176
|
const [sourceX, sourceY] = origin;
|
|
172
|
-
const
|
|
173
|
-
//
|
|
174
|
-
|
|
175
|
-
// typeof destinationZ !== 'undefined';
|
|
176
|
-
// destinationX = destinationX || 0;
|
|
177
|
-
// destinationY = destinationY || 0;
|
|
178
|
-
// destinationZ = destinationZ || 0;
|
|
179
|
-
device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
177
|
+
const [destinationX, destinationY, destinationZ] = destinationOrigin;
|
|
178
|
+
// @ts-expect-error native bindFramebuffer is overridden by our state tracker
|
|
179
|
+
const prevHandle = device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
180
180
|
// TODO - support gl.readBuffer (WebGL2 only)
|
|
181
181
|
// const prevBuffer = gl.readBuffer(attachment);
|
|
182
182
|
let texture = null;
|
|
@@ -186,56 +186,29 @@ function _copyTextureToTexture(device, options) {
|
|
|
186
186
|
width = Number.isFinite(width) ? width : texture.width;
|
|
187
187
|
height = Number.isFinite(height) ? height : texture.height;
|
|
188
188
|
texture.bind(0);
|
|
189
|
-
textureTarget = texture.
|
|
189
|
+
textureTarget = texture.target;
|
|
190
190
|
}
|
|
191
191
|
else {
|
|
192
|
-
throw new Error('
|
|
193
|
-
// textureTarget = destination;
|
|
194
|
-
}
|
|
195
|
-
if (!isSubCopy) {
|
|
196
|
-
device.gl.copyTexImage2D(textureTarget, destinationMipmaplevel, destinationInternalFormat, sourceX, sourceY, width, height, 0 /* border must be 0 */);
|
|
192
|
+
throw new Error('invalid destination');
|
|
197
193
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// sourceY,
|
|
209
|
-
// width,
|
|
210
|
-
// height
|
|
211
|
-
// );
|
|
212
|
-
// break;
|
|
213
|
-
// case GL.TEXTURE_2D_ARRAY:
|
|
214
|
-
// case GL.TEXTURE_3D:
|
|
215
|
-
// device.gl.copyTexSubImage3D(
|
|
216
|
-
// textureTarget,
|
|
217
|
-
// destinationMipmaplevel,
|
|
218
|
-
// destinationX,
|
|
219
|
-
// destinationY,
|
|
220
|
-
// destinationZ,
|
|
221
|
-
// sourceX,
|
|
222
|
-
// sourceY,
|
|
223
|
-
// width,
|
|
224
|
-
// height
|
|
225
|
-
// );
|
|
226
|
-
// break;
|
|
227
|
-
// default:
|
|
228
|
-
// }
|
|
194
|
+
switch (textureTarget) {
|
|
195
|
+
case 3553:
|
|
196
|
+
case 34067:
|
|
197
|
+
device.gl.copyTexSubImage2D(textureTarget, destinationMipLevel, destinationX, destinationY, sourceX, sourceY, width, height);
|
|
198
|
+
break;
|
|
199
|
+
case 35866:
|
|
200
|
+
case 32879:
|
|
201
|
+
device.gl.copyTexSubImage3D(textureTarget, destinationMipLevel, destinationX, destinationY, destinationZ, sourceX, sourceY, width, height);
|
|
202
|
+
break;
|
|
203
|
+
default:
|
|
229
204
|
}
|
|
230
205
|
if (texture) {
|
|
231
206
|
texture.unbind();
|
|
232
207
|
}
|
|
233
|
-
|
|
234
|
-
// device.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
208
|
+
device.gl.bindFramebuffer(36160, prevHandle);
|
|
235
209
|
if (destroyFramebuffer) {
|
|
236
210
|
framebuffer.destroy();
|
|
237
211
|
}
|
|
238
|
-
return texture;
|
|
239
212
|
}
|
|
240
213
|
// Returns number of components in a specific readPixels WebGL format
|
|
241
214
|
export function glFormatToComponents(format) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAS,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAC7C,OAAO,EAAC,gBAAgB,EAAC,gCAA6B;AAMtD,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,YAAY,CAAC;AAEzD,iDAAiD;AACjD,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,MAAM,EAAE,WAAW,CAAC;IACpB,EAAE,EAAE,sBAAsB,CAAC;IAC3B,MAAM,EAAE,gBAAgB,CAAC;IAEzB,IAAI,OAAO,wCAEV;gBAEW,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAS,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAC7C,OAAO,EAAC,gBAAgB,EAAC,gCAA6B;AAMtD,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,YAAY,CAAC;AAEzD,iDAAiD;AACjD,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,MAAM,EAAE,WAAW,CAAC;IACpB,EAAE,EAAE,sBAAsB,CAAC;IAC3B,MAAM,EAAE,gBAAgB,CAAC;IAEzB,IAAI,OAAO,wCAEV;gBAEW,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;IAsDxD,+CAA+C;IACtC,OAAO,IAAI,IAAI;IAUxB,mGAAmG;cAChF,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAW5E;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA2BzE,4BAA4B;IAC5B,SAAS,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,GAAG,YAAY;IAqC/E;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CACtB,UAAU,EAAE,EAAE,EACd,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,IAAI;CA2BR"}
|
|
@@ -28,7 +28,8 @@ export class WEBGLFramebuffer extends Framebuffer {
|
|
|
28
28
|
// Auto create textures for attachments if needed
|
|
29
29
|
this.autoCreateAttachmentTextures();
|
|
30
30
|
/** Attach from a map of attachments */
|
|
31
|
-
|
|
31
|
+
// @ts-expect-error native bindFramebuffer is overridden by our state tracker
|
|
32
|
+
const prevHandle = this.gl.bindFramebuffer(36160, this.handle);
|
|
32
33
|
// Walk the attachments
|
|
33
34
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
34
35
|
const attachment = this.colorAttachments[i];
|
|
@@ -48,7 +49,7 @@ export class WEBGLFramebuffer extends Framebuffer {
|
|
|
48
49
|
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
this.gl.bindFramebuffer(36160,
|
|
52
|
+
this.gl.bindFramebuffer(36160, prevHandle);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
/** destroys any auto created resources etc. */
|
|
@@ -63,8 +63,8 @@ export class WEBGLRenderPass extends RenderPass {
|
|
|
63
63
|
glParameters.viewport = parameters.viewport;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
glParameters.scissorTest = Boolean(parameters.scissorRect);
|
|
67
66
|
if (parameters.scissorRect) {
|
|
67
|
+
glParameters.scissorTest = true;
|
|
68
68
|
glParameters.scissor = parameters.scissorRect;
|
|
69
69
|
}
|
|
70
70
|
if (parameters.blendConstant) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,OAAO,EACP,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAE,aAAa,EAAmB,MAAM,eAAe,CAAC;AACtE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAQrD,OAAO,EAAC,mBAAmB,EAAC,kDAA+C;AAC3E,OAAO,EAAC,iBAAiB,EAAC,gDAA6C;AACvE,OAAO,EAAC,kBAAkB,EAAC,kCAA+B;AAU1D,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAEX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAEhB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EAEpB,eAAe,EACf,WAAW,EACX,gBAAgB,EAEhB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,WAAW,EAAC,oCAAiC;AACrD,OAAO,EAAC,WAAW,EAAC,oCAAiC;AACrD,OAAO,EAAC,Y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9C,SAAS,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACM,UAAU,IAAI,OAAO;IAgB9B,8DAA8D;IAC9D,SAAS,IAAI,IAAI;IAIjB,8CAA8C;IAC9C,QAAQ,IAAI,IAAI;IAIhB;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMlE;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,sBAAsB,GAAG,MAAM;IAc7D,sBAAsB;IACtB,UAAU,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;IAElC;;;;;OAKG;IACH,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI;IA2BvE,gDAAgD;IAChD,YAAY,CAAC,IAAI,EAAE,MAAM,YAAY,GAAG,YAAY;CAIrD"}
|
|
@@ -23,7 +23,7 @@ import { WEBGLVertexArray } from "./resources/webgl-vertex-array.js";
|
|
|
23
23
|
import { WEBGLTransformFeedback } from "./resources/webgl-transform-feedback.js";
|
|
24
24
|
import { WEBGLQuerySet } from "./resources/webgl-query-set.js";
|
|
25
25
|
import { readPixelsToArray, readPixelsToBuffer } from "../classic/copy-and-blit.js";
|
|
26
|
-
import { setGLParameters, getGLParameters } from "../context/parameters/unified-parameter-api.js";
|
|
26
|
+
import { setGLParameters, getGLParameters, resetGLParameters } from "../context/parameters/unified-parameter-api.js";
|
|
27
27
|
import { withGLParameters } from "../context/state-tracker/with-parameters.js";
|
|
28
28
|
import { clear } from "../classic/clear.js";
|
|
29
29
|
import { getWebGLExtension } from "../context/helpers/webgl-extensions.js";
|
|
@@ -266,11 +266,15 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
|
|
|
266
266
|
return getGLParameters(this.gl, parameters);
|
|
267
267
|
}
|
|
268
268
|
withParametersWebGL(parameters, func) {
|
|
269
|
-
withGLParameters(this.gl, parameters, func);
|
|
269
|
+
return withGLParameters(this.gl, parameters, func);
|
|
270
270
|
}
|
|
271
271
|
clearWebGL(options) {
|
|
272
272
|
clear(this, options);
|
|
273
273
|
}
|
|
274
|
+
resetWebGL() {
|
|
275
|
+
log.warn('WebGLDevice.resetWebGL is deprecated, use only for debugging')();
|
|
276
|
+
resetGLParameters(this.gl);
|
|
277
|
+
}
|
|
274
278
|
//
|
|
275
279
|
// WebGL-only API (not part of `Device` API)
|
|
276
280
|
//
|
package/dist/dist.dev.js
CHANGED
|
@@ -2315,10 +2315,14 @@ var __exports__ = (() => {
|
|
|
2315
2315
|
const extensions = webglDevice.getExtension("WEBGL_provoking_vertex");
|
|
2316
2316
|
const ext = extensions.WEBGL_provoking_vertex;
|
|
2317
2317
|
if (parameters.provokingVertex) {
|
|
2318
|
-
const vertex = map(
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2318
|
+
const vertex = map(
|
|
2319
|
+
"provokingVertex",
|
|
2320
|
+
parameters.provokingVertex,
|
|
2321
|
+
{
|
|
2322
|
+
first: 36429 /* FIRST_VERTEX_CONVENTION_WEBGL */,
|
|
2323
|
+
last: 36430 /* LAST_VERTEX_CONVENTION_WEBGL */
|
|
2324
|
+
}
|
|
2325
|
+
);
|
|
2322
2326
|
ext?.provokingVertexWEBGL(vertex);
|
|
2323
2327
|
}
|
|
2324
2328
|
}
|
|
@@ -2326,9 +2330,9 @@ var __exports__ = (() => {
|
|
|
2326
2330
|
const extensions = webglDevice.getExtension("WEBGL_polygon_mode");
|
|
2327
2331
|
const ext = extensions.WEBGL_polygon_mode;
|
|
2328
2332
|
if (parameters.polygonMode) {
|
|
2329
|
-
const mode = map("polygonMode", parameters.
|
|
2333
|
+
const mode = map("polygonMode", parameters.polygonMode, {
|
|
2330
2334
|
fill: 6914 /* FILL_WEBGL */,
|
|
2331
|
-
|
|
2335
|
+
line: 6913 /* LINE_WEBGL */
|
|
2332
2336
|
});
|
|
2333
2337
|
ext?.polygonModeWEBGL(1028 /* FRONT */, mode);
|
|
2334
2338
|
ext?.polygonModeWEBGL(1029 /* BACK */, mode);
|
|
@@ -2469,7 +2473,12 @@ var __exports__ = (() => {
|
|
|
2469
2473
|
"src-alpha": 770 /* SRC_ALPHA */,
|
|
2470
2474
|
"one-minus-src-alpha": 771 /* ONE_MINUS_SRC_ALPHA */,
|
|
2471
2475
|
"dst-alpha": 772 /* DST_ALPHA */,
|
|
2472
|
-
"one-minus-dst-alpha": 773 /* ONE_MINUS_DST_ALPHA
|
|
2476
|
+
"one-minus-dst-alpha": 773 /* ONE_MINUS_DST_ALPHA */,
|
|
2477
|
+
"src-alpha-saturated": 776 /* SRC_ALPHA_SATURATE */,
|
|
2478
|
+
"constant-color": 32769 /* CONSTANT_COLOR */,
|
|
2479
|
+
"one-minus-constant-color": 32770 /* ONE_MINUS_CONSTANT_COLOR */,
|
|
2480
|
+
"constant-alpha": 32771 /* CONSTANT_ALPHA */,
|
|
2481
|
+
"one-minus-constant-alpha": 32772 /* ONE_MINUS_CONSTANT_ALPHA */
|
|
2473
2482
|
});
|
|
2474
2483
|
}
|
|
2475
2484
|
function message(parameter, value) {
|
|
@@ -3442,7 +3451,10 @@ var __exports__ = (() => {
|
|
|
3442
3451
|
if (!isDefaultFramebuffer) {
|
|
3443
3452
|
device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
|
|
3444
3453
|
this.autoCreateAttachmentTextures();
|
|
3445
|
-
this.gl.bindFramebuffer(
|
|
3454
|
+
const prevHandle = this.gl.bindFramebuffer(
|
|
3455
|
+
36160 /* FRAMEBUFFER */,
|
|
3456
|
+
this.handle
|
|
3457
|
+
);
|
|
3446
3458
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
3447
3459
|
const attachment = this.colorAttachments[i];
|
|
3448
3460
|
const attachmentPoint = 36064 /* COLOR_ATTACHMENT0 */ + i;
|
|
@@ -3462,7 +3474,7 @@ var __exports__ = (() => {
|
|
|
3462
3474
|
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
3463
3475
|
}
|
|
3464
3476
|
}
|
|
3465
|
-
this.gl.bindFramebuffer(36160 /* FRAMEBUFFER */,
|
|
3477
|
+
this.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, prevHandle);
|
|
3466
3478
|
}
|
|
3467
3479
|
}
|
|
3468
3480
|
/** destroys any auto created resources etc. */
|
|
@@ -3700,35 +3712,38 @@ var __exports__ = (() => {
|
|
|
3700
3712
|
// src/context/debug/webgl-developer-tools.ts
|
|
3701
3713
|
var import_core13 = __toESM(require_core(), 1);
|
|
3702
3714
|
|
|
3703
|
-
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
3704
|
-
var document_ = globalThis.document || {};
|
|
3705
|
-
var process_ = globalThis.process || {};
|
|
3706
|
-
var console_ = globalThis.console;
|
|
3707
|
-
var navigator_ = globalThis.navigator || {};
|
|
3708
|
-
|
|
3709
3715
|
// ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
3710
3716
|
function isElectron(mockUserAgent) {
|
|
3711
|
-
if (typeof window !== "undefined" && window.process
|
|
3717
|
+
if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
|
|
3712
3718
|
return true;
|
|
3713
3719
|
}
|
|
3714
|
-
if (typeof process !== "undefined" && Boolean(process.versions
|
|
3720
|
+
if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
|
|
3715
3721
|
return true;
|
|
3716
3722
|
}
|
|
3717
|
-
const realUserAgent = typeof navigator
|
|
3723
|
+
const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
|
|
3718
3724
|
const userAgent = mockUserAgent || realUserAgent;
|
|
3719
|
-
|
|
3725
|
+
if (userAgent && userAgent.indexOf("Electron") >= 0) {
|
|
3726
|
+
return true;
|
|
3727
|
+
}
|
|
3728
|
+
return false;
|
|
3720
3729
|
}
|
|
3721
3730
|
|
|
3722
3731
|
// ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
3723
3732
|
function isBrowser() {
|
|
3724
|
-
const isNode = (
|
|
3725
|
-
// @ts-expect-error
|
|
3726
|
-
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
3727
|
-
);
|
|
3733
|
+
const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
|
|
3728
3734
|
return !isNode || isElectron();
|
|
3729
3735
|
}
|
|
3730
3736
|
|
|
3737
|
+
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
3738
|
+
var self_ = globalThis.self || globalThis.window || globalThis.global;
|
|
3739
|
+
var window_ = globalThis.window || globalThis.self || globalThis.global;
|
|
3740
|
+
var document_ = globalThis.document || {};
|
|
3741
|
+
var process_ = globalThis.process || {};
|
|
3742
|
+
var console_ = globalThis.console;
|
|
3743
|
+
var navigator_ = globalThis.navigator || {};
|
|
3744
|
+
|
|
3731
3745
|
// ../../node_modules/@probe.gl/env/dist/lib/get-browser.js
|
|
3746
|
+
var window2 = globalThis;
|
|
3732
3747
|
function getBrowser(mockUserAgent) {
|
|
3733
3748
|
if (!mockUserAgent && !isBrowser()) {
|
|
3734
3749
|
return "Node";
|
|
@@ -3740,13 +3755,18 @@ var __exports__ = (() => {
|
|
|
3740
3755
|
if (userAgent.indexOf("Edge") > -1) {
|
|
3741
3756
|
return "Edge";
|
|
3742
3757
|
}
|
|
3743
|
-
|
|
3758
|
+
const isMSIE = userAgent.indexOf("MSIE ") !== -1;
|
|
3759
|
+
const isTrident = userAgent.indexOf("Trident/") !== -1;
|
|
3760
|
+
if (isMSIE || isTrident) {
|
|
3761
|
+
return "IE";
|
|
3762
|
+
}
|
|
3763
|
+
if (window2.chrome) {
|
|
3744
3764
|
return "Chrome";
|
|
3745
3765
|
}
|
|
3746
|
-
if (
|
|
3766
|
+
if (window2.safari) {
|
|
3747
3767
|
return "Safari";
|
|
3748
3768
|
}
|
|
3749
|
-
if (
|
|
3769
|
+
if (window2.mozInnerScreenX) {
|
|
3750
3770
|
return "Firefox";
|
|
3751
3771
|
}
|
|
3752
3772
|
return "Unknown";
|
|
@@ -4043,8 +4063,8 @@ ${source2}`;
|
|
|
4043
4063
|
glParameters.viewport = parameters.viewport;
|
|
4044
4064
|
}
|
|
4045
4065
|
}
|
|
4046
|
-
glParameters.scissorTest = Boolean(parameters.scissorRect);
|
|
4047
4066
|
if (parameters.scissorRect) {
|
|
4067
|
+
glParameters.scissorTest = true;
|
|
4048
4068
|
glParameters.scissor = parameters.scissorRect;
|
|
4049
4069
|
}
|
|
4050
4070
|
if (parameters.blendConstant) {
|
|
@@ -5177,6 +5197,7 @@ ${source2}`;
|
|
|
5177
5197
|
throw new Error("not implemented");
|
|
5178
5198
|
}
|
|
5179
5199
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
5200
|
+
let prevHandle;
|
|
5180
5201
|
try {
|
|
5181
5202
|
const webglBuffer = destination;
|
|
5182
5203
|
const sourceWidth = width || framebuffer.width;
|
|
@@ -5185,7 +5206,7 @@ ${source2}`;
|
|
|
5185
5206
|
const sourceFormat = sourceParams.dataFormat;
|
|
5186
5207
|
const sourceType = sourceParams.type;
|
|
5187
5208
|
device.gl.bindBuffer(35051 /* PIXEL_PACK_BUFFER */, webglBuffer.handle);
|
|
5188
|
-
device.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, framebuffer.handle);
|
|
5209
|
+
prevHandle = device.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, framebuffer.handle);
|
|
5189
5210
|
device.gl.readPixels(
|
|
5190
5211
|
origin[0],
|
|
5191
5212
|
origin[1],
|
|
@@ -5197,7 +5218,9 @@ ${source2}`;
|
|
|
5197
5218
|
);
|
|
5198
5219
|
} finally {
|
|
5199
5220
|
device.gl.bindBuffer(35051 /* PIXEL_PACK_BUFFER */, null);
|
|
5200
|
-
|
|
5221
|
+
if (prevHandle !== void 0) {
|
|
5222
|
+
device.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, prevHandle);
|
|
5223
|
+
}
|
|
5201
5224
|
if (destroyFramebuffer) {
|
|
5202
5225
|
framebuffer.destroy();
|
|
5203
5226
|
}
|
|
@@ -5207,12 +5230,14 @@ ${source2}`;
|
|
|
5207
5230
|
const {
|
|
5208
5231
|
/** Texture to copy to/from. */
|
|
5209
5232
|
source,
|
|
5210
|
-
/** Mip-map level of the texture to copy to
|
|
5211
|
-
|
|
5233
|
+
/** Mip-map level of the texture to copy to (Default 0) */
|
|
5234
|
+
destinationMipLevel = 0,
|
|
5212
5235
|
/** Defines which aspects of the texture to copy to/from. */
|
|
5213
5236
|
// aspect = 'all',
|
|
5214
|
-
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy
|
|
5237
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy from. */
|
|
5215
5238
|
origin = [0, 0],
|
|
5239
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */
|
|
5240
|
+
destinationOrigin = [0, 0],
|
|
5216
5241
|
/** Texture to copy to/from. */
|
|
5217
5242
|
destination
|
|
5218
5243
|
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
@@ -5224,15 +5249,16 @@ ${source2}`;
|
|
|
5224
5249
|
} = options;
|
|
5225
5250
|
let {
|
|
5226
5251
|
width = options.destination.width,
|
|
5227
|
-
height = options.destination.
|
|
5252
|
+
height = options.destination.height
|
|
5228
5253
|
// depthOrArrayLayers = 0
|
|
5229
5254
|
} = options;
|
|
5230
|
-
const destinationMipmaplevel = 0;
|
|
5231
|
-
const destinationInternalFormat = 6408 /* RGBA */;
|
|
5232
5255
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
5233
5256
|
const [sourceX, sourceY] = origin;
|
|
5234
|
-
const
|
|
5235
|
-
device.gl.bindFramebuffer(
|
|
5257
|
+
const [destinationX, destinationY, destinationZ] = destinationOrigin;
|
|
5258
|
+
const prevHandle = device.gl.bindFramebuffer(
|
|
5259
|
+
36160 /* FRAMEBUFFER */,
|
|
5260
|
+
framebuffer.handle
|
|
5261
|
+
);
|
|
5236
5262
|
let texture = null;
|
|
5237
5263
|
let textureTarget;
|
|
5238
5264
|
if (destination instanceof WEBGLTexture) {
|
|
@@ -5240,31 +5266,47 @@ ${source2}`;
|
|
|
5240
5266
|
width = Number.isFinite(width) ? width : texture.width;
|
|
5241
5267
|
height = Number.isFinite(height) ? height : texture.height;
|
|
5242
5268
|
texture.bind(0);
|
|
5243
|
-
textureTarget = texture.
|
|
5244
|
-
} else {
|
|
5245
|
-
throw new Error("whoops");
|
|
5246
|
-
}
|
|
5247
|
-
if (!isSubCopy) {
|
|
5248
|
-
device.gl.copyTexImage2D(
|
|
5249
|
-
textureTarget,
|
|
5250
|
-
destinationMipmaplevel,
|
|
5251
|
-
destinationInternalFormat,
|
|
5252
|
-
sourceX,
|
|
5253
|
-
sourceY,
|
|
5254
|
-
width,
|
|
5255
|
-
height,
|
|
5256
|
-
0
|
|
5257
|
-
/* border must be 0 */
|
|
5258
|
-
);
|
|
5269
|
+
textureTarget = texture.target;
|
|
5259
5270
|
} else {
|
|
5271
|
+
throw new Error("invalid destination");
|
|
5272
|
+
}
|
|
5273
|
+
switch (textureTarget) {
|
|
5274
|
+
case 3553 /* TEXTURE_2D */:
|
|
5275
|
+
case 34067 /* TEXTURE_CUBE_MAP */:
|
|
5276
|
+
device.gl.copyTexSubImage2D(
|
|
5277
|
+
textureTarget,
|
|
5278
|
+
destinationMipLevel,
|
|
5279
|
+
destinationX,
|
|
5280
|
+
destinationY,
|
|
5281
|
+
sourceX,
|
|
5282
|
+
sourceY,
|
|
5283
|
+
width,
|
|
5284
|
+
height
|
|
5285
|
+
);
|
|
5286
|
+
break;
|
|
5287
|
+
case 35866 /* TEXTURE_2D_ARRAY */:
|
|
5288
|
+
case 32879 /* TEXTURE_3D */:
|
|
5289
|
+
device.gl.copyTexSubImage3D(
|
|
5290
|
+
textureTarget,
|
|
5291
|
+
destinationMipLevel,
|
|
5292
|
+
destinationX,
|
|
5293
|
+
destinationY,
|
|
5294
|
+
destinationZ,
|
|
5295
|
+
sourceX,
|
|
5296
|
+
sourceY,
|
|
5297
|
+
width,
|
|
5298
|
+
height
|
|
5299
|
+
);
|
|
5300
|
+
break;
|
|
5301
|
+
default:
|
|
5260
5302
|
}
|
|
5261
5303
|
if (texture) {
|
|
5262
5304
|
texture.unbind();
|
|
5263
5305
|
}
|
|
5306
|
+
device.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, prevHandle);
|
|
5264
5307
|
if (destroyFramebuffer) {
|
|
5265
5308
|
framebuffer.destroy();
|
|
5266
5309
|
}
|
|
5267
|
-
return texture;
|
|
5268
5310
|
}
|
|
5269
5311
|
function getFramebuffer(source) {
|
|
5270
5312
|
if (source instanceof import_core19.Texture) {
|
|
@@ -6191,11 +6233,15 @@ ${source2}`;
|
|
|
6191
6233
|
return getGLParameters(this.gl, parameters);
|
|
6192
6234
|
}
|
|
6193
6235
|
withParametersWebGL(parameters, func) {
|
|
6194
|
-
withGLParameters(this.gl, parameters, func);
|
|
6236
|
+
return withGLParameters(this.gl, parameters, func);
|
|
6195
6237
|
}
|
|
6196
6238
|
clearWebGL(options) {
|
|
6197
6239
|
clear(this, options);
|
|
6198
6240
|
}
|
|
6241
|
+
resetWebGL() {
|
|
6242
|
+
import_core27.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")();
|
|
6243
|
+
resetGLParameters(this.gl);
|
|
6244
|
+
}
|
|
6199
6245
|
//
|
|
6200
6246
|
// WebGL-only API (not part of `Device` API)
|
|
6201
6247
|
//
|