@luma.gl/webgl 9.0.0-alpha.24 → 9.0.0-alpha.25
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 +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.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 +1 -1
- package/dist/adapter/converters/vertex-formats.js.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 +1 -1
- package/dist/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js +1 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/adapter/helpers/attribute-utils.js.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.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.js.map +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts.map +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 +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js.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.js +1 -1
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- 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 +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +1 -1
- 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.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js.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.js.map +1 -1
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.js +2 -2
- 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.d.ts → buffer-with-accessor.d.ts} +8 -8
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -0
- package/dist/classic/{buffer.js → buffer-with-accessor.js} +3 -3
- package/dist/classic/buffer-with-accessor.js.map +1 -0
- 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 +2 -2
- 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.js.map +1 -1
- package/dist/context/context/create-browser-context.js.map +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/webgl-parameter-tables.js.map +1 -1
- package/dist/context/polyfill/get-parameter-polyfill.js +3 -3
- package/dist/context/polyfill/get-parameter-polyfill.js.map +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/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/dist.dev.js +32 -79
- package/dist/index.cjs +532 -543
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist.min.js +15 -15
- package/package.json +5 -5
- package/src/adapter/converters/device-parameters.ts +1 -1
- package/src/adapter/converters/texture-formats.ts +1 -1
- package/src/adapter/converters/vertex-formats.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/get-shader-layout.ts +1 -1
- package/src/adapter/helpers/set-uniform.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 +1 -1
- package/src/adapter/objects/webgl-vertex-array-object.ts +1 -1
- package/src/adapter/resources/webgl-buffer.ts +1 -1
- package/src/adapter/resources/webgl-command-buffer.ts +1 -1
- package/src/adapter/resources/webgl-framebuffer.ts +1 -1
- package/src/adapter/resources/webgl-render-pipeline.ts +1 -1
- package/src/adapter/resources/webgl-shader.ts +1 -1
- package/src/adapter/webgl-device.ts +2 -2
- package/src/classic/accessor.ts +1 -1
- package/src/classic/{buffer.ts → buffer-with-accessor.ts} +9 -9
- package/src/classic/copy-and-blit.ts +2 -2
- package/src/classic/format-utils.ts +1 -1
- package/src/context/debug/webgl-developer-tools.ts +1 -1
- package/src/context/polyfill/get-parameter-polyfill.ts +1 -1
- package/src/context/polyfill/polyfill-table.ts +1 -1
- package/src/index.ts +2 -2
- package/dist/classic/buffer.d.ts.map +0 -1
- package/dist/classic/buffer.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
6
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
8
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
9
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -33,14 +31,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
31
|
}
|
|
34
32
|
return to;
|
|
35
33
|
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
38
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
39
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
40
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
41
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
42
|
-
mod
|
|
43
|
-
));
|
|
44
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
35
|
var __async = (__this, __arguments, generator) => {
|
|
46
36
|
return new Promise((resolve, reject) => {
|
|
@@ -67,8 +57,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
67
57
|
var src_exports = {};
|
|
68
58
|
__export(src_exports, {
|
|
69
59
|
Accessor: () => Accessor,
|
|
70
|
-
|
|
71
|
-
ClassicBuffer: () => ClassicBuffer,
|
|
60
|
+
BufferWithAccessor: () => BufferWithAccessor,
|
|
72
61
|
WEBGLBuffer: () => WEBGLBuffer,
|
|
73
62
|
WEBGLCommandEncoder: () => WEBGLCommandEncoder,
|
|
74
63
|
WEBGLFramebuffer: () => WEBGLFramebuffer,
|
|
@@ -432,7 +421,7 @@ function polyfillVertexArrayObject(gl) {
|
|
|
432
421
|
|
|
433
422
|
// src/context/polyfill/polyfill-table.ts
|
|
434
423
|
var import_api2 = require("@luma.gl/api");
|
|
435
|
-
var import_constants2 =
|
|
424
|
+
var import_constants2 = require("@luma.gl/constants");
|
|
436
425
|
|
|
437
426
|
// src/context/context/webgl-checks.ts
|
|
438
427
|
var import_api = require("@luma.gl/api");
|
|
@@ -466,7 +455,7 @@ function assertWebGL2Context(gl) {
|
|
|
466
455
|
}
|
|
467
456
|
|
|
468
457
|
// src/context/polyfill/get-parameter-polyfill.ts
|
|
469
|
-
var import_constants =
|
|
458
|
+
var import_constants = require("@luma.gl/constants");
|
|
470
459
|
var OES_element_index = "OES_element_index";
|
|
471
460
|
var WEBGL_draw_buffers = "WEBGL_draw_buffers";
|
|
472
461
|
var EXT_disjoint_timer_query = "EXT_disjoint_timer_query";
|
|
@@ -481,11 +470,11 @@ var GL_UNMASKED_VENDOR_WEBGL = 37445;
|
|
|
481
470
|
var GL_UNMASKED_RENDERER_WEBGL = 37446;
|
|
482
471
|
var getWebGL2ValueOrZero = (gl) => !isWebGL2(gl) ? 0 : void 0;
|
|
483
472
|
var WEBGL_PARAMETERS = {
|
|
484
|
-
[import_constants.
|
|
473
|
+
[import_constants.GL.READ_BUFFER]: (gl) => !isWebGL2(gl) ? import_constants.GL.COLOR_ATTACHMENT0 : void 0,
|
|
485
474
|
// WebGL2 context parameters
|
|
486
475
|
[GL_FRAGMENT_SHADER_DERIVATIVE_HINT]: (gl) => !isWebGL2(gl) ? GL_DONT_CARE : void 0,
|
|
487
|
-
[import_constants.
|
|
488
|
-
[import_constants.
|
|
476
|
+
[import_constants.GL.RASTERIZER_DISCARD]: getWebGL2ValueOrZero,
|
|
477
|
+
[import_constants.GL.SAMPLES]: getWebGL2ValueOrZero,
|
|
489
478
|
// WebGL2 extension context parameters
|
|
490
479
|
[GL_GPU_DISJOINT_EXT]: (gl, getParameter) => {
|
|
491
480
|
const ext = isWebGL2(gl) ? gl.getExtension(EXT_disjoint_timer_query_webgl2) : gl.getExtension(EXT_disjoint_timer_query);
|
|
@@ -494,11 +483,11 @@ var WEBGL_PARAMETERS = {
|
|
|
494
483
|
// Extension fixed values
|
|
495
484
|
[GL_UNMASKED_VENDOR_WEBGL]: (gl, getParameter) => {
|
|
496
485
|
const ext = gl.getExtension(WEBGL_debug_renderer_info);
|
|
497
|
-
return getParameter(ext && ext.UNMASKED_VENDOR_WEBGL || import_constants.
|
|
486
|
+
return getParameter(ext && ext.UNMASKED_VENDOR_WEBGL || import_constants.GL.VENDOR);
|
|
498
487
|
},
|
|
499
488
|
[GL_UNMASKED_RENDERER_WEBGL]: (gl, getParameter) => {
|
|
500
489
|
const ext = gl.getExtension(WEBGL_debug_renderer_info);
|
|
501
|
-
return getParameter(ext && ext.UNMASKED_RENDERER_WEBGL || import_constants.
|
|
490
|
+
return getParameter(ext && ext.UNMASKED_RENDERER_WEBGL || import_constants.GL.RENDERER);
|
|
502
491
|
},
|
|
503
492
|
// Extension LIMITS
|
|
504
493
|
[GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT]: (gl, getParameter) => {
|
|
@@ -507,56 +496,56 @@ var WEBGL_PARAMETERS = {
|
|
|
507
496
|
return ext ? getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 1;
|
|
508
497
|
},
|
|
509
498
|
// WebGL2 Limits
|
|
510
|
-
[import_constants.
|
|
511
|
-
[import_constants.
|
|
512
|
-
[import_constants.
|
|
513
|
-
[import_constants.
|
|
499
|
+
[import_constants.GL.MAX_3D_TEXTURE_SIZE]: getWebGL2ValueOrZero,
|
|
500
|
+
[import_constants.GL.MAX_ARRAY_TEXTURE_LAYERS]: getWebGL2ValueOrZero,
|
|
501
|
+
[import_constants.GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: getWebGL2ValueOrZero,
|
|
502
|
+
[import_constants.GL.MAX_COLOR_ATTACHMENTS]: (gl, getParameter) => {
|
|
514
503
|
if (!isWebGL2(gl)) {
|
|
515
504
|
const ext = gl.getExtension(WEBGL_draw_buffers);
|
|
516
505
|
return ext ? getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL) : 0;
|
|
517
506
|
}
|
|
518
507
|
return void 0;
|
|
519
508
|
},
|
|
520
|
-
[import_constants.
|
|
521
|
-
[import_constants.
|
|
522
|
-
[import_constants.
|
|
523
|
-
[import_constants.
|
|
509
|
+
[import_constants.GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: getWebGL2ValueOrZero,
|
|
510
|
+
[import_constants.GL.MAX_COMBINED_UNIFORM_BLOCKS]: getWebGL2ValueOrZero,
|
|
511
|
+
[import_constants.GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: getWebGL2ValueOrZero,
|
|
512
|
+
[import_constants.GL.MAX_DRAW_BUFFERS]: (gl) => {
|
|
524
513
|
if (!isWebGL2(gl)) {
|
|
525
514
|
const ext = gl.getExtension(WEBGL_draw_buffers);
|
|
526
515
|
return ext ? ext.MAX_DRAW_BUFFERS_WEBGL : 0;
|
|
527
516
|
}
|
|
528
517
|
return void 0;
|
|
529
518
|
},
|
|
530
|
-
[import_constants.
|
|
519
|
+
[import_constants.GL.MAX_ELEMENT_INDEX]: (
|
|
531
520
|
// Guess: per webglstats.com 99.6% of webgl2 supports 2147483647
|
|
532
521
|
(gl) => gl.getExtension(OES_element_index) ? 2147483647 : 65535
|
|
533
522
|
),
|
|
534
|
-
[import_constants.
|
|
523
|
+
[import_constants.GL.MAX_ELEMENTS_INDICES]: (
|
|
535
524
|
// Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices)
|
|
536
525
|
(gl) => gl.getExtension(OES_element_index) ? 16777216 : 65535
|
|
537
526
|
),
|
|
538
|
-
[import_constants.
|
|
527
|
+
[import_constants.GL.MAX_ELEMENTS_VERTICES]: (
|
|
539
528
|
// Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices)
|
|
540
529
|
(gl) => 16777216
|
|
541
530
|
),
|
|
542
|
-
[import_constants.
|
|
543
|
-
[import_constants.
|
|
544
|
-
[import_constants.
|
|
545
|
-
[import_constants.
|
|
546
|
-
[import_constants.
|
|
547
|
-
[import_constants.
|
|
548
|
-
[import_constants.
|
|
549
|
-
[import_constants.
|
|
550
|
-
[import_constants.
|
|
551
|
-
[import_constants.
|
|
552
|
-
[import_constants.
|
|
553
|
-
[import_constants.
|
|
554
|
-
[import_constants.
|
|
555
|
-
[import_constants.
|
|
556
|
-
[import_constants.
|
|
557
|
-
[import_constants.
|
|
558
|
-
[import_constants.
|
|
559
|
-
[import_constants.
|
|
531
|
+
[import_constants.GL.MAX_FRAGMENT_INPUT_COMPONENTS]: getWebGL2ValueOrZero,
|
|
532
|
+
[import_constants.GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: getWebGL2ValueOrZero,
|
|
533
|
+
[import_constants.GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: getWebGL2ValueOrZero,
|
|
534
|
+
[import_constants.GL.MAX_SAMPLES]: getWebGL2ValueOrZero,
|
|
535
|
+
[import_constants.GL.MAX_SERVER_WAIT_TIMEOUT]: getWebGL2ValueOrZero,
|
|
536
|
+
[import_constants.GL.MAX_TEXTURE_LOD_BIAS]: getWebGL2ValueOrZero,
|
|
537
|
+
[import_constants.GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: getWebGL2ValueOrZero,
|
|
538
|
+
[import_constants.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: getWebGL2ValueOrZero,
|
|
539
|
+
[import_constants.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: getWebGL2ValueOrZero,
|
|
540
|
+
[import_constants.GL.MAX_UNIFORM_BLOCK_SIZE]: getWebGL2ValueOrZero,
|
|
541
|
+
[import_constants.GL.MAX_UNIFORM_BUFFER_BINDINGS]: getWebGL2ValueOrZero,
|
|
542
|
+
[import_constants.GL.MAX_VARYING_COMPONENTS]: getWebGL2ValueOrZero,
|
|
543
|
+
[import_constants.GL.MAX_VERTEX_OUTPUT_COMPONENTS]: getWebGL2ValueOrZero,
|
|
544
|
+
[import_constants.GL.MAX_VERTEX_UNIFORM_BLOCKS]: getWebGL2ValueOrZero,
|
|
545
|
+
[import_constants.GL.MAX_VERTEX_UNIFORM_COMPONENTS]: getWebGL2ValueOrZero,
|
|
546
|
+
[import_constants.GL.MIN_PROGRAM_TEXEL_OFFSET]: getWebGL2ValueOrZero,
|
|
547
|
+
[import_constants.GL.MAX_PROGRAM_TEXEL_OFFSET]: getWebGL2ValueOrZero,
|
|
548
|
+
[import_constants.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: getWebGL2ValueOrZero
|
|
560
549
|
};
|
|
561
550
|
function getParameterPolyfill(gl, originalGetParameter, pname) {
|
|
562
551
|
const limit = WEBGL_PARAMETERS[pname];
|
|
@@ -666,10 +655,10 @@ var WEBGL2_CONTEXT_OVERRIDES = {
|
|
|
666
655
|
const { webgl2, ext } = getExtensionData(gl, ANGLE_instanced_arrays);
|
|
667
656
|
let result;
|
|
668
657
|
switch (pname) {
|
|
669
|
-
case import_constants2.
|
|
658
|
+
case import_constants2.GL.VERTEX_ATTRIB_ARRAY_INTEGER:
|
|
670
659
|
result = !webgl2 ? false : void 0;
|
|
671
660
|
break;
|
|
672
|
-
case import_constants2.
|
|
661
|
+
case import_constants2.GL.VERTEX_ATTRIB_ARRAY_DIVISOR:
|
|
673
662
|
result = !webgl2 && !ext ? 0 : void 0;
|
|
674
663
|
break;
|
|
675
664
|
default:
|
|
@@ -680,11 +669,11 @@ var WEBGL2_CONTEXT_OVERRIDES = {
|
|
|
680
669
|
getProgramParameter: (gl, originalFunc, program, pname) => {
|
|
681
670
|
if (!isWebGL2(gl)) {
|
|
682
671
|
switch (pname) {
|
|
683
|
-
case import_constants2.
|
|
684
|
-
return import_constants2.
|
|
685
|
-
case import_constants2.
|
|
672
|
+
case import_constants2.GL.TRANSFORM_FEEDBACK_BUFFER_MODE:
|
|
673
|
+
return import_constants2.GL.SEPARATE_ATTRIBS;
|
|
674
|
+
case import_constants2.GL.TRANSFORM_FEEDBACK_VARYINGS:
|
|
686
675
|
return 0;
|
|
687
|
-
case import_constants2.
|
|
676
|
+
case import_constants2.GL.ACTIVE_UNIFORM_BLOCKS:
|
|
688
677
|
return 0;
|
|
689
678
|
default:
|
|
690
679
|
}
|
|
@@ -694,7 +683,7 @@ var WEBGL2_CONTEXT_OVERRIDES = {
|
|
|
694
683
|
getInternalformatParameter: (gl, originalFunc, target, format, pname) => {
|
|
695
684
|
if (!isWebGL2(gl)) {
|
|
696
685
|
switch (pname) {
|
|
697
|
-
case import_constants2.
|
|
686
|
+
case import_constants2.GL.SAMPLES:
|
|
698
687
|
return new Int32Array([0]);
|
|
699
688
|
default:
|
|
700
689
|
}
|
|
@@ -704,11 +693,11 @@ var WEBGL2_CONTEXT_OVERRIDES = {
|
|
|
704
693
|
},
|
|
705
694
|
getTexParameter(gl, originalFunc, target, pname) {
|
|
706
695
|
switch (pname) {
|
|
707
|
-
case import_constants2.
|
|
696
|
+
case import_constants2.GL.TEXTURE_MAX_ANISOTROPY_EXT:
|
|
708
697
|
const contextData = getContextData(gl);
|
|
709
698
|
const { _extensions } = contextData;
|
|
710
699
|
const ext = _extensions[EXT_texture_filter_anisotropic2];
|
|
711
|
-
pname = ext && ext.TEXTURE_MAX_ANISOTROPY_EXT || import_constants2.
|
|
700
|
+
pname = ext && ext.TEXTURE_MAX_ANISOTROPY_EXT || import_constants2.GL.TEXTURE_MAX_ANISOTROPY_EXT;
|
|
712
701
|
break;
|
|
713
702
|
default:
|
|
714
703
|
}
|
|
@@ -1554,13 +1543,13 @@ function createBrowserContext(canvas, props) {
|
|
|
1554
1543
|
}
|
|
1555
1544
|
|
|
1556
1545
|
// src/adapter/device-helpers/get-device-info.ts
|
|
1557
|
-
var import_constants4 =
|
|
1546
|
+
var import_constants4 = require("@luma.gl/constants");
|
|
1558
1547
|
function getDeviceInfo(gl) {
|
|
1559
|
-
const vendorMasked = gl.getParameter(import_constants4.
|
|
1560
|
-
const rendererMasked = gl.getParameter(import_constants4.
|
|
1548
|
+
const vendorMasked = gl.getParameter(import_constants4.GL.VENDOR);
|
|
1549
|
+
const rendererMasked = gl.getParameter(import_constants4.GL.RENDERER);
|
|
1561
1550
|
const ext = gl.getExtension("WEBGL_debug_renderer_info");
|
|
1562
|
-
const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : import_constants4.
|
|
1563
|
-
const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : import_constants4.
|
|
1551
|
+
const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : import_constants4.GL.VENDOR);
|
|
1552
|
+
const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : import_constants4.GL.RENDERER);
|
|
1564
1553
|
const vendor = vendorUnmasked || vendorMasked;
|
|
1565
1554
|
const renderer = rendererUnmasked || rendererMasked;
|
|
1566
1555
|
const gpu = identifyGPUVendor(vendor, renderer);
|
|
@@ -1569,10 +1558,10 @@ function getDeviceInfo(gl) {
|
|
|
1569
1558
|
gpu,
|
|
1570
1559
|
vendor: vendorUnmasked || vendorMasked,
|
|
1571
1560
|
renderer: rendererUnmasked || rendererMasked,
|
|
1572
|
-
version: gl.getParameter(import_constants4.
|
|
1561
|
+
version: gl.getParameter(import_constants4.GL.VERSION),
|
|
1573
1562
|
shadingLanguages: ["glsl"],
|
|
1574
1563
|
shadingLanguageVersions: {
|
|
1575
|
-
"glsl": gl.getParameter(import_constants4.
|
|
1564
|
+
"glsl": gl.getParameter(import_constants4.GL.SHADING_LANGUAGE_VERSION)
|
|
1576
1565
|
}
|
|
1577
1566
|
};
|
|
1578
1567
|
}
|
|
@@ -1606,7 +1595,7 @@ function isOldIE(opts = {}) {
|
|
|
1606
1595
|
|
|
1607
1596
|
// src/adapter/converters/texture-formats.ts
|
|
1608
1597
|
var import_api5 = require("@luma.gl/api");
|
|
1609
|
-
var import_constants5 =
|
|
1598
|
+
var import_constants5 = require("@luma.gl/constants");
|
|
1610
1599
|
var texture_compression_bc = "texture-compression-bc";
|
|
1611
1600
|
var texture_compression_astc = "texture-compression-astc";
|
|
1612
1601
|
var texture_compression_etc2 = "texture-compression-etc2";
|
|
@@ -1665,206 +1654,206 @@ var TEXTURE_FORMATS = {
|
|
|
1665
1654
|
// TODO - Fix bpp constants
|
|
1666
1655
|
// 'r8unorm-unsized': {gl: GL.LUMINANCE, b: 4, c: 2, bpp: 4},
|
|
1667
1656
|
"rgb8unorm-unsized": {
|
|
1668
|
-
gl: import_constants5.
|
|
1669
|
-
gl1: import_constants5.
|
|
1657
|
+
gl: import_constants5.GL.RGB,
|
|
1658
|
+
gl1: import_constants5.GL.RGB,
|
|
1670
1659
|
b: 4,
|
|
1671
1660
|
c: 2,
|
|
1672
1661
|
bpp: 4,
|
|
1673
|
-
dataFormat: import_constants5.
|
|
1674
|
-
types: [import_constants5.
|
|
1662
|
+
dataFormat: import_constants5.GL.RGB,
|
|
1663
|
+
types: [import_constants5.GL.UNSIGNED_BYTE, import_constants5.GL.UNSIGNED_SHORT_5_6_5]
|
|
1675
1664
|
},
|
|
1676
1665
|
"rgba8unorm-unsized": {
|
|
1677
|
-
gl: import_constants5.
|
|
1678
|
-
gl1: import_constants5.
|
|
1666
|
+
gl: import_constants5.GL.RGBA,
|
|
1667
|
+
gl1: import_constants5.GL.RGBA,
|
|
1679
1668
|
b: 4,
|
|
1680
1669
|
c: 2,
|
|
1681
1670
|
bpp: 4,
|
|
1682
|
-
dataFormat: import_constants5.
|
|
1683
|
-
types: [import_constants5.
|
|
1671
|
+
dataFormat: import_constants5.GL.RGBA,
|
|
1672
|
+
types: [import_constants5.GL.UNSIGNED_BYTE, import_constants5.GL.UNSIGNED_SHORT_4_4_4_4, import_constants5.GL.UNSIGNED_SHORT_5_5_5_1]
|
|
1684
1673
|
},
|
|
1685
1674
|
// 'rgb8unorm-srgb-unsized': {gl: GL.SRGB_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
1686
1675
|
// 'rgba8unorm-srgb-unsized': {gl: GL.SRGB_ALPHA_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
1687
1676
|
// 8-bit formats
|
|
1688
|
-
"r8unorm": { gl: import_constants5.
|
|
1689
|
-
"r8snorm": { gl: import_constants5.
|
|
1690
|
-
"r8uint": { gl: import_constants5.
|
|
1691
|
-
"r8sint": { gl: import_constants5.
|
|
1677
|
+
"r8unorm": { gl: import_constants5.GL.R8, b: 1, c: 1, renderbuffer: true },
|
|
1678
|
+
"r8snorm": { gl: import_constants5.GL.R8_SNORM, b: 1, c: 1 },
|
|
1679
|
+
"r8uint": { gl: import_constants5.GL.R8UI, b: 1, c: 1, renderbuffer: true },
|
|
1680
|
+
"r8sint": { gl: import_constants5.GL.R8I, b: 1, c: 1, renderbuffer: true },
|
|
1692
1681
|
// 16-bit formats
|
|
1693
|
-
"rg8unorm": { gl: import_constants5.
|
|
1694
|
-
"rg8snorm": { gl: import_constants5.
|
|
1695
|
-
"rg8uint": { gl: import_constants5.
|
|
1696
|
-
"rg8sint": { gl: import_constants5.
|
|
1697
|
-
"r16uint": { gl: import_constants5.
|
|
1698
|
-
"r16sint": { gl: import_constants5.
|
|
1699
|
-
"r16float": { gl: import_constants5.
|
|
1700
|
-
"r16unorm-webgl": { gl: import_constants5.
|
|
1701
|
-
"r16snorm-webgl": { gl: import_constants5.
|
|
1682
|
+
"rg8unorm": { gl: import_constants5.GL.RG8, b: 2, c: 2, renderbuffer: true },
|
|
1683
|
+
"rg8snorm": { gl: import_constants5.GL.RG8_SNORM, b: 2, c: 2 },
|
|
1684
|
+
"rg8uint": { gl: import_constants5.GL.RG8UI, b: 2, c: 2, renderbuffer: true },
|
|
1685
|
+
"rg8sint": { gl: import_constants5.GL.RG8I, b: 2, c: 2, renderbuffer: true },
|
|
1686
|
+
"r16uint": { gl: import_constants5.GL.R16UI, b: 2, c: 1, renderbuffer: true },
|
|
1687
|
+
"r16sint": { gl: import_constants5.GL.R16I, b: 2, c: 1, renderbuffer: true },
|
|
1688
|
+
"r16float": { gl: import_constants5.GL.R16F, b: 2, c: 1, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl", renderbuffer: true },
|
|
1689
|
+
"r16unorm-webgl": { gl: import_constants5.GL.R16_EXT, b: 2, c: 1, f: "texture-formats-norm16-webgl", renderbuffer: true, x: EXT_TEXTURE_NORM16 },
|
|
1690
|
+
"r16snorm-webgl": { gl: import_constants5.GL.R16_SNORM_EXT, b: 2, c: 1, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
|
|
1702
1691
|
// Packed 16-bit formats
|
|
1703
|
-
"rgba4unorm-webgl": { gl: import_constants5.
|
|
1704
|
-
"rgb565unorm-webgl": { gl: import_constants5.
|
|
1705
|
-
"rgb5a1unorm-webgl": { gl: import_constants5.
|
|
1692
|
+
"rgba4unorm-webgl": { gl: import_constants5.GL.RGBA4, b: 2, c: 4, wgpu: false, renderbuffer: true },
|
|
1693
|
+
"rgb565unorm-webgl": { gl: import_constants5.GL.RGB565, b: 2, c: 4, wgpu: false, renderbuffer: true },
|
|
1694
|
+
"rgb5a1unorm-webgl": { gl: import_constants5.GL.RGB5_A1, b: 2, c: 4, wgpu: false, renderbuffer: true },
|
|
1706
1695
|
// 24-bit formats
|
|
1707
|
-
"rgb8unorm-webgl": { gl: import_constants5.
|
|
1708
|
-
"rgb8snorm-webgl": { gl: import_constants5.
|
|
1696
|
+
"rgb8unorm-webgl": { gl: import_constants5.GL.RGB8, b: 3, c: 3, wgpu: false },
|
|
1697
|
+
"rgb8snorm-webgl": { gl: import_constants5.GL.RGB8_SNORM, b: 3, c: 3, wgpu: false },
|
|
1709
1698
|
// 32-bit formats
|
|
1710
|
-
"rgba8unorm": { gl: import_constants5.
|
|
1711
|
-
"rgba8unorm-srgb": { gl: import_constants5.
|
|
1712
|
-
"rgba8snorm": { gl: import_constants5.
|
|
1713
|
-
"rgba8uint": { gl: import_constants5.
|
|
1714
|
-
"rgba8sint": { gl: import_constants5.
|
|
1699
|
+
"rgba8unorm": { gl: import_constants5.GL.RGBA8, gl1: import_constants5.GL.RGBA, b: 4, c: 2, bpp: 4 },
|
|
1700
|
+
"rgba8unorm-srgb": { gl: import_constants5.GL.SRGB8_ALPHA8, gl1: import_constants5.GL.SRGB_ALPHA_EXT, b: 4, c: 4, gl1ext: EXT_SRGB, bpp: 4 },
|
|
1701
|
+
"rgba8snorm": { gl: import_constants5.GL.RGBA8_SNORM, b: 4, c: 4 },
|
|
1702
|
+
"rgba8uint": { gl: import_constants5.GL.RGBA8UI, b: 4, c: 4, bpp: 4 },
|
|
1703
|
+
"rgba8sint": { gl: import_constants5.GL.RGBA8I, b: 4, c: 4, bpp: 4 },
|
|
1715
1704
|
// reverse colors, webgpu only
|
|
1716
1705
|
"bgra8unorm": { b: 4, c: 4 },
|
|
1717
1706
|
"bgra8unorm-srgb": { b: 4, c: 4 },
|
|
1718
|
-
"rg16uint": { gl: import_constants5.
|
|
1719
|
-
"rg16sint": { gl: import_constants5.
|
|
1707
|
+
"rg16uint": { gl: import_constants5.GL.RG16UI, b: 4, c: 1, bpp: 4 },
|
|
1708
|
+
"rg16sint": { gl: import_constants5.GL.RG16I, b: 4, c: 2, bpp: 4 },
|
|
1720
1709
|
// When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
|
|
1721
|
-
"rg16float": { gl: import_constants5.
|
|
1722
|
-
"rg16unorm-webgl": { gl: import_constants5.
|
|
1723
|
-
"rg16snorm-webgl": { gl: import_constants5.
|
|
1724
|
-
"r32uint": { gl: import_constants5.
|
|
1725
|
-
"r32sint": { gl: import_constants5.
|
|
1726
|
-
"r32float": { gl: import_constants5.
|
|
1710
|
+
"rg16float": { gl: import_constants5.GL.RG16F, bpp: 4, b: 4, c: 2, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl", renderbuffer: true },
|
|
1711
|
+
"rg16unorm-webgl": { gl: import_constants5.GL.RG16_EXT, b: 2, c: 2, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
|
|
1712
|
+
"rg16snorm-webgl": { gl: import_constants5.GL.RG16_SNORM_EXT, b: 2, c: 2, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
|
|
1713
|
+
"r32uint": { gl: import_constants5.GL.R32UI, b: 4, c: 1, bpp: 4, renderbuffer: true },
|
|
1714
|
+
"r32sint": { gl: import_constants5.GL.R32I, b: 4, c: 1, bpp: 4, renderbuffer: true },
|
|
1715
|
+
"r32float": { gl: import_constants5.GL.R32F, bpp: 4, b: 4, c: 1, render: "texture-renderable-float32-webgl", filter: "texture-filter-linear-float32-webgl" },
|
|
1727
1716
|
// Packed 32-bit formats
|
|
1728
|
-
"rgb9e5ufloat": { gl: import_constants5.
|
|
1729
|
-
"rg11b10ufloat": { gl: import_constants5.
|
|
1730
|
-
"rgb10a2unorm": { gl: import_constants5.
|
|
1717
|
+
"rgb9e5ufloat": { gl: import_constants5.GL.RGB9_E5, b: 4, c: 3, p: 1, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl" },
|
|
1718
|
+
"rg11b10ufloat": { gl: import_constants5.GL.R11F_G11F_B10F, b: 4, c: 3, p: 1, render: "texture-renderable-float32-webgl", renderbuffer: true },
|
|
1719
|
+
"rgb10a2unorm": { gl: import_constants5.GL.RGB10_A2, b: 4, c: 4, p: 1, renderbuffer: true },
|
|
1731
1720
|
// webgl2 only
|
|
1732
|
-
"rgb10a2unorm-webgl": { b: 4, c: 4, gl: import_constants5.
|
|
1721
|
+
"rgb10a2unorm-webgl": { b: 4, c: 4, gl: import_constants5.GL.RGB10_A2UI, p: 1, wgpu: false, bpp: 4, renderbuffer: true },
|
|
1733
1722
|
// 48-bit formats
|
|
1734
|
-
"rgb16unorm-webgl": { gl: import_constants5.
|
|
1735
|
-
"rgb16snorm-webgl": { gl: import_constants5.
|
|
1723
|
+
"rgb16unorm-webgl": { gl: import_constants5.GL.RGB16_EXT, b: 2, c: 3, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
|
|
1724
|
+
"rgb16snorm-webgl": { gl: import_constants5.GL.RGB16_SNORM_EXT, b: 2, c: 3, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
|
|
1736
1725
|
// 64-bit formats
|
|
1737
|
-
"rg32uint": { gl: import_constants5.
|
|
1738
|
-
"rg32sint": { gl: import_constants5.
|
|
1739
|
-
"rg32float": { gl: import_constants5.
|
|
1740
|
-
"rgba16uint": { gl: import_constants5.
|
|
1741
|
-
"rgba16sint": { gl: import_constants5.
|
|
1742
|
-
"rgba16float": { gl: import_constants5.
|
|
1743
|
-
"rgba16unorm-webgl": { gl: import_constants5.
|
|
1744
|
-
"rgba16snorm-webgl": { gl: import_constants5.
|
|
1726
|
+
"rg32uint": { gl: import_constants5.GL.RG32UI, b: 8, c: 2, renderbuffer: true },
|
|
1727
|
+
"rg32sint": { gl: import_constants5.GL.RG32I, b: 8, c: 2, renderbuffer: true },
|
|
1728
|
+
"rg32float": { gl: import_constants5.GL.RG32F, b: 8, c: 2, render: "texture-renderable-float32-webgl", filter: "texture-filter-linear-float32-webgl", renderbuffer: true },
|
|
1729
|
+
"rgba16uint": { gl: import_constants5.GL.RGBA16UI, b: 8, c: 4, renderbuffer: true },
|
|
1730
|
+
"rgba16sint": { gl: import_constants5.GL.RGBA16I, b: 8, c: 4, renderbuffer: true },
|
|
1731
|
+
"rgba16float": { gl: import_constants5.GL.RGBA16F, gl1: import_constants5.GL.RGBA, b: 8, c: 4, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl" },
|
|
1732
|
+
"rgba16unorm-webgl": { gl: import_constants5.GL.RGBA16_EXT, b: 2, c: 4, f: "texture-formats-norm16-webgl", renderbuffer: true, x: EXT_TEXTURE_NORM16 },
|
|
1733
|
+
"rgba16snorm-webgl": { gl: import_constants5.GL.RGBA16_SNORM_EXT, b: 2, c: 4, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
|
|
1745
1734
|
// 96-bit formats (deprecated!)
|
|
1746
1735
|
"rgb32float-webgl": {
|
|
1747
|
-
gl: import_constants5.
|
|
1748
|
-
gl1: import_constants5.
|
|
1736
|
+
gl: import_constants5.GL.RGB32F,
|
|
1737
|
+
gl1: import_constants5.GL.RGB,
|
|
1749
1738
|
render: "texture-renderable-float32-webgl",
|
|
1750
1739
|
filter: "texture-filter-linear-float32-webgl",
|
|
1751
1740
|
gl2ext: EXT_FLOAT_RENDER_WEBGL2,
|
|
1752
1741
|
gl1ext: EXT_FLOAT_WEBGL1,
|
|
1753
1742
|
// WebGL1 render buffers are supported with GL.RGB32F
|
|
1754
|
-
dataFormat: import_constants5.
|
|
1755
|
-
types: [import_constants5.
|
|
1743
|
+
dataFormat: import_constants5.GL.RGB,
|
|
1744
|
+
types: [import_constants5.GL.FLOAT]
|
|
1756
1745
|
},
|
|
1757
1746
|
// 128-bit formats
|
|
1758
|
-
"rgba32uint": { gl: import_constants5.
|
|
1759
|
-
"rgba32sint": { gl: import_constants5.
|
|
1760
|
-
"rgba32float": { gl: import_constants5.
|
|
1747
|
+
"rgba32uint": { gl: import_constants5.GL.RGBA32UI, b: 16, c: 4, renderbuffer: true },
|
|
1748
|
+
"rgba32sint": { gl: import_constants5.GL.RGBA32I, b: 16, c: 4, renderbuffer: true },
|
|
1749
|
+
"rgba32float": { gl: import_constants5.GL.RGBA32F, b: 16, c: 4, render: "texture-renderable-float32-webgl", filter: "texture-filter-linear-float32-webgl", renderbuffer: true },
|
|
1761
1750
|
// Depth and stencil formats
|
|
1762
|
-
"stencil8": { gl: import_constants5.
|
|
1751
|
+
"stencil8": { gl: import_constants5.GL.STENCIL_INDEX8, gl1: import_constants5.GL.STENCIL_INDEX8, b: 1, c: 1, attachment: import_constants5.GL.STENCIL_ATTACHMENT, renderbuffer: true },
|
|
1763
1752
|
// 8 stencil bits
|
|
1764
|
-
"depth16unorm": { gl: import_constants5.
|
|
1753
|
+
"depth16unorm": { gl: import_constants5.GL.DEPTH_COMPONENT16, gl1: import_constants5.GL.DEPTH_COMPONENT16, b: 2, c: 1, attachment: import_constants5.GL.DEPTH_ATTACHMENT, renderbuffer: true },
|
|
1765
1754
|
// 16 depth bits
|
|
1766
|
-
"depth24plus": { gl: import_constants5.
|
|
1767
|
-
"depth32float": { gl: import_constants5.
|
|
1755
|
+
"depth24plus": { gl: import_constants5.GL.DEPTH_COMPONENT24, b: 3, c: 1, attachment: import_constants5.GL.DEPTH_ATTACHMENT },
|
|
1756
|
+
"depth32float": { gl: import_constants5.GL.DEPTH_COMPONENT32F, b: 4, c: 1, attachment: import_constants5.GL.DEPTH_ATTACHMENT, renderbuffer: true },
|
|
1768
1757
|
// The depth component of the "depth24plus" and "depth24plus-stencil8" formats may be implemented as either a 24-bit depth value or a "depth32float" value.
|
|
1769
|
-
"depth24plus-stencil8": { gl: import_constants5.
|
|
1758
|
+
"depth24plus-stencil8": { gl: import_constants5.GL.DEPTH_STENCIL, gl1: import_constants5.GL.DEPTH_STENCIL, b: 4, c: 2, p: 1, attachment: import_constants5.GL.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true, depthTexture: true },
|
|
1770
1759
|
// "depth24unorm-stencil8" feature
|
|
1771
|
-
"depth24unorm-stencil8": { gl: import_constants5.
|
|
1760
|
+
"depth24unorm-stencil8": { gl: import_constants5.GL.DEPTH24_STENCIL8, b: 4, c: 2, p: 1, attachment: import_constants5.GL.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true },
|
|
1772
1761
|
// "depth32float-stencil8" feature
|
|
1773
|
-
"depth32float-stencil8": { gl: import_constants5.
|
|
1762
|
+
"depth32float-stencil8": { gl: import_constants5.GL.DEPTH32F_STENCIL8, b: 5, c: 2, p: 1, attachment: import_constants5.GL.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true },
|
|
1774
1763
|
// BC compressed formats: check device.features.has("texture-compression-bc");
|
|
1775
|
-
"bc1-rgb-unorm-webgl": { gl: import_constants5.
|
|
1776
|
-
"bc1-rgb-unorm-srgb-webgl": { gl: import_constants5.
|
|
1777
|
-
"bc1-rgba-unorm": { gl: import_constants5.
|
|
1778
|
-
"bc1-rgba-unorm-srgb": { gl: import_constants5.
|
|
1779
|
-
"bc2-rgba-unorm": { gl: import_constants5.
|
|
1780
|
-
"bc2-rgba-unorm-srgb": { gl: import_constants5.
|
|
1781
|
-
"bc3-rgba-unorm": { gl: import_constants5.
|
|
1782
|
-
"bc3-rgba-unorm-srgb": { gl: import_constants5.
|
|
1783
|
-
"bc4-r-unorm": { gl: import_constants5.
|
|
1784
|
-
"bc4-r-snorm": { gl: import_constants5.
|
|
1785
|
-
"bc5-rg-unorm": { gl: import_constants5.
|
|
1786
|
-
"bc5-rg-snorm": { gl: import_constants5.
|
|
1787
|
-
"bc6h-rgb-ufloat": { gl: import_constants5.
|
|
1788
|
-
"bc6h-rgb-float": { gl: import_constants5.
|
|
1789
|
-
"bc7-rgba-unorm": { gl: import_constants5.
|
|
1790
|
-
"bc7-rgba-unorm-srgb": { gl: import_constants5.
|
|
1764
|
+
"bc1-rgb-unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGB_S3TC_DXT1_EXT, x: X_S3TC, f: texture_compression_bc },
|
|
1765
|
+
"bc1-rgb-unorm-srgb-webgl": { gl: import_constants5.GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
1766
|
+
"bc1-rgba-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_S3TC_DXT1_EXT, x: X_S3TC, f: texture_compression_bc },
|
|
1767
|
+
"bc1-rgba-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
1768
|
+
"bc2-rgba-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_S3TC_DXT3_EXT, x: X_S3TC, f: texture_compression_bc },
|
|
1769
|
+
"bc2-rgba-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
1770
|
+
"bc3-rgba-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_S3TC_DXT5_EXT, x: X_S3TC, f: texture_compression_bc },
|
|
1771
|
+
"bc3-rgba-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
1772
|
+
"bc4-r-unorm": { gl: import_constants5.GL.COMPRESSED_RED_RGTC1_EXT, x: X_RGTC, f: texture_compression_bc },
|
|
1773
|
+
"bc4-r-snorm": { gl: import_constants5.GL.COMPRESSED_SIGNED_RED_RGTC1_EXT, x: X_RGTC, f: texture_compression_bc },
|
|
1774
|
+
"bc5-rg-unorm": { gl: import_constants5.GL.COMPRESSED_RED_GREEN_RGTC2_EXT, x: X_RGTC, f: texture_compression_bc },
|
|
1775
|
+
"bc5-rg-snorm": { gl: import_constants5.GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, x: X_RGTC, f: texture_compression_bc },
|
|
1776
|
+
"bc6h-rgb-ufloat": { gl: import_constants5.GL.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, x: X_BPTC, f: texture_compression_bc },
|
|
1777
|
+
"bc6h-rgb-float": { gl: import_constants5.GL.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, x: X_BPTC, f: texture_compression_bc },
|
|
1778
|
+
"bc7-rgba-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_BPTC_UNORM_EXT, x: X_BPTC, f: texture_compression_bc },
|
|
1779
|
+
"bc7-rgba-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, x: X_BPTC, f: texture_compression_bc },
|
|
1791
1780
|
// WEBGL_compressed_texture_etc: device.features.has("texture-compression-etc2")
|
|
1792
1781
|
// Note: Supposedly guaranteed availability compressed formats in WebGL2, but through CPU decompression
|
|
1793
|
-
"etc2-rgb8unorm": { gl: import_constants5.
|
|
1794
|
-
"etc2-rgb8unorm-srgb": { gl: import_constants5.
|
|
1795
|
-
"etc2-rgb8a1unorm": { gl: import_constants5.
|
|
1796
|
-
"etc2-rgb8a1unorm-srgb": { gl: import_constants5.
|
|
1797
|
-
"etc2-rgba8unorm": { gl: import_constants5.
|
|
1798
|
-
"etc2-rgba8unorm-srgb": { gl: import_constants5.
|
|
1799
|
-
"eac-r11unorm": { gl: import_constants5.
|
|
1800
|
-
"eac-r11snorm": { gl: import_constants5.
|
|
1801
|
-
"eac-rg11unorm": { gl: import_constants5.
|
|
1802
|
-
"eac-rg11snorm": { gl: import_constants5.
|
|
1782
|
+
"etc2-rgb8unorm": { gl: import_constants5.GL.COMPRESSED_RGB8_ETC2, f: texture_compression_etc2 },
|
|
1783
|
+
"etc2-rgb8unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ETC2, f: texture_compression_etc2 },
|
|
1784
|
+
"etc2-rgb8a1unorm": { gl: import_constants5.GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, f: texture_compression_etc2 },
|
|
1785
|
+
"etc2-rgb8a1unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, f: texture_compression_etc2 },
|
|
1786
|
+
"etc2-rgba8unorm": { gl: import_constants5.GL.COMPRESSED_RGBA8_ETC2_EAC, f: texture_compression_etc2 },
|
|
1787
|
+
"etc2-rgba8unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, f: texture_compression_etc2 },
|
|
1788
|
+
"eac-r11unorm": { gl: import_constants5.GL.COMPRESSED_R11_EAC, f: texture_compression_etc2 },
|
|
1789
|
+
"eac-r11snorm": { gl: import_constants5.GL.COMPRESSED_SIGNED_R11_EAC, f: texture_compression_etc2 },
|
|
1790
|
+
"eac-rg11unorm": { gl: import_constants5.GL.COMPRESSED_RG11_EAC, f: texture_compression_etc2 },
|
|
1791
|
+
"eac-rg11snorm": { gl: import_constants5.GL.COMPRESSED_SIGNED_RG11_EAC, f: texture_compression_etc2 },
|
|
1803
1792
|
// X_ASTC compressed formats: device.features.has("texture-compression-astc")
|
|
1804
|
-
"astc-4x4-unorm": { gl: import_constants5.
|
|
1805
|
-
"astc-4x4-unorm-srgb": { gl: import_constants5.
|
|
1806
|
-
"astc-5x4-unorm": { gl: import_constants5.
|
|
1807
|
-
"astc-5x4-unorm-srgb": { gl: import_constants5.
|
|
1808
|
-
"astc-5x5-unorm": { gl: import_constants5.
|
|
1809
|
-
"astc-5x5-unorm-srgb": { gl: import_constants5.
|
|
1810
|
-
"astc-6x5-unorm": { gl: import_constants5.
|
|
1811
|
-
"astc-6x5-unorm-srgb": { gl: import_constants5.
|
|
1812
|
-
"astc-6x6-unorm": { gl: import_constants5.
|
|
1813
|
-
"astc-6x6-unorm-srgb": { gl: import_constants5.
|
|
1814
|
-
"astc-8x5-unorm": { gl: import_constants5.
|
|
1815
|
-
"astc-8x5-unorm-srgb": { gl: import_constants5.
|
|
1816
|
-
"astc-8x6-unorm": { gl: import_constants5.
|
|
1817
|
-
"astc-8x6-unorm-srgb": { gl: import_constants5.
|
|
1818
|
-
"astc-8x8-unorm": { gl: import_constants5.
|
|
1819
|
-
"astc-8x8-unorm-srgb": { gl: import_constants5.
|
|
1820
|
-
"astc-10x5-unorm": { gl: import_constants5.
|
|
1821
|
-
"astc-10x5-unorm-srgb": { gl: import_constants5.
|
|
1822
|
-
"astc-10x6-unorm": { gl: import_constants5.
|
|
1823
|
-
"astc-10x6-unorm-srgb": { gl: import_constants5.
|
|
1824
|
-
"astc-10x8-unorm": { gl: import_constants5.
|
|
1825
|
-
"astc-10x8-unorm-srgb": { gl: import_constants5.
|
|
1826
|
-
"astc-10x10-unorm": { gl: import_constants5.
|
|
1827
|
-
"astc-10x10-unorm-srgb": { gl: import_constants5.
|
|
1828
|
-
"astc-12x10-unorm": { gl: import_constants5.
|
|
1829
|
-
"astc-12x10-unorm-srgb": { gl: import_constants5.
|
|
1830
|
-
"astc-12x12-unorm": { gl: import_constants5.
|
|
1831
|
-
"astc-12x12-unorm-srgb": { gl: import_constants5.
|
|
1793
|
+
"astc-4x4-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_4x4_KHR, f: texture_compression_astc },
|
|
1794
|
+
"astc-4x4-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, f: texture_compression_astc },
|
|
1795
|
+
"astc-5x4-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_5x4_KHR, f: texture_compression_astc },
|
|
1796
|
+
"astc-5x4-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, f: texture_compression_astc },
|
|
1797
|
+
"astc-5x5-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_5x5_KHR, f: texture_compression_astc },
|
|
1798
|
+
"astc-5x5-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, f: texture_compression_astc },
|
|
1799
|
+
"astc-6x5-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_6x5_KHR, f: texture_compression_astc },
|
|
1800
|
+
"astc-6x5-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, f: texture_compression_astc },
|
|
1801
|
+
"astc-6x6-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_6x6_KHR, f: texture_compression_astc },
|
|
1802
|
+
"astc-6x6-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, f: texture_compression_astc },
|
|
1803
|
+
"astc-8x5-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_8x5_KHR, f: texture_compression_astc },
|
|
1804
|
+
"astc-8x5-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, f: texture_compression_astc },
|
|
1805
|
+
"astc-8x6-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_8x6_KHR, f: texture_compression_astc },
|
|
1806
|
+
"astc-8x6-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, f: texture_compression_astc },
|
|
1807
|
+
"astc-8x8-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_8x8_KHR, f: texture_compression_astc },
|
|
1808
|
+
"astc-8x8-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, f: texture_compression_astc },
|
|
1809
|
+
"astc-10x5-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_10x10_KHR, f: texture_compression_astc },
|
|
1810
|
+
"astc-10x5-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, f: texture_compression_astc },
|
|
1811
|
+
"astc-10x6-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_10x6_KHR, f: texture_compression_astc },
|
|
1812
|
+
"astc-10x6-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, f: texture_compression_astc },
|
|
1813
|
+
"astc-10x8-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_10x8_KHR, f: texture_compression_astc },
|
|
1814
|
+
"astc-10x8-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, f: texture_compression_astc },
|
|
1815
|
+
"astc-10x10-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_10x10_KHR, f: texture_compression_astc },
|
|
1816
|
+
"astc-10x10-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, f: texture_compression_astc },
|
|
1817
|
+
"astc-12x10-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_12x10_KHR, f: texture_compression_astc },
|
|
1818
|
+
"astc-12x10-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, f: texture_compression_astc },
|
|
1819
|
+
"astc-12x12-unorm": { gl: import_constants5.GL.COMPRESSED_RGBA_ASTC_12x12_KHR, f: texture_compression_astc },
|
|
1820
|
+
"astc-12x12-unorm-srgb": { gl: import_constants5.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, f: texture_compression_astc },
|
|
1832
1821
|
// WEBGL_compressed_texture_pvrtc
|
|
1833
|
-
"pvrtc-rgb4unorm-webgl": { gl: import_constants5.
|
|
1834
|
-
"pvrtc-rgba4unorm-webgl": { gl: import_constants5.
|
|
1835
|
-
"pvrtc-rbg2unorm-webgl": { gl: import_constants5.
|
|
1836
|
-
"pvrtc-rgba2unorm-webgl": { gl: import_constants5.
|
|
1822
|
+
"pvrtc-rgb4unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG, f: texture_compression_pvrtc_webgl },
|
|
1823
|
+
"pvrtc-rgba4unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, f: texture_compression_pvrtc_webgl },
|
|
1824
|
+
"pvrtc-rbg2unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG, f: texture_compression_pvrtc_webgl },
|
|
1825
|
+
"pvrtc-rgba2unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, f: texture_compression_pvrtc_webgl },
|
|
1837
1826
|
// WEBGL_compressed_texture_etc1
|
|
1838
|
-
"etc1-rbg-unorm-webgl": { gl: import_constants5.
|
|
1827
|
+
"etc1-rbg-unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGB_ETC1_WEBGL, f: texture_compression_etc1_webgl },
|
|
1839
1828
|
// WEBGL_compressed_texture_atc
|
|
1840
|
-
"atc-rgb-unorm-webgl": { gl: import_constants5.
|
|
1841
|
-
"atc-rgba-unorm-webgl": { gl: import_constants5.
|
|
1842
|
-
"atc-rgbai-unorm-webgl": { gl: import_constants5.
|
|
1829
|
+
"atc-rgb-unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGB_ATC_WEBGL, f: texture_compression_atc_webgl },
|
|
1830
|
+
"atc-rgba-unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL, f: texture_compression_atc_webgl },
|
|
1831
|
+
"atc-rgbai-unorm-webgl": { gl: import_constants5.GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL, f: texture_compression_atc_webgl }
|
|
1843
1832
|
};
|
|
1844
1833
|
var DATA_FORMAT_CHANNELS = {
|
|
1845
|
-
[import_constants5.
|
|
1846
|
-
[import_constants5.
|
|
1847
|
-
[import_constants5.
|
|
1848
|
-
[import_constants5.
|
|
1849
|
-
[import_constants5.
|
|
1850
|
-
[import_constants5.
|
|
1851
|
-
[import_constants5.
|
|
1852
|
-
[import_constants5.
|
|
1853
|
-
[import_constants5.
|
|
1854
|
-
[import_constants5.
|
|
1855
|
-
[import_constants5.
|
|
1856
|
-
[import_constants5.
|
|
1857
|
-
[import_constants5.
|
|
1834
|
+
[import_constants5.GL.RED]: 1,
|
|
1835
|
+
[import_constants5.GL.RED_INTEGER]: 1,
|
|
1836
|
+
[import_constants5.GL.RG]: 2,
|
|
1837
|
+
[import_constants5.GL.RG_INTEGER]: 2,
|
|
1838
|
+
[import_constants5.GL.RGB]: 3,
|
|
1839
|
+
[import_constants5.GL.RGB_INTEGER]: 3,
|
|
1840
|
+
[import_constants5.GL.RGBA]: 4,
|
|
1841
|
+
[import_constants5.GL.RGBA_INTEGER]: 4,
|
|
1842
|
+
[import_constants5.GL.DEPTH_COMPONENT]: 1,
|
|
1843
|
+
[import_constants5.GL.DEPTH_STENCIL]: 1,
|
|
1844
|
+
[import_constants5.GL.ALPHA]: 1,
|
|
1845
|
+
[import_constants5.GL.LUMINANCE]: 1,
|
|
1846
|
+
[import_constants5.GL.LUMINANCE_ALPHA]: 2
|
|
1858
1847
|
};
|
|
1859
1848
|
var TYPE_SIZES = {
|
|
1860
|
-
[import_constants5.
|
|
1861
|
-
[import_constants5.
|
|
1862
|
-
[import_constants5.
|
|
1863
|
-
[import_constants5.
|
|
1864
|
-
[import_constants5.
|
|
1865
|
-
[import_constants5.
|
|
1866
|
-
[import_constants5.
|
|
1867
|
-
[import_constants5.
|
|
1849
|
+
[import_constants5.GL.FLOAT]: 4,
|
|
1850
|
+
[import_constants5.GL.UNSIGNED_INT]: 4,
|
|
1851
|
+
[import_constants5.GL.INT]: 4,
|
|
1852
|
+
[import_constants5.GL.UNSIGNED_SHORT]: 2,
|
|
1853
|
+
[import_constants5.GL.SHORT]: 2,
|
|
1854
|
+
[import_constants5.GL.HALF_FLOAT]: 2,
|
|
1855
|
+
[import_constants5.GL.BYTE]: 1,
|
|
1856
|
+
[import_constants5.GL.UNSIGNED_BYTE]: 1
|
|
1868
1857
|
};
|
|
1869
1858
|
function isTextureFormatSupported(gl, formatOrGL) {
|
|
1870
1859
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
@@ -1960,12 +1949,12 @@ function getDepthStencilAttachmentWebGL(format) {
|
|
|
1960
1949
|
}
|
|
1961
1950
|
return info.attachment;
|
|
1962
1951
|
}
|
|
1963
|
-
function _checkFloat32ColorAttachment(gl, internalFormat = gl.RGBA, srcFormat = import_constants5.
|
|
1952
|
+
function _checkFloat32ColorAttachment(gl, internalFormat = gl.RGBA, srcFormat = import_constants5.GL.RGBA, srcType = import_constants5.GL.UNSIGNED_BYTE) {
|
|
1964
1953
|
let texture = null;
|
|
1965
1954
|
let framebuffer = null;
|
|
1966
1955
|
try {
|
|
1967
1956
|
texture = gl.createTexture();
|
|
1968
|
-
gl.bindTexture(import_constants5.
|
|
1957
|
+
gl.bindTexture(import_constants5.GL.TEXTURE_2D, texture);
|
|
1969
1958
|
const level = 0;
|
|
1970
1959
|
const width = 1;
|
|
1971
1960
|
const height = 1;
|
|
@@ -1983,10 +1972,10 @@ function _checkFloat32ColorAttachment(gl, internalFormat = gl.RGBA, srcFormat =
|
|
|
1983
1972
|
pixel
|
|
1984
1973
|
);
|
|
1985
1974
|
framebuffer = gl.createFramebuffer();
|
|
1986
|
-
gl.bindFramebuffer(import_constants5.
|
|
1987
|
-
gl.framebufferTexture2D(import_constants5.
|
|
1988
|
-
const status = gl.checkFramebufferStatus(import_constants5.
|
|
1989
|
-
gl.bindTexture(import_constants5.
|
|
1975
|
+
gl.bindFramebuffer(import_constants5.GL.FRAMEBUFFER, framebuffer);
|
|
1976
|
+
gl.framebufferTexture2D(import_constants5.GL.FRAMEBUFFER, import_constants5.GL.COLOR_ATTACHMENT0, import_constants5.GL.TEXTURE_2D, texture, 0);
|
|
1977
|
+
const status = gl.checkFramebufferStatus(import_constants5.GL.FRAMEBUFFER) === import_constants5.GL.FRAMEBUFFER_COMPLETE;
|
|
1978
|
+
gl.bindTexture(import_constants5.GL.TEXTURE_2D, null);
|
|
1990
1979
|
return status;
|
|
1991
1980
|
} finally {
|
|
1992
1981
|
gl.deleteTexture(texture);
|
|
@@ -2001,42 +1990,42 @@ function getTextureFormatBytesPerPixel(formatOrGL, isWebGL23) {
|
|
|
2001
1990
|
return channels * channelSize;
|
|
2002
1991
|
}
|
|
2003
1992
|
function getWebGLPixelDataFormat(dataFormat, integer, normalized, format) {
|
|
2004
|
-
if (format === import_constants5.
|
|
1993
|
+
if (format === import_constants5.GL.RGBA || format === import_constants5.GL.RGB) {
|
|
2005
1994
|
return format;
|
|
2006
1995
|
}
|
|
2007
1996
|
switch (dataFormat) {
|
|
2008
1997
|
case "r":
|
|
2009
|
-
return integer && !normalized ? import_constants5.
|
|
1998
|
+
return integer && !normalized ? import_constants5.GL.RED_INTEGER : import_constants5.GL.RED;
|
|
2010
1999
|
case "rg":
|
|
2011
|
-
return integer && !normalized ? import_constants5.
|
|
2000
|
+
return integer && !normalized ? import_constants5.GL.RG_INTEGER : import_constants5.GL.RG;
|
|
2012
2001
|
case "rgb":
|
|
2013
|
-
return integer && !normalized ? import_constants5.
|
|
2002
|
+
return integer && !normalized ? import_constants5.GL.RGB_INTEGER : import_constants5.GL.RGB;
|
|
2014
2003
|
case "rgba":
|
|
2015
|
-
return integer && !normalized ? import_constants5.
|
|
2004
|
+
return integer && !normalized ? import_constants5.GL.RGBA_INTEGER : import_constants5.GL.RGBA;
|
|
2016
2005
|
default:
|
|
2017
|
-
return import_constants5.
|
|
2006
|
+
return import_constants5.GL.RGBA;
|
|
2018
2007
|
}
|
|
2019
2008
|
}
|
|
2020
2009
|
function getWebGLDataType(dataType) {
|
|
2021
2010
|
switch (dataType) {
|
|
2022
2011
|
case "uint8":
|
|
2023
|
-
return import_constants5.
|
|
2012
|
+
return import_constants5.GL.UNSIGNED_BYTE;
|
|
2024
2013
|
case "sint8":
|
|
2025
|
-
return import_constants5.
|
|
2014
|
+
return import_constants5.GL.BYTE;
|
|
2026
2015
|
case "uint16":
|
|
2027
|
-
return import_constants5.
|
|
2016
|
+
return import_constants5.GL.UNSIGNED_SHORT;
|
|
2028
2017
|
case "sint16":
|
|
2029
|
-
return import_constants5.
|
|
2018
|
+
return import_constants5.GL.SHORT;
|
|
2030
2019
|
case "uint32":
|
|
2031
|
-
return import_constants5.
|
|
2020
|
+
return import_constants5.GL.UNSIGNED_INT;
|
|
2032
2021
|
case "sint32":
|
|
2033
|
-
return import_constants5.
|
|
2022
|
+
return import_constants5.GL.INT;
|
|
2034
2023
|
case "float16":
|
|
2035
|
-
return import_constants5.
|
|
2024
|
+
return import_constants5.GL.HALF_FLOAT;
|
|
2036
2025
|
case "float32":
|
|
2037
|
-
return import_constants5.
|
|
2026
|
+
return import_constants5.GL.FLOAT;
|
|
2038
2027
|
default:
|
|
2039
|
-
return import_constants5.
|
|
2028
|
+
return import_constants5.GL.UNSIGNED_BYTE;
|
|
2040
2029
|
}
|
|
2041
2030
|
}
|
|
2042
2031
|
|
|
@@ -2138,39 +2127,39 @@ var WEBGL_FEATURES = {
|
|
|
2138
2127
|
};
|
|
2139
2128
|
|
|
2140
2129
|
// src/adapter/device-helpers/device-limits.ts
|
|
2141
|
-
var import_constants6 =
|
|
2130
|
+
var import_constants6 = require("@luma.gl/constants");
|
|
2142
2131
|
function getDeviceLimits(gl) {
|
|
2143
2132
|
const gl2 = getWebGL2Context(gl);
|
|
2144
2133
|
return {
|
|
2145
2134
|
maxTextureDimension1D: 0,
|
|
2146
2135
|
// WebGL does not support 1D textures
|
|
2147
|
-
maxTextureDimension2D: gl.getParameter(import_constants6.
|
|
2148
|
-
maxTextureDimension3D: gl2 ? gl2.getParameter(import_constants6.
|
|
2149
|
-
maxTextureArrayLayers: gl2 ? gl2.getParameter(import_constants6.
|
|
2136
|
+
maxTextureDimension2D: gl.getParameter(import_constants6.GL.MAX_TEXTURE_SIZE),
|
|
2137
|
+
maxTextureDimension3D: gl2 ? gl2.getParameter(import_constants6.GL.MAX_3D_TEXTURE_SIZE) : 0,
|
|
2138
|
+
maxTextureArrayLayers: gl2 ? gl2.getParameter(import_constants6.GL.MAX_ARRAY_TEXTURE_LAYERS) : 0,
|
|
2150
2139
|
maxBindGroups: 1,
|
|
2151
2140
|
// TBD
|
|
2152
2141
|
maxDynamicUniformBuffersPerPipelineLayout: 0,
|
|
2153
2142
|
// TBD
|
|
2154
2143
|
maxDynamicStorageBuffersPerPipelineLayout: 0,
|
|
2155
2144
|
// TBD
|
|
2156
|
-
maxSampledTexturesPerShaderStage: gl.getParameter(import_constants6.
|
|
2145
|
+
maxSampledTexturesPerShaderStage: gl.getParameter(import_constants6.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
|
|
2157
2146
|
// TBD
|
|
2158
|
-
maxSamplersPerShaderStage: gl.getParameter(import_constants6.
|
|
2147
|
+
maxSamplersPerShaderStage: gl.getParameter(import_constants6.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
|
|
2159
2148
|
maxStorageBuffersPerShaderStage: 0,
|
|
2160
2149
|
// TBD
|
|
2161
2150
|
maxStorageTexturesPerShaderStage: 0,
|
|
2162
2151
|
// TBD
|
|
2163
|
-
maxUniformBuffersPerShaderStage: gl2 ? gl2.getParameter(import_constants6.
|
|
2164
|
-
maxUniformBufferBindingSize: gl2 ? gl2.getParameter(import_constants6.
|
|
2152
|
+
maxUniformBuffersPerShaderStage: gl2 ? gl2.getParameter(import_constants6.GL.MAX_UNIFORM_BUFFER_BINDINGS) : 0,
|
|
2153
|
+
maxUniformBufferBindingSize: gl2 ? gl2.getParameter(import_constants6.GL.MAX_UNIFORM_BLOCK_SIZE) : 0,
|
|
2165
2154
|
maxStorageBufferBindingSize: 0,
|
|
2166
|
-
minUniformBufferOffsetAlignment: gl2 ? gl2.getParameter(import_constants6.
|
|
2155
|
+
minUniformBufferOffsetAlignment: gl2 ? gl2.getParameter(import_constants6.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT) : 0,
|
|
2167
2156
|
minStorageBufferOffsetAlignment: 0,
|
|
2168
2157
|
// TBD
|
|
2169
2158
|
maxVertexBuffers: 0,
|
|
2170
|
-
maxVertexAttributes: gl.getParameter(import_constants6.
|
|
2159
|
+
maxVertexAttributes: gl.getParameter(import_constants6.GL.MAX_VERTEX_ATTRIBS),
|
|
2171
2160
|
maxVertexBufferArrayStride: 2048,
|
|
2172
2161
|
// TBD, this is just the default value from WebGPU
|
|
2173
|
-
maxInterStageShaderComponents: gl2 ? gl2.getParameter(import_constants6.
|
|
2162
|
+
maxInterStageShaderComponents: gl2 ? gl2.getParameter(import_constants6.GL.MAX_VARYING_COMPONENTS) : 0,
|
|
2174
2163
|
maxComputeWorkgroupStorageSize: 0,
|
|
2175
2164
|
// WebGL does not support compute shaders
|
|
2176
2165
|
maxComputeInvocationsPerWorkgroup: 0,
|
|
@@ -2194,89 +2183,89 @@ function getWebGLLimits(gl) {
|
|
|
2194
2183
|
return gl2 ? gl2.getParameter(pname) : defaultValue || 0;
|
|
2195
2184
|
}
|
|
2196
2185
|
return {
|
|
2197
|
-
[import_constants6.
|
|
2198
|
-
[import_constants6.
|
|
2199
|
-
[import_constants6.
|
|
2200
|
-
[import_constants6.
|
|
2186
|
+
[import_constants6.GL.ALIASED_LINE_WIDTH_RANGE]: get(import_constants6.GL.ALIASED_LINE_WIDTH_RANGE),
|
|
2187
|
+
[import_constants6.GL.ALIASED_POINT_SIZE_RANGE]: get(import_constants6.GL.ALIASED_POINT_SIZE_RANGE),
|
|
2188
|
+
[import_constants6.GL.MAX_TEXTURE_SIZE]: get(import_constants6.GL.MAX_TEXTURE_SIZE),
|
|
2189
|
+
[import_constants6.GL.MAX_CUBE_MAP_TEXTURE_SIZE]: get(import_constants6.GL.MAX_CUBE_MAP_TEXTURE_SIZE),
|
|
2201
2190
|
// GLint
|
|
2202
|
-
[import_constants6.
|
|
2191
|
+
[import_constants6.GL.MAX_TEXTURE_IMAGE_UNITS]: get(import_constants6.GL.MAX_TEXTURE_IMAGE_UNITS),
|
|
2203
2192
|
// GLint
|
|
2204
|
-
[import_constants6.
|
|
2193
|
+
[import_constants6.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS]: get(import_constants6.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
|
|
2205
2194
|
// GLint
|
|
2206
|
-
[import_constants6.
|
|
2195
|
+
[import_constants6.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS]: get(import_constants6.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
|
|
2207
2196
|
// GLint
|
|
2208
|
-
[import_constants6.
|
|
2197
|
+
[import_constants6.GL.MAX_RENDERBUFFER_SIZE]: get(import_constants6.GL.MAX_RENDERBUFFER_SIZE),
|
|
2209
2198
|
// GLint
|
|
2210
|
-
[import_constants6.
|
|
2199
|
+
[import_constants6.GL.MAX_VARYING_VECTORS]: get(import_constants6.GL.MAX_VARYING_VECTORS),
|
|
2211
2200
|
// GLint
|
|
2212
|
-
[import_constants6.
|
|
2201
|
+
[import_constants6.GL.MAX_VERTEX_ATTRIBS]: get(import_constants6.GL.MAX_VERTEX_ATTRIBS),
|
|
2213
2202
|
// GLint
|
|
2214
|
-
[import_constants6.
|
|
2203
|
+
[import_constants6.GL.MAX_VERTEX_UNIFORM_VECTORS]: get(import_constants6.GL.MAX_VERTEX_UNIFORM_VECTORS),
|
|
2215
2204
|
// GLint
|
|
2216
|
-
[import_constants6.
|
|
2205
|
+
[import_constants6.GL.MAX_FRAGMENT_UNIFORM_VECTORS]: get(import_constants6.GL.MAX_FRAGMENT_UNIFORM_VECTORS),
|
|
2217
2206
|
// GLint
|
|
2218
|
-
[import_constants6.
|
|
2207
|
+
[import_constants6.GL.MAX_VIEWPORT_DIMS]: get(import_constants6.GL.MAX_VIEWPORT_DIMS),
|
|
2219
2208
|
// Extensions
|
|
2220
|
-
[import_constants6.
|
|
2209
|
+
[import_constants6.GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT]: get(import_constants6.GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT),
|
|
2221
2210
|
// getMaxAnistropy(),
|
|
2222
2211
|
// WebGL2 Limits
|
|
2223
|
-
[import_constants6.
|
|
2212
|
+
[import_constants6.GL.MAX_3D_TEXTURE_SIZE]: get2(import_constants6.GL.MAX_3D_TEXTURE_SIZE),
|
|
2224
2213
|
// GLint
|
|
2225
|
-
[import_constants6.
|
|
2214
|
+
[import_constants6.GL.MAX_ARRAY_TEXTURE_LAYERS]: get2(import_constants6.GL.MAX_ARRAY_TEXTURE_LAYERS),
|
|
2226
2215
|
// GLint
|
|
2227
|
-
[import_constants6.
|
|
2216
|
+
[import_constants6.GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: get2(import_constants6.GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL),
|
|
2228
2217
|
// GLint64
|
|
2229
|
-
[import_constants6.
|
|
2218
|
+
[import_constants6.GL.MAX_COLOR_ATTACHMENTS]: get2(import_constants6.GL.MAX_COLOR_ATTACHMENTS),
|
|
2230
2219
|
// GLint
|
|
2231
|
-
[import_constants6.
|
|
2220
|
+
[import_constants6.GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: get2(import_constants6.GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS),
|
|
2232
2221
|
// GLint64
|
|
2233
|
-
[import_constants6.
|
|
2222
|
+
[import_constants6.GL.MAX_COMBINED_UNIFORM_BLOCKS]: get2(import_constants6.GL.MAX_COMBINED_UNIFORM_BLOCKS),
|
|
2234
2223
|
// GLint
|
|
2235
|
-
[import_constants6.
|
|
2224
|
+
[import_constants6.GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: get2(import_constants6.GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS),
|
|
2236
2225
|
// GLint64
|
|
2237
|
-
[import_constants6.
|
|
2226
|
+
[import_constants6.GL.MAX_DRAW_BUFFERS]: get2(import_constants6.GL.MAX_DRAW_BUFFERS),
|
|
2238
2227
|
// GLint
|
|
2239
|
-
[import_constants6.
|
|
2228
|
+
[import_constants6.GL.MAX_ELEMENT_INDEX]: get2(import_constants6.GL.MAX_ELEMENT_INDEX),
|
|
2240
2229
|
// GLint64
|
|
2241
|
-
[import_constants6.
|
|
2230
|
+
[import_constants6.GL.MAX_ELEMENTS_INDICES]: get2(import_constants6.GL.MAX_ELEMENTS_INDICES),
|
|
2242
2231
|
// GLint
|
|
2243
|
-
[import_constants6.
|
|
2232
|
+
[import_constants6.GL.MAX_ELEMENTS_VERTICES]: get2(import_constants6.GL.MAX_ELEMENTS_VERTICES),
|
|
2244
2233
|
// GLint
|
|
2245
|
-
[import_constants6.
|
|
2234
|
+
[import_constants6.GL.MAX_FRAGMENT_INPUT_COMPONENTS]: get2(import_constants6.GL.MAX_FRAGMENT_INPUT_COMPONENTS),
|
|
2246
2235
|
// GLint
|
|
2247
|
-
[import_constants6.
|
|
2236
|
+
[import_constants6.GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: get2(import_constants6.GL.MAX_FRAGMENT_UNIFORM_BLOCKS),
|
|
2248
2237
|
// GLint
|
|
2249
|
-
[import_constants6.
|
|
2238
|
+
[import_constants6.GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: get2(import_constants6.GL.MAX_FRAGMENT_UNIFORM_COMPONENTS),
|
|
2250
2239
|
// GLint
|
|
2251
|
-
[import_constants6.
|
|
2240
|
+
[import_constants6.GL.MAX_SAMPLES]: get2(import_constants6.GL.MAX_SAMPLES),
|
|
2252
2241
|
// GLint
|
|
2253
|
-
[import_constants6.
|
|
2242
|
+
[import_constants6.GL.MAX_SERVER_WAIT_TIMEOUT]: get2(import_constants6.GL.MAX_SERVER_WAIT_TIMEOUT),
|
|
2254
2243
|
// GLint64
|
|
2255
|
-
[import_constants6.
|
|
2244
|
+
[import_constants6.GL.MAX_TEXTURE_LOD_BIAS]: get2(import_constants6.GL.MAX_TEXTURE_LOD_BIAS),
|
|
2256
2245
|
// GLfloat
|
|
2257
|
-
[import_constants6.
|
|
2246
|
+
[import_constants6.GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: get2(import_constants6.GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS),
|
|
2258
2247
|
// GLint
|
|
2259
|
-
[import_constants6.
|
|
2248
|
+
[import_constants6.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: get2(import_constants6.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS),
|
|
2260
2249
|
// GLint
|
|
2261
|
-
[import_constants6.
|
|
2250
|
+
[import_constants6.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: get2(import_constants6.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS),
|
|
2262
2251
|
// GLint
|
|
2263
|
-
[import_constants6.
|
|
2252
|
+
[import_constants6.GL.MAX_UNIFORM_BLOCK_SIZE]: get2(import_constants6.GL.MAX_UNIFORM_BLOCK_SIZE),
|
|
2264
2253
|
// GLint64
|
|
2265
|
-
[import_constants6.
|
|
2254
|
+
[import_constants6.GL.MAX_UNIFORM_BUFFER_BINDINGS]: get2(import_constants6.GL.MAX_UNIFORM_BUFFER_BINDINGS),
|
|
2266
2255
|
// GLint
|
|
2267
|
-
[import_constants6.
|
|
2256
|
+
[import_constants6.GL.MAX_VARYING_COMPONENTS]: get2(import_constants6.GL.MAX_VARYING_COMPONENTS),
|
|
2268
2257
|
// GLint
|
|
2269
|
-
[import_constants6.
|
|
2258
|
+
[import_constants6.GL.MAX_VERTEX_OUTPUT_COMPONENTS]: get2(import_constants6.GL.MAX_VERTEX_OUTPUT_COMPONENTS),
|
|
2270
2259
|
// GLint
|
|
2271
|
-
[import_constants6.
|
|
2260
|
+
[import_constants6.GL.MAX_VERTEX_UNIFORM_BLOCKS]: get2(import_constants6.GL.MAX_VERTEX_UNIFORM_BLOCKS),
|
|
2272
2261
|
// GLint
|
|
2273
|
-
[import_constants6.
|
|
2262
|
+
[import_constants6.GL.MAX_VERTEX_UNIFORM_COMPONENTS]: get2(import_constants6.GL.MAX_VERTEX_UNIFORM_COMPONENTS),
|
|
2274
2263
|
// GLint
|
|
2275
|
-
[import_constants6.
|
|
2264
|
+
[import_constants6.GL.MIN_PROGRAM_TEXEL_OFFSET]: get2(import_constants6.GL.MIN_PROGRAM_TEXEL_OFFSET),
|
|
2276
2265
|
// GLint
|
|
2277
|
-
[import_constants6.
|
|
2266
|
+
[import_constants6.GL.MAX_PROGRAM_TEXEL_OFFSET]: get2(import_constants6.GL.MAX_PROGRAM_TEXEL_OFFSET),
|
|
2278
2267
|
// GLint
|
|
2279
|
-
[import_constants6.
|
|
2268
|
+
[import_constants6.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: get2(import_constants6.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT)
|
|
2280
2269
|
// GLint
|
|
2281
2270
|
};
|
|
2282
2271
|
}
|
|
@@ -2286,7 +2275,7 @@ var import_api15 = require("@luma.gl/api");
|
|
|
2286
2275
|
|
|
2287
2276
|
// src/adapter/resources/webgl-framebuffer.ts
|
|
2288
2277
|
var import_api14 = require("@luma.gl/api");
|
|
2289
|
-
var import_constants13 =
|
|
2278
|
+
var import_constants13 = require("@luma.gl/constants");
|
|
2290
2279
|
|
|
2291
2280
|
// src/adapter/resources/webgl-texture.ts
|
|
2292
2281
|
var import_api9 = require("@luma.gl/api");
|
|
@@ -2328,7 +2317,7 @@ var import_constants8 = require("@luma.gl/constants");
|
|
|
2328
2317
|
|
|
2329
2318
|
// src/adapter/converters/device-parameters.ts
|
|
2330
2319
|
var import_api6 = require("@luma.gl/api");
|
|
2331
|
-
var import_constants7 =
|
|
2320
|
+
var import_constants7 = require("@luma.gl/constants");
|
|
2332
2321
|
function withGLParameters(device, parameters, func) {
|
|
2333
2322
|
if ((0, import_api6.isObjectEmpty)(parameters)) {
|
|
2334
2323
|
return func(device);
|
|
@@ -2359,23 +2348,23 @@ function setDeviceParameters(device, parameters) {
|
|
|
2359
2348
|
if (parameters.cullMode) {
|
|
2360
2349
|
switch (parameters.cullMode) {
|
|
2361
2350
|
case "none":
|
|
2362
|
-
gl.disable(import_constants7.
|
|
2351
|
+
gl.disable(import_constants7.GL.CULL_FACE);
|
|
2363
2352
|
break;
|
|
2364
2353
|
case "front":
|
|
2365
|
-
gl.enable(import_constants7.
|
|
2366
|
-
gl.cullFace(import_constants7.
|
|
2354
|
+
gl.enable(import_constants7.GL.CULL_FACE);
|
|
2355
|
+
gl.cullFace(import_constants7.GL.FRONT);
|
|
2367
2356
|
break;
|
|
2368
2357
|
case "back":
|
|
2369
|
-
gl.enable(import_constants7.
|
|
2370
|
-
gl.cullFace(import_constants7.
|
|
2358
|
+
gl.enable(import_constants7.GL.CULL_FACE);
|
|
2359
|
+
gl.cullFace(import_constants7.GL.BACK);
|
|
2371
2360
|
break;
|
|
2372
2361
|
}
|
|
2373
2362
|
}
|
|
2374
2363
|
if (parameters.frontFace) {
|
|
2375
2364
|
gl.frontFace(
|
|
2376
2365
|
map("frontFace", parameters.frontFace, {
|
|
2377
|
-
ccw: import_constants7.
|
|
2378
|
-
cw: import_constants7.
|
|
2366
|
+
ccw: import_constants7.GL.CCW,
|
|
2367
|
+
cw: import_constants7.GL.CW
|
|
2379
2368
|
})
|
|
2380
2369
|
);
|
|
2381
2370
|
}
|
|
@@ -2386,13 +2375,13 @@ function setDeviceParameters(device, parameters) {
|
|
|
2386
2375
|
gl.depthMask(mapBoolean("depthWriteEnabled", parameters.depthWriteEnabled));
|
|
2387
2376
|
}
|
|
2388
2377
|
if (parameters.depthCompare) {
|
|
2389
|
-
parameters.depthCompare !== "always" ? gl.enable(import_constants7.
|
|
2378
|
+
parameters.depthCompare !== "always" ? gl.enable(import_constants7.GL.DEPTH_TEST) : gl.disable(import_constants7.GL.DEPTH_TEST);
|
|
2390
2379
|
gl.depthFunc(convertCompareFunction("depthCompare", parameters.depthCompare));
|
|
2391
2380
|
}
|
|
2392
2381
|
if (parameters.stencilWriteMask) {
|
|
2393
2382
|
const mask = parameters.stencilWriteMask;
|
|
2394
|
-
gl.stencilMaskSeparate(import_constants7.
|
|
2395
|
-
gl.stencilMaskSeparate(import_constants7.
|
|
2383
|
+
gl.stencilMaskSeparate(import_constants7.GL.FRONT, mask);
|
|
2384
|
+
gl.stencilMaskSeparate(import_constants7.GL.BACK, mask);
|
|
2396
2385
|
}
|
|
2397
2386
|
if (parameters.stencilReadMask) {
|
|
2398
2387
|
import_api6.log.warn("stencilReadMask not supported under WebGL");
|
|
@@ -2400,9 +2389,9 @@ function setDeviceParameters(device, parameters) {
|
|
|
2400
2389
|
if (parameters.stencilCompare) {
|
|
2401
2390
|
const mask = parameters.stencilReadMask || 4294967295;
|
|
2402
2391
|
const glValue = convertCompareFunction("depthCompare", parameters.stencilCompare);
|
|
2403
|
-
parameters.stencilCompare !== "always" ? gl.enable(import_constants7.
|
|
2404
|
-
gl.stencilFuncSeparate(import_constants7.
|
|
2405
|
-
gl.stencilFuncSeparate(import_constants7.
|
|
2392
|
+
parameters.stencilCompare !== "always" ? gl.enable(import_constants7.GL.STENCIL_TEST) : gl.disable(import_constants7.GL.STENCIL_TEST);
|
|
2393
|
+
gl.stencilFuncSeparate(import_constants7.GL.FRONT, glValue, 0, mask);
|
|
2394
|
+
gl.stencilFuncSeparate(import_constants7.GL.BACK, glValue, 0, mask);
|
|
2406
2395
|
}
|
|
2407
2396
|
if (parameters.stencilPassOperation && parameters.stencilFailOperation && parameters.stencilDepthFailOperation) {
|
|
2408
2397
|
const dppass = convertStencilOperation("stencilPassOperation", parameters.stencilPassOperation);
|
|
@@ -2411,32 +2400,32 @@ function setDeviceParameters(device, parameters) {
|
|
|
2411
2400
|
"stencilDepthFailOperation",
|
|
2412
2401
|
parameters.stencilDepthFailOperation
|
|
2413
2402
|
);
|
|
2414
|
-
gl.stencilOpSeparate(import_constants7.
|
|
2415
|
-
gl.stencilOpSeparate(import_constants7.
|
|
2403
|
+
gl.stencilOpSeparate(import_constants7.GL.FRONT, sfail, dpfail, dppass);
|
|
2404
|
+
gl.stencilOpSeparate(import_constants7.GL.BACK, sfail, dpfail, dppass);
|
|
2416
2405
|
}
|
|
2417
2406
|
}
|
|
2418
2407
|
function convertCompareFunction(parameter, value) {
|
|
2419
2408
|
return map(parameter, value, {
|
|
2420
|
-
never: import_constants7.
|
|
2421
|
-
less: import_constants7.
|
|
2422
|
-
equal: import_constants7.
|
|
2423
|
-
"less-equal": import_constants7.
|
|
2424
|
-
greater: import_constants7.
|
|
2425
|
-
"not-equal": import_constants7.
|
|
2426
|
-
"greater-equal": import_constants7.
|
|
2427
|
-
always: import_constants7.
|
|
2409
|
+
never: import_constants7.GL.NEVER,
|
|
2410
|
+
less: import_constants7.GL.LESS,
|
|
2411
|
+
equal: import_constants7.GL.EQUAL,
|
|
2412
|
+
"less-equal": import_constants7.GL.LEQUAL,
|
|
2413
|
+
greater: import_constants7.GL.GREATER,
|
|
2414
|
+
"not-equal": import_constants7.GL.NOTEQUAL,
|
|
2415
|
+
"greater-equal": import_constants7.GL.GEQUAL,
|
|
2416
|
+
always: import_constants7.GL.ALWAYS
|
|
2428
2417
|
});
|
|
2429
2418
|
}
|
|
2430
2419
|
function convertStencilOperation(parameter, value) {
|
|
2431
2420
|
return map(parameter, value, {
|
|
2432
|
-
keep: import_constants7.
|
|
2433
|
-
zero: import_constants7.
|
|
2434
|
-
replace: import_constants7.
|
|
2435
|
-
invert: import_constants7.
|
|
2436
|
-
"increment-clamp": import_constants7.
|
|
2437
|
-
"decrement-clamp": import_constants7.
|
|
2438
|
-
"increment-wrap": import_constants7.
|
|
2439
|
-
"decrement-wrap": import_constants7.
|
|
2421
|
+
keep: import_constants7.GL.KEEP,
|
|
2422
|
+
zero: import_constants7.GL.ZERO,
|
|
2423
|
+
replace: import_constants7.GL.REPLACE,
|
|
2424
|
+
invert: import_constants7.GL.INVERT,
|
|
2425
|
+
"increment-clamp": import_constants7.GL.INCR,
|
|
2426
|
+
"decrement-clamp": import_constants7.GL.DECR,
|
|
2427
|
+
"increment-wrap": import_constants7.GL.INCR_WRAP,
|
|
2428
|
+
"decrement-wrap": import_constants7.GL.DECR_WRAP
|
|
2440
2429
|
});
|
|
2441
2430
|
}
|
|
2442
2431
|
function message(parameter, value) {
|
|
@@ -2528,7 +2517,7 @@ function updateSamplerParametersForNPOT(parameters) {
|
|
|
2528
2517
|
|
|
2529
2518
|
// src/adapter/resources/webgl-buffer.ts
|
|
2530
2519
|
var import_api7 = require("@luma.gl/api");
|
|
2531
|
-
var import_constants9 =
|
|
2520
|
+
var import_constants9 = require("@luma.gl/constants");
|
|
2532
2521
|
var DEBUG_DATA_LENGTH = 10;
|
|
2533
2522
|
var WEBGLBuffer = class extends import_api7.Buffer {
|
|
2534
2523
|
// accessor: {};
|
|
@@ -2593,7 +2582,7 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2593
2582
|
write(data, byteOffset = 0) {
|
|
2594
2583
|
const srcOffset = 0;
|
|
2595
2584
|
const byteLength = void 0;
|
|
2596
|
-
const target = this.device.isWebGL2 ? import_constants9.
|
|
2585
|
+
const target = this.device.isWebGL2 ? import_constants9.GL.COPY_WRITE_BUFFER : this.target;
|
|
2597
2586
|
this.gl.bindBuffer(target, this.handle);
|
|
2598
2587
|
if (srcOffset !== 0 || byteLength !== void 0) {
|
|
2599
2588
|
this.device.assertWebGL2();
|
|
@@ -2609,9 +2598,9 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2609
2598
|
this.device.assertWebGL2();
|
|
2610
2599
|
const data = new Uint8Array(byteLength);
|
|
2611
2600
|
const dstOffset = 0;
|
|
2612
|
-
this.gl.bindBuffer(import_constants9.
|
|
2613
|
-
this.gl2.getBufferSubData(import_constants9.
|
|
2614
|
-
this.gl.bindBuffer(import_constants9.
|
|
2601
|
+
this.gl.bindBuffer(import_constants9.GL.COPY_READ_BUFFER, this.handle);
|
|
2602
|
+
this.gl2.getBufferSubData(import_constants9.GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);
|
|
2603
|
+
this.gl.bindBuffer(import_constants9.GL.COPY_READ_BUFFER, null);
|
|
2615
2604
|
return data;
|
|
2616
2605
|
});
|
|
2617
2606
|
}
|
|
@@ -2628,27 +2617,27 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2628
2617
|
};
|
|
2629
2618
|
function getWebGLTarget(usage) {
|
|
2630
2619
|
if (usage & import_api7.Buffer.INDEX) {
|
|
2631
|
-
return import_constants9.
|
|
2620
|
+
return import_constants9.GL.ELEMENT_ARRAY_BUFFER;
|
|
2632
2621
|
}
|
|
2633
2622
|
if (usage & import_api7.Buffer.VERTEX) {
|
|
2634
|
-
return import_constants9.
|
|
2623
|
+
return import_constants9.GL.ARRAY_BUFFER;
|
|
2635
2624
|
}
|
|
2636
2625
|
if (usage & import_api7.Buffer.UNIFORM) {
|
|
2637
|
-
return import_constants9.
|
|
2626
|
+
return import_constants9.GL.UNIFORM_BUFFER;
|
|
2638
2627
|
}
|
|
2639
|
-
return import_constants9.
|
|
2628
|
+
return import_constants9.GL.ARRAY_BUFFER;
|
|
2640
2629
|
}
|
|
2641
2630
|
function getWebGLUsage(usage) {
|
|
2642
2631
|
if (usage & import_api7.Buffer.INDEX) {
|
|
2643
|
-
return import_constants9.
|
|
2632
|
+
return import_constants9.GL.STATIC_DRAW;
|
|
2644
2633
|
}
|
|
2645
2634
|
if (usage & import_api7.Buffer.VERTEX) {
|
|
2646
|
-
return import_constants9.
|
|
2635
|
+
return import_constants9.GL.STATIC_DRAW;
|
|
2647
2636
|
}
|
|
2648
2637
|
if (usage & import_api7.Buffer.UNIFORM) {
|
|
2649
|
-
return import_constants9.
|
|
2638
|
+
return import_constants9.GL.DYNAMIC_DRAW;
|
|
2650
2639
|
}
|
|
2651
|
-
return import_constants9.
|
|
2640
|
+
return import_constants9.GL.DYNAMIC_DRAW;
|
|
2652
2641
|
}
|
|
2653
2642
|
|
|
2654
2643
|
// src/adapter/resources/webgl-sampler.ts
|
|
@@ -3410,7 +3399,7 @@ function logParameters(parameters) {
|
|
|
3410
3399
|
|
|
3411
3400
|
// src/adapter/objects/webgl-renderbuffer.ts
|
|
3412
3401
|
var import_api13 = require("@luma.gl/api");
|
|
3413
|
-
var import_constants12 =
|
|
3402
|
+
var import_constants12 = require("@luma.gl/constants");
|
|
3414
3403
|
|
|
3415
3404
|
// src/adapter/objects/webgl-resource.ts
|
|
3416
3405
|
var import_api12 = require("@luma.gl/api");
|
|
@@ -3676,13 +3665,13 @@ var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
|
3676
3665
|
const { format, width, height, samples } = props;
|
|
3677
3666
|
(0, import_api13.assert)(format, "Needs format");
|
|
3678
3667
|
this.trackDeallocatedMemory();
|
|
3679
|
-
this.gl.bindRenderbuffer(import_constants12.
|
|
3668
|
+
this.gl.bindRenderbuffer(import_constants12.GL.RENDERBUFFER, this.handle);
|
|
3680
3669
|
if (samples !== 0 && this.device.isWebGL2) {
|
|
3681
|
-
this.gl2.renderbufferStorageMultisample(import_constants12.
|
|
3670
|
+
this.gl2.renderbufferStorageMultisample(import_constants12.GL.RENDERBUFFER, samples, this.glFormat, width, height);
|
|
3682
3671
|
} else {
|
|
3683
|
-
this.gl.renderbufferStorage(import_constants12.
|
|
3672
|
+
this.gl.renderbufferStorage(import_constants12.GL.RENDERBUFFER, this.glFormat, width, height);
|
|
3684
3673
|
}
|
|
3685
|
-
this.gl.bindRenderbuffer(import_constants12.
|
|
3674
|
+
this.gl.bindRenderbuffer(import_constants12.GL.RENDERBUFFER, null);
|
|
3686
3675
|
this.trackAllocatedMemory(
|
|
3687
3676
|
width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.glFormat, this.device.isWebGL2)
|
|
3688
3677
|
);
|
|
@@ -3696,7 +3685,7 @@ var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
|
3696
3685
|
this.trackDeallocatedMemory();
|
|
3697
3686
|
}
|
|
3698
3687
|
_bindHandle(handle) {
|
|
3699
|
-
this.gl.bindRenderbuffer(import_constants12.
|
|
3688
|
+
this.gl.bindRenderbuffer(import_constants12.GL.RENDERBUFFER, handle);
|
|
3700
3689
|
}
|
|
3701
3690
|
};
|
|
3702
3691
|
var WEBGLRenderbuffer = _WEBGLRenderbuffer;
|
|
@@ -3722,10 +3711,10 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3722
3711
|
if (!isDefaultFramebuffer) {
|
|
3723
3712
|
device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
|
|
3724
3713
|
this.autoCreateAttachmentTextures();
|
|
3725
|
-
this.gl.bindFramebuffer(import_constants13.
|
|
3714
|
+
this.gl.bindFramebuffer(import_constants13.GL.FRAMEBUFFER, this.handle);
|
|
3726
3715
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
3727
3716
|
const attachment = this.colorAttachments[i];
|
|
3728
|
-
const attachmentPoint = import_constants13.
|
|
3717
|
+
const attachmentPoint = import_constants13.GL.COLOR_ATTACHMENT0 + i;
|
|
3729
3718
|
if (attachment) {
|
|
3730
3719
|
this._attachOne(attachmentPoint, attachment);
|
|
3731
3720
|
}
|
|
@@ -3736,7 +3725,7 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3736
3725
|
this.depthStencilAttachment
|
|
3737
3726
|
);
|
|
3738
3727
|
}
|
|
3739
|
-
this.gl.bindFramebuffer(import_constants13.
|
|
3728
|
+
this.gl.bindFramebuffer(import_constants13.GL.FRAMEBUFFER, null);
|
|
3740
3729
|
}
|
|
3741
3730
|
if (props.check !== false) {
|
|
3742
3731
|
this._checkStatus();
|
|
@@ -3756,9 +3745,9 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3756
3745
|
/** Check the status */
|
|
3757
3746
|
_checkStatus() {
|
|
3758
3747
|
const { gl } = this;
|
|
3759
|
-
const prevHandle2 = gl.bindFramebuffer(import_constants13.
|
|
3760
|
-
const status = gl.checkFramebufferStatus(import_constants13.
|
|
3761
|
-
gl.bindFramebuffer(import_constants13.
|
|
3748
|
+
const prevHandle2 = gl.bindFramebuffer(import_constants13.GL.FRAMEBUFFER, this.handle);
|
|
3749
|
+
const status = gl.checkFramebufferStatus(import_constants13.GL.FRAMEBUFFER);
|
|
3750
|
+
gl.bindFramebuffer(import_constants13.GL.FRAMEBUFFER, prevHandle2 || null);
|
|
3762
3751
|
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
3763
3752
|
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
3764
3753
|
}
|
|
@@ -3815,9 +3804,9 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3815
3804
|
}
|
|
3816
3805
|
_attachWEBGLRenderbuffer(attachment, renderbuffer) {
|
|
3817
3806
|
this.gl.framebufferRenderbuffer(
|
|
3818
|
-
import_constants13.
|
|
3807
|
+
import_constants13.GL.FRAMEBUFFER,
|
|
3819
3808
|
attachment,
|
|
3820
|
-
import_constants13.
|
|
3809
|
+
import_constants13.GL.RENDERBUFFER,
|
|
3821
3810
|
renderbuffer.handle
|
|
3822
3811
|
);
|
|
3823
3812
|
}
|
|
@@ -3831,17 +3820,17 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3831
3820
|
const { gl, gl2 } = this.device;
|
|
3832
3821
|
gl.bindTexture(texture.target, texture.handle);
|
|
3833
3822
|
switch (texture.target) {
|
|
3834
|
-
case import_constants13.
|
|
3835
|
-
case import_constants13.
|
|
3823
|
+
case import_constants13.GL.TEXTURE_2D_ARRAY:
|
|
3824
|
+
case import_constants13.GL.TEXTURE_3D:
|
|
3836
3825
|
this.device.assertWebGL2();
|
|
3837
|
-
gl2 == null ? void 0 : gl2.framebufferTextureLayer(import_constants13.
|
|
3826
|
+
gl2 == null ? void 0 : gl2.framebufferTextureLayer(import_constants13.GL.FRAMEBUFFER, attachment, texture.target, level, layer);
|
|
3838
3827
|
break;
|
|
3839
|
-
case import_constants13.
|
|
3828
|
+
case import_constants13.GL.TEXTURE_CUBE_MAP:
|
|
3840
3829
|
const face = mapIndexToCubeMapFace(layer);
|
|
3841
|
-
gl.framebufferTexture2D(import_constants13.
|
|
3830
|
+
gl.framebufferTexture2D(import_constants13.GL.FRAMEBUFFER, attachment, face, texture.handle, level);
|
|
3842
3831
|
break;
|
|
3843
|
-
case import_constants13.
|
|
3844
|
-
gl.framebufferTexture2D(import_constants13.
|
|
3832
|
+
case import_constants13.GL.TEXTURE_2D:
|
|
3833
|
+
gl.framebufferTexture2D(import_constants13.GL.FRAMEBUFFER, attachment, import_constants13.GL.TEXTURE_2D, texture.handle, level);
|
|
3845
3834
|
break;
|
|
3846
3835
|
default:
|
|
3847
3836
|
(0, import_api14.assert)(false, "Illegal texture type");
|
|
@@ -3850,21 +3839,21 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3850
3839
|
}
|
|
3851
3840
|
};
|
|
3852
3841
|
function mapIndexToCubeMapFace(layer) {
|
|
3853
|
-
return layer < import_constants13.
|
|
3842
|
+
return layer < import_constants13.GL.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + import_constants13.GL.TEXTURE_CUBE_MAP_POSITIVE_X : layer;
|
|
3854
3843
|
}
|
|
3855
3844
|
function _getFrameBufferStatus(status) {
|
|
3856
3845
|
switch (status) {
|
|
3857
|
-
case import_constants13.
|
|
3846
|
+
case import_constants13.GL.FRAMEBUFFER_COMPLETE:
|
|
3858
3847
|
return "success";
|
|
3859
|
-
case import_constants13.
|
|
3848
|
+
case import_constants13.GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
|
3860
3849
|
return "Mismatched attachments";
|
|
3861
|
-
case import_constants13.
|
|
3850
|
+
case import_constants13.GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
|
3862
3851
|
return "No attachments";
|
|
3863
|
-
case import_constants13.
|
|
3852
|
+
case import_constants13.GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
|
|
3864
3853
|
return "Height/width mismatch";
|
|
3865
|
-
case import_constants13.
|
|
3854
|
+
case import_constants13.GL.FRAMEBUFFER_UNSUPPORTED:
|
|
3866
3855
|
return "Unsupported or split attachments";
|
|
3867
|
-
case import_constants13.
|
|
3856
|
+
case import_constants13.GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
|
|
3868
3857
|
return "Samples mismatch";
|
|
3869
3858
|
default:
|
|
3870
3859
|
return `${status}`;
|
|
@@ -3981,7 +3970,7 @@ function initializeSpectorJS(props) {
|
|
|
3981
3970
|
|
|
3982
3971
|
// src/context/debug/webgl-developer-tools.ts
|
|
3983
3972
|
var import_api17 = require("@luma.gl/api");
|
|
3984
|
-
var import_constants14 =
|
|
3973
|
+
var import_constants14 = require("@luma.gl/constants");
|
|
3985
3974
|
var WEBGL_DEBUG_CDN_URL = "https://unpkg.com/webgl-debug@2.0.1/index.js";
|
|
3986
3975
|
function getContextData2(gl) {
|
|
3987
3976
|
gl.luma = gl.luma || {};
|
|
@@ -4015,15 +4004,15 @@ function getDebugContext(gl, props) {
|
|
|
4015
4004
|
if (data.debugContext) {
|
|
4016
4005
|
return data.debugContext;
|
|
4017
4006
|
}
|
|
4018
|
-
globalThis.WebGLDebugUtils.init(__spreadValues(__spreadValues({}, import_constants14.
|
|
4007
|
+
globalThis.WebGLDebugUtils.init(__spreadValues(__spreadValues({}, import_constants14.GL), gl));
|
|
4019
4008
|
const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(
|
|
4020
4009
|
gl,
|
|
4021
4010
|
onGLError.bind(null, props),
|
|
4022
4011
|
onValidateGLFunc.bind(null, props)
|
|
4023
4012
|
);
|
|
4024
|
-
for (const key in import_constants14.
|
|
4025
|
-
if (!(key in glDebug) && typeof import_constants14.
|
|
4026
|
-
glDebug[key] = import_constants14.
|
|
4013
|
+
for (const key in import_constants14.GL) {
|
|
4014
|
+
if (!(key in glDebug) && typeof import_constants14.GL[key] === "number") {
|
|
4015
|
+
glDebug[key] = import_constants14.GL[key];
|
|
4027
4016
|
}
|
|
4028
4017
|
}
|
|
4029
4018
|
class WebGLDebugContext {
|
|
@@ -4080,13 +4069,13 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
4080
4069
|
}
|
|
4081
4070
|
}
|
|
4082
4071
|
|
|
4083
|
-
// src/classic/buffer.ts
|
|
4072
|
+
// src/classic/buffer-with-accessor.ts
|
|
4084
4073
|
var import_api19 = require("@luma.gl/api");
|
|
4085
|
-
var import_constants17 =
|
|
4074
|
+
var import_constants17 = require("@luma.gl/constants");
|
|
4086
4075
|
|
|
4087
4076
|
// src/classic/accessor.ts
|
|
4088
4077
|
var import_api18 = require("@luma.gl/api");
|
|
4089
|
-
var import_constants16 =
|
|
4078
|
+
var import_constants16 = require("@luma.gl/constants");
|
|
4090
4079
|
|
|
4091
4080
|
// src/classic/typed-array-utils.ts
|
|
4092
4081
|
var import_constants15 = require("@luma.gl/constants");
|
|
@@ -4143,7 +4132,7 @@ function getTypedArrayFromGLType(glType, options) {
|
|
|
4143
4132
|
var DEFAULT_ACCESSOR_VALUES = {
|
|
4144
4133
|
offset: 0,
|
|
4145
4134
|
stride: 0,
|
|
4146
|
-
type: import_constants16.
|
|
4135
|
+
type: import_constants16.GL.FLOAT,
|
|
4147
4136
|
size: 1,
|
|
4148
4137
|
divisor: 0,
|
|
4149
4138
|
normalized: false,
|
|
@@ -4157,12 +4146,12 @@ var PROP_CHECKS = {
|
|
|
4157
4146
|
};
|
|
4158
4147
|
var Accessor = class {
|
|
4159
4148
|
static getBytesPerElement(accessor) {
|
|
4160
|
-
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.
|
|
4149
|
+
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.GL.FLOAT);
|
|
4161
4150
|
return ArrayType.BYTES_PER_ELEMENT;
|
|
4162
4151
|
}
|
|
4163
4152
|
static getBytesPerVertex(accessor) {
|
|
4164
4153
|
(0, import_api18.assert)(accessor.size);
|
|
4165
|
-
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.
|
|
4154
|
+
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.GL.FLOAT);
|
|
4166
4155
|
return ArrayType.BYTES_PER_ELEMENT * accessor.size;
|
|
4167
4156
|
}
|
|
4168
4157
|
// Combines (merges) a list of accessors. On top of default values
|
|
@@ -4193,7 +4182,7 @@ var Accessor = class {
|
|
|
4193
4182
|
props = (0, import_api18.checkProps)("Accessor", props, PROP_CHECKS);
|
|
4194
4183
|
if (props.type !== void 0) {
|
|
4195
4184
|
this.type = props.type;
|
|
4196
|
-
if (props.type === import_constants16.
|
|
4185
|
+
if (props.type === import_constants16.GL.INT || props.type === import_constants16.GL.UNSIGNED_INT) {
|
|
4197
4186
|
this.integer = true;
|
|
4198
4187
|
}
|
|
4199
4188
|
}
|
|
@@ -4256,7 +4245,7 @@ var Accessor = class {
|
|
|
4256
4245
|
}
|
|
4257
4246
|
};
|
|
4258
4247
|
|
|
4259
|
-
// src/classic/buffer.ts
|
|
4248
|
+
// src/classic/buffer-with-accessor.ts
|
|
4260
4249
|
var DEBUG_DATA_LENGTH2 = 10;
|
|
4261
4250
|
var DEPRECATED_PROPS = {
|
|
4262
4251
|
offset: "accessor.offset",
|
|
@@ -4294,7 +4283,7 @@ function getWEBGLBufferProps(props) {
|
|
|
4294
4283
|
}
|
|
4295
4284
|
return bufferProps;
|
|
4296
4285
|
}
|
|
4297
|
-
var
|
|
4286
|
+
var BufferWithAccessor = class extends WEBGLBuffer {
|
|
4298
4287
|
constructor(device, props = {}) {
|
|
4299
4288
|
super(WebGLDevice.attach(device), getWEBGLBufferProps(props));
|
|
4300
4289
|
this.setAccessor(Object.assign({}, props, props.accessor));
|
|
@@ -4328,7 +4317,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4328
4317
|
props = { byteLength: props };
|
|
4329
4318
|
}
|
|
4330
4319
|
props = (0, import_api19.checkProps)("Buffer", props, PROP_CHECKS_INITIALIZE);
|
|
4331
|
-
this.webglUsage = props.webglUsage || import_constants17.
|
|
4320
|
+
this.webglUsage = props.webglUsage || import_constants17.GL.STATIC_DRAW;
|
|
4332
4321
|
this.debugData = null;
|
|
4333
4322
|
this.setAccessor(Object.assign({}, props, props.accessor));
|
|
4334
4323
|
if (props.data) {
|
|
@@ -4382,7 +4371,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4382
4371
|
const { data, offset = 0, srcOffset = 0 } = options;
|
|
4383
4372
|
const byteLength = options.byteLength || options.length;
|
|
4384
4373
|
(0, import_api19.assert)(data);
|
|
4385
|
-
const target = this.gl.webgl2 ? import_constants17.
|
|
4374
|
+
const target = this.gl.webgl2 ? import_constants17.GL.COPY_WRITE_BUFFER : this.target;
|
|
4386
4375
|
this.gl.bindBuffer(target, this.handle);
|
|
4387
4376
|
if (srcOffset !== 0 || byteLength !== void 0) {
|
|
4388
4377
|
assertWebGL2Context(this.gl);
|
|
@@ -4403,11 +4392,11 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4403
4392
|
const { sourceBuffer, readOffset = 0, writeOffset = 0, size } = options;
|
|
4404
4393
|
const { gl, gl2 } = this;
|
|
4405
4394
|
assertWebGL2Context(gl);
|
|
4406
|
-
gl.bindBuffer(import_constants17.
|
|
4407
|
-
gl.bindBuffer(import_constants17.
|
|
4408
|
-
gl2 == null ? void 0 : gl2.copyBufferSubData(import_constants17.
|
|
4409
|
-
gl.bindBuffer(import_constants17.
|
|
4410
|
-
gl.bindBuffer(import_constants17.
|
|
4395
|
+
gl.bindBuffer(import_constants17.GL.COPY_READ_BUFFER, sourceBuffer.handle);
|
|
4396
|
+
gl.bindBuffer(import_constants17.GL.COPY_WRITE_BUFFER, this.handle);
|
|
4397
|
+
gl2 == null ? void 0 : gl2.copyBufferSubData(import_constants17.GL.COPY_READ_BUFFER, import_constants17.GL.COPY_WRITE_BUFFER, readOffset, writeOffset, size);
|
|
4398
|
+
gl.bindBuffer(import_constants17.GL.COPY_READ_BUFFER, null);
|
|
4399
|
+
gl.bindBuffer(import_constants17.GL.COPY_WRITE_BUFFER, null);
|
|
4411
4400
|
this.debugData = null;
|
|
4412
4401
|
return this;
|
|
4413
4402
|
}
|
|
@@ -4420,7 +4409,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4420
4409
|
let { dstData = null, length = 0 } = options || {};
|
|
4421
4410
|
const { srcByteOffset = 0, dstOffset = 0 } = options || {};
|
|
4422
4411
|
assertWebGL2Context(this.gl);
|
|
4423
|
-
const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.
|
|
4412
|
+
const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.GL.FLOAT, { clamped: false });
|
|
4424
4413
|
const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);
|
|
4425
4414
|
const dstElementOffset = dstOffset;
|
|
4426
4415
|
let dstAvailableElementCount;
|
|
@@ -4439,9 +4428,9 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4439
4428
|
length = length || copyElementCount;
|
|
4440
4429
|
(0, import_api19.assert)(length <= copyElementCount);
|
|
4441
4430
|
dstData = dstData || new ArrayType(dstElementCount);
|
|
4442
|
-
this.gl.bindBuffer(import_constants17.
|
|
4443
|
-
(_a = this.gl2) == null ? void 0 : _a.getBufferSubData(import_constants17.
|
|
4444
|
-
this.gl.bindBuffer(import_constants17.
|
|
4431
|
+
this.gl.bindBuffer(import_constants17.GL.COPY_READ_BUFFER, this.handle);
|
|
4432
|
+
(_a = this.gl2) == null ? void 0 : _a.getBufferSubData(import_constants17.GL.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);
|
|
4433
|
+
this.gl.bindBuffer(import_constants17.GL.COPY_READ_BUFFER, null);
|
|
4445
4434
|
return dstData;
|
|
4446
4435
|
}
|
|
4447
4436
|
/**
|
|
@@ -4461,7 +4450,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4461
4450
|
offset = 0,
|
|
4462
4451
|
size
|
|
4463
4452
|
} = options || {};
|
|
4464
|
-
if (target === import_constants17.
|
|
4453
|
+
if (target === import_constants17.GL.UNIFORM_BUFFER || target === import_constants17.GL.TRANSFORM_FEEDBACK_BUFFER) {
|
|
4465
4454
|
if (size !== void 0) {
|
|
4466
4455
|
(_a = this.gl2) == null ? void 0 : _a.bindBufferRange(target, index, this.handle, offset, size);
|
|
4467
4456
|
} else {
|
|
@@ -4476,7 +4465,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4476
4465
|
unbind(options) {
|
|
4477
4466
|
var _a;
|
|
4478
4467
|
const { target = this.target, index = this.accessor && this.accessor.index } = options || {};
|
|
4479
|
-
const isIndexedBuffer = target === import_constants17.
|
|
4468
|
+
const isIndexedBuffer = target === import_constants17.GL.UNIFORM_BUFFER || target === import_constants17.GL.TRANSFORM_FEEDBACK_BUFFER;
|
|
4480
4469
|
if (isIndexedBuffer) {
|
|
4481
4470
|
(_a = this.gl2) == null ? void 0 : _a.bindBufferBase(target, index, null);
|
|
4482
4471
|
} else {
|
|
@@ -4537,10 +4526,10 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4537
4526
|
// Binding a buffer for the first time locks the type
|
|
4538
4527
|
// In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type
|
|
4539
4528
|
_getTarget() {
|
|
4540
|
-
return this.gl.webgl2 ? import_constants17.
|
|
4529
|
+
return this.gl.webgl2 ? import_constants17.GL.COPY_WRITE_BUFFER : this.target;
|
|
4541
4530
|
}
|
|
4542
4531
|
_getAvailableElementCount(srcByteOffset) {
|
|
4543
|
-
const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.
|
|
4532
|
+
const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.GL.FLOAT, { clamped: false });
|
|
4544
4533
|
const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;
|
|
4545
4534
|
return this.getElementCount() - sourceElementOffset;
|
|
4546
4535
|
}
|
|
@@ -4567,7 +4556,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4567
4556
|
|
|
4568
4557
|
// src/adapter/resources/webgl-shader.ts
|
|
4569
4558
|
var import_api20 = require("@luma.gl/api");
|
|
4570
|
-
var import_constants18 =
|
|
4559
|
+
var import_constants18 = require("@luma.gl/constants");
|
|
4571
4560
|
|
|
4572
4561
|
// src/adapter/helpers/get-shader-info.ts
|
|
4573
4562
|
function getShaderInfo(source, defaultName) {
|
|
@@ -4633,10 +4622,10 @@ var WEBGLShader = class extends import_api20.Shader {
|
|
|
4633
4622
|
this.device = device;
|
|
4634
4623
|
switch (this.props.stage) {
|
|
4635
4624
|
case "vertex":
|
|
4636
|
-
this.handle = this.props.handle || this.device.gl.createShader(import_constants18.
|
|
4625
|
+
this.handle = this.props.handle || this.device.gl.createShader(import_constants18.GL.VERTEX_SHADER);
|
|
4637
4626
|
break;
|
|
4638
4627
|
case "fragment":
|
|
4639
|
-
this.handle = this.props.handle || this.device.gl.createShader(import_constants18.
|
|
4628
|
+
this.handle = this.props.handle || this.device.gl.createShader(import_constants18.GL.FRAGMENT_SHADER);
|
|
4640
4629
|
break;
|
|
4641
4630
|
default:
|
|
4642
4631
|
throw new Error(this.props.stage);
|
|
@@ -4664,7 +4653,7 @@ ${source2}`;
|
|
|
4664
4653
|
const { gl } = this.device;
|
|
4665
4654
|
gl.shaderSource(this.handle, source);
|
|
4666
4655
|
gl.compileShader(this.handle);
|
|
4667
|
-
const compileStatus = gl.getShaderParameter(this.handle, import_constants18.
|
|
4656
|
+
const compileStatus = gl.getShaderParameter(this.handle, import_constants18.GL.COMPILE_STATUS);
|
|
4668
4657
|
if (!compileStatus) {
|
|
4669
4658
|
const shaderLog = gl.getShaderInfoLog(this.handle);
|
|
4670
4659
|
const parsedLog = shaderLog ? parseShaderCompilerLog(shaderLog) : [];
|
|
@@ -4804,10 +4793,10 @@ var WEBGLRenderPass = class extends import_api21.RenderPass {
|
|
|
4804
4793
|
|
|
4805
4794
|
// src/adapter/resources/webgl-render-pipeline.ts
|
|
4806
4795
|
var import_api23 = require("@luma.gl/api");
|
|
4807
|
-
var import_constants25 =
|
|
4796
|
+
var import_constants25 = require("@luma.gl/constants");
|
|
4808
4797
|
|
|
4809
4798
|
// src/adapter/helpers/get-shader-layout.ts
|
|
4810
|
-
var import_constants22 =
|
|
4799
|
+
var import_constants22 = require("@luma.gl/constants");
|
|
4811
4800
|
|
|
4812
4801
|
// src/adapter/helpers/uniforms.ts
|
|
4813
4802
|
var import_constants20 = require("@luma.gl/constants");
|
|
@@ -4885,7 +4874,7 @@ function decodeAttributeType(attributeType) {
|
|
|
4885
4874
|
}
|
|
4886
4875
|
|
|
4887
4876
|
// src/adapter/converters/vertex-formats.ts
|
|
4888
|
-
var import_constants21 =
|
|
4877
|
+
var import_constants21 = require("@luma.gl/constants");
|
|
4889
4878
|
function getVertexFormat(type, components) {
|
|
4890
4879
|
const base = getDataFormat(type);
|
|
4891
4880
|
switch (components) {
|
|
@@ -4903,11 +4892,11 @@ function getVertexFormat(type, components) {
|
|
|
4903
4892
|
}
|
|
4904
4893
|
function getDataFormat(type) {
|
|
4905
4894
|
switch (type) {
|
|
4906
|
-
case import_constants21.
|
|
4895
|
+
case import_constants21.GL.INT:
|
|
4907
4896
|
return "sint32";
|
|
4908
|
-
case import_constants21.
|
|
4897
|
+
case import_constants21.GL.UNSIGNED_INT:
|
|
4909
4898
|
return "uint32";
|
|
4910
|
-
case import_constants21.
|
|
4899
|
+
case import_constants21.GL.FLOAT:
|
|
4911
4900
|
return "float32";
|
|
4912
4901
|
default:
|
|
4913
4902
|
throw new Error(String(type));
|
|
@@ -4926,7 +4915,7 @@ function getShaderLayout(gl, program) {
|
|
|
4926
4915
|
const size = Math.min(attribute.accessor.size, 4);
|
|
4927
4916
|
const format = (
|
|
4928
4917
|
// attribute.accessor.format ||
|
|
4929
|
-
getVertexFormat(attribute.accessor.type || import_constants22.
|
|
4918
|
+
getVertexFormat(attribute.accessor.type || import_constants22.GL.FLOAT, size)
|
|
4930
4919
|
);
|
|
4931
4920
|
shaderLayout.attributes.push({
|
|
4932
4921
|
name: attribute.name,
|
|
@@ -5015,7 +5004,7 @@ function readVaryings(gl, program) {
|
|
|
5015
5004
|
}
|
|
5016
5005
|
const gl2 = gl;
|
|
5017
5006
|
const varyings = [];
|
|
5018
|
-
const count = gl.getProgramParameter(program, import_constants22.
|
|
5007
|
+
const count = gl.getProgramParameter(program, import_constants22.GL.TRANSFORM_FEEDBACK_VARYINGS);
|
|
5019
5008
|
for (let location = 0; location < count; location++) {
|
|
5020
5009
|
const activeInfo = gl2.getTransformFeedbackVarying(program, location);
|
|
5021
5010
|
if (!activeInfo) {
|
|
@@ -5032,7 +5021,7 @@ function readVaryings(gl, program) {
|
|
|
5032
5021
|
}
|
|
5033
5022
|
function readUniformBindings(gl, program) {
|
|
5034
5023
|
const uniforms = [];
|
|
5035
|
-
const uniformCount = gl.getProgramParameter(program, import_constants22.
|
|
5024
|
+
const uniformCount = gl.getProgramParameter(program, import_constants22.GL.ACTIVE_UNIFORMS);
|
|
5036
5025
|
for (let i = 0; i < uniformCount; i++) {
|
|
5037
5026
|
const activeInfo = gl.getActiveUniform(program, i);
|
|
5038
5027
|
if (!activeInfo) {
|
|
@@ -5071,22 +5060,22 @@ function readUniformBlocks(gl, program) {
|
|
|
5071
5060
|
const gl2 = gl;
|
|
5072
5061
|
const getBlockParameter = (blockIndex, pname) => gl2.getActiveUniformBlockParameter(program, blockIndex, pname);
|
|
5073
5062
|
const uniformBlocks = [];
|
|
5074
|
-
const blockCount = gl2.getProgramParameter(program, import_constants22.
|
|
5063
|
+
const blockCount = gl2.getProgramParameter(program, import_constants22.GL.ACTIVE_UNIFORM_BLOCKS);
|
|
5075
5064
|
for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {
|
|
5076
5065
|
const blockInfo = {
|
|
5077
5066
|
name: gl2.getActiveUniformBlockName(program, blockIndex) || "",
|
|
5078
|
-
location: getBlockParameter(blockIndex, import_constants22.
|
|
5079
|
-
byteLength: getBlockParameter(blockIndex, import_constants22.
|
|
5080
|
-
vertex: getBlockParameter(blockIndex, import_constants22.
|
|
5081
|
-
fragment: getBlockParameter(blockIndex, import_constants22.
|
|
5082
|
-
uniformCount: getBlockParameter(blockIndex, import_constants22.
|
|
5067
|
+
location: getBlockParameter(blockIndex, import_constants22.GL.UNIFORM_BLOCK_BINDING),
|
|
5068
|
+
byteLength: getBlockParameter(blockIndex, import_constants22.GL.UNIFORM_BLOCK_DATA_SIZE),
|
|
5069
|
+
vertex: getBlockParameter(blockIndex, import_constants22.GL.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),
|
|
5070
|
+
fragment: getBlockParameter(blockIndex, import_constants22.GL.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),
|
|
5071
|
+
uniformCount: getBlockParameter(blockIndex, import_constants22.GL.UNIFORM_BLOCK_ACTIVE_UNIFORMS),
|
|
5083
5072
|
uniforms: []
|
|
5084
5073
|
};
|
|
5085
|
-
const uniformIndices = getBlockParameter(blockIndex, import_constants22.
|
|
5086
|
-
const uniformType = gl2.getActiveUniforms(program, uniformIndices, import_constants22.
|
|
5087
|
-
const uniformArrayLength = gl2.getActiveUniforms(program, uniformIndices, import_constants22.
|
|
5088
|
-
const uniformOffset = gl2.getActiveUniforms(program, uniformIndices, import_constants22.
|
|
5089
|
-
const uniformStride = gl2.getActiveUniforms(program, uniformIndices, import_constants22.
|
|
5074
|
+
const uniformIndices = getBlockParameter(blockIndex, import_constants22.GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) || [];
|
|
5075
|
+
const uniformType = gl2.getActiveUniforms(program, uniformIndices, import_constants22.GL.UNIFORM_TYPE);
|
|
5076
|
+
const uniformArrayLength = gl2.getActiveUniforms(program, uniformIndices, import_constants22.GL.UNIFORM_SIZE);
|
|
5077
|
+
const uniformOffset = gl2.getActiveUniforms(program, uniformIndices, import_constants22.GL.UNIFORM_OFFSET);
|
|
5078
|
+
const uniformStride = gl2.getActiveUniforms(program, uniformIndices, import_constants22.GL.UNIFORM_ARRAY_STRIDE);
|
|
5090
5079
|
for (let i = 0; i < blockInfo.uniformCount; ++i) {
|
|
5091
5080
|
const activeInfo = gl2.getActiveUniform(program, uniformIndices[i]);
|
|
5092
5081
|
if (!activeInfo) {
|
|
@@ -5109,21 +5098,21 @@ function readUniformBlocks(gl, program) {
|
|
|
5109
5098
|
return uniformBlocks;
|
|
5110
5099
|
}
|
|
5111
5100
|
var SAMPLER_UNIFORMS_GL_TO_GPU = {
|
|
5112
|
-
[import_constants22.
|
|
5113
|
-
[import_constants22.
|
|
5114
|
-
[import_constants22.
|
|
5115
|
-
[import_constants22.
|
|
5116
|
-
[import_constants22.
|
|
5117
|
-
[import_constants22.
|
|
5118
|
-
[import_constants22.
|
|
5119
|
-
[import_constants22.
|
|
5120
|
-
[import_constants22.
|
|
5121
|
-
[import_constants22.
|
|
5122
|
-
[import_constants22.
|
|
5123
|
-
[import_constants22.
|
|
5124
|
-
[import_constants22.
|
|
5125
|
-
[import_constants22.
|
|
5126
|
-
[import_constants22.
|
|
5101
|
+
[import_constants22.GL.SAMPLER_2D]: ["2d", "float"],
|
|
5102
|
+
[import_constants22.GL.SAMPLER_CUBE]: ["cube", "float"],
|
|
5103
|
+
[import_constants22.GL.SAMPLER_3D]: ["3d", "float"],
|
|
5104
|
+
[import_constants22.GL.SAMPLER_2D_SHADOW]: ["3d", "depth"],
|
|
5105
|
+
[import_constants22.GL.SAMPLER_2D_ARRAY]: ["2d-array", "float"],
|
|
5106
|
+
[import_constants22.GL.SAMPLER_2D_ARRAY_SHADOW]: ["2d-array", "depth"],
|
|
5107
|
+
[import_constants22.GL.SAMPLER_CUBE_SHADOW]: ["cube", "float"],
|
|
5108
|
+
[import_constants22.GL.INT_SAMPLER_2D]: ["2d", "sint"],
|
|
5109
|
+
[import_constants22.GL.INT_SAMPLER_3D]: ["3d", "sint"],
|
|
5110
|
+
[import_constants22.GL.INT_SAMPLER_CUBE]: ["cube", "sint"],
|
|
5111
|
+
[import_constants22.GL.INT_SAMPLER_2D_ARRAY]: ["2d-array", "uint"],
|
|
5112
|
+
[import_constants22.GL.UNSIGNED_INT_SAMPLER_2D]: ["2d", "uint"],
|
|
5113
|
+
[import_constants22.GL.UNSIGNED_INT_SAMPLER_3D]: ["3d", "uint"],
|
|
5114
|
+
[import_constants22.GL.UNSIGNED_INT_SAMPLER_CUBE]: ["cube", "uint"],
|
|
5115
|
+
[import_constants22.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY]: ["2d-array", "uint"]
|
|
5127
5116
|
};
|
|
5128
5117
|
function getSamplerInfo(type) {
|
|
5129
5118
|
const sampler = SAMPLER_UNIFORMS_GL_TO_GPU[type];
|
|
@@ -5154,26 +5143,26 @@ function parseUniformName(name) {
|
|
|
5154
5143
|
}
|
|
5155
5144
|
|
|
5156
5145
|
// src/adapter/helpers/set-uniform.ts
|
|
5157
|
-
var import_constants23 =
|
|
5146
|
+
var import_constants23 = require("@luma.gl/constants");
|
|
5158
5147
|
function setUniform(gl, location, type, value) {
|
|
5159
5148
|
const gl2 = gl;
|
|
5160
5149
|
if (typeof value === "number") {
|
|
5161
5150
|
switch (type) {
|
|
5162
|
-
case import_constants23.
|
|
5163
|
-
case import_constants23.
|
|
5164
|
-
case import_constants23.
|
|
5165
|
-
case import_constants23.
|
|
5166
|
-
case import_constants23.
|
|
5167
|
-
case import_constants23.
|
|
5168
|
-
case import_constants23.
|
|
5169
|
-
case import_constants23.
|
|
5170
|
-
case import_constants23.
|
|
5171
|
-
case import_constants23.
|
|
5172
|
-
case import_constants23.
|
|
5173
|
-
case import_constants23.
|
|
5174
|
-
case import_constants23.
|
|
5175
|
-
case import_constants23.
|
|
5176
|
-
case import_constants23.
|
|
5151
|
+
case import_constants23.GL.SAMPLER_2D:
|
|
5152
|
+
case import_constants23.GL.SAMPLER_CUBE:
|
|
5153
|
+
case import_constants23.GL.SAMPLER_3D:
|
|
5154
|
+
case import_constants23.GL.SAMPLER_2D_SHADOW:
|
|
5155
|
+
case import_constants23.GL.SAMPLER_2D_ARRAY:
|
|
5156
|
+
case import_constants23.GL.SAMPLER_2D_ARRAY_SHADOW:
|
|
5157
|
+
case import_constants23.GL.SAMPLER_CUBE_SHADOW:
|
|
5158
|
+
case import_constants23.GL.INT_SAMPLER_2D:
|
|
5159
|
+
case import_constants23.GL.INT_SAMPLER_3D:
|
|
5160
|
+
case import_constants23.GL.INT_SAMPLER_CUBE:
|
|
5161
|
+
case import_constants23.GL.INT_SAMPLER_2D_ARRAY:
|
|
5162
|
+
case import_constants23.GL.UNSIGNED_INT_SAMPLER_2D:
|
|
5163
|
+
case import_constants23.GL.UNSIGNED_INT_SAMPLER_3D:
|
|
5164
|
+
case import_constants23.GL.UNSIGNED_INT_SAMPLER_CUBE:
|
|
5165
|
+
case import_constants23.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
|
5177
5166
|
return gl.uniform1i(location, value);
|
|
5178
5167
|
}
|
|
5179
5168
|
}
|
|
@@ -5185,55 +5174,55 @@ function setUniform(gl, location, type, value) {
|
|
|
5185
5174
|
}
|
|
5186
5175
|
const arrayValue = typeof value === "number" ? [value] : value;
|
|
5187
5176
|
switch (type) {
|
|
5188
|
-
case import_constants23.
|
|
5177
|
+
case import_constants23.GL.FLOAT:
|
|
5189
5178
|
return gl.uniform1fv(location, arrayValue);
|
|
5190
|
-
case import_constants23.
|
|
5179
|
+
case import_constants23.GL.FLOAT_VEC2:
|
|
5191
5180
|
return gl.uniform2fv(location, arrayValue);
|
|
5192
|
-
case import_constants23.
|
|
5181
|
+
case import_constants23.GL.FLOAT_VEC3:
|
|
5193
5182
|
return gl.uniform3fv(location, arrayValue);
|
|
5194
|
-
case import_constants23.
|
|
5183
|
+
case import_constants23.GL.FLOAT_VEC4:
|
|
5195
5184
|
return gl.uniform4fv(location, arrayValue);
|
|
5196
|
-
case import_constants23.
|
|
5185
|
+
case import_constants23.GL.INT:
|
|
5197
5186
|
return gl.uniform1iv(location, arrayValue);
|
|
5198
|
-
case import_constants23.
|
|
5187
|
+
case import_constants23.GL.INT_VEC2:
|
|
5199
5188
|
return gl.uniform2iv(location, arrayValue);
|
|
5200
|
-
case import_constants23.
|
|
5189
|
+
case import_constants23.GL.INT_VEC3:
|
|
5201
5190
|
return gl.uniform3iv(location, arrayValue);
|
|
5202
|
-
case import_constants23.
|
|
5191
|
+
case import_constants23.GL.INT_VEC4:
|
|
5203
5192
|
return gl.uniform4iv(location, arrayValue);
|
|
5204
|
-
case import_constants23.
|
|
5193
|
+
case import_constants23.GL.BOOL:
|
|
5205
5194
|
return gl.uniform1iv(location, arrayValue);
|
|
5206
|
-
case import_constants23.
|
|
5195
|
+
case import_constants23.GL.BOOL_VEC2:
|
|
5207
5196
|
return gl.uniform2iv(location, arrayValue);
|
|
5208
|
-
case import_constants23.
|
|
5197
|
+
case import_constants23.GL.BOOL_VEC3:
|
|
5209
5198
|
return gl.uniform3iv(location, arrayValue);
|
|
5210
|
-
case import_constants23.
|
|
5199
|
+
case import_constants23.GL.BOOL_VEC4:
|
|
5211
5200
|
return gl.uniform4iv(location, arrayValue);
|
|
5212
|
-
case import_constants23.
|
|
5201
|
+
case import_constants23.GL.UNSIGNED_INT:
|
|
5213
5202
|
return gl2.uniform1uiv(location, arrayValue, 1);
|
|
5214
|
-
case import_constants23.
|
|
5203
|
+
case import_constants23.GL.UNSIGNED_INT_VEC2:
|
|
5215
5204
|
return gl2.uniform2uiv(location, arrayValue, 2);
|
|
5216
|
-
case import_constants23.
|
|
5205
|
+
case import_constants23.GL.UNSIGNED_INT_VEC3:
|
|
5217
5206
|
return gl2.uniform3uiv(location, arrayValue, 3);
|
|
5218
|
-
case import_constants23.
|
|
5207
|
+
case import_constants23.GL.UNSIGNED_INT_VEC4:
|
|
5219
5208
|
return gl2.uniform4uiv(location, arrayValue, 4);
|
|
5220
|
-
case import_constants23.
|
|
5209
|
+
case import_constants23.GL.FLOAT_MAT2:
|
|
5221
5210
|
return gl.uniformMatrix2fv(location, false, arrayValue);
|
|
5222
|
-
case import_constants23.
|
|
5211
|
+
case import_constants23.GL.FLOAT_MAT3:
|
|
5223
5212
|
return gl.uniformMatrix3fv(location, false, arrayValue);
|
|
5224
|
-
case import_constants23.
|
|
5213
|
+
case import_constants23.GL.FLOAT_MAT4:
|
|
5225
5214
|
return gl.uniformMatrix4fv(location, false, arrayValue);
|
|
5226
|
-
case import_constants23.
|
|
5215
|
+
case import_constants23.GL.FLOAT_MAT2x3:
|
|
5227
5216
|
return gl2.uniformMatrix2x3fv(location, false, arrayValue);
|
|
5228
|
-
case import_constants23.
|
|
5217
|
+
case import_constants23.GL.FLOAT_MAT2x4:
|
|
5229
5218
|
return gl2.uniformMatrix2x4fv(location, false, arrayValue);
|
|
5230
|
-
case import_constants23.
|
|
5219
|
+
case import_constants23.GL.FLOAT_MAT3x2:
|
|
5231
5220
|
return gl2.uniformMatrix3x2fv(location, false, arrayValue);
|
|
5232
|
-
case import_constants23.
|
|
5221
|
+
case import_constants23.GL.FLOAT_MAT3x4:
|
|
5233
5222
|
return gl2.uniformMatrix3x4fv(location, false, arrayValue);
|
|
5234
|
-
case import_constants23.
|
|
5223
|
+
case import_constants23.GL.FLOAT_MAT4x2:
|
|
5235
5224
|
return gl2.uniformMatrix4x2fv(location, false, arrayValue);
|
|
5236
|
-
case import_constants23.
|
|
5225
|
+
case import_constants23.GL.FLOAT_MAT4x3:
|
|
5237
5226
|
return gl2.uniformMatrix4x3fv(location, false, arrayValue);
|
|
5238
5227
|
}
|
|
5239
5228
|
throw new Error("Illegal uniform");
|
|
@@ -5241,7 +5230,7 @@ function setUniform(gl, location, type, value) {
|
|
|
5241
5230
|
|
|
5242
5231
|
// src/adapter/objects/webgl-vertex-array-object.ts
|
|
5243
5232
|
var import_api22 = require("@luma.gl/api");
|
|
5244
|
-
var import_constants24 =
|
|
5233
|
+
var import_constants24 = require("@luma.gl/constants");
|
|
5245
5234
|
var import_env = require("@probe.gl/env");
|
|
5246
5235
|
var ERR_ELEMENTS = "elements must be GL.ELEMENT_ARRAY_BUFFER";
|
|
5247
5236
|
var WEBGLVertexArrayObject = class extends WebGLResource {
|
|
@@ -5264,15 +5253,15 @@ var WEBGLVertexArrayObject = class extends WebGLResource {
|
|
|
5264
5253
|
// Set (bind) an elements buffer, for indexed rendering.
|
|
5265
5254
|
// Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported
|
|
5266
5255
|
setElementBuffer(elementBuffer = null, opts = {}) {
|
|
5267
|
-
(0, import_api22.assert)(!elementBuffer || elementBuffer.target === import_constants24.
|
|
5256
|
+
(0, import_api22.assert)(!elementBuffer || elementBuffer.target === import_constants24.GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);
|
|
5268
5257
|
this.bind(() => {
|
|
5269
|
-
this.gl.bindBuffer(import_constants24.
|
|
5258
|
+
this.gl.bindBuffer(import_constants24.GL.ELEMENT_ARRAY_BUFFER, elementBuffer ? elementBuffer.handle : null);
|
|
5270
5259
|
});
|
|
5271
5260
|
return this;
|
|
5272
5261
|
}
|
|
5273
5262
|
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
5274
5263
|
setBuffer(location, buffer, accessor) {
|
|
5275
|
-
if (buffer.target === import_constants24.
|
|
5264
|
+
if (buffer.target === import_constants24.GL.ELEMENT_ARRAY_BUFFER) {
|
|
5276
5265
|
return this.setElementBuffer(buffer, accessor);
|
|
5277
5266
|
}
|
|
5278
5267
|
const { size, type, stride, offset, normalized, integer, divisor } = accessor;
|
|
@@ -5331,7 +5320,7 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5331
5320
|
this.device.setSpectorMetadata(this.handle, { id: this.props.id });
|
|
5332
5321
|
this.vs = (0, import_api23.cast)(props.vs);
|
|
5333
5322
|
this.fs = (0, import_api23.cast)(props.fs);
|
|
5334
|
-
const { varyings, bufferMode = import_constants25.
|
|
5323
|
+
const { varyings, bufferMode = import_constants25.GL.SEPARATE_ATTRIBS } = props;
|
|
5335
5324
|
if (varyings && varyings.length > 0) {
|
|
5336
5325
|
this.device.assertWebGL2();
|
|
5337
5326
|
this.varyings = varyings;
|
|
@@ -5428,7 +5417,7 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5428
5417
|
} = options;
|
|
5429
5418
|
const drawMode = getDrawMode(this.props.topology);
|
|
5430
5419
|
const isIndexed = Boolean(this._indexBuffer);
|
|
5431
|
-
const indexType = ((_a = this._indexBuffer) == null ? void 0 : _a.props.indexType) === "uint16" ? import_constants25.
|
|
5420
|
+
const indexType = ((_a = this._indexBuffer) == null ? void 0 : _a.props.indexType) === "uint16" ? import_constants25.GL.UNSIGNED_SHORT : import_constants25.GL.UNSIGNED_INT;
|
|
5432
5421
|
const isInstanced = Number(options.instanceCount) > 0;
|
|
5433
5422
|
if (!this._areTexturesRenderable() || options.vertexCount === 0) {
|
|
5434
5423
|
return false;
|
|
@@ -5528,15 +5517,15 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5528
5517
|
case "uniform":
|
|
5529
5518
|
const { name } = binding;
|
|
5530
5519
|
const location = gl2.getUniformBlockIndex(this.handle, name);
|
|
5531
|
-
if (location === import_constants25.
|
|
5520
|
+
if (location === import_constants25.GL.INVALID_INDEX) {
|
|
5532
5521
|
throw new Error(`Invalid uniform block name ${name}`);
|
|
5533
5522
|
}
|
|
5534
5523
|
gl2.uniformBlockBinding(this.handle, uniformBufferIndex, location);
|
|
5535
5524
|
if (value instanceof WEBGLBuffer) {
|
|
5536
|
-
gl2.bindBufferBase(import_constants25.
|
|
5525
|
+
gl2.bindBufferBase(import_constants25.GL.UNIFORM_BUFFER, uniformBufferIndex, value.handle);
|
|
5537
5526
|
} else {
|
|
5538
5527
|
gl2.bindBufferRange(
|
|
5539
|
-
import_constants25.
|
|
5528
|
+
import_constants25.GL.UNIFORM_BUFFER,
|
|
5540
5529
|
uniformBufferIndex,
|
|
5541
5530
|
value.buffer.handle,
|
|
5542
5531
|
value.offset || 0,
|
|
@@ -5550,7 +5539,7 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5550
5539
|
throw new Error("texture");
|
|
5551
5540
|
}
|
|
5552
5541
|
const texture = value;
|
|
5553
|
-
gl2.activeTexture(import_constants25.
|
|
5542
|
+
gl2.activeTexture(import_constants25.GL.TEXTURE0 + textureUnit);
|
|
5554
5543
|
gl2.bindTexture(texture.target, texture.handle);
|
|
5555
5544
|
textureUnit += 1;
|
|
5556
5545
|
break;
|
|
@@ -5576,19 +5565,19 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5576
5565
|
function getDrawMode(topology) {
|
|
5577
5566
|
switch (topology) {
|
|
5578
5567
|
case "point-list":
|
|
5579
|
-
return import_constants25.
|
|
5568
|
+
return import_constants25.GL.POINTS;
|
|
5580
5569
|
case "line-list":
|
|
5581
|
-
return import_constants25.
|
|
5570
|
+
return import_constants25.GL.LINES;
|
|
5582
5571
|
case "line-strip":
|
|
5583
|
-
return import_constants25.
|
|
5572
|
+
return import_constants25.GL.LINE_STRIP;
|
|
5584
5573
|
case "line-loop":
|
|
5585
|
-
return import_constants25.
|
|
5574
|
+
return import_constants25.GL.LINE_LOOP;
|
|
5586
5575
|
case "triangle-list":
|
|
5587
|
-
return import_constants25.
|
|
5576
|
+
return import_constants25.GL.TRIANGLES;
|
|
5588
5577
|
case "triangle-strip":
|
|
5589
|
-
return import_constants25.
|
|
5578
|
+
return import_constants25.GL.TRIANGLE_STRIP;
|
|
5590
5579
|
case "triangle-fan":
|
|
5591
|
-
return import_constants25.
|
|
5580
|
+
return import_constants25.GL.TRIANGLE_FAN;
|
|
5592
5581
|
default:
|
|
5593
5582
|
throw new Error(topology);
|
|
5594
5583
|
}
|
|
@@ -5596,19 +5585,19 @@ function getDrawMode(topology) {
|
|
|
5596
5585
|
function getGLPrimitive(topology) {
|
|
5597
5586
|
switch (topology) {
|
|
5598
5587
|
case "point-list":
|
|
5599
|
-
return import_constants25.
|
|
5588
|
+
return import_constants25.GL.POINTS;
|
|
5600
5589
|
case "line-list":
|
|
5601
|
-
return import_constants25.
|
|
5590
|
+
return import_constants25.GL.LINES;
|
|
5602
5591
|
case "line-strip":
|
|
5603
|
-
return import_constants25.
|
|
5592
|
+
return import_constants25.GL.LINES;
|
|
5604
5593
|
case "line-loop":
|
|
5605
|
-
return import_constants25.
|
|
5594
|
+
return import_constants25.GL.LINES;
|
|
5606
5595
|
case "triangle-list":
|
|
5607
|
-
return import_constants25.
|
|
5596
|
+
return import_constants25.GL.TRIANGLES;
|
|
5608
5597
|
case "triangle-strip":
|
|
5609
|
-
return import_constants25.
|
|
5598
|
+
return import_constants25.GL.TRIANGLES;
|
|
5610
5599
|
case "triangle-fan":
|
|
5611
|
-
return import_constants25.
|
|
5600
|
+
return import_constants25.GL.TRIANGLES;
|
|
5612
5601
|
default:
|
|
5613
5602
|
throw new Error(topology);
|
|
5614
5603
|
}
|
|
@@ -5622,7 +5611,7 @@ var import_api25 = require("@luma.gl/api");
|
|
|
5622
5611
|
|
|
5623
5612
|
// src/adapter/resources/webgl-command-buffer.ts
|
|
5624
5613
|
var import_api24 = require("@luma.gl/api");
|
|
5625
|
-
var import_constants26 =
|
|
5614
|
+
var import_constants26 = require("@luma.gl/constants");
|
|
5626
5615
|
function cast3(value) {
|
|
5627
5616
|
return value;
|
|
5628
5617
|
}
|
|
@@ -5657,17 +5646,17 @@ function _copyBufferToBuffer(device, options) {
|
|
|
5657
5646
|
const destination = cast3(options.destination);
|
|
5658
5647
|
const gl2 = device.assertWebGL2();
|
|
5659
5648
|
if (gl2) {
|
|
5660
|
-
gl2.bindBuffer(import_constants26.
|
|
5661
|
-
gl2.bindBuffer(import_constants26.
|
|
5649
|
+
gl2.bindBuffer(import_constants26.GL.COPY_READ_BUFFER, source.handle);
|
|
5650
|
+
gl2.bindBuffer(import_constants26.GL.COPY_WRITE_BUFFER, destination.handle);
|
|
5662
5651
|
gl2.copyBufferSubData(
|
|
5663
|
-
import_constants26.
|
|
5664
|
-
import_constants26.
|
|
5652
|
+
import_constants26.GL.COPY_READ_BUFFER,
|
|
5653
|
+
import_constants26.GL.COPY_WRITE_BUFFER,
|
|
5665
5654
|
(_a = options.sourceOffset) != null ? _a : 0,
|
|
5666
5655
|
(_b = options.destinationOffset) != null ? _b : 0,
|
|
5667
5656
|
options.size
|
|
5668
5657
|
);
|
|
5669
|
-
gl2.bindBuffer(import_constants26.
|
|
5670
|
-
gl2.bindBuffer(import_constants26.
|
|
5658
|
+
gl2.bindBuffer(import_constants26.GL.COPY_READ_BUFFER, null);
|
|
5659
|
+
gl2.bindBuffer(import_constants26.GL.COPY_WRITE_BUFFER, null);
|
|
5671
5660
|
} else {
|
|
5672
5661
|
throw new Error("copyBufferToBuffer not implemented in WebGL1");
|
|
5673
5662
|
}
|
|
@@ -5718,10 +5707,10 @@ function _copyTextureToBuffer(device, options) {
|
|
|
5718
5707
|
const webglBuffer = destination;
|
|
5719
5708
|
const sourceWidth = width || framebuffer.width;
|
|
5720
5709
|
const sourceHeight = height || framebuffer.height;
|
|
5721
|
-
const sourceFormat = import_constants26.
|
|
5722
|
-
const sourceType = import_constants26.
|
|
5723
|
-
gl2.bindBuffer(import_constants26.
|
|
5724
|
-
gl2.bindFramebuffer(import_constants26.
|
|
5710
|
+
const sourceFormat = import_constants26.GL.RGBA;
|
|
5711
|
+
const sourceType = import_constants26.GL.UNSIGNED_BYTE;
|
|
5712
|
+
gl2.bindBuffer(import_constants26.GL.PIXEL_PACK_BUFFER, webglBuffer.handle);
|
|
5713
|
+
gl2.bindFramebuffer(import_constants26.GL.FRAMEBUFFER, framebuffer.handle);
|
|
5725
5714
|
gl2.readPixels(
|
|
5726
5715
|
origin[0],
|
|
5727
5716
|
origin[1],
|
|
@@ -5732,8 +5721,8 @@ function _copyTextureToBuffer(device, options) {
|
|
|
5732
5721
|
byteOffset
|
|
5733
5722
|
);
|
|
5734
5723
|
} finally {
|
|
5735
|
-
gl2.bindBuffer(import_constants26.
|
|
5736
|
-
gl2.bindFramebuffer(import_constants26.
|
|
5724
|
+
gl2.bindBuffer(import_constants26.GL.PIXEL_PACK_BUFFER, null);
|
|
5725
|
+
gl2.bindFramebuffer(import_constants26.GL.FRAMEBUFFER, null);
|
|
5737
5726
|
if (destroyFramebuffer) {
|
|
5738
5727
|
framebuffer.destroy();
|
|
5739
5728
|
}
|
|
@@ -5764,11 +5753,11 @@ function _copyTextureToTexture(device, options) {
|
|
|
5764
5753
|
// depthOrArrayLayers = 0
|
|
5765
5754
|
} = options;
|
|
5766
5755
|
const destinationMipmaplevel = 0;
|
|
5767
|
-
const destinationInternalFormat = import_constants26.
|
|
5756
|
+
const destinationInternalFormat = import_constants26.GL.RGBA;
|
|
5768
5757
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
5769
5758
|
const [sourceX, sourceY] = origin;
|
|
5770
5759
|
const isSubCopy = false;
|
|
5771
|
-
device.gl.bindFramebuffer(import_constants26.
|
|
5760
|
+
device.gl.bindFramebuffer(import_constants26.GL.FRAMEBUFFER, framebuffer.handle);
|
|
5772
5761
|
let texture = null;
|
|
5773
5762
|
let textureTarget;
|
|
5774
5763
|
if (destination instanceof WEBGLTexture) {
|
|
@@ -5797,7 +5786,7 @@ function _copyTextureToTexture(device, options) {
|
|
|
5797
5786
|
if (texture) {
|
|
5798
5787
|
texture.unbind();
|
|
5799
5788
|
}
|
|
5800
|
-
device.gl.bindFramebuffer(import_constants26.
|
|
5789
|
+
device.gl.bindFramebuffer(import_constants26.GL.FRAMEBUFFER, prevHandle || null);
|
|
5801
5790
|
if (destroyFramebuffer) {
|
|
5802
5791
|
framebuffer.destroy();
|
|
5803
5792
|
}
|
|
@@ -6019,7 +6008,7 @@ var _WebGLDevice = class extends import_api26.Device {
|
|
|
6019
6008
|
}
|
|
6020
6009
|
createBuffer(props) {
|
|
6021
6010
|
const newProps = this._getBufferProps(props);
|
|
6022
|
-
return new
|
|
6011
|
+
return new BufferWithAccessor(this, newProps);
|
|
6023
6012
|
}
|
|
6024
6013
|
_createTexture(props) {
|
|
6025
6014
|
return new WEBGLTexture(this, props);
|
|
@@ -6182,25 +6171,25 @@ function clear(gl, options) {
|
|
|
6182
6171
|
|
|
6183
6172
|
// src/classic/copy-and-blit.ts
|
|
6184
6173
|
var import_api29 = require("@luma.gl/api");
|
|
6185
|
-
var import_constants28 =
|
|
6174
|
+
var import_constants28 = require("@luma.gl/constants");
|
|
6186
6175
|
|
|
6187
6176
|
// src/classic/format-utils.ts
|
|
6188
6177
|
var import_api28 = require("@luma.gl/api");
|
|
6189
|
-
var import_constants27 =
|
|
6178
|
+
var import_constants27 = require("@luma.gl/constants");
|
|
6190
6179
|
function glFormatToComponents(format) {
|
|
6191
6180
|
switch (format) {
|
|
6192
|
-
case import_constants27.
|
|
6193
|
-
case import_constants27.
|
|
6194
|
-
case import_constants27.
|
|
6181
|
+
case import_constants27.GL.ALPHA:
|
|
6182
|
+
case import_constants27.GL.R32F:
|
|
6183
|
+
case import_constants27.GL.RED:
|
|
6195
6184
|
return 1;
|
|
6196
|
-
case import_constants27.
|
|
6197
|
-
case import_constants27.
|
|
6185
|
+
case import_constants27.GL.RG32F:
|
|
6186
|
+
case import_constants27.GL.RG:
|
|
6198
6187
|
return 2;
|
|
6199
|
-
case import_constants27.
|
|
6200
|
-
case import_constants27.
|
|
6188
|
+
case import_constants27.GL.RGB:
|
|
6189
|
+
case import_constants27.GL.RGB32F:
|
|
6201
6190
|
return 3;
|
|
6202
|
-
case import_constants27.
|
|
6203
|
-
case import_constants27.
|
|
6191
|
+
case import_constants27.GL.RGBA:
|
|
6192
|
+
case import_constants27.GL.RGBA32F:
|
|
6204
6193
|
return 4;
|
|
6205
6194
|
default:
|
|
6206
6195
|
(0, import_api28.assert)(false);
|
|
@@ -6209,13 +6198,13 @@ function glFormatToComponents(format) {
|
|
|
6209
6198
|
}
|
|
6210
6199
|
function glTypeToBytes(type) {
|
|
6211
6200
|
switch (type) {
|
|
6212
|
-
case import_constants27.
|
|
6201
|
+
case import_constants27.GL.UNSIGNED_BYTE:
|
|
6213
6202
|
return 1;
|
|
6214
|
-
case import_constants27.
|
|
6215
|
-
case import_constants27.
|
|
6216
|
-
case import_constants27.
|
|
6203
|
+
case import_constants27.GL.UNSIGNED_SHORT_5_6_5:
|
|
6204
|
+
case import_constants27.GL.UNSIGNED_SHORT_4_4_4_4:
|
|
6205
|
+
case import_constants27.GL.UNSIGNED_SHORT_5_5_5_1:
|
|
6217
6206
|
return 2;
|
|
6218
|
-
case import_constants27.
|
|
6207
|
+
case import_constants27.GL.FLOAT:
|
|
6219
6208
|
return 4;
|
|
6220
6209
|
default:
|
|
6221
6210
|
(0, import_api28.assert)(false);
|
|
@@ -6225,9 +6214,9 @@ function glTypeToBytes(type) {
|
|
|
6225
6214
|
|
|
6226
6215
|
// src/classic/copy-and-blit.ts
|
|
6227
6216
|
function readPixelsToArray(source, options) {
|
|
6228
|
-
const { sourceX = 0, sourceY = 0, sourceFormat = import_constants28.
|
|
6217
|
+
const { sourceX = 0, sourceY = 0, sourceFormat = import_constants28.GL.RGBA } = options || {};
|
|
6229
6218
|
let {
|
|
6230
|
-
sourceAttachment = import_constants28.
|
|
6219
|
+
sourceAttachment = import_constants28.GL.COLOR_ATTACHMENT0,
|
|
6231
6220
|
// TODO - support gl.readBuffer
|
|
6232
6221
|
target = null,
|
|
6233
6222
|
// following parameters are auto deduced if not provided
|
|
@@ -6240,23 +6229,23 @@ function readPixelsToArray(source, options) {
|
|
|
6240
6229
|
const { gl, handle } = framebuffer;
|
|
6241
6230
|
sourceWidth = sourceWidth || framebuffer.width;
|
|
6242
6231
|
sourceHeight = sourceHeight || framebuffer.height;
|
|
6243
|
-
if (sourceAttachment === import_constants28.
|
|
6244
|
-
sourceAttachment = import_constants28.
|
|
6232
|
+
if (sourceAttachment === import_constants28.GL.COLOR_ATTACHMENT0 && handle === null) {
|
|
6233
|
+
sourceAttachment = import_constants28.GL.FRONT;
|
|
6245
6234
|
}
|
|
6246
|
-
const attachment = sourceAttachment - import_constants28.
|
|
6235
|
+
const attachment = sourceAttachment - import_constants28.GL.COLOR_ATTACHMENT0;
|
|
6247
6236
|
sourceType = sourceType || framebuffer.colorAttachments[attachment].type;
|
|
6248
6237
|
target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);
|
|
6249
6238
|
sourceType = sourceType || getGLTypeFromTypedArray(target);
|
|
6250
|
-
const prevHandle2 = gl.bindFramebuffer(import_constants28.
|
|
6239
|
+
const prevHandle2 = gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, handle);
|
|
6251
6240
|
gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);
|
|
6252
|
-
gl.bindFramebuffer(import_constants28.
|
|
6241
|
+
gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, prevHandle2 || null);
|
|
6253
6242
|
if (deleteFramebuffer) {
|
|
6254
6243
|
framebuffer.destroy();
|
|
6255
6244
|
}
|
|
6256
6245
|
return target;
|
|
6257
6246
|
}
|
|
6258
6247
|
function readPixelsToBuffer(source, options) {
|
|
6259
|
-
const { sourceX = 0, sourceY = 0, sourceFormat = import_constants28.
|
|
6248
|
+
const { sourceX = 0, sourceY = 0, sourceFormat = import_constants28.GL.RGBA, targetByteOffset = 0 } = options || {};
|
|
6260
6249
|
let { target, sourceWidth, sourceHeight, sourceType } = options || {};
|
|
6261
6250
|
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
6262
6251
|
(0, import_api29.assert)(framebuffer);
|
|
@@ -6264,14 +6253,14 @@ function readPixelsToBuffer(source, options) {
|
|
|
6264
6253
|
sourceHeight = sourceHeight || framebuffer.height;
|
|
6265
6254
|
const webglFramebuffer = framebuffer;
|
|
6266
6255
|
const gl2 = webglFramebuffer.device.assertWebGL2();
|
|
6267
|
-
sourceType = sourceType || (target ? target.type : import_constants28.
|
|
6256
|
+
sourceType = sourceType || (target ? target.type : import_constants28.GL.UNSIGNED_BYTE);
|
|
6268
6257
|
if (!target) {
|
|
6269
6258
|
const components = glFormatToComponents(sourceFormat);
|
|
6270
6259
|
const byteCount = glTypeToBytes(sourceType);
|
|
6271
6260
|
const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;
|
|
6272
|
-
target = new
|
|
6261
|
+
target = new BufferWithAccessor(gl2, { byteLength, accessor: { type: sourceType, size: components } });
|
|
6273
6262
|
}
|
|
6274
|
-
target.bind({ target: import_constants28.
|
|
6263
|
+
target.bind({ target: import_constants28.GL.PIXEL_PACK_BUFFER });
|
|
6275
6264
|
withParameters(gl2, { framebuffer }, () => {
|
|
6276
6265
|
gl2.readPixels(
|
|
6277
6266
|
sourceX,
|
|
@@ -6283,7 +6272,7 @@ function readPixelsToBuffer(source, options) {
|
|
|
6283
6272
|
targetByteOffset
|
|
6284
6273
|
);
|
|
6285
6274
|
});
|
|
6286
|
-
target.unbind({ target: import_constants28.
|
|
6275
|
+
target.unbind({ target: import_constants28.GL.PIXEL_PACK_BUFFER });
|
|
6287
6276
|
if (deleteFramebuffer) {
|
|
6288
6277
|
framebuffer.destroy();
|
|
6289
6278
|
}
|
|
@@ -6313,7 +6302,7 @@ function getPixelArray(pixelArray, type, format, width, height) {
|
|
|
6313
6302
|
if (pixelArray) {
|
|
6314
6303
|
return pixelArray;
|
|
6315
6304
|
}
|
|
6316
|
-
type = type || import_constants28.
|
|
6305
|
+
type = type || import_constants28.GL.UNSIGNED_BYTE;
|
|
6317
6306
|
const ArrayType = getTypedArrayFromGLType(type, { clamped: false });
|
|
6318
6307
|
const components = glFormatToComponents(format);
|
|
6319
6308
|
return new ArrayType(width * height * components);
|