@luma.gl/webgl 9.1.0-alpha.14 → 9.1.0-alpha.16
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 +3 -3
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-texture-utils.d.ts +24 -22
- package/dist/adapter/helpers/webgl-texture-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-texture-utils.js +6 -224
- package/dist/adapter/resources/webgl-command-buffer.js +15 -15
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -3
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +10 -11
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +24 -11
- package/dist/adapter/resources/webgl-shader.d.ts +1 -0
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +6 -4
- package/dist/adapter/webgl-adapter.d.ts.map +1 -1
- package/dist/adapter/webgl-adapter.js +4 -10
- package/dist/adapter/webgl-device.d.ts +1 -2
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +33 -14
- package/dist/context/debug/spector-types.js +1 -1
- package/dist/context/debug/spector.d.ts +5 -5
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +6 -6
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -3
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +4 -19
- package/dist/context/helpers/create-browser-context.d.ts +6 -22
- package/dist/context/helpers/create-browser-context.d.ts.map +1 -1
- package/dist/context/helpers/create-browser-context.js +26 -32
- package/dist/dist.dev.js +1762 -1749
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +1660 -1653
- package/dist/index.cjs.map +4 -4
- package/package.json +4 -4
- package/src/adapter/converters/device-parameters.ts +3 -3
- package/src/adapter/helpers/webgl-texture-utils.ts +33 -30
- package/src/adapter/resources/webgl-command-buffer.ts +16 -16
- package/src/adapter/resources/webgl-framebuffer.ts +12 -12
- package/src/adapter/resources/webgl-render-pipeline.ts +26 -11
- package/src/adapter/resources/webgl-shader.ts +7 -5
- package/src/adapter/webgl-adapter.ts +4 -12
- package/src/adapter/webgl-device.ts +67 -40
- package/src/context/debug/spector-types.ts +1 -1
- package/src/context/debug/spector.ts +11 -11
- package/src/context/debug/webgl-developer-tools.ts +5 -31
- package/src/context/helpers/create-browser-context.ts +39 -64
|
@@ -9,7 +9,7 @@ import type { GLFunction, GLParameters } from '@luma.gl/constants';
|
|
|
9
9
|
* - Restores parameters
|
|
10
10
|
* - Returns the return value of the supplied function
|
|
11
11
|
*/
|
|
12
|
-
export declare function withDeviceAndGLParameters<T = unknown>(device: Device, parameters: Parameters, glParameters: GLParameters, func: (
|
|
12
|
+
export declare function withDeviceAndGLParameters<T = unknown>(device: Device, parameters: Parameters, glParameters: GLParameters, func: (_?: Device) => T): T;
|
|
13
13
|
/**
|
|
14
14
|
* Execute a function with a set of temporary WebGL parameter overrides
|
|
15
15
|
* - Saves current "global" WebGL context settings
|
|
@@ -19,7 +19,7 @@ export declare function withDeviceAndGLParameters<T = unknown>(device: Device, p
|
|
|
19
19
|
* - Returns the return value of the supplied function
|
|
20
20
|
* @deprecated use withDeviceParameters instead
|
|
21
21
|
*/
|
|
22
|
-
export declare function withGLParameters<T = unknown>(device: Device, parameters: GLParameters, func: (
|
|
22
|
+
export declare function withGLParameters<T = unknown>(device: Device, parameters: GLParameters, func: (_?: Device) => T): T;
|
|
23
23
|
/**
|
|
24
24
|
* Execute a function with a set of temporary WebGL parameter overrides
|
|
25
25
|
* - Saves current "global" WebGL context settings
|
|
@@ -28,7 +28,7 @@ export declare function withGLParameters<T = unknown>(device: Device, parameters
|
|
|
28
28
|
* - Restores parameters
|
|
29
29
|
* - Returns the return value of the supplied function
|
|
30
30
|
*/
|
|
31
|
-
export declare function withDeviceParameters<T = unknown>(device: Device, parameters: Parameters, func: (
|
|
31
|
+
export declare function withDeviceParameters<T = unknown>(device: Device, parameters: Parameters, func: (_?: Device) => T): T;
|
|
32
32
|
/** Set WebGPU Style Parameters */
|
|
33
33
|
export declare function setDeviceParameters(device: Device, parameters: Parameters): void;
|
|
34
34
|
export declare function convertCompareFunction(parameter: string, value: CompareFunction): GLFunction;
|
|
@@ -1 +1 @@
|
|
|
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,EAAO,UAAU,EAA+B,MAAM,eAAe,CAAC;AAEpF,OAAO,KAAK,EAGV,UAAU,EACV,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,OAAO,EACnD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,CAAC,
|
|
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,EAAO,UAAU,EAA+B,MAAM,eAAe,CAAC;AAEpF,OAAO,KAAK,EAGV,UAAU,EACV,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,OAAO,EACnD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,CAAC,GACtB,CAAC,CAgBH;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,YAAY,EACxB,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,CAAC,GACtB,CAAC,CAeH;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,OAAO,EAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,CAAC,GACtB,CAAC,CAeH;AAED,kCAAkC;AAClC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,QAgNzE;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"}
|
|
@@ -305,6 +305,27 @@ export function setMipLevelFromGPUBuffer(
|
|
|
305
305
|
gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, null);
|
|
306
306
|
}
|
|
307
307
|
*/
|
|
308
|
+
export type ReadPixelsToArrayOptions = {
|
|
309
|
+
sourceX?: number;
|
|
310
|
+
sourceY?: number;
|
|
311
|
+
sourceFormat?: number;
|
|
312
|
+
sourceAttachment?: number;
|
|
313
|
+
target?: Uint8Array | Uint16Array | Float32Array;
|
|
314
|
+
sourceWidth?: number;
|
|
315
|
+
sourceHeight?: number;
|
|
316
|
+
sourceDepth?: number;
|
|
317
|
+
sourceType?: number;
|
|
318
|
+
};
|
|
319
|
+
export type ReadPixelsToBufferOptions = {
|
|
320
|
+
sourceX?: number;
|
|
321
|
+
sourceY?: number;
|
|
322
|
+
sourceFormat?: number;
|
|
323
|
+
target?: Buffer;
|
|
324
|
+
targetByteOffset?: number;
|
|
325
|
+
sourceWidth?: number;
|
|
326
|
+
sourceHeight?: number;
|
|
327
|
+
sourceType?: number;
|
|
328
|
+
};
|
|
308
329
|
/**
|
|
309
330
|
* Copies data from a type or a Texture object into ArrayBuffer object.
|
|
310
331
|
* App can provide targetPixelArray or have it auto allocated by this method
|
|
@@ -316,17 +337,7 @@ export function setMipLevelFromGPUBuffer(
|
|
|
316
337
|
* @param options
|
|
317
338
|
* @returns pixel array,
|
|
318
339
|
*/
|
|
319
|
-
export declare function readPixelsToArray(source: Framebuffer | Texture, options?:
|
|
320
|
-
sourceX?: number;
|
|
321
|
-
sourceY?: number;
|
|
322
|
-
sourceFormat?: number;
|
|
323
|
-
sourceAttachment?: number;
|
|
324
|
-
target?: Uint8Array | Uint16Array | Float32Array;
|
|
325
|
-
sourceWidth?: number;
|
|
326
|
-
sourceHeight?: number;
|
|
327
|
-
sourceDepth?: number;
|
|
328
|
-
sourceType?: number;
|
|
329
|
-
}): Uint8Array | Uint16Array | Float32Array;
|
|
340
|
+
export declare function readPixelsToArray(source: Framebuffer | Texture, options?: ReadPixelsToArrayOptions): Uint8Array | Uint16Array | Float32Array;
|
|
330
341
|
/**
|
|
331
342
|
* Copies data from a Framebuffer or a Texture object into a Buffer object.
|
|
332
343
|
* NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.
|
|
@@ -334,21 +345,12 @@ export declare function readPixelsToArray(source: Framebuffer | Texture, options
|
|
|
334
345
|
* @param source
|
|
335
346
|
* @param options
|
|
336
347
|
*/
|
|
337
|
-
export declare function readPixelsToBuffer(source: Framebuffer | Texture, options?:
|
|
338
|
-
sourceX?: number;
|
|
339
|
-
sourceY?: number;
|
|
340
|
-
sourceFormat?: number;
|
|
341
|
-
target?: Buffer;
|
|
342
|
-
targetByteOffset?: number;
|
|
343
|
-
sourceWidth?: number;
|
|
344
|
-
sourceHeight?: number;
|
|
345
|
-
sourceType?: number;
|
|
346
|
-
}): WEBGLBuffer;
|
|
348
|
+
export declare function readPixelsToBuffer(source: Framebuffer | Texture, options?: ReadPixelsToBufferOptions): WEBGLBuffer;
|
|
347
349
|
/**
|
|
348
350
|
* Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)
|
|
349
351
|
* @deprecated Use CommandEncoder
|
|
350
352
|
*/
|
|
351
|
-
export declare function copyToTexture(
|
|
353
|
+
export declare function copyToTexture(sourceTexture: Framebuffer | Texture, destinationTexture: Texture | GL, options?: {
|
|
352
354
|
sourceX?: number;
|
|
353
355
|
sourceY?: number;
|
|
354
356
|
targetX?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-texture-utils.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/webgl-texture-utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE7E,OAAO,EACL,EAAE,EACF,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,0CAAuC;AAGhE,OAAO,EAAC,WAAW,EAAC,qCAAkC;AAMtD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,eAAe,CAAC;IAC1B,gBAAgB,EAAE,EAAE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,OAAO,GAAG,EAAE,EAChC,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAiGT;AAYD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAU1F"}
|
|
@@ -156,224 +156,6 @@ export function getWebGLTextureTarget(dimension) {
|
|
|
156
156
|
export function getWebGLCubeFaceTarget(glTarget, dimension, level) {
|
|
157
157
|
return dimension === 'cube' ? 34069 + level : glTarget;
|
|
158
158
|
}
|
|
159
|
-
// texImage methods
|
|
160
|
-
/**
|
|
161
|
-
* Clear a texture mip level.
|
|
162
|
-
* Wrapper for the messy WebGL texture API
|
|
163
|
-
*
|
|
164
|
-
export function clearMipLevel(gl: WebGL2RenderingContext, options: WebGLSetTextureOptions): void {
|
|
165
|
-
const {dimension, width, height, depth = 0, level = 0} = options;
|
|
166
|
-
const {glInternalFormat, glFormat, glType, compressed} = options;
|
|
167
|
-
const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);
|
|
168
|
-
|
|
169
|
-
switch (dimension) {
|
|
170
|
-
case '2d-array':
|
|
171
|
-
case '3d':
|
|
172
|
-
if (compressed) {
|
|
173
|
-
// prettier-ignore
|
|
174
|
-
gl.compressedTexImage3D(glTarget, level, glInternalFormat, width, height, depth, BORDER, null);
|
|
175
|
-
} else {
|
|
176
|
-
// prettier-ignore
|
|
177
|
-
gl.texImage3D( glTarget, level, glInternalFormat, width, height, depth, BORDER, glFormat, glType, null);
|
|
178
|
-
}
|
|
179
|
-
break;
|
|
180
|
-
|
|
181
|
-
case '2d':
|
|
182
|
-
case 'cube':
|
|
183
|
-
if (compressed) {
|
|
184
|
-
// prettier-ignore
|
|
185
|
-
gl.compressedTexImage2D(glTarget, level, glInternalFormat, width, height, BORDER, null);
|
|
186
|
-
} else {
|
|
187
|
-
// prettier-ignore
|
|
188
|
-
gl.texImage2D(glTarget, level, glInternalFormat, width, height, BORDER, glFormat, glType, null);
|
|
189
|
-
}
|
|
190
|
-
break;
|
|
191
|
-
|
|
192
|
-
default:
|
|
193
|
-
throw new Error(dimension);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Set a texture mip level to the contents of an external image.
|
|
199
|
-
* Wrapper for the messy WebGL texture API
|
|
200
|
-
* @note Corresponds to WebGPU device.queue.copyExternalImageToTexture()
|
|
201
|
-
*
|
|
202
|
-
export function setMipLevelFromExternalImage(
|
|
203
|
-
gl: WebGL2RenderingContext,
|
|
204
|
-
image: ExternalImage,
|
|
205
|
-
options: WebGLSetTextureOptions
|
|
206
|
-
): void {
|
|
207
|
-
const {dimension, width, height, depth = 0, level = 0} = options;
|
|
208
|
-
const {glInternalFormat, glType} = options;
|
|
209
|
-
|
|
210
|
-
const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);
|
|
211
|
-
|
|
212
|
-
// TODO - we can't change texture width (due to WebGPU limitations) -
|
|
213
|
-
// and the width/heigh of an external image is implicit, so why do we need to extract it?
|
|
214
|
-
// So what width height do we supply? The image size or the texture size?
|
|
215
|
-
// const {width, height} = Texture.getExternalImageSize(image);
|
|
216
|
-
|
|
217
|
-
switch (dimension) {
|
|
218
|
-
case '2d-array':
|
|
219
|
-
case '3d':
|
|
220
|
-
// prettier-ignore
|
|
221
|
-
gl.texImage3D(glTarget, level, glInternalFormat, width, height, depth, BORDER, glInternalFormat, glType, image);
|
|
222
|
-
break;
|
|
223
|
-
|
|
224
|
-
case '2d':
|
|
225
|
-
case 'cube':
|
|
226
|
-
// prettier-ignore
|
|
227
|
-
gl.texImage2D(glTarget, level, glInternalFormat, width, height, BORDER, glInternalFormat, glType, image);
|
|
228
|
-
break;
|
|
229
|
-
|
|
230
|
-
default:
|
|
231
|
-
throw new Error(dimension);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Set a texture mip level from CPU memory
|
|
237
|
-
* Wrapper for the messy WebGL texture API
|
|
238
|
-
* @note Not available (directly) in WebGPU
|
|
239
|
-
*
|
|
240
|
-
export function setMipLevelFromTypedArray(
|
|
241
|
-
gl: WebGL2RenderingContext,
|
|
242
|
-
data: TypedArray,
|
|
243
|
-
parameters: {},
|
|
244
|
-
options: {
|
|
245
|
-
dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';
|
|
246
|
-
height: number;
|
|
247
|
-
width: number;
|
|
248
|
-
depth?: number;
|
|
249
|
-
level?: number;
|
|
250
|
-
offset?: number;
|
|
251
|
-
glTarget: GLTextureTarget;
|
|
252
|
-
glInternalFormat: GL;
|
|
253
|
-
glFormat: GL;
|
|
254
|
-
glType: GL;
|
|
255
|
-
compressed?: boolean;
|
|
256
|
-
}
|
|
257
|
-
): void {
|
|
258
|
-
const {dimension, width, height, depth = 0, level = 0, offset = 0} = options;
|
|
259
|
-
const {glInternalFormat, glFormat, glType, compressed} = options;
|
|
260
|
-
|
|
261
|
-
const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);
|
|
262
|
-
|
|
263
|
-
withGLParameters(gl, parameters, () => {
|
|
264
|
-
switch (dimension) {
|
|
265
|
-
case '2d-array':
|
|
266
|
-
case '3d':
|
|
267
|
-
if (compressed) {
|
|
268
|
-
// prettier-ignore
|
|
269
|
-
gl.compressedTexImage3D(glTarget, level, glInternalFormat, width, height, depth, BORDER, data);
|
|
270
|
-
} else {
|
|
271
|
-
// prettier-ignore
|
|
272
|
-
gl.texImage3D( glTarget, level, glInternalFormat, width, height, depth, BORDER, glFormat, glType, data);
|
|
273
|
-
}
|
|
274
|
-
break;
|
|
275
|
-
|
|
276
|
-
case '2d':
|
|
277
|
-
if (compressed) {
|
|
278
|
-
// prettier-ignore
|
|
279
|
-
gl.compressedTexImage2D(glTarget, level, glInternalFormat, width, height, BORDER, data);
|
|
280
|
-
} else {
|
|
281
|
-
// prettier-ignore
|
|
282
|
-
gl.texImage2D( glTarget, level, glInternalFormat, width, height, BORDER, glFormat, glType, data, offset);
|
|
283
|
-
}
|
|
284
|
-
break;
|
|
285
|
-
|
|
286
|
-
default:
|
|
287
|
-
throw new Error(dimension);
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Set a texture level from CPU memory
|
|
294
|
-
* @note Not available (directly) in WebGPU
|
|
295
|
-
_setMipLevelFromTypedArray(
|
|
296
|
-
depth: number,
|
|
297
|
-
level: number,
|
|
298
|
-
data: TextureLevelData,
|
|
299
|
-
offset = 0,
|
|
300
|
-
parameters
|
|
301
|
-
): void {
|
|
302
|
-
withGLParameters(this.gl, parameters, () => {
|
|
303
|
-
switch (this.props.dimension) {
|
|
304
|
-
case '2d-array':
|
|
305
|
-
case '3d':
|
|
306
|
-
if (this.compressed) {
|
|
307
|
-
// prettier-ignore
|
|
308
|
-
this.device.gl.compressedTexImage3D(this.glTarget, level, this.glInternalFormat, data.width, data.height, depth, BORDER, data.data);
|
|
309
|
-
} else {
|
|
310
|
-
// prettier-ignore
|
|
311
|
-
this.gl.texImage3D( this.glTarget, level, this.glInternalFormat, this.width, this.height, depth, BORDER, this.glFormat, this.glType, data.data);
|
|
312
|
-
}
|
|
313
|
-
break;
|
|
314
|
-
|
|
315
|
-
case '2d':
|
|
316
|
-
if (this.compressed) {
|
|
317
|
-
// prettier-ignore
|
|
318
|
-
this.device.gl.compressedTexImage2D(this.glTarget, level, this.glInternalFormat, data.width, data.height, BORDER, data.data);
|
|
319
|
-
} else {
|
|
320
|
-
// prettier-ignore
|
|
321
|
-
this.device.gl.texImage2D( this.glTarget, level, this.glInternalFormat, this.width, this.height, BORDER, this.glFormat, this.glType, data.data, offset);
|
|
322
|
-
}
|
|
323
|
-
break;
|
|
324
|
-
|
|
325
|
-
default:
|
|
326
|
-
throw new Error(this.props.dimension);
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
* Set a texture level from a GPU buffer
|
|
332
|
-
*
|
|
333
|
-
export function setMipLevelFromGPUBuffer(
|
|
334
|
-
gl: WebGL2RenderingContext,
|
|
335
|
-
buffer: Buffer,
|
|
336
|
-
options: WebGLSetTextureOptions
|
|
337
|
-
): void {
|
|
338
|
-
const {dimension, width, height, depth = 0, level = 0, byteOffset = 0} = options;
|
|
339
|
-
const {glInternalFormat, glFormat, glType, compressed} = options;
|
|
340
|
-
const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);
|
|
341
|
-
|
|
342
|
-
const webglBuffer = buffer as WEBGLBuffer;
|
|
343
|
-
const imageSize = buffer.byteLength;
|
|
344
|
-
|
|
345
|
-
// In WebGL the source buffer is not a parameter. Instead it needs to be bound to a special bind point
|
|
346
|
-
gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, webglBuffer.handle);
|
|
347
|
-
|
|
348
|
-
switch (dimension) {
|
|
349
|
-
case '2d-array':
|
|
350
|
-
case '3d':
|
|
351
|
-
if (compressed) {
|
|
352
|
-
// prettier-ignore
|
|
353
|
-
gl.compressedTexImage3D(glTarget, level, glInternalFormat, width, height, depth, BORDER, imageSize, byteOffset);
|
|
354
|
-
} else {
|
|
355
|
-
// prettier-ignore
|
|
356
|
-
gl.texImage3D(glTarget, level, glInternalFormat, width, height, depth, BORDER, glFormat, glType, byteOffset);
|
|
357
|
-
}
|
|
358
|
-
break;
|
|
359
|
-
|
|
360
|
-
case '2d':
|
|
361
|
-
if (compressed) {
|
|
362
|
-
// prettier-ignore
|
|
363
|
-
gl.compressedTexImage2D(glTarget, level, glInternalFormat, width, height, BORDER, imageSize, byteOffset);
|
|
364
|
-
} else {
|
|
365
|
-
// prettier-ignore
|
|
366
|
-
gl.texImage2D(glTarget, level, glInternalFormat, width, height, BORDER, glFormat, glType, byteOffset);
|
|
367
|
-
}
|
|
368
|
-
break;
|
|
369
|
-
|
|
370
|
-
default:
|
|
371
|
-
throw new Error(dimension);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, null);
|
|
375
|
-
}
|
|
376
|
-
*/
|
|
377
159
|
/**
|
|
378
160
|
* Copies data from a type or a Texture object into ArrayBuffer object.
|
|
379
161
|
* App can provide targetPixelArray or have it auto allocated by this method
|
|
@@ -448,11 +230,11 @@ export function readPixelsToBuffer(source, options) {
|
|
|
448
230
|
// TODO(donmccurdy): Do we have tests to confirm this is working?
|
|
449
231
|
const commandEncoder = source.device.createCommandEncoder();
|
|
450
232
|
commandEncoder.copyTextureToBuffer({
|
|
451
|
-
|
|
233
|
+
sourceTexture: source,
|
|
452
234
|
width: sourceWidth,
|
|
453
235
|
height: sourceHeight,
|
|
454
236
|
origin: [sourceX, sourceY],
|
|
455
|
-
|
|
237
|
+
destinationBuffer: webglBufferTarget,
|
|
456
238
|
byteOffset: targetByteOffset
|
|
457
239
|
});
|
|
458
240
|
commandEncoder.destroy();
|
|
@@ -466,14 +248,14 @@ export function readPixelsToBuffer(source, options) {
|
|
|
466
248
|
* @deprecated Use CommandEncoder
|
|
467
249
|
*/
|
|
468
250
|
// eslint-disable-next-line complexity, max-statements
|
|
469
|
-
export function copyToTexture(
|
|
251
|
+
export function copyToTexture(sourceTexture, destinationTexture, options) {
|
|
470
252
|
const { sourceX = 0, sourceY = 0,
|
|
471
253
|
// attachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer
|
|
472
254
|
targetMipmaplevel = 0, targetInternalFormat = 6408 } = options || {};
|
|
473
255
|
let { targetX, targetY, targetZ, width, // defaults to target width
|
|
474
256
|
height // defaults to target height
|
|
475
257
|
} = options || {};
|
|
476
|
-
const { framebuffer, deleteFramebuffer } = getFramebuffer(
|
|
258
|
+
const { framebuffer, deleteFramebuffer } = getFramebuffer(sourceTexture);
|
|
477
259
|
// assert(framebuffer);
|
|
478
260
|
const webglFramebuffer = framebuffer;
|
|
479
261
|
const { device, handle } = webglFramebuffer;
|
|
@@ -489,8 +271,8 @@ export function copyToTexture(source, target, options) {
|
|
|
489
271
|
// assert(target);
|
|
490
272
|
let texture = null;
|
|
491
273
|
let textureTarget;
|
|
492
|
-
if (
|
|
493
|
-
texture =
|
|
274
|
+
if (destinationTexture instanceof WEBGLTexture) {
|
|
275
|
+
texture = destinationTexture;
|
|
494
276
|
width = Number.isFinite(width) ? width : texture.width;
|
|
495
277
|
height = Number.isFinite(height) ? height : texture.height;
|
|
496
278
|
texture?.bind(0);
|
|
@@ -32,8 +32,8 @@ export class WEBGLCommandBuffer extends CommandBuffer {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
function _copyBufferToBuffer(device, options) {
|
|
35
|
-
const source = options.
|
|
36
|
-
const destination = options.
|
|
35
|
+
const source = options.sourceBuffer;
|
|
36
|
+
const destination = options.destinationBuffer;
|
|
37
37
|
// {In WebGL2 we can p}erform the copy on the GPU
|
|
38
38
|
// Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type
|
|
39
39
|
device.gl.bindBuffer(36662, source.handle);
|
|
@@ -56,19 +56,19 @@ function _copyBufferToTexture(device, options) {
|
|
|
56
56
|
function _copyTextureToBuffer(device, options) {
|
|
57
57
|
const {
|
|
58
58
|
/** Texture to copy to/from. */
|
|
59
|
-
|
|
59
|
+
sourceTexture,
|
|
60
60
|
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
61
61
|
mipLevel = 0,
|
|
62
62
|
/** Defines which aspects of the texture to copy to/from. */
|
|
63
63
|
aspect = 'all',
|
|
64
64
|
/** Width to copy */
|
|
65
|
-
width = options.
|
|
65
|
+
width = options.sourceTexture.width,
|
|
66
66
|
/** Height to copy */
|
|
67
|
-
height = options.
|
|
67
|
+
height = options.sourceTexture.height, depthOrArrayLayers = 0,
|
|
68
68
|
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
|
|
69
69
|
origin = [0, 0],
|
|
70
70
|
/** Destination buffer */
|
|
71
|
-
|
|
71
|
+
destinationBuffer,
|
|
72
72
|
/** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */
|
|
73
73
|
byteOffset = 0,
|
|
74
74
|
/**
|
|
@@ -84,17 +84,17 @@ function _copyTextureToBuffer(device, options) {
|
|
|
84
84
|
rowsPerImage } = options;
|
|
85
85
|
// TODO - Not possible to read just stencil or depth part in WebGL?
|
|
86
86
|
if (aspect !== 'all') {
|
|
87
|
-
throw new Error('not supported');
|
|
87
|
+
throw new Error('aspect not supported in WebGL');
|
|
88
88
|
}
|
|
89
89
|
// TODO - mipLevels are set when attaching texture to framebuffer
|
|
90
90
|
if (mipLevel !== 0 || depthOrArrayLayers !== 0 || bytesPerRow || rowsPerImage) {
|
|
91
91
|
throw new Error('not implemented');
|
|
92
92
|
}
|
|
93
93
|
// Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature
|
|
94
|
-
const { framebuffer, destroyFramebuffer } = getFramebuffer(
|
|
94
|
+
const { framebuffer, destroyFramebuffer } = getFramebuffer(sourceTexture);
|
|
95
95
|
let prevHandle;
|
|
96
96
|
try {
|
|
97
|
-
const webglBuffer =
|
|
97
|
+
const webglBuffer = destinationBuffer;
|
|
98
98
|
const sourceWidth = width || framebuffer.width;
|
|
99
99
|
const sourceHeight = height || framebuffer.height;
|
|
100
100
|
const sourceParams = getTextureFormatWebGL(framebuffer.colorAttachments[0].texture.props.format);
|
|
@@ -148,7 +148,7 @@ export function readPixelsToBuffer(
|
|
|
148
148
|
function _copyTextureToTexture(device, options) {
|
|
149
149
|
const {
|
|
150
150
|
/** Texture to copy to/from. */
|
|
151
|
-
|
|
151
|
+
sourceTexture,
|
|
152
152
|
/** Mip-map level of the texture to copy to (Default 0) */
|
|
153
153
|
destinationMipLevel = 0,
|
|
154
154
|
/** Defines which aspects of the texture to copy to/from. */
|
|
@@ -158,7 +158,7 @@ function _copyTextureToTexture(device, options) {
|
|
|
158
158
|
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */
|
|
159
159
|
destinationOrigin = [0, 0],
|
|
160
160
|
/** Texture to copy to/from. */
|
|
161
|
-
|
|
161
|
+
destinationTexture
|
|
162
162
|
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
163
163
|
// destinationMipLevel = options.mipLevel,
|
|
164
164
|
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
|
|
@@ -166,10 +166,10 @@ function _copyTextureToTexture(device, options) {
|
|
|
166
166
|
/** Defines which aspects of the texture to copy to/from. */
|
|
167
167
|
// destinationAspect = options.aspect,
|
|
168
168
|
} = options;
|
|
169
|
-
let { width = options.
|
|
169
|
+
let { width = options.destinationTexture.width, height = options.destinationTexture.height
|
|
170
170
|
// depthOrArrayLayers = 0
|
|
171
171
|
} = options;
|
|
172
|
-
const { framebuffer, destroyFramebuffer } = getFramebuffer(
|
|
172
|
+
const { framebuffer, destroyFramebuffer } = getFramebuffer(sourceTexture);
|
|
173
173
|
const [sourceX, sourceY] = origin;
|
|
174
174
|
const [destinationX, destinationY, destinationZ] = destinationOrigin;
|
|
175
175
|
// @ts-expect-error native bindFramebuffer is overridden by our state tracker
|
|
@@ -178,8 +178,8 @@ function _copyTextureToTexture(device, options) {
|
|
|
178
178
|
// const prevBuffer = gl.readBuffer(attachment);
|
|
179
179
|
let texture = null;
|
|
180
180
|
let textureTarget;
|
|
181
|
-
if (
|
|
182
|
-
texture =
|
|
181
|
+
if (destinationTexture instanceof WEBGLTexture) {
|
|
182
|
+
texture = destinationTexture;
|
|
183
183
|
width = Number.isFinite(width) ? width : texture.width;
|
|
184
184
|
height = Number.isFinite(height) ? height : texture.height;
|
|
185
185
|
texture.bind(0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FramebufferProps
|
|
2
|
-
import { Framebuffer
|
|
1
|
+
import type { FramebufferProps } from '@luma.gl/core';
|
|
2
|
+
import { Framebuffer } from '@luma.gl/core';
|
|
3
3
|
import { GL } from '@luma.gl/constants';
|
|
4
4
|
import { WebGLDevice } from "../webgl-device.js";
|
|
5
5
|
import { WEBGLTexture } from "./webgl-texture.js";
|
|
@@ -17,7 +17,6 @@ export declare class WEBGLFramebuffer extends Framebuffer {
|
|
|
17
17
|
destroy(): void;
|
|
18
18
|
protected updateAttachments(): void;
|
|
19
19
|
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
20
|
-
protected createDepthStencilTexture(format: TextureFormat): Texture;
|
|
21
20
|
/**
|
|
22
21
|
* @param attachment
|
|
23
22
|
* @param texture
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,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;AAGtD,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,gBAAgB,EAAE,gBAAgB,EAAE,CAAM;IAC1C,sBAAsB,EAAE,gBAAgB,GAAG,IAAI,CAAQ;gBAE3C,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;IAsBxD,+CAA+C;IACtC,OAAO,IAAI,IAAI;IAQxB,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAsCnC,mGAAmG;IAYnG;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI;CA8BlF;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BE"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { Framebuffer } from '@luma.gl/core';
|
|
5
5
|
import { GL } from '@luma.gl/constants';
|
|
6
|
-
import { WEBGLTexture } from "./webgl-texture.js";
|
|
7
6
|
import { getDepthStencilAttachmentWebGL } from "../converters/texture-formats.js";
|
|
8
7
|
/** luma.gl Framebuffer, WebGL implementation */
|
|
9
8
|
export class WEBGLFramebuffer extends Framebuffer {
|
|
@@ -64,16 +63,16 @@ export class WEBGLFramebuffer extends Framebuffer {
|
|
|
64
63
|
}
|
|
65
64
|
// PRIVATE
|
|
66
65
|
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
67
|
-
createDepthStencilTexture(format) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
66
|
+
// protected override createDepthStencilTexture(format: TextureFormat): Texture {
|
|
67
|
+
// // return new WEBGLRenderbuffer(this.device, {
|
|
68
|
+
// return new WEBGLTexture(this.device, {
|
|
69
|
+
// id: `${this.id}-depth-stencil`,
|
|
70
|
+
// format,
|
|
71
|
+
// width: this.width,
|
|
72
|
+
// height: this.height,
|
|
73
|
+
// mipmaps: false
|
|
74
|
+
// });
|
|
75
|
+
// }
|
|
77
76
|
/**
|
|
78
77
|
* @param attachment
|
|
79
78
|
* @param texture
|
|
@@ -54,7 +54,7 @@ export declare class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
54
54
|
setUniformsWebGL(uniforms: Record<string, UniformValue>): void;
|
|
55
55
|
protected _linkShaders(): Promise<void>;
|
|
56
56
|
/** Report link status. First, check for shader compilation failures if linking fails */
|
|
57
|
-
_reportLinkStatus(status: 'success' | 'linking' | 'validation'): void
|
|
57
|
+
_reportLinkStatus(status: 'success' | 'linking' | 'validation'): Promise<void>;
|
|
58
58
|
/**
|
|
59
59
|
* Get the shader compilation status
|
|
60
60
|
* TODO - Load log even when no error reported, to catch warnings?
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,UAAU,EACV,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,cAAc,EAAM,MAAM,eAAe,CAAC;AAUlD,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAK3C,OAAO,EAAC,sBAAsB,EAAC,sCAAmC;AAKlE,oCAAoC;AACpC,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,yDAAyD;IACzD,MAAM,EAAE,WAAW,CAAC;IACpB,yCAAyC;IACzC,MAAM,EAAE,YAAY,CAAC;IACrB,oBAAoB;IACpB,EAAE,EAAE,WAAW,CAAC;IAChB,sB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AAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAC,GAAG,IAAI;IA0D3F;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,UAAU,CAAC;QACvB,UAAU,CAAC,EAAE,wBAAwB,CAAC;QACtC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;QAC7B,WAAW,EAAE,WAAW,CAAC;QACzB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;KAC5C,GAAG,OAAO;IAgGF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;cAkBhD,YAAY;IA2B5B,wFAAwF;IAClF,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCpF;;;;OAIG;IACH,cAAc,IAAI,SAAS,GAAG,SAAS,GAAG,YAAY;IAmBtD,6DAA6D;IACvD,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3C;;;;OAIG;IACH,sBAAsB;IAsBtB,iDAAiD;IACjD,cAAc;IAyFd;;;OAGG;IACH,cAAc;CASf"}
|
|
@@ -78,11 +78,11 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
78
78
|
// This convention allows shaders to name uniform blocks as `uniform appUniforms {} app;`
|
|
79
79
|
// and reference them as `app` from both GLSL and JS.
|
|
80
80
|
// TODO - this is rather hacky - we could also remap the name directly in the shader layout.
|
|
81
|
-
const binding = this.shaderLayout.bindings.find(
|
|
82
|
-
this.shaderLayout.bindings.find(
|
|
81
|
+
const binding = this.shaderLayout.bindings.find(binding_ => binding_.name === name) ||
|
|
82
|
+
this.shaderLayout.bindings.find(binding_ => binding_.name === `${name}Uniforms`);
|
|
83
83
|
if (!binding) {
|
|
84
84
|
const validBindings = this.shaderLayout.bindings
|
|
85
|
-
.map(
|
|
85
|
+
.map(binding_ => `"${binding_.name}"`)
|
|
86
86
|
.join(', ');
|
|
87
87
|
if (!options?.disableWarnings) {
|
|
88
88
|
log.warn(`No binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`, value)();
|
|
@@ -220,21 +220,34 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
220
220
|
this._reportLinkStatus(status);
|
|
221
221
|
}
|
|
222
222
|
/** Report link status. First, check for shader compilation failures if linking fails */
|
|
223
|
-
_reportLinkStatus(status) {
|
|
223
|
+
async _reportLinkStatus(status) {
|
|
224
224
|
switch (status) {
|
|
225
225
|
case 'success':
|
|
226
226
|
return;
|
|
227
227
|
default:
|
|
228
228
|
// First check for shader compilation failures if linking fails
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
switch (this.vs.compilationStatus) {
|
|
230
|
+
case 'error':
|
|
231
|
+
this.vs.debugShader();
|
|
232
|
+
throw new Error(`Error during compilation of shader ${this.vs.id}`);
|
|
233
|
+
case 'pending':
|
|
234
|
+
this.vs.asyncCompilationStatus.then(() => this.vs.debugShader());
|
|
235
|
+
break;
|
|
236
|
+
case 'success':
|
|
237
|
+
break;
|
|
232
238
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
239
|
+
switch (this.fs?.compilationStatus) {
|
|
240
|
+
case 'error':
|
|
241
|
+
this.fs.debugShader();
|
|
242
|
+
throw new Error(`Error during compilation of shader ${this.fs.id}`);
|
|
243
|
+
case 'pending':
|
|
244
|
+
this.fs.asyncCompilationStatus.then(() => this.fs.debugShader());
|
|
245
|
+
break;
|
|
246
|
+
case 'success':
|
|
247
|
+
break;
|
|
236
248
|
}
|
|
237
|
-
|
|
249
|
+
const linkErrorLog = this.device.gl.getProgramInfoLog(this.handle);
|
|
250
|
+
throw new Error(`Error during ${status}: ${linkErrorLog}`);
|
|
238
251
|
}
|
|
239
252
|
}
|
|
240
253
|
/**
|
|
@@ -8,6 +8,7 @@ export declare class WEBGLShader extends Shader {
|
|
|
8
8
|
readonly handle: WebGLShader;
|
|
9
9
|
constructor(device: WebGLDevice, props: ShaderProps);
|
|
10
10
|
destroy(): void;
|
|
11
|
+
get asyncCompilationStatus(): Promise<'pending' | 'success' | 'error'>;
|
|
11
12
|
getCompilationInfo(): Promise<readonly CompilerMessage[]>;
|
|
12
13
|
getCompilationInfoSync(): readonly CompilerMessage[];
|
|
13
14
|
getTranslatedSource(): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-shader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAE,eAAe,EAAM,MAAM,eAAe,CAAC;AAGxE,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C;;GAEG;AACH,qBAAa,WAAY,SAAQ,MAAM;IACrC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;gBAEjB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW;IAgB1C,OAAO,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"webgl-shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-shader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAE,eAAe,EAAM,MAAM,eAAe,CAAC;AAGxE,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C;;GAEG;AACH,qBAAa,WAAY,SAAQ,MAAM;IACrC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;gBAEjB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW;IAgB1C,OAAO,IAAI,IAAI;IASxB,IAAI,sBAAsB,IAAI,OAAO,CAAC,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC,CAErE;IAEc,kBAAkB,IAAI,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC;IAK/D,sBAAsB,IAAI,SAAS,eAAe,EAAE;IAKpD,mBAAmB,IAAI,MAAM,GAAG,IAAI;IAQ7C,kDAAkD;cAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCvD,6DAA6D;cAC7C,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB5D;;;;OAIG;IACH,SAAS,CAAC,qBAAqB;CAKhC"}
|