@luma.gl/webgl 9.0.0-alpha.29 → 9.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -1
- package/dist/adapter/converters/device-parameters.d.ts +1 -1
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +1 -1
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/converters/texture-formats.d.ts +1 -1
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +1 -1
- package/dist/adapter/converters/texture-formats.js.map +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/adapter/device-helpers/device-features.d.ts +1 -1
- package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/adapter/helpers/attribute-utils.d.ts +4 -4
- package/dist/adapter/helpers/attribute-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.d.ts +2 -2
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +1 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +1 -1
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/helpers/uniforms.d.ts +1 -1
- package/dist/adapter/helpers/uniforms.d.ts.map +1 -1
- package/dist/adapter/helpers/uniforms.js.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +1 -1
- package/dist/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts +2 -2
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +1 -1
- package/dist/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +1 -1
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.d.ts +2 -2
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +3 -3
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +7 -3
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +2 -2
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +7 -8
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- 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 +1 -1
- package/dist/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +1 -1
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts +4 -4
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +2 -2
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- 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 +1 -1
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +3 -3
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +1 -1
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/accessor.d.ts +1 -1
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +1 -1
- package/dist/classic/accessor.js.map +1 -1
- package/dist/classic/buffer-with-accessor.d.ts +1 -1
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -1
- package/dist/classic/buffer-with-accessor.js +1 -1
- package/dist/classic/buffer-with-accessor.js.map +1 -1
- package/dist/classic/clear.d.ts +1 -1
- package/dist/classic/clear.d.ts.map +1 -1
- package/dist/classic/clear.js +1 -1
- package/dist/classic/clear.js.map +1 -1
- 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 +1 -1
- package/dist/classic/copy-and-blit.js.map +1 -1
- package/dist/classic/format-utils.js +1 -1
- package/dist/classic/format-utils.js.map +1 -1
- package/dist/classic/typed-array-utils.d.ts +1 -1
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/context/context/webgl-checks.js +1 -1
- package/dist/context/context/webgl-checks.js.map +1 -1
- package/dist/context/debug/spector.js +1 -1
- package/dist/context/debug/spector.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +1 -1
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/context/polyfill/polyfill-context.js +1 -1
- package/dist/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/context/polyfill/polyfill-table.js +1 -1
- package/dist/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +1 -1
- package/dist/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/dist.dev.js +55 -37
- package/dist/index.cjs +185 -170
- package/dist/index.js.map +1 -1
- package/dist.min.js +4 -4
- package/package.json +5 -5
- package/src/adapter/converters/device-parameters.ts +1 -1
- package/src/adapter/converters/sampler-parameters.ts +1 -1
- package/src/adapter/converters/texture-formats.ts +2 -2
- package/src/adapter/converters/vertex-formats.ts +1 -1
- package/src/adapter/device-helpers/device-features.ts +1 -1
- package/src/adapter/device-helpers/device-limits.ts +1 -1
- package/src/adapter/device-helpers/get-device-info.ts +1 -1
- package/src/adapter/helpers/attribute-utils.ts +4 -4
- package/src/adapter/helpers/get-shader-layout.ts +3 -3
- package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
- package/src/adapter/helpers/set-uniform.ts +3 -4
- package/src/adapter/helpers/uniforms.ts +1 -1
- package/src/adapter/objects/constants-to-keys.ts +1 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
- package/src/adapter/objects/webgl-resource.ts +2 -2
- package/src/adapter/objects/webgl-vertex-array-object.ts +2 -2
- package/src/adapter/resources/webgl-buffer.ts +2 -2
- package/src/adapter/resources/webgl-command-buffer.ts +2 -2
- package/src/adapter/resources/webgl-command-encoder.ts +2 -2
- package/src/adapter/resources/webgl-framebuffer.ts +2 -2
- package/src/adapter/resources/webgl-render-pass.ts +9 -3
- package/src/adapter/resources/webgl-render-pipeline.ts +13 -8
- package/src/adapter/resources/webgl-sampler.ts +1 -1
- package/src/adapter/resources/webgl-shader.ts +1 -1
- package/src/adapter/resources/webgl-texture.ts +2 -2
- package/src/adapter/webgl-canvas-context.ts +2 -2
- package/src/adapter/webgl-device.ts +3 -3
- package/src/classic/accessor.ts +1 -1
- package/src/classic/buffer-with-accessor.ts +2 -2
- package/src/classic/clear.ts +1 -1
- package/src/classic/copy-and-blit.ts +1 -1
- package/src/classic/format-utils.ts +1 -1
- package/src/classic/typed-array-utils.ts +1 -1
- package/src/context/context/webgl-checks.ts +1 -1
- package/src/context/debug/spector.ts +1 -1
- package/src/context/debug/webgl-developer-tools.ts +1 -1
- package/src/context/parameters/unified-parameter-api.ts +1 -1
- package/src/context/polyfill/polyfill-context.ts +1 -1
- package/src/context/polyfill/polyfill-table.ts +1 -1
- package/src/context/state-tracker/track-context-state.ts +1 -1
- package/src/context/state-tracker/with-parameters.ts +1 -1
- package/src/index.ts +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +0 -12
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +0 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +0 -84
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +0 -1
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +0 -123
package/dist/index.cjs
CHANGED
|
@@ -133,11 +133,11 @@ function createHeadlessContext(options) {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// src/adapter/webgl-device.ts
|
|
136
|
-
var
|
|
136
|
+
var import_core27 = require("@luma.gl/core");
|
|
137
137
|
var import_env3 = require("@probe.gl/env");
|
|
138
138
|
|
|
139
139
|
// src/context/polyfill/polyfill-context.ts
|
|
140
|
-
var
|
|
140
|
+
var import_core3 = require("@luma.gl/core");
|
|
141
141
|
|
|
142
142
|
// src/context/polyfill/polyfill-vertex-array-object.ts
|
|
143
143
|
var glErrorShadow = {};
|
|
@@ -421,11 +421,11 @@ function polyfillVertexArrayObject(gl2) {
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
// src/context/polyfill/polyfill-table.ts
|
|
424
|
-
var
|
|
424
|
+
var import_core2 = require("@luma.gl/core");
|
|
425
425
|
var import_constants2 = require("@luma.gl/constants");
|
|
426
426
|
|
|
427
427
|
// src/context/context/webgl-checks.ts
|
|
428
|
-
var
|
|
428
|
+
var import_core = require("@luma.gl/core");
|
|
429
429
|
var ERR_CONTEXT = "Invalid WebGLRenderingContext";
|
|
430
430
|
var ERR_WEBGL2 = "Requires WebGL2";
|
|
431
431
|
function isWebGL(gl2) {
|
|
@@ -447,11 +447,11 @@ function getWebGL2Context(gl2) {
|
|
|
447
447
|
return isWebGL2(gl2) ? gl2 : null;
|
|
448
448
|
}
|
|
449
449
|
function assertWebGLContext(gl2) {
|
|
450
|
-
(0,
|
|
450
|
+
(0, import_core.assert)(isWebGL(gl2), ERR_CONTEXT);
|
|
451
451
|
return gl2;
|
|
452
452
|
}
|
|
453
453
|
function assertWebGL2Context(gl2) {
|
|
454
|
-
(0,
|
|
454
|
+
(0, import_core.assert)(isWebGL2(gl2), ERR_WEBGL2);
|
|
455
455
|
return gl2;
|
|
456
456
|
}
|
|
457
457
|
|
|
@@ -587,7 +587,7 @@ var WEBGL2_CONTEXT_POLYFILLS = {
|
|
|
587
587
|
meta: { suffix: "OES" },
|
|
588
588
|
// NEW METHODS
|
|
589
589
|
createVertexArray: () => {
|
|
590
|
-
(0,
|
|
590
|
+
(0, import_core2.assert)(false, ERR_VAO_NOT_SUPPORTED);
|
|
591
591
|
},
|
|
592
592
|
deleteVertexArray: () => {
|
|
593
593
|
},
|
|
@@ -603,7 +603,7 @@ var WEBGL2_CONTEXT_POLYFILLS = {
|
|
|
603
603
|
// }
|
|
604
604
|
},
|
|
605
605
|
vertexAttribDivisor(location, divisor) {
|
|
606
|
-
(0,
|
|
606
|
+
(0, import_core2.assert)(divisor === 0, "WebGL instanced rendering not supported");
|
|
607
607
|
},
|
|
608
608
|
drawElementsInstanced: () => {
|
|
609
609
|
},
|
|
@@ -615,20 +615,20 @@ var WEBGL2_CONTEXT_POLYFILLS = {
|
|
|
615
615
|
suffix: "WEBGL"
|
|
616
616
|
},
|
|
617
617
|
drawBuffers: () => {
|
|
618
|
-
(0,
|
|
618
|
+
(0, import_core2.assert)(false);
|
|
619
619
|
}
|
|
620
620
|
},
|
|
621
621
|
[EXT_disjoint_timer_query2]: {
|
|
622
622
|
meta: { suffix: "EXT" },
|
|
623
623
|
// WebGL1: Polyfills the WebGL2 Query API
|
|
624
624
|
createQuery: () => {
|
|
625
|
-
(0,
|
|
625
|
+
(0, import_core2.assert)(false);
|
|
626
626
|
},
|
|
627
627
|
deleteQuery: () => {
|
|
628
|
-
(0,
|
|
628
|
+
(0, import_core2.assert)(false);
|
|
629
629
|
},
|
|
630
630
|
beginQuery: () => {
|
|
631
|
-
(0,
|
|
631
|
+
(0, import_core2.assert)(false);
|
|
632
632
|
},
|
|
633
633
|
endQuery: () => {
|
|
634
634
|
},
|
|
@@ -740,7 +740,7 @@ function installPolyfills(gl2, polyfills) {
|
|
|
740
740
|
}
|
|
741
741
|
function polyfillExtension(gl2, { extension, target, target2 }) {
|
|
742
742
|
const defaults = WEBGL2_CONTEXT_POLYFILLS[extension];
|
|
743
|
-
(0,
|
|
743
|
+
(0, import_core3.assert)(defaults);
|
|
744
744
|
const { meta = {} } = defaults;
|
|
745
745
|
const { suffix = "" } = meta;
|
|
746
746
|
const ext = gl2.getExtension(extension);
|
|
@@ -773,7 +773,7 @@ function installOverrides(gl2, { target, target2 }) {
|
|
|
773
773
|
}
|
|
774
774
|
|
|
775
775
|
// src/context/state-tracker/track-context-state.ts
|
|
776
|
-
var
|
|
776
|
+
var import_core4 = require("@luma.gl/core");
|
|
777
777
|
|
|
778
778
|
// src/context/parameters/webgl-parameter-tables.ts
|
|
779
779
|
var import_constants3 = require("@luma.gl/constants");
|
|
@@ -1375,7 +1375,7 @@ var GLState = class {
|
|
|
1375
1375
|
this.stateStack.push({});
|
|
1376
1376
|
}
|
|
1377
1377
|
pop() {
|
|
1378
|
-
(0,
|
|
1378
|
+
(0, import_core4.assert)(this.stateStack.length > 0);
|
|
1379
1379
|
const oldValues = this.stateStack[this.stateStack.length - 1];
|
|
1380
1380
|
setParameters(this.gl, oldValues);
|
|
1381
1381
|
this.stateStack.pop();
|
|
@@ -1391,7 +1391,7 @@ var GLState = class {
|
|
|
1391
1391
|
let oldValue;
|
|
1392
1392
|
const oldValues = this.stateStack.length > 0 ? this.stateStack[this.stateStack.length - 1] : null;
|
|
1393
1393
|
for (const key in values) {
|
|
1394
|
-
(0,
|
|
1394
|
+
(0, import_core4.assert)(key !== void 0);
|
|
1395
1395
|
const value = values[key];
|
|
1396
1396
|
const cached = this.cache[key];
|
|
1397
1397
|
if (!deepArrayEqual(value, cached)) {
|
|
@@ -1411,7 +1411,7 @@ function getContextState(gl2) {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
function trackContextState(gl2, options) {
|
|
1413
1413
|
const { enable: enable2 = true, copyState } = options;
|
|
1414
|
-
(0,
|
|
1414
|
+
(0, import_core4.assert)(copyState !== void 0);
|
|
1415
1415
|
if (!gl2.state) {
|
|
1416
1416
|
gl2.state = new GLState(gl2, { copyState });
|
|
1417
1417
|
installProgramSpy(gl2);
|
|
@@ -1436,7 +1436,7 @@ function pushContextState(gl2) {
|
|
|
1436
1436
|
}
|
|
1437
1437
|
function popContextState(gl2) {
|
|
1438
1438
|
const glState = getContextState(gl2);
|
|
1439
|
-
(0,
|
|
1439
|
+
(0, import_core4.assert)(glState);
|
|
1440
1440
|
glState.pop();
|
|
1441
1441
|
}
|
|
1442
1442
|
function installGetterOverride(gl2, functionName) {
|
|
@@ -1595,7 +1595,7 @@ function isOldIE(opts = {}) {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
1597
1597
|
// src/adapter/converters/texture-formats.ts
|
|
1598
|
-
var
|
|
1598
|
+
var import_core5 = require("@luma.gl/core");
|
|
1599
1599
|
var import_constants5 = require("@luma.gl/constants");
|
|
1600
1600
|
var texture_compression_bc = "texture-compression-bc";
|
|
1601
1601
|
var texture_compression_astc = "texture-compression-astc";
|
|
@@ -1901,7 +1901,7 @@ function isTextureFormatFilterable(gl2, formatOrGL) {
|
|
|
1901
1901
|
return false;
|
|
1902
1902
|
}
|
|
1903
1903
|
try {
|
|
1904
|
-
const decoded = (0,
|
|
1904
|
+
const decoded = (0, import_core5.decodeTextureFormat)(format);
|
|
1905
1905
|
if (decoded.signed) {
|
|
1906
1906
|
return false;
|
|
1907
1907
|
}
|
|
@@ -1929,7 +1929,7 @@ function isTextureFormatRenderable(gl2, formatOrGL) {
|
|
|
1929
1929
|
function getWebGLTextureParameters(formatOrGL, isWebGL23) {
|
|
1930
1930
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
1931
1931
|
const webglFormat = convertTextureFormatToGL(format, isWebGL23);
|
|
1932
|
-
const decoded = (0,
|
|
1932
|
+
const decoded = (0, import_core5.decodeTextureFormat)(format);
|
|
1933
1933
|
return {
|
|
1934
1934
|
format: webglFormat,
|
|
1935
1935
|
dataFormat: getWebGLPixelDataFormat(
|
|
@@ -2272,15 +2272,15 @@ function getWebGLLimits(gl2) {
|
|
|
2272
2272
|
}
|
|
2273
2273
|
|
|
2274
2274
|
// src/adapter/webgl-canvas-context.ts
|
|
2275
|
-
var
|
|
2275
|
+
var import_core15 = require("@luma.gl/core");
|
|
2276
2276
|
|
|
2277
2277
|
// src/adapter/resources/webgl-framebuffer.ts
|
|
2278
|
-
var
|
|
2278
|
+
var import_core14 = require("@luma.gl/core");
|
|
2279
2279
|
var import_constants13 = require("@luma.gl/constants");
|
|
2280
2280
|
|
|
2281
2281
|
// src/adapter/resources/webgl-texture.ts
|
|
2282
|
-
var
|
|
2283
|
-
var
|
|
2282
|
+
var import_core9 = require("@luma.gl/core");
|
|
2283
|
+
var import_core10 = require("@luma.gl/core");
|
|
2284
2284
|
var import_constants11 = require("@luma.gl/constants");
|
|
2285
2285
|
|
|
2286
2286
|
// src/context/state-tracker/with-parameters.ts
|
|
@@ -2317,10 +2317,10 @@ function isObjectEmpty2(object) {
|
|
|
2317
2317
|
var import_constants8 = require("@luma.gl/constants");
|
|
2318
2318
|
|
|
2319
2319
|
// src/adapter/converters/device-parameters.ts
|
|
2320
|
-
var
|
|
2320
|
+
var import_core6 = require("@luma.gl/core");
|
|
2321
2321
|
var import_constants7 = require("@luma.gl/constants");
|
|
2322
2322
|
function withGLParameters(device, parameters, func) {
|
|
2323
|
-
if ((0,
|
|
2323
|
+
if ((0, import_core6.isObjectEmpty)(parameters)) {
|
|
2324
2324
|
return func(device);
|
|
2325
2325
|
}
|
|
2326
2326
|
pushContextState(device.gl);
|
|
@@ -2332,7 +2332,7 @@ function withGLParameters(device, parameters, func) {
|
|
|
2332
2332
|
}
|
|
2333
2333
|
}
|
|
2334
2334
|
function withDeviceParameters(device, parameters, func) {
|
|
2335
|
-
if ((0,
|
|
2335
|
+
if ((0, import_core6.isObjectEmpty)(parameters)) {
|
|
2336
2336
|
return func(device);
|
|
2337
2337
|
}
|
|
2338
2338
|
pushContextState(device.gl);
|
|
@@ -2385,7 +2385,7 @@ function setDeviceParameters(device, parameters) {
|
|
|
2385
2385
|
gl2.stencilMaskSeparate(import_constants7.GL.BACK, mask);
|
|
2386
2386
|
}
|
|
2387
2387
|
if (parameters.stencilReadMask) {
|
|
2388
|
-
|
|
2388
|
+
import_core6.log.warn("stencilReadMask not supported under WebGL");
|
|
2389
2389
|
}
|
|
2390
2390
|
if (parameters.stencilCompare) {
|
|
2391
2391
|
const mask = parameters.stencilReadMask || 4294967295;
|
|
@@ -2517,10 +2517,10 @@ function updateSamplerParametersForNPOT(parameters) {
|
|
|
2517
2517
|
}
|
|
2518
2518
|
|
|
2519
2519
|
// src/adapter/resources/webgl-buffer.ts
|
|
2520
|
-
var
|
|
2520
|
+
var import_core7 = require("@luma.gl/core");
|
|
2521
2521
|
var import_constants9 = require("@luma.gl/constants");
|
|
2522
2522
|
var DEBUG_DATA_LENGTH = 10;
|
|
2523
|
-
var WEBGLBuffer = class extends
|
|
2523
|
+
var WEBGLBuffer = class extends import_core7.Buffer {
|
|
2524
2524
|
constructor(device, props = {}) {
|
|
2525
2525
|
super(device, props);
|
|
2526
2526
|
/** Index type is needed when issuing draw calls, so we pre-compute it */
|
|
@@ -2546,7 +2546,7 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2546
2546
|
// PRIVATE METHODS
|
|
2547
2547
|
/** Allocate a new buffer and initialize to contents of typed array */
|
|
2548
2548
|
_initWithData(data, byteOffset = 0, byteLength = data.byteLength + byteOffset) {
|
|
2549
|
-
(0,
|
|
2549
|
+
(0, import_core7.assert)(ArrayBuffer.isView(data));
|
|
2550
2550
|
const glTarget = this._getWriteTarget();
|
|
2551
2551
|
this.gl.bindBuffer(glTarget, this.handle);
|
|
2552
2552
|
this.gl.bufferData(glTarget, byteLength, this.glUsage);
|
|
@@ -2560,7 +2560,7 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2560
2560
|
}
|
|
2561
2561
|
// Allocate a GPU buffer of specified size.
|
|
2562
2562
|
_initWithByteLength(byteLength) {
|
|
2563
|
-
(0,
|
|
2563
|
+
(0, import_core7.assert)(byteLength >= 0);
|
|
2564
2564
|
let data = byteLength;
|
|
2565
2565
|
if (byteLength === 0) {
|
|
2566
2566
|
data = new Float32Array(0);
|
|
@@ -2620,34 +2620,34 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2620
2620
|
}
|
|
2621
2621
|
};
|
|
2622
2622
|
function getWebGLTarget(usage) {
|
|
2623
|
-
if (usage &
|
|
2623
|
+
if (usage & import_core7.Buffer.INDEX) {
|
|
2624
2624
|
return import_constants9.GL.ELEMENT_ARRAY_BUFFER;
|
|
2625
2625
|
}
|
|
2626
|
-
if (usage &
|
|
2626
|
+
if (usage & import_core7.Buffer.VERTEX) {
|
|
2627
2627
|
return import_constants9.GL.ARRAY_BUFFER;
|
|
2628
2628
|
}
|
|
2629
|
-
if (usage &
|
|
2629
|
+
if (usage & import_core7.Buffer.UNIFORM) {
|
|
2630
2630
|
return import_constants9.GL.UNIFORM_BUFFER;
|
|
2631
2631
|
}
|
|
2632
2632
|
return import_constants9.GL.ARRAY_BUFFER;
|
|
2633
2633
|
}
|
|
2634
2634
|
function getWebGLUsage(usage) {
|
|
2635
|
-
if (usage &
|
|
2635
|
+
if (usage & import_core7.Buffer.INDEX) {
|
|
2636
2636
|
return import_constants9.GL.STATIC_DRAW;
|
|
2637
2637
|
}
|
|
2638
|
-
if (usage &
|
|
2638
|
+
if (usage & import_core7.Buffer.VERTEX) {
|
|
2639
2639
|
return import_constants9.GL.STATIC_DRAW;
|
|
2640
2640
|
}
|
|
2641
|
-
if (usage &
|
|
2641
|
+
if (usage & import_core7.Buffer.UNIFORM) {
|
|
2642
2642
|
return import_constants9.GL.DYNAMIC_DRAW;
|
|
2643
2643
|
}
|
|
2644
2644
|
return import_constants9.GL.STATIC_DRAW;
|
|
2645
2645
|
}
|
|
2646
2646
|
|
|
2647
2647
|
// src/adapter/resources/webgl-sampler.ts
|
|
2648
|
-
var
|
|
2648
|
+
var import_core8 = require("@luma.gl/core");
|
|
2649
2649
|
var import_constants10 = require("@luma.gl/constants");
|
|
2650
|
-
var WEBGLSampler = class extends
|
|
2650
|
+
var WEBGLSampler = class extends import_core8.Sampler {
|
|
2651
2651
|
constructor(device, props) {
|
|
2652
2652
|
super(device, props);
|
|
2653
2653
|
this.device = device;
|
|
@@ -2694,7 +2694,7 @@ var DEFAULT_WEBGL_TEXTURE_PROPS = {
|
|
|
2694
2694
|
textureUnit: void 0,
|
|
2695
2695
|
target: void 0
|
|
2696
2696
|
};
|
|
2697
|
-
var _WEBGLTexture = class extends
|
|
2697
|
+
var _WEBGLTexture = class extends import_core10.Texture {
|
|
2698
2698
|
constructor(device, props) {
|
|
2699
2699
|
var _a;
|
|
2700
2700
|
super(device, __spreadValues(__spreadProps(__spreadValues({}, DEFAULT_WEBGL_TEXTURE_PROPS), { format: "rgba8unorm" }), props));
|
|
@@ -2712,7 +2712,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
2712
2712
|
* Set to true as soon as texture has been initialized with valid data
|
|
2713
2713
|
*/
|
|
2714
2714
|
this.loaded = false;
|
|
2715
|
-
this.device = (0,
|
|
2715
|
+
this.device = (0, import_core10.cast)(device);
|
|
2716
2716
|
this.gl = this.device.gl;
|
|
2717
2717
|
this.gl2 = this.device.gl2;
|
|
2718
2718
|
this.handle = this.props.handle || this.gl.createTexture();
|
|
@@ -2721,7 +2721,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
2721
2721
|
this.target = getWebGLTextureTarget(this.props);
|
|
2722
2722
|
this.loaded = false;
|
|
2723
2723
|
if (typeof ((_a = this.props) == null ? void 0 : _a.data) === "string") {
|
|
2724
|
-
Object.assign(this.props, { data: (0,
|
|
2724
|
+
Object.assign(this.props, { data: (0, import_core10.loadImage)(this.props.data) });
|
|
2725
2725
|
}
|
|
2726
2726
|
this.initialize(this.props);
|
|
2727
2727
|
Object.seal(this);
|
|
@@ -2792,7 +2792,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
2792
2792
|
this.gl.bindTexture(this.target, this.handle);
|
|
2793
2793
|
}
|
|
2794
2794
|
if (mipmaps && this.device.isWebGL1 && isNPOT(this.width, this.height)) {
|
|
2795
|
-
|
|
2795
|
+
import_core10.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaps`)();
|
|
2796
2796
|
mipmaps = false;
|
|
2797
2797
|
}
|
|
2798
2798
|
this.mipmaps = mipmaps;
|
|
@@ -2886,7 +2886,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
2886
2886
|
// Call to regenerate mipmaps after modifying texture(s)
|
|
2887
2887
|
generateMipmap(params = {}) {
|
|
2888
2888
|
if (this.device.isWebGL1 && isNPOT(this.width, this.height)) {
|
|
2889
|
-
|
|
2889
|
+
import_core10.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)();
|
|
2890
2890
|
return this;
|
|
2891
2891
|
}
|
|
2892
2892
|
this.mipmaps = true;
|
|
@@ -3024,7 +3024,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
3024
3024
|
}
|
|
3025
3025
|
break;
|
|
3026
3026
|
default:
|
|
3027
|
-
(0,
|
|
3027
|
+
(0, import_core10.assert)(false, "Unknown image data type");
|
|
3028
3028
|
}
|
|
3029
3029
|
});
|
|
3030
3030
|
if (data && data.byteLength) {
|
|
@@ -3066,7 +3066,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
3066
3066
|
width,
|
|
3067
3067
|
height
|
|
3068
3068
|
}));
|
|
3069
|
-
(0,
|
|
3069
|
+
(0, import_core10.assert)(this.depth === 1, "texSubImage not supported for 3D textures");
|
|
3070
3070
|
if (!data) {
|
|
3071
3071
|
data = pixels;
|
|
3072
3072
|
}
|
|
@@ -3110,7 +3110,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
3110
3110
|
* rendering can be faster.
|
|
3111
3111
|
*/
|
|
3112
3112
|
copyFramebuffer(opts = {}) {
|
|
3113
|
-
|
|
3113
|
+
import_core10.log.error(
|
|
3114
3114
|
"Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})"
|
|
3115
3115
|
)();
|
|
3116
3116
|
return null;
|
|
@@ -3184,12 +3184,12 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
3184
3184
|
} else {
|
|
3185
3185
|
size = { width, height };
|
|
3186
3186
|
}
|
|
3187
|
-
(0,
|
|
3188
|
-
(0,
|
|
3187
|
+
(0, import_core10.assert)(size, "Could not deduced texture size");
|
|
3188
|
+
(0, import_core10.assert)(
|
|
3189
3189
|
width === void 0 || size.width === width,
|
|
3190
3190
|
"Deduced texture width does not match supplied width"
|
|
3191
3191
|
);
|
|
3192
|
-
(0,
|
|
3192
|
+
(0, import_core10.assert)(
|
|
3193
3193
|
height === void 0 || size.height === height,
|
|
3194
3194
|
"Deduced texture height does not match supplied height"
|
|
3195
3195
|
);
|
|
@@ -3211,7 +3211,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
3211
3211
|
this.bind();
|
|
3212
3212
|
_WEBGLTexture.FACES.forEach((face, index) => {
|
|
3213
3213
|
if (resolvedFaces[index].length > 1 && this.props.mipmaps !== false) {
|
|
3214
|
-
|
|
3214
|
+
import_core10.log.warn(`${this.id} has mipmap and multiple LODs.`)();
|
|
3215
3215
|
}
|
|
3216
3216
|
resolvedFaces[index].forEach((image, lodLevel) => {
|
|
3217
3217
|
if (width && height) {
|
|
@@ -3324,7 +3324,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
|
|
|
3324
3324
|
if (this.device.isWebGL1 && isNPOT(this.width, this.height)) {
|
|
3325
3325
|
parameters = updateSamplerParametersForNPOT(parameters);
|
|
3326
3326
|
}
|
|
3327
|
-
if ((0,
|
|
3327
|
+
if ((0, import_core9.isObjectEmpty)(parameters)) {
|
|
3328
3328
|
return;
|
|
3329
3329
|
}
|
|
3330
3330
|
logParameters(parameters);
|
|
@@ -3395,21 +3395,21 @@ function isNPOT(width, height) {
|
|
|
3395
3395
|
if (!width || !height) {
|
|
3396
3396
|
return false;
|
|
3397
3397
|
}
|
|
3398
|
-
return !(0,
|
|
3398
|
+
return !(0, import_core10.isPowerOfTwo)(width) || !(0, import_core10.isPowerOfTwo)(height);
|
|
3399
3399
|
}
|
|
3400
3400
|
function logParameters(parameters) {
|
|
3401
|
-
|
|
3401
|
+
import_core10.log.log(1, "texture sampler parameters", parameters)();
|
|
3402
3402
|
}
|
|
3403
3403
|
|
|
3404
3404
|
// src/adapter/objects/webgl-renderbuffer.ts
|
|
3405
|
-
var
|
|
3405
|
+
var import_core13 = require("@luma.gl/core");
|
|
3406
3406
|
var import_constants12 = require("@luma.gl/constants");
|
|
3407
3407
|
|
|
3408
3408
|
// src/adapter/objects/webgl-resource.ts
|
|
3409
|
-
var
|
|
3409
|
+
var import_core12 = require("@luma.gl/core");
|
|
3410
3410
|
|
|
3411
3411
|
// src/adapter/objects/constants-to-keys.ts
|
|
3412
|
-
var
|
|
3412
|
+
var import_core11 = require("@luma.gl/core");
|
|
3413
3413
|
function getKeyValue(gl2, name) {
|
|
3414
3414
|
if (typeof name !== "string") {
|
|
3415
3415
|
return name;
|
|
@@ -3420,13 +3420,13 @@ function getKeyValue(gl2, name) {
|
|
|
3420
3420
|
}
|
|
3421
3421
|
name = name.replace(/^.*\./, "");
|
|
3422
3422
|
const value = gl2[name];
|
|
3423
|
-
(0,
|
|
3423
|
+
(0, import_core11.assert)(value !== void 0, `Accessing undefined constant GL.${name}`);
|
|
3424
3424
|
return value;
|
|
3425
3425
|
}
|
|
3426
3426
|
|
|
3427
3427
|
// src/adapter/objects/webgl-resource.ts
|
|
3428
3428
|
var ERR_RESOURCE_METHOD_UNDEFINED = "Resource subclass must define virtual methods";
|
|
3429
|
-
var WebGLResource = class extends
|
|
3429
|
+
var WebGLResource = class extends import_core12.Resource {
|
|
3430
3430
|
constructor(device, props, defaultProps) {
|
|
3431
3431
|
super(device, props, defaultProps);
|
|
3432
3432
|
this._bound = false;
|
|
@@ -3438,7 +3438,7 @@ var WebGLResource = class extends import_api12.Resource {
|
|
|
3438
3438
|
const { id } = props || {};
|
|
3439
3439
|
this.gl = gl2;
|
|
3440
3440
|
this.gl2 = gl2;
|
|
3441
|
-
this.id = id || (0,
|
|
3441
|
+
this.id = id || (0, import_core12.uid)(this.constructor.name);
|
|
3442
3442
|
this._handle = props == null ? void 0 : props.handle;
|
|
3443
3443
|
if (this._handle === void 0) {
|
|
3444
3444
|
this._handle = this._createHandle();
|
|
@@ -3490,7 +3490,7 @@ var WebGLResource = class extends import_api12.Resource {
|
|
|
3490
3490
|
*/
|
|
3491
3491
|
getParameter(pname, props = {}) {
|
|
3492
3492
|
pname = getKeyValue(this.gl, pname);
|
|
3493
|
-
(0,
|
|
3493
|
+
(0, import_core12.assert)(pname);
|
|
3494
3494
|
const parameters = this.constructor.PARAMETERS || {};
|
|
3495
3495
|
const parameter = parameters[pname];
|
|
3496
3496
|
if (parameter) {
|
|
@@ -3538,7 +3538,7 @@ var WebGLResource = class extends import_api12.Resource {
|
|
|
3538
3538
|
*/
|
|
3539
3539
|
setParameter(pname, value) {
|
|
3540
3540
|
pname = getKeyValue(this.gl, pname);
|
|
3541
|
-
(0,
|
|
3541
|
+
(0, import_core12.assert)(pname);
|
|
3542
3542
|
const parameters = this.constructor.PARAMETERS || {};
|
|
3543
3543
|
const parameter = parameters[pname];
|
|
3544
3544
|
if (parameter) {
|
|
@@ -3566,7 +3566,7 @@ var WebGLResource = class extends import_api12.Resource {
|
|
|
3566
3566
|
}
|
|
3567
3567
|
// Install stubs for removed methods
|
|
3568
3568
|
stubRemovedMethods(className, version, methodNames) {
|
|
3569
|
-
return (0,
|
|
3569
|
+
return (0, import_core12.stubRemovedMethods)(this, className, version, methodNames);
|
|
3570
3570
|
}
|
|
3571
3571
|
// PUBLIC VIRTUAL METHODS
|
|
3572
3572
|
initialize(props) {
|
|
@@ -3667,7 +3667,7 @@ var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
|
3667
3667
|
/** Creates and initializes a renderbuffer object's data store */
|
|
3668
3668
|
_initialize(props) {
|
|
3669
3669
|
const { format, width, height, samples } = props;
|
|
3670
|
-
(0,
|
|
3670
|
+
(0, import_core13.assert)(format, "Needs format");
|
|
3671
3671
|
this.trackDeallocatedMemory();
|
|
3672
3672
|
this.gl.bindRenderbuffer(import_constants12.GL.RENDERBUFFER, this.handle);
|
|
3673
3673
|
if (samples !== 0 && this.device.isWebGL2) {
|
|
@@ -3705,7 +3705,7 @@ WEBGLRenderbuffer.defaultProps = {
|
|
|
3705
3705
|
};
|
|
3706
3706
|
|
|
3707
3707
|
// src/adapter/resources/webgl-framebuffer.ts
|
|
3708
|
-
var WEBGLFramebuffer = class extends
|
|
3708
|
+
var WEBGLFramebuffer = class extends import_core14.Framebuffer {
|
|
3709
3709
|
constructor(device, props) {
|
|
3710
3710
|
super(device, props);
|
|
3711
3711
|
const isDefaultFramebuffer = props.handle === null;
|
|
@@ -3837,7 +3837,7 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3837
3837
|
gl2.framebufferTexture2D(import_constants13.GL.FRAMEBUFFER, attachment, import_constants13.GL.TEXTURE_2D, texture.handle, level);
|
|
3838
3838
|
break;
|
|
3839
3839
|
default:
|
|
3840
|
-
(0,
|
|
3840
|
+
(0, import_core14.assert)(false, "Illegal texture type");
|
|
3841
3841
|
}
|
|
3842
3842
|
gl2.bindTexture(texture.target, null);
|
|
3843
3843
|
}
|
|
@@ -3865,7 +3865,7 @@ function _getFrameBufferStatus(status) {
|
|
|
3865
3865
|
}
|
|
3866
3866
|
|
|
3867
3867
|
// src/adapter/webgl-canvas-context.ts
|
|
3868
|
-
var WebGLCanvasContext = class extends
|
|
3868
|
+
var WebGLCanvasContext = class extends import_core15.CanvasContext {
|
|
3869
3869
|
constructor(device, props) {
|
|
3870
3870
|
super(props);
|
|
3871
3871
|
this._framebuffer = null;
|
|
@@ -3915,9 +3915,9 @@ var WebGLCanvasContext = class extends import_api15.CanvasContext {
|
|
|
3915
3915
|
};
|
|
3916
3916
|
|
|
3917
3917
|
// src/context/debug/spector.ts
|
|
3918
|
-
var
|
|
3918
|
+
var import_core16 = require("@luma.gl/core");
|
|
3919
3919
|
var DEFAULT_SPECTOR_PROPS = {
|
|
3920
|
-
spector:
|
|
3920
|
+
spector: import_core16.log.get("spector") || import_core16.log.get("inspect")
|
|
3921
3921
|
};
|
|
3922
3922
|
var SPECTOR_CDN_URL = "https://spectorcdn.babylonjs.com/spector.bundle.js";
|
|
3923
3923
|
var LOG_LEVEL = 1;
|
|
@@ -3927,9 +3927,9 @@ function loadSpectorJS(props) {
|
|
|
3927
3927
|
return __async(this, null, function* () {
|
|
3928
3928
|
if (!globalThis.SPECTOR) {
|
|
3929
3929
|
try {
|
|
3930
|
-
yield (0,
|
|
3930
|
+
yield (0, import_core16.loadScript)(SPECTOR_CDN_URL);
|
|
3931
3931
|
} catch (error2) {
|
|
3932
|
-
|
|
3932
|
+
import_core16.log.warn(String(error2));
|
|
3933
3933
|
}
|
|
3934
3934
|
}
|
|
3935
3935
|
});
|
|
@@ -3940,7 +3940,7 @@ function initializeSpectorJS(props) {
|
|
|
3940
3940
|
return null;
|
|
3941
3941
|
}
|
|
3942
3942
|
if (!spector && globalThis.SPECTOR) {
|
|
3943
|
-
|
|
3943
|
+
import_core16.log.probe(LOG_LEVEL, "SPECTOR found and initialized")();
|
|
3944
3944
|
spector = new globalThis.SPECTOR.Spector();
|
|
3945
3945
|
if (globalThis.luma) {
|
|
3946
3946
|
globalThis.luma.spector = spector;
|
|
@@ -3952,9 +3952,9 @@ function initializeSpectorJS(props) {
|
|
|
3952
3952
|
if (!initialized) {
|
|
3953
3953
|
initialized = true;
|
|
3954
3954
|
spector.spyCanvases();
|
|
3955
|
-
spector == null ? void 0 : spector.onCaptureStarted.add((capture) =>
|
|
3955
|
+
spector == null ? void 0 : spector.onCaptureStarted.add((capture) => import_core16.log.info("Spector capture started:", capture)());
|
|
3956
3956
|
spector == null ? void 0 : spector.onCapture.add((capture) => {
|
|
3957
|
-
|
|
3957
|
+
import_core16.log.info("Spector capture complete:", capture)();
|
|
3958
3958
|
spector == null ? void 0 : spector.getResultUI();
|
|
3959
3959
|
spector == null ? void 0 : spector.resultView.display();
|
|
3960
3960
|
spector == null ? void 0 : spector.resultView.addCapture(capture);
|
|
@@ -3966,7 +3966,7 @@ function initializeSpectorJS(props) {
|
|
|
3966
3966
|
}
|
|
3967
3967
|
spector == null ? void 0 : spector.startCapture(props == null ? void 0 : props.canvas, 500);
|
|
3968
3968
|
new Promise((resolve) => setTimeout(resolve, 2e3)).then((_) => {
|
|
3969
|
-
|
|
3969
|
+
import_core16.log.info("Spector capture stopped after 2 seconds")();
|
|
3970
3970
|
spector == null ? void 0 : spector.stopCapture();
|
|
3971
3971
|
});
|
|
3972
3972
|
}
|
|
@@ -3974,7 +3974,7 @@ function initializeSpectorJS(props) {
|
|
|
3974
3974
|
}
|
|
3975
3975
|
|
|
3976
3976
|
// src/context/debug/webgl-developer-tools.ts
|
|
3977
|
-
var
|
|
3977
|
+
var import_core17 = require("@luma.gl/core");
|
|
3978
3978
|
var import_constants14 = require("@luma.gl/constants");
|
|
3979
3979
|
var import_env = require("@probe.gl/env");
|
|
3980
3980
|
var WEBGL_DEBUG_CDN_URL = "https://unpkg.com/webgl-debug@2.0.1/index.js";
|
|
@@ -3987,7 +3987,7 @@ function loadWebGLDeveloperTools() {
|
|
|
3987
3987
|
if ((0, import_env.isBrowser)() && !globalThis.WebGLDebugUtils) {
|
|
3988
3988
|
globalThis.global = globalThis.global || globalThis;
|
|
3989
3989
|
globalThis.global.module = {};
|
|
3990
|
-
yield (0,
|
|
3990
|
+
yield (0, import_core17.loadScript)(WEBGL_DEBUG_CDN_URL);
|
|
3991
3991
|
}
|
|
3992
3992
|
});
|
|
3993
3993
|
}
|
|
@@ -4003,7 +4003,7 @@ function getRealContext(gl2) {
|
|
|
4003
4003
|
}
|
|
4004
4004
|
function getDebugContext(gl2, props) {
|
|
4005
4005
|
if (!globalThis.WebGLDebugUtils) {
|
|
4006
|
-
|
|
4006
|
+
import_core17.log.warn("webgl-debug not loaded")();
|
|
4007
4007
|
return gl2;
|
|
4008
4008
|
}
|
|
4009
4009
|
const data = getContextData2(gl2);
|
|
@@ -4043,7 +4043,7 @@ function onGLError(props, err, functionName, args) {
|
|
|
4043
4043
|
const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);
|
|
4044
4044
|
const glName = props.webgl2 ? "gl2" : "gl1";
|
|
4045
4045
|
const message2 = `${errorMessage} in ${glName}.${functionName}(${functionArgs})`;
|
|
4046
|
-
|
|
4046
|
+
import_core17.log.error(message2)();
|
|
4047
4047
|
debugger;
|
|
4048
4048
|
if (props.throwOnError) {
|
|
4049
4049
|
throw new Error(message2);
|
|
@@ -4051,9 +4051,9 @@ function onGLError(props, err, functionName, args) {
|
|
|
4051
4051
|
}
|
|
4052
4052
|
function onValidateGLFunc(props, functionName, functionArgs) {
|
|
4053
4053
|
let functionString = "";
|
|
4054
|
-
if (
|
|
4054
|
+
if (import_core17.log.level >= 1) {
|
|
4055
4055
|
functionString = getFunctionString(functionName, functionArgs);
|
|
4056
|
-
|
|
4056
|
+
import_core17.log.log(1, functionString)();
|
|
4057
4057
|
}
|
|
4058
4058
|
if (props.break && props.break.length > 0) {
|
|
4059
4059
|
functionString = functionString || getFunctionString(functionName, functionArgs);
|
|
@@ -4068,7 +4068,7 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
4068
4068
|
if (props.throwOnError) {
|
|
4069
4069
|
throw new Error(`Undefined argument: ${functionString}`);
|
|
4070
4070
|
} else {
|
|
4071
|
-
|
|
4071
|
+
import_core17.log.error(`Undefined argument: ${functionString}`)();
|
|
4072
4072
|
debugger;
|
|
4073
4073
|
}
|
|
4074
4074
|
}
|
|
@@ -4076,11 +4076,11 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
4076
4076
|
}
|
|
4077
4077
|
|
|
4078
4078
|
// src/classic/buffer-with-accessor.ts
|
|
4079
|
-
var
|
|
4079
|
+
var import_core19 = require("@luma.gl/core");
|
|
4080
4080
|
var import_constants17 = require("@luma.gl/constants");
|
|
4081
4081
|
|
|
4082
4082
|
// src/classic/accessor.ts
|
|
4083
|
-
var
|
|
4083
|
+
var import_core18 = require("@luma.gl/core");
|
|
4084
4084
|
var import_constants16 = require("@luma.gl/constants");
|
|
4085
4085
|
|
|
4086
4086
|
// src/classic/typed-array-utils.ts
|
|
@@ -4156,7 +4156,7 @@ var Accessor = class {
|
|
|
4156
4156
|
return ArrayType.BYTES_PER_ELEMENT;
|
|
4157
4157
|
}
|
|
4158
4158
|
static getBytesPerVertex(accessor) {
|
|
4159
|
-
(0,
|
|
4159
|
+
(0, import_core18.assert)(accessor.size);
|
|
4160
4160
|
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.GL.FLOAT);
|
|
4161
4161
|
return ArrayType.BYTES_PER_ELEMENT * accessor.size;
|
|
4162
4162
|
}
|
|
@@ -4185,7 +4185,7 @@ var Accessor = class {
|
|
|
4185
4185
|
// PRIVATE
|
|
4186
4186
|
// eslint-disable-next-line complexity, max-statements
|
|
4187
4187
|
_assign(props = {}) {
|
|
4188
|
-
props = (0,
|
|
4188
|
+
props = (0, import_core18.checkProps)("Accessor", props, PROP_CHECKS);
|
|
4189
4189
|
if (props.type !== void 0) {
|
|
4190
4190
|
this.type = props.type;
|
|
4191
4191
|
if (props.type === import_constants16.GL.INT || props.type === import_constants16.GL.UNSIGNED_INT) {
|
|
@@ -4282,7 +4282,7 @@ function getWEBGLBufferProps(props) {
|
|
|
4282
4282
|
} else if (typeof props === "number") {
|
|
4283
4283
|
return { byteLength: props };
|
|
4284
4284
|
}
|
|
4285
|
-
props = (0,
|
|
4285
|
+
props = (0, import_core19.checkProps)("Buffer", props, PROP_CHECKS_INITIALIZE);
|
|
4286
4286
|
const bufferProps = __spreadValues({}, props);
|
|
4287
4287
|
return bufferProps;
|
|
4288
4288
|
}
|
|
@@ -4292,7 +4292,7 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4292
4292
|
this.setAccessor(Object.assign({}, props, props.accessor));
|
|
4293
4293
|
if (this.props.data) {
|
|
4294
4294
|
const type = getGLTypeFromTypedArray(this.props.data);
|
|
4295
|
-
(0,
|
|
4295
|
+
(0, import_core19.assert)(type);
|
|
4296
4296
|
this.setAccessor(new Accessor(this.accessor, { type }));
|
|
4297
4297
|
}
|
|
4298
4298
|
Object.seal(this);
|
|
@@ -4319,7 +4319,7 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4319
4319
|
if (Number.isFinite(props)) {
|
|
4320
4320
|
props = { byteLength: props };
|
|
4321
4321
|
}
|
|
4322
|
-
props = (0,
|
|
4322
|
+
props = (0, import_core19.checkProps)("Buffer", props, PROP_CHECKS_INITIALIZE);
|
|
4323
4323
|
this.glUsage = props.glUsage || import_constants17.GL.STATIC_DRAW;
|
|
4324
4324
|
this.debugData = null;
|
|
4325
4325
|
this.setAccessor(Object.assign({}, props, props.accessor));
|
|
@@ -4331,7 +4331,7 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4331
4331
|
return this;
|
|
4332
4332
|
}
|
|
4333
4333
|
setProps(props) {
|
|
4334
|
-
props = (0,
|
|
4334
|
+
props = (0, import_core19.checkProps)("Buffer", props, PROP_CHECKS_SET_PROPS);
|
|
4335
4335
|
if ("accessor" in props) {
|
|
4336
4336
|
this.setAccessor(props.accessor);
|
|
4337
4337
|
}
|
|
@@ -4373,7 +4373,7 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4373
4373
|
}
|
|
4374
4374
|
const { data, offset = 0, srcOffset = 0 } = options;
|
|
4375
4375
|
const byteLength = options.byteLength || options.length;
|
|
4376
|
-
(0,
|
|
4376
|
+
(0, import_core19.assert)(data);
|
|
4377
4377
|
const glTarget = this.gl.webgl2 ? import_constants17.GL.COPY_WRITE_BUFFER : this.glTarget;
|
|
4378
4378
|
this.gl.bindBuffer(glTarget, this.handle);
|
|
4379
4379
|
if (srcOffset !== 0 || byteLength !== void 0) {
|
|
@@ -4429,7 +4429,7 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4429
4429
|
}
|
|
4430
4430
|
const copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount);
|
|
4431
4431
|
length = length || copyElementCount;
|
|
4432
|
-
(0,
|
|
4432
|
+
(0, import_core19.assert)(length <= copyElementCount);
|
|
4433
4433
|
dstData = dstData || new ArrayType(dstElementCount);
|
|
4434
4434
|
this.gl.bindBuffer(import_constants17.GL.COPY_READ_BUFFER, this.handle);
|
|
4435
4435
|
(_a = this.gl2) == null ? void 0 : _a.getBufferSubData(import_constants17.GL.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);
|
|
@@ -4457,7 +4457,7 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4457
4457
|
if (size !== void 0) {
|
|
4458
4458
|
(_a = this.gl2) == null ? void 0 : _a.bindBufferRange(glTarget, index, this.handle, offset, size);
|
|
4459
4459
|
} else {
|
|
4460
|
-
(0,
|
|
4460
|
+
(0, import_core19.assert)(offset === 0);
|
|
4461
4461
|
(_b = this.gl2) == null ? void 0 : _b.bindBufferBase(glTarget, index, this.handle);
|
|
4462
4462
|
}
|
|
4463
4463
|
} else {
|
|
@@ -4491,7 +4491,7 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4491
4491
|
// PRIVATE METHODS
|
|
4492
4492
|
// Allocate a new buffer and initialize to contents of typed array
|
|
4493
4493
|
_setData(data, offset = 0, byteLength = data.byteLength + offset) {
|
|
4494
|
-
(0,
|
|
4494
|
+
(0, import_core19.assert)(ArrayBuffer.isView(data));
|
|
4495
4495
|
this.trackDeallocatedMemory();
|
|
4496
4496
|
const target = this._getTarget();
|
|
4497
4497
|
this.gl.bindBuffer(target, this.handle);
|
|
@@ -4503,13 +4503,13 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4503
4503
|
this.byteLength = byteLength;
|
|
4504
4504
|
this.trackAllocatedMemory(byteLength);
|
|
4505
4505
|
const type = getGLTypeFromTypedArray(data);
|
|
4506
|
-
(0,
|
|
4506
|
+
(0, import_core19.assert)(type);
|
|
4507
4507
|
this.setAccessor(new Accessor(this.accessor, { type }));
|
|
4508
4508
|
return this;
|
|
4509
4509
|
}
|
|
4510
4510
|
// Allocate a GPU buffer of specified size.
|
|
4511
4511
|
_setByteLength(byteLength) {
|
|
4512
|
-
(0,
|
|
4512
|
+
(0, import_core19.assert)(byteLength >= 0);
|
|
4513
4513
|
this.trackDeallocatedMemory();
|
|
4514
4514
|
let data = byteLength;
|
|
4515
4515
|
if (byteLength === 0) {
|
|
@@ -4557,7 +4557,7 @@ var BufferWithAccessor = class extends WEBGLBuffer {
|
|
|
4557
4557
|
};
|
|
4558
4558
|
|
|
4559
4559
|
// src/adapter/resources/webgl-shader.ts
|
|
4560
|
-
var
|
|
4560
|
+
var import_core20 = require("@luma.gl/core");
|
|
4561
4561
|
var import_constants18 = require("@luma.gl/constants");
|
|
4562
4562
|
|
|
4563
4563
|
// src/adapter/helpers/get-shader-info.ts
|
|
@@ -4618,7 +4618,7 @@ function parseShaderCompilerLog(errLog) {
|
|
|
4618
4618
|
}
|
|
4619
4619
|
|
|
4620
4620
|
// src/adapter/resources/webgl-shader.ts
|
|
4621
|
-
var WEBGLShader = class extends
|
|
4621
|
+
var WEBGLShader = class extends import_core20.Shader {
|
|
4622
4622
|
constructor(device, props) {
|
|
4623
4623
|
super(device, __spreadValues({ id: getShaderIdFromProps(props) }, props));
|
|
4624
4624
|
this.device = device;
|
|
@@ -4660,27 +4660,27 @@ ${source2}`;
|
|
|
4660
4660
|
const shaderLog = gl2.getShaderInfoLog(this.handle);
|
|
4661
4661
|
const parsedLog = shaderLog ? parseShaderCompilerLog(shaderLog) : [];
|
|
4662
4662
|
const messages = parsedLog.filter((message2) => message2.type === "error");
|
|
4663
|
-
const formattedLog = (0,
|
|
4663
|
+
const formattedLog = (0, import_core20.formatCompilerLog)(messages, source);
|
|
4664
4664
|
const shaderName = getShaderInfo(source).name;
|
|
4665
4665
|
const shaderDescription = `${this.stage} shader ${shaderName}`;
|
|
4666
|
-
|
|
4666
|
+
import_core20.log.error(`GLSL compilation errors in ${shaderDescription}
|
|
4667
4667
|
${formattedLog}`)();
|
|
4668
4668
|
throw new Error(`GLSL compilation errors in ${shaderName}`);
|
|
4669
4669
|
}
|
|
4670
4670
|
}
|
|
4671
4671
|
};
|
|
4672
4672
|
function getShaderIdFromProps(props) {
|
|
4673
|
-
return getShaderInfo(props.source).name || props.id || (0,
|
|
4673
|
+
return getShaderInfo(props.source).name || props.id || (0, import_core20.uid)(`unnamed ${props.stage}-shader`);
|
|
4674
4674
|
}
|
|
4675
4675
|
|
|
4676
4676
|
// src/adapter/resources/webgl-render-pass.ts
|
|
4677
|
-
var
|
|
4677
|
+
var import_core21 = require("@luma.gl/core");
|
|
4678
4678
|
var import_constants19 = require("@luma.gl/constants");
|
|
4679
4679
|
var GL_DEPTH_BUFFER_BIT = 256;
|
|
4680
4680
|
var GL_STENCIL_BUFFER_BIT = 1024;
|
|
4681
4681
|
var GL_COLOR_BUFFER_BIT = 16384;
|
|
4682
4682
|
var GL_COLOR = 6144;
|
|
4683
|
-
var WEBGLRenderPass = class extends
|
|
4683
|
+
var WEBGLRenderPass = class extends import_core21.RenderPass {
|
|
4684
4684
|
constructor(device, props) {
|
|
4685
4685
|
super(device, props);
|
|
4686
4686
|
this.device = device;
|
|
@@ -4713,8 +4713,12 @@ var WEBGLRenderPass = class extends import_api21.RenderPass {
|
|
|
4713
4713
|
glParameters.stencilMask = this.props.stencilReadOnly ? 0 : 1;
|
|
4714
4714
|
glParameters[import_constants19.GL.RASTERIZER_DISCARD] = this.props.discard;
|
|
4715
4715
|
if (parameters.viewport) {
|
|
4716
|
-
|
|
4717
|
-
|
|
4716
|
+
if (parameters.viewport.length >= 6) {
|
|
4717
|
+
glParameters.viewport = parameters.viewport.slice(0, 4);
|
|
4718
|
+
glParameters.depthRange = [parameters.viewport[4], parameters.viewport[5]];
|
|
4719
|
+
} else {
|
|
4720
|
+
glParameters.viewport = parameters.viewport;
|
|
4721
|
+
}
|
|
4718
4722
|
}
|
|
4719
4723
|
glParameters.scissorTest = Boolean(parameters.scissorRect);
|
|
4720
4724
|
if (parameters.scissorRect) {
|
|
@@ -4794,11 +4798,11 @@ var WEBGLRenderPass = class extends import_api21.RenderPass {
|
|
|
4794
4798
|
};
|
|
4795
4799
|
|
|
4796
4800
|
// src/adapter/resources/webgl-render-pipeline.ts
|
|
4797
|
-
var
|
|
4801
|
+
var import_core24 = require("@luma.gl/core");
|
|
4798
4802
|
var import_constants25 = require("@luma.gl/constants");
|
|
4799
4803
|
|
|
4800
4804
|
// src/adapter/helpers/get-shader-layout.ts
|
|
4801
|
-
var
|
|
4805
|
+
var import_core22 = require("@luma.gl/core");
|
|
4802
4806
|
var import_constants22 = require("@luma.gl/constants");
|
|
4803
4807
|
|
|
4804
4808
|
// src/adapter/helpers/uniforms.ts
|
|
@@ -4976,7 +4980,7 @@ function mergeShaderLayout(baseLayout, overrideLayout) {
|
|
|
4976
4980
|
for (const attribute of (overrideLayout == null ? void 0 : overrideLayout.attributes) || []) {
|
|
4977
4981
|
const baseAttribute = mergedLayout.attributes.find((attr) => attr.name === attribute.name);
|
|
4978
4982
|
if (!baseAttribute) {
|
|
4979
|
-
|
|
4983
|
+
import_core22.log.warn(`shader layout attribute ${attribute.name} not present in shader`);
|
|
4980
4984
|
} else {
|
|
4981
4985
|
baseAttribute.format = attribute.format || baseAttribute.format;
|
|
4982
4986
|
baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;
|
|
@@ -5010,7 +5014,7 @@ function overrideShaderLayoutAttribute(layout, attributeOverride) {
|
|
|
5010
5014
|
function getAttributeFromLayout(shaderLayout, name) {
|
|
5011
5015
|
const attribute = shaderLayout.attributes.find((attr) => attr.name === name);
|
|
5012
5016
|
if (!attribute) {
|
|
5013
|
-
|
|
5017
|
+
import_core22.log.warn(`shader layout attribute "${name}" not present in shader`);
|
|
5014
5018
|
}
|
|
5015
5019
|
return attribute || null;
|
|
5016
5020
|
}
|
|
@@ -5209,7 +5213,7 @@ function setUniform(gl2, location, type, value) {
|
|
|
5209
5213
|
value = 1;
|
|
5210
5214
|
}
|
|
5211
5215
|
if (value === false) {
|
|
5212
|
-
value =
|
|
5216
|
+
value = 0;
|
|
5213
5217
|
}
|
|
5214
5218
|
const arrayValue = typeof value === "number" ? [value] : value;
|
|
5215
5219
|
switch (type) {
|
|
@@ -5268,14 +5272,14 @@ function setUniform(gl2, location, type, value) {
|
|
|
5268
5272
|
}
|
|
5269
5273
|
|
|
5270
5274
|
// src/adapter/objects/webgl-vertex-array-object.ts
|
|
5271
|
-
var
|
|
5275
|
+
var import_core23 = require("@luma.gl/core");
|
|
5272
5276
|
var import_constants24 = require("@luma.gl/constants");
|
|
5273
5277
|
var import_env2 = require("@probe.gl/env");
|
|
5274
5278
|
var ERR_ELEMENTS = "elements must be GL.ELEMENT_ARRAY_BUFFER";
|
|
5275
5279
|
var WEBGLVertexArrayObject = class extends WebGLResource {
|
|
5276
5280
|
// Create a VertexArray
|
|
5277
5281
|
constructor(device, props) {
|
|
5278
|
-
super(device, props, __spreadProps(__spreadValues({},
|
|
5282
|
+
super(device, props, __spreadProps(__spreadValues({}, import_core23.Resource.defaultProps), { constantAttributeZero: false }));
|
|
5279
5283
|
/** Buffer constant */
|
|
5280
5284
|
this.buffer = null;
|
|
5281
5285
|
this.bufferValue = null;
|
|
@@ -5323,7 +5327,7 @@ var WEBGLVertexArrayObject = class extends WebGLResource {
|
|
|
5323
5327
|
// Set (bind) an elements buffer, for indexed rendering.
|
|
5324
5328
|
// Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported
|
|
5325
5329
|
setElementBuffer(elementBuffer = null, opts = {}) {
|
|
5326
|
-
(0,
|
|
5330
|
+
(0, import_core23.assert)(!elementBuffer || elementBuffer.glTarget === import_constants24.GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);
|
|
5327
5331
|
this.bind(() => {
|
|
5328
5332
|
this.gl.bindBuffer(import_constants24.GL.ELEMENT_ARRAY_BUFFER, elementBuffer ? elementBuffer.handle : null);
|
|
5329
5333
|
});
|
|
@@ -5372,7 +5376,7 @@ var WEBGLVertexArrayObject = class extends WebGLResource {
|
|
|
5372
5376
|
setConstantUintArray(this.device, location, array);
|
|
5373
5377
|
break;
|
|
5374
5378
|
default:
|
|
5375
|
-
(0,
|
|
5379
|
+
(0, import_core23.assert)(false);
|
|
5376
5380
|
}
|
|
5377
5381
|
}
|
|
5378
5382
|
/**
|
|
@@ -5390,8 +5394,8 @@ var WEBGLVertexArrayObject = class extends WebGLResource {
|
|
|
5390
5394
|
updateNeeded = updateNeeded || this.buffer.reallocate(byteLength);
|
|
5391
5395
|
updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
|
|
5392
5396
|
if (updateNeeded) {
|
|
5393
|
-
const typedArray = (0,
|
|
5394
|
-
(0,
|
|
5397
|
+
const typedArray = (0, import_core23.getScratchArray)(value.constructor, length);
|
|
5398
|
+
(0, import_core23.fillArray)({ target: typedArray, source: constantValue, start: 0, count: length });
|
|
5395
5399
|
this.buffer.subData(typedArray);
|
|
5396
5400
|
this.bufferValue = value;
|
|
5397
5401
|
}
|
|
@@ -5413,7 +5417,7 @@ function setConstantFloatArray(device, location, array) {
|
|
|
5413
5417
|
device.gl.vertexAttrib4fv(location, array);
|
|
5414
5418
|
break;
|
|
5415
5419
|
default:
|
|
5416
|
-
(0,
|
|
5420
|
+
(0, import_core23.assert)(false);
|
|
5417
5421
|
}
|
|
5418
5422
|
}
|
|
5419
5423
|
function setConstantIntArray(device, location, array) {
|
|
@@ -5446,7 +5450,7 @@ function compareConstantArrayValues(v1, v2) {
|
|
|
5446
5450
|
|
|
5447
5451
|
// src/adapter/resources/webgl-render-pipeline.ts
|
|
5448
5452
|
var LOG_PROGRAM_PERF_PRIORITY = 4;
|
|
5449
|
-
var WEBGLRenderPipeline = class extends
|
|
5453
|
+
var WEBGLRenderPipeline = class extends import_core24.RenderPipeline {
|
|
5450
5454
|
// TODO are these used?
|
|
5451
5455
|
constructor(device, props) {
|
|
5452
5456
|
var _a;
|
|
@@ -5466,8 +5470,8 @@ var WEBGLRenderPipeline = class extends import_api24.RenderPipeline {
|
|
|
5466
5470
|
this.device = device;
|
|
5467
5471
|
this.handle = this.props.handle || this.device.gl.createProgram();
|
|
5468
5472
|
this.device.setSpectorMetadata(this.handle, { id: this.props.id });
|
|
5469
|
-
this.vs = (0,
|
|
5470
|
-
this.fs = (0,
|
|
5473
|
+
this.vs = (0, import_core24.cast)(props.vs);
|
|
5474
|
+
this.fs = (0, import_core24.cast)(props.fs);
|
|
5471
5475
|
const { varyings, bufferMode = import_constants25.GL.SEPARATE_ATTRIBS } = props;
|
|
5472
5476
|
if (varyings && varyings.length > 0) {
|
|
5473
5477
|
this.device.assertWebGL2();
|
|
@@ -5488,21 +5492,27 @@ var WEBGLRenderPipeline = class extends import_api24.RenderPipeline {
|
|
|
5488
5492
|
}
|
|
5489
5493
|
}
|
|
5490
5494
|
setIndexBuffer(indexBuffer) {
|
|
5491
|
-
const webglBuffer = (0,
|
|
5495
|
+
const webglBuffer = (0, import_core24.cast)(indexBuffer);
|
|
5492
5496
|
this.vertexArrayObject.setElementBuffer(webglBuffer);
|
|
5493
5497
|
this._indexBuffer = webglBuffer;
|
|
5494
5498
|
}
|
|
5495
5499
|
/** @todo needed for portable model */
|
|
5496
5500
|
setAttributes(attributes) {
|
|
5497
5501
|
for (const [name, buffer] of Object.entries(attributes)) {
|
|
5498
|
-
const webglBuffer = (0,
|
|
5502
|
+
const webglBuffer = (0, import_core24.cast)(buffer);
|
|
5499
5503
|
const attribute = getAttributeLayout(this.layout, name);
|
|
5500
5504
|
if (!attribute) {
|
|
5501
|
-
|
|
5505
|
+
import_core24.log.warn(`Ignoring buffer supplied for unknown attribute "${name}" in pipeline "${this.id}" (buffer "${buffer.id}")`)();
|
|
5502
5506
|
continue;
|
|
5503
5507
|
}
|
|
5504
|
-
const decoded = (0,
|
|
5505
|
-
const {
|
|
5508
|
+
const decoded = (0, import_core24.decodeVertexFormat)(attribute.format);
|
|
5509
|
+
const {
|
|
5510
|
+
type: typeString,
|
|
5511
|
+
components: size,
|
|
5512
|
+
byteLength: stride,
|
|
5513
|
+
normalized
|
|
5514
|
+
/* , integer*/
|
|
5515
|
+
} = decoded;
|
|
5506
5516
|
const divisor = attribute.stepMode === "instance" ? 1 : 0;
|
|
5507
5517
|
const type = getWebGLDataType(typeString);
|
|
5508
5518
|
this.vertexArrayObject.setBuffer(attribute.location, webglBuffer, {
|
|
@@ -5511,7 +5521,12 @@ var WEBGLRenderPipeline = class extends import_api24.RenderPipeline {
|
|
|
5511
5521
|
stride,
|
|
5512
5522
|
offset: 0,
|
|
5513
5523
|
normalized,
|
|
5514
|
-
|
|
5524
|
+
// it is the shader attribute declaration, not the vertex memory format,
|
|
5525
|
+
// that determines if the data in the buffer will be treated as integers.
|
|
5526
|
+
// /
|
|
5527
|
+
// Also note that WebGL supports assigning non-normalized integer data to floating point attributes,
|
|
5528
|
+
// but as far as we can tell, WebGPU does not.
|
|
5529
|
+
integer: false,
|
|
5515
5530
|
divisor
|
|
5516
5531
|
});
|
|
5517
5532
|
}
|
|
@@ -5526,7 +5541,7 @@ var WEBGLRenderPipeline = class extends import_api24.RenderPipeline {
|
|
|
5526
5541
|
for (const [name, value] of Object.entries(attributes)) {
|
|
5527
5542
|
const attribute = getAttributeLayout(this.layout, name);
|
|
5528
5543
|
if (!attribute) {
|
|
5529
|
-
|
|
5544
|
+
import_core24.log.warn(`Ignoring constant value supplied for unknown attribute "${name}" in pipeline "${this.id}"`)();
|
|
5530
5545
|
continue;
|
|
5531
5546
|
}
|
|
5532
5547
|
this.vertexArrayObject.setConstant(attribute.location, value);
|
|
@@ -5541,11 +5556,11 @@ var WEBGLRenderPipeline = class extends import_api24.RenderPipeline {
|
|
|
5541
5556
|
for (const [name, value] of Object.entries(bindings)) {
|
|
5542
5557
|
const binding = this.layout.bindings.find((binding2) => binding2.name === name);
|
|
5543
5558
|
if (!binding) {
|
|
5544
|
-
|
|
5559
|
+
import_core24.log.warn(`Unknown binding ${name} in render pipeline ${this.id}`)();
|
|
5545
5560
|
continue;
|
|
5546
5561
|
}
|
|
5547
5562
|
if (!value) {
|
|
5548
|
-
|
|
5563
|
+
import_core24.log.warn(`Unsetting binding ${name} in render pipeline ${this.id}`)();
|
|
5549
5564
|
}
|
|
5550
5565
|
switch (binding.type) {
|
|
5551
5566
|
case "uniform":
|
|
@@ -5559,7 +5574,7 @@ var WEBGLRenderPipeline = class extends import_api24.RenderPipeline {
|
|
|
5559
5574
|
}
|
|
5560
5575
|
break;
|
|
5561
5576
|
case "sampler":
|
|
5562
|
-
|
|
5577
|
+
import_core24.log.warn(`Ignoring sampler ${name}`)();
|
|
5563
5578
|
break;
|
|
5564
5579
|
default:
|
|
5565
5580
|
throw new Error(binding.type);
|
|
@@ -5637,10 +5652,10 @@ var WEBGLRenderPipeline = class extends import_api24.RenderPipeline {
|
|
|
5637
5652
|
const { gl: gl2 } = this.device;
|
|
5638
5653
|
gl2.attachShader(this.handle, this.vs.handle);
|
|
5639
5654
|
gl2.attachShader(this.handle, this.fs.handle);
|
|
5640
|
-
|
|
5655
|
+
import_core24.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
|
|
5641
5656
|
gl2.linkProgram(this.handle);
|
|
5642
|
-
|
|
5643
|
-
if (gl2.debug ||
|
|
5657
|
+
import_core24.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
|
|
5658
|
+
if (gl2.debug || import_core24.log.level > 0) {
|
|
5644
5659
|
const linked = gl2.getProgramParameter(this.handle, gl2.LINK_STATUS);
|
|
5645
5660
|
if (!linked) {
|
|
5646
5661
|
throw new Error(`Error linking: ${gl2.getProgramInfoLog(this.handle)}`);
|
|
@@ -5742,7 +5757,7 @@ var WEBGLRenderPipeline = class extends import_api24.RenderPipeline {
|
|
|
5742
5757
|
for (const [name, value] of Object.entries(this.constantAttributes)) {
|
|
5743
5758
|
const attribute = getAttributeLayout(this.layout, name);
|
|
5744
5759
|
if (!attribute) {
|
|
5745
|
-
|
|
5760
|
+
import_core24.log.warn(`Ignoring constant value supplied for unknown attribute "${name}" in pipeline "${this.id}"`)();
|
|
5746
5761
|
continue;
|
|
5747
5762
|
}
|
|
5748
5763
|
this.vertexArrayObject.setConstant(attribute.location, value);
|
|
@@ -5757,13 +5772,13 @@ function getDrawMode(topology) {
|
|
|
5757
5772
|
return import_constants25.GL.LINES;
|
|
5758
5773
|
case "line-strip":
|
|
5759
5774
|
return import_constants25.GL.LINE_STRIP;
|
|
5760
|
-
case "line-loop":
|
|
5775
|
+
case "line-loop-webgl":
|
|
5761
5776
|
return import_constants25.GL.LINE_LOOP;
|
|
5762
5777
|
case "triangle-list":
|
|
5763
5778
|
return import_constants25.GL.TRIANGLES;
|
|
5764
5779
|
case "triangle-strip":
|
|
5765
5780
|
return import_constants25.GL.TRIANGLE_STRIP;
|
|
5766
|
-
case "triangle-fan":
|
|
5781
|
+
case "triangle-fan-webgl":
|
|
5767
5782
|
return import_constants25.GL.TRIANGLE_FAN;
|
|
5768
5783
|
default:
|
|
5769
5784
|
throw new Error(topology);
|
|
@@ -5777,13 +5792,13 @@ function getGLPrimitive(topology) {
|
|
|
5777
5792
|
return import_constants25.GL.LINES;
|
|
5778
5793
|
case "line-strip":
|
|
5779
5794
|
return import_constants25.GL.LINES;
|
|
5780
|
-
case "line-loop":
|
|
5795
|
+
case "line-loop-webgl":
|
|
5781
5796
|
return import_constants25.GL.LINES;
|
|
5782
5797
|
case "triangle-list":
|
|
5783
5798
|
return import_constants25.GL.TRIANGLES;
|
|
5784
5799
|
case "triangle-strip":
|
|
5785
5800
|
return import_constants25.GL.TRIANGLES;
|
|
5786
|
-
case "triangle-fan":
|
|
5801
|
+
case "triangle-fan-webgl":
|
|
5787
5802
|
return import_constants25.GL.TRIANGLES;
|
|
5788
5803
|
default:
|
|
5789
5804
|
throw new Error(topology);
|
|
@@ -5794,15 +5809,15 @@ function getAttributeLayout(layout, name) {
|
|
|
5794
5809
|
}
|
|
5795
5810
|
|
|
5796
5811
|
// src/adapter/resources/webgl-command-encoder.ts
|
|
5797
|
-
var
|
|
5812
|
+
var import_core26 = require("@luma.gl/core");
|
|
5798
5813
|
|
|
5799
5814
|
// src/adapter/resources/webgl-command-buffer.ts
|
|
5800
|
-
var
|
|
5815
|
+
var import_core25 = require("@luma.gl/core");
|
|
5801
5816
|
var import_constants26 = require("@luma.gl/constants");
|
|
5802
5817
|
function cast3(value) {
|
|
5803
5818
|
return value;
|
|
5804
5819
|
}
|
|
5805
|
-
var WEBGLCommandBuffer = class extends
|
|
5820
|
+
var WEBGLCommandBuffer = class extends import_core25.CommandBuffer {
|
|
5806
5821
|
constructor(device) {
|
|
5807
5822
|
super({});
|
|
5808
5823
|
this.commands = [];
|
|
@@ -5980,7 +5995,7 @@ function _copyTextureToTexture(device, options) {
|
|
|
5980
5995
|
return texture;
|
|
5981
5996
|
}
|
|
5982
5997
|
function getFramebuffer(source) {
|
|
5983
|
-
if (source instanceof
|
|
5998
|
+
if (source instanceof import_core25.Texture) {
|
|
5984
5999
|
const { width, height, id } = source;
|
|
5985
6000
|
const framebuffer = source.device.createFramebuffer({
|
|
5986
6001
|
id: `framebuffer-for-${id}`,
|
|
@@ -5994,7 +6009,7 @@ function getFramebuffer(source) {
|
|
|
5994
6009
|
}
|
|
5995
6010
|
|
|
5996
6011
|
// src/adapter/resources/webgl-command-encoder.ts
|
|
5997
|
-
var WEBGLCommandEncoder = class extends
|
|
6012
|
+
var WEBGLCommandEncoder = class extends import_core26.CommandEncoder {
|
|
5998
6013
|
constructor(device, props) {
|
|
5999
6014
|
super(props);
|
|
6000
6015
|
this.device = device;
|
|
@@ -6038,13 +6053,13 @@ var WEBGLCommandEncoder = class extends import_api26.CommandEncoder {
|
|
|
6038
6053
|
|
|
6039
6054
|
// src/adapter/webgl-device.ts
|
|
6040
6055
|
var LOG_LEVEL2 = 1;
|
|
6041
|
-
var _WebGLDevice = class extends
|
|
6056
|
+
var _WebGLDevice = class extends import_core27.Device {
|
|
6042
6057
|
//
|
|
6043
6058
|
// Public API
|
|
6044
6059
|
//
|
|
6045
6060
|
constructor(props) {
|
|
6046
6061
|
var _a;
|
|
6047
|
-
super(__spreadProps(__spreadValues({}, props), { id: props.id || (0,
|
|
6062
|
+
super(__spreadProps(__spreadValues({}, props), { id: props.id || (0, import_core27.uid)("webgl-device") }));
|
|
6048
6063
|
this.renderPass = null;
|
|
6049
6064
|
/** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */
|
|
6050
6065
|
this.gl2 = null;
|
|
@@ -6088,22 +6103,22 @@ var _WebGLDevice = class extends import_api27.Device {
|
|
|
6088
6103
|
trackContextState(this.gl, {
|
|
6089
6104
|
enable: enable2,
|
|
6090
6105
|
copyState,
|
|
6091
|
-
log: (...args) =>
|
|
6106
|
+
log: (...args) => import_core27.log.log(1, ...args)()
|
|
6092
6107
|
});
|
|
6093
6108
|
if ((0, import_env3.isBrowser)() && props.debug) {
|
|
6094
6109
|
this.gl = makeDebugContext(this.gl, __spreadProps(__spreadValues({}, props), { webgl2: this.isWebGL2, throwOnError: true }));
|
|
6095
6110
|
this.gl2 = this.gl;
|
|
6096
6111
|
this.debug = true;
|
|
6097
|
-
|
|
6098
|
-
|
|
6112
|
+
import_core27.log.level = Math.max(import_core27.log.level, 1);
|
|
6113
|
+
import_core27.log.warn("WebGL debug mode activated. Performance reduced.")();
|
|
6099
6114
|
}
|
|
6100
6115
|
if ((0, import_env3.isBrowser)() && props.spector) {
|
|
6101
6116
|
const canvas = this.handle.canvas || props.canvas;
|
|
6102
6117
|
this.spector = initializeSpectorJS(__spreadProps(__spreadValues({}, this.props), { canvas }));
|
|
6103
6118
|
}
|
|
6104
6119
|
const message2 = `Created ${this.info.type}${this.debug ? " debug" : ""} context: ${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;
|
|
6105
|
-
|
|
6106
|
-
|
|
6120
|
+
import_core27.log.probe(LOG_LEVEL2, message2)();
|
|
6121
|
+
import_core27.log.groupEnd(LOG_LEVEL2)();
|
|
6107
6122
|
}
|
|
6108
6123
|
static isSupported() {
|
|
6109
6124
|
return typeof WebGLRenderingContext !== "undefined" || isHeadlessGLRegistered();
|
|
@@ -6129,7 +6144,7 @@ var _WebGLDevice = class extends import_api27.Device {
|
|
|
6129
6144
|
if (gl2 instanceof _WebGLDevice) {
|
|
6130
6145
|
return gl2;
|
|
6131
6146
|
}
|
|
6132
|
-
if ((gl2 == null ? void 0 : gl2.device) instanceof
|
|
6147
|
+
if ((gl2 == null ? void 0 : gl2.device) instanceof import_core27.Device) {
|
|
6133
6148
|
return gl2.device;
|
|
6134
6149
|
}
|
|
6135
6150
|
if (!isWebGL3(gl2)) {
|
|
@@ -6139,18 +6154,18 @@ var _WebGLDevice = class extends import_api27.Device {
|
|
|
6139
6154
|
}
|
|
6140
6155
|
static create() {
|
|
6141
6156
|
return __async(this, arguments, function* (props = {}) {
|
|
6142
|
-
|
|
6157
|
+
import_core27.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created");
|
|
6143
6158
|
if (typeof props.canvas === "string") {
|
|
6144
|
-
yield
|
|
6159
|
+
yield import_core27.CanvasContext.pageLoaded;
|
|
6145
6160
|
}
|
|
6146
|
-
if (
|
|
6161
|
+
if (import_core27.log.get("debug") || props.debug) {
|
|
6147
6162
|
yield loadWebGLDeveloperTools();
|
|
6148
6163
|
}
|
|
6149
6164
|
const { spector: spector2 } = props;
|
|
6150
|
-
if (
|
|
6165
|
+
if (import_core27.log.get("spector") || spector2) {
|
|
6151
6166
|
yield loadSpectorJS();
|
|
6152
6167
|
}
|
|
6153
|
-
|
|
6168
|
+
import_core27.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
|
|
6154
6169
|
if (props.gl && props.gl.device) {
|
|
6155
6170
|
return _WebGLDevice.attach(props.gl);
|
|
6156
6171
|
}
|
|
@@ -6320,7 +6335,7 @@ function isWebGL22(gl2) {
|
|
|
6320
6335
|
}
|
|
6321
6336
|
|
|
6322
6337
|
// src/classic/clear.ts
|
|
6323
|
-
var
|
|
6338
|
+
var import_core28 = require("@luma.gl/core");
|
|
6324
6339
|
var GL_DEPTH_BUFFER_BIT2 = 256;
|
|
6325
6340
|
var GL_STENCIL_BUFFER_BIT2 = 1024;
|
|
6326
6341
|
var GL_COLOR_BUFFER_BIT2 = 16384;
|
|
@@ -6351,18 +6366,18 @@ function clear(gl2, options) {
|
|
|
6351
6366
|
parameters.clearStencil = depth;
|
|
6352
6367
|
}
|
|
6353
6368
|
}
|
|
6354
|
-
(0,
|
|
6369
|
+
(0, import_core28.assert)(clearFlags !== 0, ERR_ARGUMENTS);
|
|
6355
6370
|
withParameters(device.gl, parameters, () => {
|
|
6356
6371
|
device.gl.clear(clearFlags);
|
|
6357
6372
|
});
|
|
6358
6373
|
}
|
|
6359
6374
|
|
|
6360
6375
|
// src/classic/copy-and-blit.ts
|
|
6361
|
-
var
|
|
6376
|
+
var import_core30 = require("@luma.gl/core");
|
|
6362
6377
|
var import_constants28 = require("@luma.gl/constants");
|
|
6363
6378
|
|
|
6364
6379
|
// src/classic/format-utils.ts
|
|
6365
|
-
var
|
|
6380
|
+
var import_core29 = require("@luma.gl/core");
|
|
6366
6381
|
var import_constants27 = require("@luma.gl/constants");
|
|
6367
6382
|
function glFormatToComponents(format) {
|
|
6368
6383
|
switch (format) {
|
|
@@ -6380,7 +6395,7 @@ function glFormatToComponents(format) {
|
|
|
6380
6395
|
case import_constants27.GL.RGBA32F:
|
|
6381
6396
|
return 4;
|
|
6382
6397
|
default:
|
|
6383
|
-
(0,
|
|
6398
|
+
(0, import_core29.assert)(false);
|
|
6384
6399
|
return 0;
|
|
6385
6400
|
}
|
|
6386
6401
|
}
|
|
@@ -6395,7 +6410,7 @@ function glTypeToBytes(type) {
|
|
|
6395
6410
|
case import_constants27.GL.FLOAT:
|
|
6396
6411
|
return 4;
|
|
6397
6412
|
default:
|
|
6398
|
-
(0,
|
|
6413
|
+
(0, import_core29.assert)(false);
|
|
6399
6414
|
return 0;
|
|
6400
6415
|
}
|
|
6401
6416
|
}
|
|
@@ -6413,7 +6428,7 @@ function readPixelsToArray(source, options) {
|
|
|
6413
6428
|
sourceType
|
|
6414
6429
|
} = options || {};
|
|
6415
6430
|
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
6416
|
-
(0,
|
|
6431
|
+
(0, import_core30.assert)(framebuffer);
|
|
6417
6432
|
const { gl: gl2, handle } = framebuffer;
|
|
6418
6433
|
sourceWidth = sourceWidth || framebuffer.width;
|
|
6419
6434
|
sourceHeight = sourceHeight || framebuffer.height;
|
|
@@ -6436,7 +6451,7 @@ function readPixelsToBuffer(source, options) {
|
|
|
6436
6451
|
const { sourceX = 0, sourceY = 0, sourceFormat = import_constants28.GL.RGBA, targetByteOffset = 0 } = options || {};
|
|
6437
6452
|
let { target, sourceWidth, sourceHeight, sourceType } = options || {};
|
|
6438
6453
|
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
6439
|
-
(0,
|
|
6454
|
+
(0, import_core30.assert)(framebuffer);
|
|
6440
6455
|
sourceWidth = sourceWidth || framebuffer.width;
|
|
6441
6456
|
sourceHeight = sourceHeight || framebuffer.height;
|
|
6442
6457
|
const webglFramebuffer = framebuffer;
|
|
@@ -6484,7 +6499,7 @@ function copyToTexture(source, target, options) {
|
|
|
6484
6499
|
// defaults to target height
|
|
6485
6500
|
} = options || {};
|
|
6486
6501
|
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
6487
|
-
(0,
|
|
6502
|
+
(0, import_core30.assert)(framebuffer);
|
|
6488
6503
|
const webglFramebuffer = framebuffer;
|
|
6489
6504
|
const { device, handle } = webglFramebuffer;
|
|
6490
6505
|
const isSubCopy = typeof targetX !== "undefined" || typeof targetY !== "undefined" || typeof targetZ !== "undefined";
|
|
@@ -6492,10 +6507,10 @@ function copyToTexture(source, target, options) {
|
|
|
6492
6507
|
targetY = targetY || 0;
|
|
6493
6508
|
targetZ = targetZ || 0;
|
|
6494
6509
|
const prevHandle2 = device.gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, handle);
|
|
6495
|
-
(0,
|
|
6510
|
+
(0, import_core30.assert)(target);
|
|
6496
6511
|
let texture = null;
|
|
6497
6512
|
let textureTarget;
|
|
6498
|
-
if (target instanceof
|
|
6513
|
+
if (target instanceof import_core30.Texture) {
|
|
6499
6514
|
texture = target;
|
|
6500
6515
|
width = Number.isFinite(width) ? width : texture.width;
|
|
6501
6516
|
height = Number.isFinite(height) ? height : texture.height;
|
|
@@ -6559,7 +6574,7 @@ function copyToTexture(source, target, options) {
|
|
|
6559
6574
|
return texture;
|
|
6560
6575
|
}
|
|
6561
6576
|
function getFramebuffer2(source) {
|
|
6562
|
-
if (!(source instanceof
|
|
6577
|
+
if (!(source instanceof import_core30.Framebuffer)) {
|
|
6563
6578
|
return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
|
|
6564
6579
|
}
|
|
6565
6580
|
return { framebuffer: source, deleteFramebuffer: false };
|