@luma.gl/webgl 9.0.0-beta.5 → 9.0.0-beta.7
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.map +1 -1
- package/dist/adapter/converters/device-parameters.js +128 -71
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +20 -19
- package/dist/adapter/converters/shader-formats.d.ts.map +1 -1
- package/dist/adapter/converters/shader-formats.js +40 -20
- package/dist/adapter/converters/texture-formats.d.ts +16 -11
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +224 -205
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +22 -21
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +19 -5
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +89 -43
- package/dist/adapter/device-helpers/webgl-device-info.d.ts +2 -1
- package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-info.js +22 -19
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts +33 -48
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-limits.js +42 -87
- package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -1
- package/dist/adapter/helpers/decode-webgl-types.js +47 -46
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +35 -34
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js +3 -2
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +42 -41
- package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.js +40 -39
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +2 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +2 -2
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +30 -17
- package/dist/adapter/objects/webgl-resource.d.ts +2 -24
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +6 -101
- package/dist/adapter/resources/webgl-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +16 -15
- package/dist/adapter/resources/webgl-command-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +32 -31
- package/dist/adapter/resources/webgl-command-encoder.d.ts +8 -3
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +4 -2
- package/dist/adapter/resources/webgl-external-texture.js +6 -5
- package/dist/adapter/resources/webgl-framebuffer.d.ts +6 -10
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +60 -53
- package/dist/adapter/resources/webgl-query-set.d.ts +44 -0
- package/dist/adapter/resources/webgl-query-set.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-query-set.js +136 -0
- package/dist/adapter/resources/webgl-render-pass.d.ts +3 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +20 -12
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +4 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +52 -61
- package/dist/adapter/resources/webgl-sampler.d.ts +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +5 -4
- package/dist/adapter/resources/webgl-shader.d.ts +3 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +15 -9
- package/dist/adapter/resources/webgl-texture-view.d.ts +14 -0
- package/dist/adapter/resources/webgl-texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-texture-view.js +18 -0
- package/dist/adapter/resources/webgl-texture.d.ts +6 -4
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +39 -32
- package/dist/adapter/resources/webgl-transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js +10 -10
- package/dist/adapter/resources/webgl-vertex-array.d.ts +3 -3
- package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +10 -9
- package/dist/adapter/webgl-canvas-context.d.ts +2 -2
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +3 -2
- package/dist/adapter/webgl-device.d.ts +35 -30
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +110 -109
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +8 -7
- package/dist/classic/clear.d.ts.map +1 -1
- package/dist/classic/clear.js +5 -4
- package/dist/classic/copy-and-blit.d.ts +1 -1
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +19 -19
- package/dist/classic/format-utils.d.ts.map +1 -1
- package/dist/classic/format-utils.js +16 -15
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +20 -19
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +2 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +7 -6
- package/dist/context/{context → helpers}/create-browser-context.d.ts.map +1 -1
- package/dist/context/{context → helpers}/create-browser-context.js +2 -1
- package/dist/context/{context/context-data.d.ts → helpers/webgl-context-data.d.ts} +2 -3
- package/dist/context/helpers/webgl-context-data.d.ts.map +1 -0
- package/dist/context/helpers/webgl-context-data.js +21 -0
- package/dist/context/helpers/webgl-extensions.d.ts +4 -0
- package/dist/context/helpers/webgl-extensions.d.ts.map +1 -0
- package/dist/context/helpers/webgl-extensions.js +10 -0
- package/dist/context/parameters/unified-parameter-api.d.ts +3 -4
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +7 -11
- package/dist/context/parameters/webgl-parameter-tables.d.ts +12 -13
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +302 -295
- package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.js +2 -1
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +5 -4
- package/dist/context/state-tracker/with-parameters.d.ts +2 -3
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +6 -8
- package/dist/dist.dev.js +1635 -1387
- package/dist/index.cjs +1766 -1534
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +25 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist.min.js +6 -6
- package/package.json +4 -4
- package/src/adapter/converters/device-parameters.ts +114 -27
- package/src/adapter/converters/sampler-parameters.ts +12 -3
- package/src/adapter/converters/shader-formats.ts +47 -22
- package/src/adapter/converters/texture-formats.ts +138 -114
- package/src/adapter/converters/vertex-formats.ts +3 -3
- package/src/adapter/device-helpers/webgl-device-features.ts +102 -50
- package/src/adapter/device-helpers/webgl-device-info.ts +28 -19
- package/src/adapter/device-helpers/webgl-device-limits.ts +46 -150
- package/src/adapter/helpers/decode-webgl-types.ts +13 -7
- package/src/adapter/helpers/get-shader-layout.ts +4 -3
- package/src/adapter/helpers/parse-shader-compiler-log.ts +10 -6
- package/src/adapter/helpers/set-uniform.ts +2 -1
- package/src/adapter/helpers/webgl-topology-utils.ts +10 -3
- package/src/adapter/objects/constants-to-keys.ts +2 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +36 -14
- package/src/adapter/objects/webgl-resource.ts +7 -125
- package/src/adapter/resources/webgl-buffer.ts +4 -3
- package/src/adapter/resources/webgl-command-buffer.ts +5 -5
- package/src/adapter/resources/webgl-command-encoder.ts +14 -11
- package/src/adapter/resources/webgl-external-texture.ts +6 -5
- package/src/adapter/resources/webgl-framebuffer.ts +61 -53
- package/src/adapter/resources/webgl-query-set.ts +171 -0
- package/src/adapter/resources/webgl-render-pass.ts +20 -11
- package/src/adapter/resources/webgl-render-pipeline.ts +54 -54
- package/src/adapter/resources/webgl-sampler.ts +2 -1
- package/src/adapter/resources/webgl-shader.ts +12 -5
- package/src/adapter/resources/webgl-texture-view.ts +28 -0
- package/src/adapter/resources/webgl-texture.ts +14 -3
- package/src/adapter/resources/webgl-transform-feedback.ts +2 -7
- package/src/adapter/resources/webgl-vertex-array.ts +4 -3
- package/src/adapter/webgl-canvas-context.ts +6 -4
- package/src/adapter/webgl-device.ts +116 -107
- package/src/classic/accessor.ts +5 -4
- package/src/classic/clear.ts +14 -8
- package/src/classic/copy-and-blit.ts +11 -4
- package/src/classic/format-utils.ts +2 -1
- package/src/classic/typed-array-utils.ts +3 -7
- package/src/context/debug/spector.ts +9 -6
- package/src/context/debug/webgl-developer-tools.ts +27 -14
- package/src/context/{context → helpers}/create-browser-context.ts +3 -2
- package/src/context/helpers/webgl-context-data.ts +31 -0
- package/src/context/helpers/webgl-extensions.ts +17 -0
- package/src/context/parameters/unified-parameter-api.ts +6 -17
- package/src/context/parameters/webgl-parameter-tables.ts +69 -32
- package/src/context/state-tracker/deep-array-equal.ts +2 -1
- package/src/context/state-tracker/track-context-state.ts +11 -6
- package/src/context/state-tracker/with-parameters.ts +8 -8
- package/src/index.ts +7 -6
- package/src/types.ts +2 -1
- package/dist/adapter/device-helpers/device-features.d.ts +0 -6
- package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-features.js +0 -65
- package/dist/adapter/device-helpers/device-limits.d.ts +0 -50
- package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js +0 -92
- package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js +0 -87
- package/dist/context/context/context-data.d.ts.map +0 -1
- package/dist/context/context/context-data.js +0 -33
- package/src/context/context/context-data.ts +0 -44
- /package/dist/context/{context → helpers}/create-browser-context.d.ts +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { Texture, log, assert, loadImage, isObjectEmpty } from '@luma.gl/core';
|
|
4
5
|
import { GL } from '@luma.gl/constants';
|
|
5
|
-
import { withGLParameters } from
|
|
6
|
-
import { convertTextureFormatToGL, getWebGLTextureParameters, getTextureFormatBytesPerPixel } from
|
|
7
|
-
import { convertSamplerParametersToWebGL } from
|
|
8
|
-
import { WEBGLBuffer } from
|
|
9
|
-
import { WEBGLSampler } from
|
|
6
|
+
import { withGLParameters } from "../../context/state-tracker/with-parameters.js";
|
|
7
|
+
import { convertTextureFormatToGL, getWebGLTextureParameters, getTextureFormatBytesPerPixel } from "../converters/texture-formats.js";
|
|
8
|
+
import { convertSamplerParametersToWebGL } from "../converters/sampler-parameters.js";
|
|
9
|
+
import { WEBGLBuffer } from "./webgl-buffer.js";
|
|
10
|
+
import { WEBGLSampler } from "./webgl-sampler.js";
|
|
11
|
+
import { WEBGLTextureView } from "./webgl-texture-view.js";
|
|
10
12
|
export const DEFAULT_WEBGL_TEXTURE_PROPS = {
|
|
11
13
|
// deprecated
|
|
12
14
|
parameters: {},
|
|
@@ -21,19 +23,20 @@ export const DEFAULT_WEBGL_TEXTURE_PROPS = {
|
|
|
21
23
|
export class WEBGLTexture extends Texture {
|
|
22
24
|
// TODO - remove?
|
|
23
25
|
static FACES = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
34069,
|
|
27
|
+
34070,
|
|
28
|
+
34071,
|
|
29
|
+
34072,
|
|
30
|
+
34073,
|
|
31
|
+
34074
|
|
30
32
|
];
|
|
31
33
|
MAX_ATTRIBUTES;
|
|
32
34
|
device;
|
|
33
35
|
gl;
|
|
34
36
|
handle;
|
|
35
|
-
|
|
37
|
+
// (TODO - currently unused in WebGL, but WebGL 2 does support sampler objects) */
|
|
36
38
|
sampler = undefined;
|
|
39
|
+
view = undefined;
|
|
37
40
|
// data;
|
|
38
41
|
glFormat = undefined;
|
|
39
42
|
type = undefined;
|
|
@@ -63,7 +66,7 @@ export class WEBGLTexture extends Texture {
|
|
|
63
66
|
this.gl = this.device.gl;
|
|
64
67
|
this.handle = this.props.handle || this.gl.createTexture();
|
|
65
68
|
this.device.setSpectorMetadata(this.handle, { ...this.props, data: typeof this.props.data }); // {name: this.props.id};
|
|
66
|
-
this.glFormat =
|
|
69
|
+
this.glFormat = 6408;
|
|
67
70
|
this.target = getWebGLTextureTarget(this.props);
|
|
68
71
|
// Program.draw() checks the loaded flag of all textures
|
|
69
72
|
this.loaded = false;
|
|
@@ -86,6 +89,9 @@ export class WEBGLTexture extends Texture {
|
|
|
86
89
|
toString() {
|
|
87
90
|
return `Texture(${this.id},${this.width}x${this.height})`;
|
|
88
91
|
}
|
|
92
|
+
createView(props) {
|
|
93
|
+
return new WEBGLTextureView(this.device, { ...props, texture: this });
|
|
94
|
+
}
|
|
89
95
|
// eslint-disable-next-line max-statements
|
|
90
96
|
initialize(props = {}) {
|
|
91
97
|
// Cube textures
|
|
@@ -139,7 +145,7 @@ export class WEBGLTexture extends Texture {
|
|
|
139
145
|
this.dataFormat = dataFormat;
|
|
140
146
|
this.textureUnit = textureUnit;
|
|
141
147
|
if (Number.isFinite(this.textureUnit)) {
|
|
142
|
-
this.gl.activeTexture(
|
|
148
|
+
this.gl.activeTexture(33984 + this.textureUnit);
|
|
143
149
|
this.gl.bindTexture(this.target, this.handle);
|
|
144
150
|
}
|
|
145
151
|
this.mipmaps = mipmaps;
|
|
@@ -158,7 +164,8 @@ export class WEBGLTexture extends Texture {
|
|
|
158
164
|
// Set texture sampler parameters
|
|
159
165
|
this.setSampler(props.sampler);
|
|
160
166
|
this._setSamplerParameters(parameters);
|
|
161
|
-
|
|
167
|
+
this.view = this.createView({ ...this.props, mipLevelCount: 1, arrayLayerCount: 1 });
|
|
168
|
+
if (mipmaps && this.device.isTextureFormatFilterable(props.format)) {
|
|
162
169
|
this.generateMipmap();
|
|
163
170
|
}
|
|
164
171
|
if (isVideo) {
|
|
@@ -304,9 +311,9 @@ export class WEBGLTexture extends Texture {
|
|
|
304
311
|
break;
|
|
305
312
|
case 'buffer':
|
|
306
313
|
// WebGL2 enables creating textures directly from a WebGL buffer
|
|
307
|
-
this.device.gl.bindBuffer(
|
|
314
|
+
this.device.gl.bindBuffer(35052, data.handle || data);
|
|
308
315
|
this.device.gl.texImage2D(target, level, glFormat, width, height, 0 /* border*/, dataFormat, type, offset);
|
|
309
|
-
this.device.gl.bindBuffer(
|
|
316
|
+
this.device.gl.bindBuffer(35052, null);
|
|
310
317
|
break;
|
|
311
318
|
case 'browser-object':
|
|
312
319
|
gl.texImage2D(target, level, glFormat, width, height, 0 /* border*/, dataFormat, type, data);
|
|
@@ -376,9 +383,9 @@ export class WEBGLTexture extends Texture {
|
|
|
376
383
|
else if (typeof WebGLBuffer !== 'undefined' && data instanceof WebGLBuffer) {
|
|
377
384
|
// WebGL2 allows us to create texture directly from a WebGL buffer
|
|
378
385
|
// This texImage2D signature uses currently bound GL.PIXEL_UNPACK_BUFFER
|
|
379
|
-
this.device.gl.bindBuffer(
|
|
386
|
+
this.device.gl.bindBuffer(35052, data);
|
|
380
387
|
this.device.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, offset);
|
|
381
|
-
this.device.gl.bindBuffer(
|
|
388
|
+
this.device.gl.bindBuffer(35052, null);
|
|
382
389
|
}
|
|
383
390
|
else {
|
|
384
391
|
// Assume data is a browser supported object (ImageData, Canvas, ...)
|
|
@@ -400,13 +407,13 @@ export class WEBGLTexture extends Texture {
|
|
|
400
407
|
return null;
|
|
401
408
|
}
|
|
402
409
|
getActiveUnit() {
|
|
403
|
-
return this.gl.getParameter(
|
|
410
|
+
return this.gl.getParameter(34016) - 33984;
|
|
404
411
|
}
|
|
405
412
|
bind(textureUnit = this.textureUnit) {
|
|
406
413
|
const { gl } = this;
|
|
407
414
|
if (textureUnit !== undefined) {
|
|
408
415
|
this.textureUnit = textureUnit;
|
|
409
|
-
gl.activeTexture(
|
|
416
|
+
gl.activeTexture(33984 + textureUnit);
|
|
410
417
|
}
|
|
411
418
|
gl.bindTexture(this.target, this.handle);
|
|
412
419
|
return textureUnit;
|
|
@@ -415,7 +422,7 @@ export class WEBGLTexture extends Texture {
|
|
|
415
422
|
const { gl } = this;
|
|
416
423
|
if (textureUnit !== undefined) {
|
|
417
424
|
this.textureUnit = textureUnit;
|
|
418
|
-
gl.activeTexture(
|
|
425
|
+
gl.activeTexture(33984 + textureUnit);
|
|
419
426
|
}
|
|
420
427
|
gl.bindTexture(this.target, null);
|
|
421
428
|
return textureUnit;
|
|
@@ -486,7 +493,7 @@ export class WEBGLTexture extends Texture {
|
|
|
486
493
|
/* eslint-disable max-statements, max-len */
|
|
487
494
|
async setCubeMapImageData(options) {
|
|
488
495
|
const { gl } = this;
|
|
489
|
-
const { width, height, pixels, data, format =
|
|
496
|
+
const { width, height, pixels, data, format = 6408, type = 5121 } = options;
|
|
490
497
|
const imageDataMap = pixels || data;
|
|
491
498
|
// pixel data (imageDataMap) is an Object from Face to Image or Promise.
|
|
492
499
|
// For example:
|
|
@@ -525,7 +532,7 @@ export class WEBGLTexture extends Texture {
|
|
|
525
532
|
}
|
|
526
533
|
/** @todo update this method to accept LODs */
|
|
527
534
|
setImageDataForFace(options) {
|
|
528
|
-
const { face, width, height, pixels, data, format =
|
|
535
|
+
const { face, width, height, pixels, data, format = 6408, type = 5121
|
|
529
536
|
// generateMipmap = false // TODO
|
|
530
537
|
} = options;
|
|
531
538
|
const { gl } = this;
|
|
@@ -559,7 +566,7 @@ export class WEBGLTexture extends Texture {
|
|
|
559
566
|
data);
|
|
560
567
|
}
|
|
561
568
|
if (data instanceof WEBGLBuffer) {
|
|
562
|
-
this.gl.bindBuffer(
|
|
569
|
+
this.gl.bindBuffer(35052, data.handle);
|
|
563
570
|
this.gl.texImage3D(this.target, level, dataFormat, width, height, depth, 0 /* border, must be 0 */, format, type, offset);
|
|
564
571
|
}
|
|
565
572
|
});
|
|
@@ -590,8 +597,8 @@ export class WEBGLTexture extends Texture {
|
|
|
590
597
|
// Apparently there are integer/float conversion issues requires two parameter setting functions in JavaScript.
|
|
591
598
|
// For now, pick the float version for parameters specified as GLfloat.
|
|
592
599
|
switch (param) {
|
|
593
|
-
case
|
|
594
|
-
case
|
|
600
|
+
case 33082:
|
|
601
|
+
case 33083:
|
|
595
602
|
this.gl.texParameterf(this.target, param, value);
|
|
596
603
|
break;
|
|
597
604
|
default:
|
|
@@ -608,14 +615,14 @@ function getWebGLTextureTarget(props) {
|
|
|
608
615
|
switch (props.dimension) {
|
|
609
616
|
// supported in WebGL
|
|
610
617
|
case '2d':
|
|
611
|
-
return
|
|
618
|
+
return 3553;
|
|
612
619
|
case 'cube':
|
|
613
|
-
return
|
|
620
|
+
return 34067;
|
|
614
621
|
// supported in WebGL2
|
|
615
622
|
case '2d-array':
|
|
616
|
-
return
|
|
623
|
+
return 35866;
|
|
617
624
|
case '3d':
|
|
618
|
-
return
|
|
625
|
+
return 32879;
|
|
619
626
|
// not supported in any WebGL version
|
|
620
627
|
case '1d':
|
|
621
628
|
case 'cube-array':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PrimitiveTopology, ShaderLayout, TransformFeedbackProps } from '@luma.gl/core';
|
|
2
2
|
import { TransformFeedback, Buffer, BufferRange } from '@luma.gl/core';
|
|
3
|
-
import { WebGLDevice } from
|
|
3
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
4
4
|
export declare class WEBGLTransformFeedback extends TransformFeedback {
|
|
5
5
|
readonly device: WebGLDevice;
|
|
6
6
|
readonly gl: WebGL2RenderingContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-transform-feedback.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-transform-feedback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAM,iBAAiB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAC,WAAW,EAAC,
|
|
1
|
+
{"version":3,"file":"webgl-transform-feedback.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-transform-feedback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAM,iBAAiB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAI5C,qBAAa,sBAAuB,SAAQ,iBAAiB;IAC3D,QAAQ,CAAC,MAAM,EAAE,WAAW,C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AAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,SAAI,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;CAQhG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { log, TransformFeedback } from '@luma.gl/core';
|
|
2
2
|
import { GL } from '@luma.gl/constants';
|
|
3
|
-
import { WEBGLBuffer } from
|
|
4
|
-
import { getGLPrimitive } from
|
|
3
|
+
import { WEBGLBuffer } from "../../index.js";
|
|
4
|
+
import { getGLPrimitive } from "../helpers/webgl-topology-utils.js";
|
|
5
5
|
export class WEBGLTransformFeedback extends TransformFeedback {
|
|
6
6
|
device;
|
|
7
7
|
gl;
|
|
@@ -37,7 +37,7 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
37
37
|
super.destroy();
|
|
38
38
|
}
|
|
39
39
|
begin(topology = 'point-list') {
|
|
40
|
-
this.gl.bindTransformFeedback(
|
|
40
|
+
this.gl.bindTransformFeedback(36386, this.handle);
|
|
41
41
|
if (this.bindOnUse) {
|
|
42
42
|
this._bindBuffers();
|
|
43
43
|
}
|
|
@@ -48,7 +48,7 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
48
48
|
if (!this.bindOnUse) {
|
|
49
49
|
this._unbindBuffers();
|
|
50
50
|
}
|
|
51
|
-
this.gl.bindTransformFeedback(
|
|
51
|
+
this.gl.bindTransformFeedback(36386, null);
|
|
52
52
|
}
|
|
53
53
|
// SUBCLASS
|
|
54
54
|
setBuffers(buffers) {
|
|
@@ -84,16 +84,16 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
84
84
|
}
|
|
85
85
|
bind(funcOrHandle = this.handle) {
|
|
86
86
|
if (typeof funcOrHandle !== 'function') {
|
|
87
|
-
this.gl.bindTransformFeedback(
|
|
87
|
+
this.gl.bindTransformFeedback(36386, funcOrHandle);
|
|
88
88
|
return this;
|
|
89
89
|
}
|
|
90
90
|
let value;
|
|
91
91
|
if (!this._bound) {
|
|
92
|
-
this.gl.bindTransformFeedback(
|
|
92
|
+
this.gl.bindTransformFeedback(36386, this.handle);
|
|
93
93
|
this._bound = true;
|
|
94
94
|
value = funcOrHandle();
|
|
95
95
|
this._bound = false;
|
|
96
|
-
this.gl.bindTransformFeedback(
|
|
96
|
+
this.gl.bindTransformFeedback(36386, null);
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
value = funcOrHandle();
|
|
@@ -137,16 +137,16 @@ export class WEBGLTransformFeedback extends TransformFeedback {
|
|
|
137
137
|
}
|
|
138
138
|
_unbindBuffers() {
|
|
139
139
|
for (const bufferIndex in this.buffers) {
|
|
140
|
-
this.gl.bindBufferBase(
|
|
140
|
+
this.gl.bindBufferBase(35982, Number(bufferIndex), null);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
_bindBuffer(index, buffer, byteOffset = 0, byteLength) {
|
|
144
144
|
const handle = buffer && buffer.handle;
|
|
145
145
|
if (!handle || byteLength === undefined) {
|
|
146
|
-
this.gl.bindBufferBase(
|
|
146
|
+
this.gl.bindBufferBase(35982, index, handle);
|
|
147
147
|
}
|
|
148
148
|
else {
|
|
149
|
-
this.gl.bindBufferRange(
|
|
149
|
+
this.gl.bindBufferRange(35982, index, handle, byteOffset, byteLength);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Device, Buffer, VertexArrayProps, TypedArray } from '@luma.gl/core';
|
|
2
2
|
import { VertexArray } from '@luma.gl/core';
|
|
3
3
|
import { GL } from '@luma.gl/constants';
|
|
4
|
-
import { WebGLDevice } from
|
|
4
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
5
5
|
/** VertexArrayObject wrapper */
|
|
6
6
|
export declare class WEBGLVertexArray extends VertexArray {
|
|
7
7
|
get [Symbol.toStringTag](): string;
|
|
@@ -24,7 +24,7 @@ export declare class WEBGLVertexArray extends VertexArray {
|
|
|
24
24
|
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
25
25
|
setBuffer(location: number, attributeBuffer: Buffer): void;
|
|
26
26
|
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
27
|
-
|
|
27
|
+
setConstantWebGL(location: number, value: TypedArray): void;
|
|
28
28
|
init: boolean;
|
|
29
29
|
bindBeforeRender(): void;
|
|
30
30
|
unbindAfterRender(): void;
|
|
@@ -41,7 +41,7 @@ export declare class WEBGLVertexArray extends VertexArray {
|
|
|
41
41
|
*/
|
|
42
42
|
/** Get an accessor from the */
|
|
43
43
|
protected _getAccessor(location: number): {
|
|
44
|
-
size:
|
|
44
|
+
size: 4 | 1 | 2 | 3;
|
|
45
45
|
type: GL.BYTE | GL.UNSIGNED_BYTE | GL.SHORT | GL.UNSIGNED_SHORT | GL.INT | GL.UNSIGNED_INT | GL.FLOAT | GL.HALF_FLOAT;
|
|
46
46
|
stride: number;
|
|
47
47
|
offset: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-vertex-array.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAc,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,WAAW,EAA6B,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAGtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAO5C,gCAAgC;AAChC,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IAExC,kCAAkC;IAClC,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,WAAW,CAAQ;IAE3B,6EAA6E;IAC7E,MAAM,CAAC,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;gBAKpD,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,gBAAgB;IAMhD,OAAO,IAAI,IAAI;IAexB;;;;;OAKG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAgBhD,gGAAgG;IAChG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI;IA6B1D,2FAA2F;IAClF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAKpE,IAAI,UAAS;IAEJ,gBAAgB,IAAI,IAAI;IAYxB,iBAAiB,IAAI,IAAI;IAUlC;;;;;OAKG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI;IAU1C;;;OAGG;IAcH,gCAAgC;IAChC,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;IAsBvC;;;;;OAKG;IACH,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,IAAI;IAiBxD;;;;;OAKG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM;CA8BnE"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { VertexArray, getScratchArray, fillArray } from '@luma.gl/core';
|
|
4
5
|
import { GL } from '@luma.gl/constants';
|
|
5
6
|
import { getBrowser } from '@probe.gl/env';
|
|
6
|
-
import { getGLFromVertexType } from
|
|
7
|
+
import { getGLFromVertexType } from "../converters/vertex-formats.js";
|
|
7
8
|
// import {AccessorObject} from '../..';
|
|
8
9
|
// import {getGLFromVertexType} from '../converters/vertex-formats';
|
|
9
10
|
/** VertexArrayObject wrapper */
|
|
@@ -48,13 +49,13 @@ export class WEBGLVertexArray extends VertexArray {
|
|
|
48
49
|
setIndexBuffer(indexBuffer) {
|
|
49
50
|
const buffer = indexBuffer;
|
|
50
51
|
// Explicitly allow `null` to support clearing the index buffer
|
|
51
|
-
if (buffer && buffer.glTarget !==
|
|
52
|
+
if (buffer && buffer.glTarget !== 34963) {
|
|
52
53
|
throw new Error('Use .setBuffer()');
|
|
53
54
|
}
|
|
54
55
|
// In WebGL The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject
|
|
55
56
|
this.device.gl.bindVertexArray(this.handle);
|
|
56
57
|
// TODO - this initial binding does not seem to take effect? see bindBeforeRender()
|
|
57
|
-
this.device.gl.bindBuffer(
|
|
58
|
+
this.device.gl.bindBuffer(34963, buffer ? buffer.handle : null);
|
|
58
59
|
// log.log(1, 'VertexArray.setIndexBuffer', indexBuffer)();
|
|
59
60
|
// log.log(1, `Binding vertex array ${this.id}`, buffer?.id)();
|
|
60
61
|
this.indexBuffer = buffer;
|
|
@@ -63,13 +64,13 @@ export class WEBGLVertexArray extends VertexArray {
|
|
|
63
64
|
setBuffer(location, attributeBuffer) {
|
|
64
65
|
const buffer = attributeBuffer;
|
|
65
66
|
// Sanity check target
|
|
66
|
-
if (buffer.glTarget ===
|
|
67
|
+
if (buffer.glTarget === 34963) {
|
|
67
68
|
throw new Error('Use .setIndexBuffer()');
|
|
68
69
|
}
|
|
69
70
|
const { size, type, stride, offset, normalized, integer, divisor } = this._getAccessor(location);
|
|
70
71
|
this.device.gl.bindVertexArray(this.handle);
|
|
71
72
|
// A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target
|
|
72
|
-
this.device.gl.bindBuffer(
|
|
73
|
+
this.device.gl.bindBuffer(34962, buffer.handle);
|
|
73
74
|
// WebGL2 supports *integer* data formats, i.e. GPU will see integer values
|
|
74
75
|
if (integer) {
|
|
75
76
|
this.device.gl.vertexAttribIPointer(location, size, type, stride, offset);
|
|
@@ -85,7 +86,7 @@ export class WEBGLVertexArray extends VertexArray {
|
|
|
85
86
|
this.attributes[location] = buffer;
|
|
86
87
|
}
|
|
87
88
|
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
88
|
-
|
|
89
|
+
setConstantWebGL(location, value) {
|
|
89
90
|
this._enable(location, false);
|
|
90
91
|
this.attributes[location] = value;
|
|
91
92
|
}
|
|
@@ -96,7 +97,7 @@ export class WEBGLVertexArray extends VertexArray {
|
|
|
96
97
|
if (!this.init) {
|
|
97
98
|
// log.log(1, `Binding vertex array ${this.id}`, this.indexBuffer?.id)();
|
|
98
99
|
const webglBuffer = this.indexBuffer;
|
|
99
|
-
this.device.gl.bindBuffer(
|
|
100
|
+
this.device.gl.bindBuffer(34963, webglBuffer?.handle || null);
|
|
100
101
|
this.init = true;
|
|
101
102
|
}
|
|
102
103
|
this._applyConstantAttributes();
|
|
@@ -120,7 +121,7 @@ export class WEBGLVertexArray extends VertexArray {
|
|
|
120
121
|
const constant = this.attributes[location];
|
|
121
122
|
// A typed array means this is a constant
|
|
122
123
|
if (ArrayBuffer.isView(constant)) {
|
|
123
|
-
this.device.
|
|
124
|
+
this.device.setConstantAttributeWebGL(location, constant);
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CanvasContextProps } from '@luma.gl/core';
|
|
2
2
|
import { CanvasContext } from '@luma.gl/core';
|
|
3
|
-
import { WebGLDevice } from
|
|
4
|
-
import { WEBGLFramebuffer } from
|
|
3
|
+
import { WebGLDevice } from "./webgl-device.js";
|
|
4
|
+
import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
|
|
5
5
|
/**
|
|
6
6
|
* A WebGL Canvas Context which manages the canvas and handles drawing buffer resizing etc
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-canvas-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-canvas-context.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAC3C,OAAO,EAAC,gBAAgB,EAAC,yCAAsC;AAE/D;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,YAAY,CAAiC;gBAEzC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB;IAS1D,qBAAqB,IAAI,gBAAgB;IAOzC,sDAAsD;IACtD,MAAM;IAUN;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAC,GAAG,IAAI;IAW7F,MAAM;CAOP"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { CanvasContext } from '@luma.gl/core';
|
|
4
|
-
import { WEBGLFramebuffer } from
|
|
5
|
+
import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
|
|
5
6
|
/**
|
|
6
7
|
* A WebGL Canvas Context which manages the canvas and handles drawing buffer resizing etc
|
|
7
8
|
*/
|
|
@@ -1,33 +1,39 @@
|
|
|
1
|
-
import type { DeviceProps, DeviceInfo,
|
|
1
|
+
import type { DeviceProps, DeviceInfo, CanvasContextProps, TextureFormat, VertexArray, VertexArrayProps, Framebuffer, Buffer, Texture, TypedArray } from '@luma.gl/core';
|
|
2
2
|
import { Device, CanvasContext } from '@luma.gl/core';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
3
|
+
import type { GLExtensions } from '@luma.gl/constants';
|
|
4
|
+
import { WebGLDeviceFeatures } from "./device-helpers/webgl-device-features.js";
|
|
5
|
+
import { WebGLDeviceLimits } from "./device-helpers/webgl-device-limits.js";
|
|
6
|
+
import { WebGLCanvasContext } from "./webgl-canvas-context.js";
|
|
7
|
+
import type { BufferProps, ShaderProps, SamplerProps, TextureProps, ExternalTexture, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipeline, ComputePipelineProps, RenderPassProps, ComputePass, ComputePassProps, CommandEncoderProps, TransformFeedbackProps, QuerySetProps } from '@luma.gl/core';
|
|
8
|
+
import { WEBGLBuffer } from "./resources/webgl-buffer.js";
|
|
9
|
+
import { WEBGLShader } from "./resources/webgl-shader.js";
|
|
10
|
+
import { WEBGLSampler } from "./resources/webgl-sampler.js";
|
|
11
|
+
import { WEBGLTexture } from "./resources/webgl-texture.js";
|
|
12
|
+
import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
|
|
13
|
+
import { WEBGLRenderPass } from "./resources/webgl-render-pass.js";
|
|
14
|
+
import { WEBGLRenderPipeline } from "./resources/webgl-render-pipeline.js";
|
|
15
|
+
import { WEBGLCommandEncoder } from "./resources/webgl-command-encoder.js";
|
|
16
|
+
import { WEBGLTransformFeedback } from "./resources/webgl-transform-feedback.js";
|
|
17
|
+
import { WEBGLQuerySet } from "./resources/webgl-query-set.js";
|
|
15
18
|
/** WebGPU style Device API for a WebGL context */
|
|
16
19
|
export declare class WebGLDevice extends Device {
|
|
17
|
-
|
|
18
|
-
static
|
|
20
|
+
/** type of this device */
|
|
21
|
+
static readonly type: string;
|
|
22
|
+
/** type of this device */
|
|
23
|
+
readonly type = "webgl";
|
|
24
|
+
/** The underlying WebGL context */
|
|
25
|
+
readonly handle: WebGL2RenderingContext;
|
|
26
|
+
features: WebGLDeviceFeatures;
|
|
27
|
+
limits: WebGLDeviceLimits;
|
|
19
28
|
readonly info: DeviceInfo;
|
|
20
29
|
readonly canvasContext: WebGLCanvasContext;
|
|
21
|
-
readonly handle: WebGL2RenderingContext;
|
|
22
|
-
get features(): Set<DeviceFeature>;
|
|
23
|
-
get limits(): DeviceLimits;
|
|
24
30
|
readonly lost: Promise<{
|
|
25
31
|
reason: 'destroyed';
|
|
26
32
|
message: string;
|
|
27
33
|
}>;
|
|
28
34
|
private _resolveContextLost?;
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
/** Check if WebGL 2 is available */
|
|
36
|
+
static isSupported(): boolean;
|
|
31
37
|
/**
|
|
32
38
|
* Get a device instance from a GL context
|
|
33
39
|
* Creates and instruments the device if not already created
|
|
@@ -39,7 +45,7 @@ export declare class WebGLDevice extends Device {
|
|
|
39
45
|
constructor(props: DeviceProps);
|
|
40
46
|
/**
|
|
41
47
|
* Destroys the context
|
|
42
|
-
* @note Has no effect for browser contexts, there is no browser API for destroying contexts
|
|
48
|
+
* @note Has no effect for WebGL browser contexts, there is no browser API for destroying contexts
|
|
43
49
|
*/
|
|
44
50
|
destroy(): void;
|
|
45
51
|
get isLost(): boolean;
|
|
@@ -54,14 +60,14 @@ export declare class WebGLDevice extends Device {
|
|
|
54
60
|
createSampler(props: SamplerProps): WEBGLSampler;
|
|
55
61
|
createShader(props: ShaderProps): WEBGLShader;
|
|
56
62
|
createFramebuffer(props: FramebufferProps): WEBGLFramebuffer;
|
|
57
|
-
createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline;
|
|
58
63
|
createVertexArray(props: VertexArrayProps): VertexArray;
|
|
64
|
+
createTransformFeedback(props: TransformFeedbackProps): WEBGLTransformFeedback;
|
|
65
|
+
createQuerySet(props: QuerySetProps): WEBGLQuerySet;
|
|
66
|
+
createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline;
|
|
59
67
|
beginRenderPass(props: RenderPassProps): WEBGLRenderPass;
|
|
60
68
|
createComputePipeline(props?: ComputePipelineProps): ComputePipeline;
|
|
61
69
|
beginComputePass(props: ComputePassProps): ComputePass;
|
|
62
|
-
createTransformFeedback(props: TransformFeedbackProps): WEBGLTransformFeedback;
|
|
63
70
|
private renderPass;
|
|
64
|
-
getDefaultRenderPass(): WEBGLRenderPass;
|
|
65
71
|
createCommandEncoder(props?: CommandEncoderProps): WEBGLCommandEncoder;
|
|
66
72
|
/**
|
|
67
73
|
* Offscreen Canvas Support: Commit the frame
|
|
@@ -110,13 +116,10 @@ export declare class WebGLDevice extends Device {
|
|
|
110
116
|
devicePixelRatio: number;
|
|
111
117
|
};
|
|
112
118
|
/** State used by luma.gl classes - TODO - not used? */
|
|
113
|
-
readonly _extensions:
|
|
119
|
+
readonly _extensions: GLExtensions;
|
|
114
120
|
_polyfilled: boolean;
|
|
115
121
|
/** Instance of Spector.js (if initialized) */
|
|
116
|
-
|
|
117
|
-
private _webglLimits?;
|
|
118
|
-
/** Return WebGL specific limits */
|
|
119
|
-
get webglLimits(): WebGLLimits;
|
|
122
|
+
spectorJS: unknown;
|
|
120
123
|
/**
|
|
121
124
|
* Triggers device (or WebGL context) loss.
|
|
122
125
|
* @note primarily intended for testing how application reacts to device loss
|
|
@@ -145,6 +148,8 @@ export declare class WebGLDevice extends Device {
|
|
|
145
148
|
* so they need to be updated before every render
|
|
146
149
|
* @todo - remember/cache values to avoid setting them unnecessarily?
|
|
147
150
|
*/
|
|
148
|
-
|
|
151
|
+
setConstantAttributeWebGL(location: number, constant: TypedArray): void;
|
|
152
|
+
/** Ensure extensions are only requested once */
|
|
153
|
+
getExtension(name: keyof GLExtensions): GLExtensions;
|
|
149
154
|
}
|
|
150
155
|
//# sourceMappingURL=webgl-device.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"
|
|
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,YAAY,EAAC,qCAAkC;AACvD,OAAO,EAAC,YAAY,EAAC,qCAAkC;AACvD,OAAO,EAAC,gBAAgB,EAAC,yCAAsC;AA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