@luma.gl/webgl 9.0.3 → 9.0.4
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/dist.dev.js +70 -36
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +37 -32
- package/dist/index.cjs.map +2 -2
- package/package.json +3 -3
- 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
|
@@ -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,E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AG;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,E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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. */
|
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. */
|
|
@@ -5177,6 +5189,7 @@ ${source2}`;
|
|
|
5177
5189
|
throw new Error("not implemented");
|
|
5178
5190
|
}
|
|
5179
5191
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
5192
|
+
let prevHandle;
|
|
5180
5193
|
try {
|
|
5181
5194
|
const webglBuffer = destination;
|
|
5182
5195
|
const sourceWidth = width || framebuffer.width;
|
|
@@ -5185,7 +5198,7 @@ ${source2}`;
|
|
|
5185
5198
|
const sourceFormat = sourceParams.dataFormat;
|
|
5186
5199
|
const sourceType = sourceParams.type;
|
|
5187
5200
|
device.gl.bindBuffer(35051 /* PIXEL_PACK_BUFFER */, webglBuffer.handle);
|
|
5188
|
-
device.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, framebuffer.handle);
|
|
5201
|
+
prevHandle = device.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, framebuffer.handle);
|
|
5189
5202
|
device.gl.readPixels(
|
|
5190
5203
|
origin[0],
|
|
5191
5204
|
origin[1],
|
|
@@ -5197,7 +5210,9 @@ ${source2}`;
|
|
|
5197
5210
|
);
|
|
5198
5211
|
} finally {
|
|
5199
5212
|
device.gl.bindBuffer(35051 /* PIXEL_PACK_BUFFER */, null);
|
|
5200
|
-
|
|
5213
|
+
if (prevHandle !== void 0) {
|
|
5214
|
+
device.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, prevHandle);
|
|
5215
|
+
}
|
|
5201
5216
|
if (destroyFramebuffer) {
|
|
5202
5217
|
framebuffer.destroy();
|
|
5203
5218
|
}
|
|
@@ -5207,12 +5222,14 @@ ${source2}`;
|
|
|
5207
5222
|
const {
|
|
5208
5223
|
/** Texture to copy to/from. */
|
|
5209
5224
|
source,
|
|
5210
|
-
/** Mip-map level of the texture to copy to
|
|
5211
|
-
|
|
5225
|
+
/** Mip-map level of the texture to copy to (Default 0) */
|
|
5226
|
+
destinationMipLevel = 0,
|
|
5212
5227
|
/** Defines which aspects of the texture to copy to/from. */
|
|
5213
5228
|
// aspect = 'all',
|
|
5214
|
-
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy
|
|
5229
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy from. */
|
|
5215
5230
|
origin = [0, 0],
|
|
5231
|
+
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */
|
|
5232
|
+
destinationOrigin = [0, 0],
|
|
5216
5233
|
/** Texture to copy to/from. */
|
|
5217
5234
|
destination
|
|
5218
5235
|
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
@@ -5224,15 +5241,16 @@ ${source2}`;
|
|
|
5224
5241
|
} = options;
|
|
5225
5242
|
let {
|
|
5226
5243
|
width = options.destination.width,
|
|
5227
|
-
height = options.destination.
|
|
5244
|
+
height = options.destination.height
|
|
5228
5245
|
// depthOrArrayLayers = 0
|
|
5229
5246
|
} = options;
|
|
5230
|
-
const destinationMipmaplevel = 0;
|
|
5231
|
-
const destinationInternalFormat = 6408 /* RGBA */;
|
|
5232
5247
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
5233
5248
|
const [sourceX, sourceY] = origin;
|
|
5234
|
-
const
|
|
5235
|
-
device.gl.bindFramebuffer(
|
|
5249
|
+
const [destinationX, destinationY, destinationZ] = destinationOrigin;
|
|
5250
|
+
const prevHandle = device.gl.bindFramebuffer(
|
|
5251
|
+
36160 /* FRAMEBUFFER */,
|
|
5252
|
+
framebuffer.handle
|
|
5253
|
+
);
|
|
5236
5254
|
let texture = null;
|
|
5237
5255
|
let textureTarget;
|
|
5238
5256
|
if (destination instanceof WEBGLTexture) {
|
|
@@ -5240,31 +5258,47 @@ ${source2}`;
|
|
|
5240
5258
|
width = Number.isFinite(width) ? width : texture.width;
|
|
5241
5259
|
height = Number.isFinite(height) ? height : texture.height;
|
|
5242
5260
|
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
|
-
);
|
|
5261
|
+
textureTarget = texture.target;
|
|
5259
5262
|
} else {
|
|
5263
|
+
throw new Error("invalid destination");
|
|
5264
|
+
}
|
|
5265
|
+
switch (textureTarget) {
|
|
5266
|
+
case 3553 /* TEXTURE_2D */:
|
|
5267
|
+
case 34067 /* TEXTURE_CUBE_MAP */:
|
|
5268
|
+
device.gl.copyTexSubImage2D(
|
|
5269
|
+
textureTarget,
|
|
5270
|
+
destinationMipLevel,
|
|
5271
|
+
destinationX,
|
|
5272
|
+
destinationY,
|
|
5273
|
+
sourceX,
|
|
5274
|
+
sourceY,
|
|
5275
|
+
width,
|
|
5276
|
+
height
|
|
5277
|
+
);
|
|
5278
|
+
break;
|
|
5279
|
+
case 35866 /* TEXTURE_2D_ARRAY */:
|
|
5280
|
+
case 32879 /* TEXTURE_3D */:
|
|
5281
|
+
device.gl.copyTexSubImage3D(
|
|
5282
|
+
textureTarget,
|
|
5283
|
+
destinationMipLevel,
|
|
5284
|
+
destinationX,
|
|
5285
|
+
destinationY,
|
|
5286
|
+
destinationZ,
|
|
5287
|
+
sourceX,
|
|
5288
|
+
sourceY,
|
|
5289
|
+
width,
|
|
5290
|
+
height
|
|
5291
|
+
);
|
|
5292
|
+
break;
|
|
5293
|
+
default:
|
|
5260
5294
|
}
|
|
5261
5295
|
if (texture) {
|
|
5262
5296
|
texture.unbind();
|
|
5263
5297
|
}
|
|
5298
|
+
device.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, prevHandle);
|
|
5264
5299
|
if (destroyFramebuffer) {
|
|
5265
5300
|
framebuffer.destroy();
|
|
5266
5301
|
}
|
|
5267
|
-
return texture;
|
|
5268
5302
|
}
|
|
5269
5303
|
function getFramebuffer(source) {
|
|
5270
5304
|
if (source instanceof import_core19.Texture) {
|