@luma.gl/webgl 9.0.0-alpha.23 → 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 +3 -3
- 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 +2 -2
- 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-info.d.ts +1 -1
- package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +1 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.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 +2 -2
- 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.d.ts +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +1 -1
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +6 -6
- 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 +3 -3
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +3 -2
- 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.d.ts +5 -5
- package/dist/adapter/resources/webgl-texture.d.ts.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.d.ts +22 -0
- package/dist/classic/clear.d.ts.map +1 -0
- package/dist/classic/clear.js +88 -0
- package/dist/classic/clear.js.map +1 -0
- package/dist/classic/copy-and-blit.d.ts +45 -0
- package/dist/classic/copy-and-blit.d.ts.map +1 -0
- package/dist/classic/copy-and-blit.js +136 -0
- package/dist/classic/copy-and-blit.js.map +1 -0
- package/dist/classic/format-utils.d.ts +3 -0
- package/dist/classic/format-utils.d.ts.map +1 -0
- package/dist/classic/format-utils.js +38 -0
- package/dist/classic/format-utils.js.map +1 -0
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/context/context/create-browser-context.d.ts +17 -19
- package/dist/context/context/create-browser-context.d.ts.map +1 -1
- package/dist/context/context/create-browser-context.js +4 -4
- package/dist/context/context/create-browser-context.js.map +1 -1
- package/dist/context/context/create-headless-context.d.ts +1 -1
- package/dist/context/context/create-headless-context.d.ts.map +1 -1
- package/dist/context/debug/spector.d.ts +1 -3
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.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.d.ts +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts.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 +251 -83
- package/dist/index.cjs +694 -520
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist.min.js +22 -22
- 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 +2 -2
- 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/clear.ts +110 -0
- package/src/classic/copy-and-blit.ts +189 -0
- package/src/classic/format-utils.ts +43 -0
- package/src/context/context/create-browser-context.ts +37 -30
- 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 +8 -3
- 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,
|
|
@@ -87,6 +76,7 @@ __export(src_exports, {
|
|
|
87
76
|
_checkFloat32ColorAttachment: () => _checkFloat32ColorAttachment,
|
|
88
77
|
assertWebGL2Context: () => assertWebGL2Context,
|
|
89
78
|
assertWebGLContext: () => assertWebGLContext,
|
|
79
|
+
clear: () => clear,
|
|
90
80
|
convertGLToTextureFormat: () => convertGLToTextureFormat,
|
|
91
81
|
getParameters: () => getParameters,
|
|
92
82
|
getProgramBindings: () => getProgramBindings,
|
|
@@ -97,6 +87,8 @@ __export(src_exports, {
|
|
|
97
87
|
polyfillContext: () => polyfillContext,
|
|
98
88
|
popContextState: () => popContextState,
|
|
99
89
|
pushContextState: () => pushContextState,
|
|
90
|
+
readPixelsToArray: () => readPixelsToArray,
|
|
91
|
+
readPixelsToBuffer: () => readPixelsToBuffer,
|
|
100
92
|
registerHeadlessGL: () => registerHeadlessGL,
|
|
101
93
|
resetParameters: () => resetParameters,
|
|
102
94
|
setDeviceParameters: () => setDeviceParameters,
|
|
@@ -429,7 +421,7 @@ function polyfillVertexArrayObject(gl) {
|
|
|
429
421
|
|
|
430
422
|
// src/context/polyfill/polyfill-table.ts
|
|
431
423
|
var import_api2 = require("@luma.gl/api");
|
|
432
|
-
var import_constants2 =
|
|
424
|
+
var import_constants2 = require("@luma.gl/constants");
|
|
433
425
|
|
|
434
426
|
// src/context/context/webgl-checks.ts
|
|
435
427
|
var import_api = require("@luma.gl/api");
|
|
@@ -463,7 +455,7 @@ function assertWebGL2Context(gl) {
|
|
|
463
455
|
}
|
|
464
456
|
|
|
465
457
|
// src/context/polyfill/get-parameter-polyfill.ts
|
|
466
|
-
var import_constants =
|
|
458
|
+
var import_constants = require("@luma.gl/constants");
|
|
467
459
|
var OES_element_index = "OES_element_index";
|
|
468
460
|
var WEBGL_draw_buffers = "WEBGL_draw_buffers";
|
|
469
461
|
var EXT_disjoint_timer_query = "EXT_disjoint_timer_query";
|
|
@@ -478,11 +470,11 @@ var GL_UNMASKED_VENDOR_WEBGL = 37445;
|
|
|
478
470
|
var GL_UNMASKED_RENDERER_WEBGL = 37446;
|
|
479
471
|
var getWebGL2ValueOrZero = (gl) => !isWebGL2(gl) ? 0 : void 0;
|
|
480
472
|
var WEBGL_PARAMETERS = {
|
|
481
|
-
[import_constants.
|
|
473
|
+
[import_constants.GL.READ_BUFFER]: (gl) => !isWebGL2(gl) ? import_constants.GL.COLOR_ATTACHMENT0 : void 0,
|
|
482
474
|
// WebGL2 context parameters
|
|
483
475
|
[GL_FRAGMENT_SHADER_DERIVATIVE_HINT]: (gl) => !isWebGL2(gl) ? GL_DONT_CARE : void 0,
|
|
484
|
-
[import_constants.
|
|
485
|
-
[import_constants.
|
|
476
|
+
[import_constants.GL.RASTERIZER_DISCARD]: getWebGL2ValueOrZero,
|
|
477
|
+
[import_constants.GL.SAMPLES]: getWebGL2ValueOrZero,
|
|
486
478
|
// WebGL2 extension context parameters
|
|
487
479
|
[GL_GPU_DISJOINT_EXT]: (gl, getParameter) => {
|
|
488
480
|
const ext = isWebGL2(gl) ? gl.getExtension(EXT_disjoint_timer_query_webgl2) : gl.getExtension(EXT_disjoint_timer_query);
|
|
@@ -491,11 +483,11 @@ var WEBGL_PARAMETERS = {
|
|
|
491
483
|
// Extension fixed values
|
|
492
484
|
[GL_UNMASKED_VENDOR_WEBGL]: (gl, getParameter) => {
|
|
493
485
|
const ext = gl.getExtension(WEBGL_debug_renderer_info);
|
|
494
|
-
return getParameter(ext && ext.UNMASKED_VENDOR_WEBGL || import_constants.
|
|
486
|
+
return getParameter(ext && ext.UNMASKED_VENDOR_WEBGL || import_constants.GL.VENDOR);
|
|
495
487
|
},
|
|
496
488
|
[GL_UNMASKED_RENDERER_WEBGL]: (gl, getParameter) => {
|
|
497
489
|
const ext = gl.getExtension(WEBGL_debug_renderer_info);
|
|
498
|
-
return getParameter(ext && ext.UNMASKED_RENDERER_WEBGL || import_constants.
|
|
490
|
+
return getParameter(ext && ext.UNMASKED_RENDERER_WEBGL || import_constants.GL.RENDERER);
|
|
499
491
|
},
|
|
500
492
|
// Extension LIMITS
|
|
501
493
|
[GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT]: (gl, getParameter) => {
|
|
@@ -504,56 +496,56 @@ var WEBGL_PARAMETERS = {
|
|
|
504
496
|
return ext ? getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 1;
|
|
505
497
|
},
|
|
506
498
|
// WebGL2 Limits
|
|
507
|
-
[import_constants.
|
|
508
|
-
[import_constants.
|
|
509
|
-
[import_constants.
|
|
510
|
-
[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) => {
|
|
511
503
|
if (!isWebGL2(gl)) {
|
|
512
504
|
const ext = gl.getExtension(WEBGL_draw_buffers);
|
|
513
505
|
return ext ? getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL) : 0;
|
|
514
506
|
}
|
|
515
507
|
return void 0;
|
|
516
508
|
},
|
|
517
|
-
[import_constants.
|
|
518
|
-
[import_constants.
|
|
519
|
-
[import_constants.
|
|
520
|
-
[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) => {
|
|
521
513
|
if (!isWebGL2(gl)) {
|
|
522
514
|
const ext = gl.getExtension(WEBGL_draw_buffers);
|
|
523
515
|
return ext ? ext.MAX_DRAW_BUFFERS_WEBGL : 0;
|
|
524
516
|
}
|
|
525
517
|
return void 0;
|
|
526
518
|
},
|
|
527
|
-
[import_constants.
|
|
519
|
+
[import_constants.GL.MAX_ELEMENT_INDEX]: (
|
|
528
520
|
// Guess: per webglstats.com 99.6% of webgl2 supports 2147483647
|
|
529
521
|
(gl) => gl.getExtension(OES_element_index) ? 2147483647 : 65535
|
|
530
522
|
),
|
|
531
|
-
[import_constants.
|
|
523
|
+
[import_constants.GL.MAX_ELEMENTS_INDICES]: (
|
|
532
524
|
// Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices)
|
|
533
525
|
(gl) => gl.getExtension(OES_element_index) ? 16777216 : 65535
|
|
534
526
|
),
|
|
535
|
-
[import_constants.
|
|
527
|
+
[import_constants.GL.MAX_ELEMENTS_VERTICES]: (
|
|
536
528
|
// Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices)
|
|
537
529
|
(gl) => 16777216
|
|
538
530
|
),
|
|
539
|
-
[import_constants.
|
|
540
|
-
[import_constants.
|
|
541
|
-
[import_constants.
|
|
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.
|
|
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
|
|
557
549
|
};
|
|
558
550
|
function getParameterPolyfill(gl, originalGetParameter, pname) {
|
|
559
551
|
const limit = WEBGL_PARAMETERS[pname];
|
|
@@ -663,10 +655,10 @@ var WEBGL2_CONTEXT_OVERRIDES = {
|
|
|
663
655
|
const { webgl2, ext } = getExtensionData(gl, ANGLE_instanced_arrays);
|
|
664
656
|
let result;
|
|
665
657
|
switch (pname) {
|
|
666
|
-
case import_constants2.
|
|
658
|
+
case import_constants2.GL.VERTEX_ATTRIB_ARRAY_INTEGER:
|
|
667
659
|
result = !webgl2 ? false : void 0;
|
|
668
660
|
break;
|
|
669
|
-
case import_constants2.
|
|
661
|
+
case import_constants2.GL.VERTEX_ATTRIB_ARRAY_DIVISOR:
|
|
670
662
|
result = !webgl2 && !ext ? 0 : void 0;
|
|
671
663
|
break;
|
|
672
664
|
default:
|
|
@@ -677,11 +669,11 @@ var WEBGL2_CONTEXT_OVERRIDES = {
|
|
|
677
669
|
getProgramParameter: (gl, originalFunc, program, pname) => {
|
|
678
670
|
if (!isWebGL2(gl)) {
|
|
679
671
|
switch (pname) {
|
|
680
|
-
case import_constants2.
|
|
681
|
-
return import_constants2.
|
|
682
|
-
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:
|
|
683
675
|
return 0;
|
|
684
|
-
case import_constants2.
|
|
676
|
+
case import_constants2.GL.ACTIVE_UNIFORM_BLOCKS:
|
|
685
677
|
return 0;
|
|
686
678
|
default:
|
|
687
679
|
}
|
|
@@ -691,7 +683,7 @@ var WEBGL2_CONTEXT_OVERRIDES = {
|
|
|
691
683
|
getInternalformatParameter: (gl, originalFunc, target, format, pname) => {
|
|
692
684
|
if (!isWebGL2(gl)) {
|
|
693
685
|
switch (pname) {
|
|
694
|
-
case import_constants2.
|
|
686
|
+
case import_constants2.GL.SAMPLES:
|
|
695
687
|
return new Int32Array([0]);
|
|
696
688
|
default:
|
|
697
689
|
}
|
|
@@ -701,11 +693,11 @@ var WEBGL2_CONTEXT_OVERRIDES = {
|
|
|
701
693
|
},
|
|
702
694
|
getTexParameter(gl, originalFunc, target, pname) {
|
|
703
695
|
switch (pname) {
|
|
704
|
-
case import_constants2.
|
|
696
|
+
case import_constants2.GL.TEXTURE_MAX_ANISOTROPY_EXT:
|
|
705
697
|
const contextData = getContextData(gl);
|
|
706
698
|
const { _extensions } = contextData;
|
|
707
699
|
const ext = _extensions[EXT_texture_filter_anisotropic2];
|
|
708
|
-
pname = ext && ext.TEXTURE_MAX_ANISOTROPY_EXT || import_constants2.
|
|
700
|
+
pname = ext && ext.TEXTURE_MAX_ANISOTROPY_EXT || import_constants2.GL.TEXTURE_MAX_ANISOTROPY_EXT;
|
|
709
701
|
break;
|
|
710
702
|
default:
|
|
711
703
|
}
|
|
@@ -1523,11 +1515,11 @@ function createBrowserContext(canvas, props) {
|
|
|
1523
1515
|
if (props.type === "webgl1") {
|
|
1524
1516
|
props = __spreadProps(__spreadValues({}, props), { webgl2: false });
|
|
1525
1517
|
}
|
|
1526
|
-
if (props.webgl2) {
|
|
1527
|
-
gl =
|
|
1518
|
+
if (!gl && props.webgl2) {
|
|
1519
|
+
gl = canvas.getContext("webgl2", props);
|
|
1528
1520
|
}
|
|
1529
|
-
if (props.webgl1) {
|
|
1530
|
-
gl =
|
|
1521
|
+
if (!gl && props.webgl1) {
|
|
1522
|
+
gl = canvas.getContext("webgl", props);
|
|
1531
1523
|
}
|
|
1532
1524
|
canvas.removeEventListener("webglcontextcreationerror", onCreateError, false);
|
|
1533
1525
|
if (!gl) {
|
|
@@ -1541,19 +1533,23 @@ function createBrowserContext(canvas, props) {
|
|
|
1541
1533
|
}
|
|
1542
1534
|
if (props.onContextRestored) {
|
|
1543
1535
|
const { onContextRestored } = props;
|
|
1544
|
-
canvas.addEventListener(
|
|
1536
|
+
canvas.addEventListener(
|
|
1537
|
+
"webglcontextrestored",
|
|
1538
|
+
(event) => onContextRestored(event),
|
|
1539
|
+
false
|
|
1540
|
+
);
|
|
1545
1541
|
}
|
|
1546
1542
|
return gl;
|
|
1547
1543
|
}
|
|
1548
1544
|
|
|
1549
1545
|
// src/adapter/device-helpers/get-device-info.ts
|
|
1550
|
-
var import_constants4 =
|
|
1546
|
+
var import_constants4 = require("@luma.gl/constants");
|
|
1551
1547
|
function getDeviceInfo(gl) {
|
|
1552
|
-
const vendorMasked = gl.getParameter(import_constants4.
|
|
1553
|
-
const rendererMasked = gl.getParameter(import_constants4.
|
|
1548
|
+
const vendorMasked = gl.getParameter(import_constants4.GL.VENDOR);
|
|
1549
|
+
const rendererMasked = gl.getParameter(import_constants4.GL.RENDERER);
|
|
1554
1550
|
const ext = gl.getExtension("WEBGL_debug_renderer_info");
|
|
1555
|
-
const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : import_constants4.
|
|
1556
|
-
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);
|
|
1557
1553
|
const vendor = vendorUnmasked || vendorMasked;
|
|
1558
1554
|
const renderer = rendererUnmasked || rendererMasked;
|
|
1559
1555
|
const gpu = identifyGPUVendor(vendor, renderer);
|
|
@@ -1562,10 +1558,10 @@ function getDeviceInfo(gl) {
|
|
|
1562
1558
|
gpu,
|
|
1563
1559
|
vendor: vendorUnmasked || vendorMasked,
|
|
1564
1560
|
renderer: rendererUnmasked || rendererMasked,
|
|
1565
|
-
version: gl.getParameter(import_constants4.
|
|
1561
|
+
version: gl.getParameter(import_constants4.GL.VERSION),
|
|
1566
1562
|
shadingLanguages: ["glsl"],
|
|
1567
1563
|
shadingLanguageVersions: {
|
|
1568
|
-
"glsl": gl.getParameter(import_constants4.
|
|
1564
|
+
"glsl": gl.getParameter(import_constants4.GL.SHADING_LANGUAGE_VERSION)
|
|
1569
1565
|
}
|
|
1570
1566
|
};
|
|
1571
1567
|
}
|
|
@@ -1599,7 +1595,7 @@ function isOldIE(opts = {}) {
|
|
|
1599
1595
|
|
|
1600
1596
|
// src/adapter/converters/texture-formats.ts
|
|
1601
1597
|
var import_api5 = require("@luma.gl/api");
|
|
1602
|
-
var import_constants5 =
|
|
1598
|
+
var import_constants5 = require("@luma.gl/constants");
|
|
1603
1599
|
var texture_compression_bc = "texture-compression-bc";
|
|
1604
1600
|
var texture_compression_astc = "texture-compression-astc";
|
|
1605
1601
|
var texture_compression_etc2 = "texture-compression-etc2";
|
|
@@ -1658,206 +1654,206 @@ var TEXTURE_FORMATS = {
|
|
|
1658
1654
|
// TODO - Fix bpp constants
|
|
1659
1655
|
// 'r8unorm-unsized': {gl: GL.LUMINANCE, b: 4, c: 2, bpp: 4},
|
|
1660
1656
|
"rgb8unorm-unsized": {
|
|
1661
|
-
gl: import_constants5.
|
|
1662
|
-
gl1: import_constants5.
|
|
1657
|
+
gl: import_constants5.GL.RGB,
|
|
1658
|
+
gl1: import_constants5.GL.RGB,
|
|
1663
1659
|
b: 4,
|
|
1664
1660
|
c: 2,
|
|
1665
1661
|
bpp: 4,
|
|
1666
|
-
dataFormat: import_constants5.
|
|
1667
|
-
types: [import_constants5.
|
|
1662
|
+
dataFormat: import_constants5.GL.RGB,
|
|
1663
|
+
types: [import_constants5.GL.UNSIGNED_BYTE, import_constants5.GL.UNSIGNED_SHORT_5_6_5]
|
|
1668
1664
|
},
|
|
1669
1665
|
"rgba8unorm-unsized": {
|
|
1670
|
-
gl: import_constants5.
|
|
1671
|
-
gl1: import_constants5.
|
|
1666
|
+
gl: import_constants5.GL.RGBA,
|
|
1667
|
+
gl1: import_constants5.GL.RGBA,
|
|
1672
1668
|
b: 4,
|
|
1673
1669
|
c: 2,
|
|
1674
1670
|
bpp: 4,
|
|
1675
|
-
dataFormat: import_constants5.
|
|
1676
|
-
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]
|
|
1677
1673
|
},
|
|
1678
1674
|
// 'rgb8unorm-srgb-unsized': {gl: GL.SRGB_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
1679
1675
|
// 'rgba8unorm-srgb-unsized': {gl: GL.SRGB_ALPHA_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
1680
1676
|
// 8-bit formats
|
|
1681
|
-
"r8unorm": { gl: import_constants5.
|
|
1682
|
-
"r8snorm": { gl: import_constants5.
|
|
1683
|
-
"r8uint": { gl: import_constants5.
|
|
1684
|
-
"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 },
|
|
1685
1681
|
// 16-bit formats
|
|
1686
|
-
"rg8unorm": { gl: import_constants5.
|
|
1687
|
-
"rg8snorm": { gl: import_constants5.
|
|
1688
|
-
"rg8uint": { gl: import_constants5.
|
|
1689
|
-
"rg8sint": { gl: import_constants5.
|
|
1690
|
-
"r16uint": { gl: import_constants5.
|
|
1691
|
-
"r16sint": { gl: import_constants5.
|
|
1692
|
-
"r16float": { gl: import_constants5.
|
|
1693
|
-
"r16unorm-webgl": { gl: import_constants5.
|
|
1694
|
-
"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 },
|
|
1695
1691
|
// Packed 16-bit formats
|
|
1696
|
-
"rgba4unorm-webgl": { gl: import_constants5.
|
|
1697
|
-
"rgb565unorm-webgl": { gl: import_constants5.
|
|
1698
|
-
"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 },
|
|
1699
1695
|
// 24-bit formats
|
|
1700
|
-
"rgb8unorm-webgl": { gl: import_constants5.
|
|
1701
|
-
"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 },
|
|
1702
1698
|
// 32-bit formats
|
|
1703
|
-
"rgba8unorm": { gl: import_constants5.
|
|
1704
|
-
"rgba8unorm-srgb": { gl: import_constants5.
|
|
1705
|
-
"rgba8snorm": { gl: import_constants5.
|
|
1706
|
-
"rgba8uint": { gl: import_constants5.
|
|
1707
|
-
"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 },
|
|
1708
1704
|
// reverse colors, webgpu only
|
|
1709
1705
|
"bgra8unorm": { b: 4, c: 4 },
|
|
1710
1706
|
"bgra8unorm-srgb": { b: 4, c: 4 },
|
|
1711
|
-
"rg16uint": { gl: import_constants5.
|
|
1712
|
-
"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 },
|
|
1713
1709
|
// When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
|
|
1714
|
-
"rg16float": { gl: import_constants5.
|
|
1715
|
-
"rg16unorm-webgl": { gl: import_constants5.
|
|
1716
|
-
"rg16snorm-webgl": { gl: import_constants5.
|
|
1717
|
-
"r32uint": { gl: import_constants5.
|
|
1718
|
-
"r32sint": { gl: import_constants5.
|
|
1719
|
-
"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" },
|
|
1720
1716
|
// Packed 32-bit formats
|
|
1721
|
-
"rgb9e5ufloat": { gl: import_constants5.
|
|
1722
|
-
"rg11b10ufloat": { gl: import_constants5.
|
|
1723
|
-
"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 },
|
|
1724
1720
|
// webgl2 only
|
|
1725
|
-
"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 },
|
|
1726
1722
|
// 48-bit formats
|
|
1727
|
-
"rgb16unorm-webgl": { gl: import_constants5.
|
|
1728
|
-
"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 },
|
|
1729
1725
|
// 64-bit formats
|
|
1730
|
-
"rg32uint": { gl: import_constants5.
|
|
1731
|
-
"rg32sint": { gl: import_constants5.
|
|
1732
|
-
"rg32float": { gl: import_constants5.
|
|
1733
|
-
"rgba16uint": { gl: import_constants5.
|
|
1734
|
-
"rgba16sint": { gl: import_constants5.
|
|
1735
|
-
"rgba16float": { gl: import_constants5.
|
|
1736
|
-
"rgba16unorm-webgl": { gl: import_constants5.
|
|
1737
|
-
"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 },
|
|
1738
1734
|
// 96-bit formats (deprecated!)
|
|
1739
1735
|
"rgb32float-webgl": {
|
|
1740
|
-
gl: import_constants5.
|
|
1741
|
-
gl1: import_constants5.
|
|
1736
|
+
gl: import_constants5.GL.RGB32F,
|
|
1737
|
+
gl1: import_constants5.GL.RGB,
|
|
1742
1738
|
render: "texture-renderable-float32-webgl",
|
|
1743
1739
|
filter: "texture-filter-linear-float32-webgl",
|
|
1744
1740
|
gl2ext: EXT_FLOAT_RENDER_WEBGL2,
|
|
1745
1741
|
gl1ext: EXT_FLOAT_WEBGL1,
|
|
1746
1742
|
// WebGL1 render buffers are supported with GL.RGB32F
|
|
1747
|
-
dataFormat: import_constants5.
|
|
1748
|
-
types: [import_constants5.
|
|
1743
|
+
dataFormat: import_constants5.GL.RGB,
|
|
1744
|
+
types: [import_constants5.GL.FLOAT]
|
|
1749
1745
|
},
|
|
1750
1746
|
// 128-bit formats
|
|
1751
|
-
"rgba32uint": { gl: import_constants5.
|
|
1752
|
-
"rgba32sint": { gl: import_constants5.
|
|
1753
|
-
"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 },
|
|
1754
1750
|
// Depth and stencil formats
|
|
1755
|
-
"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 },
|
|
1756
1752
|
// 8 stencil bits
|
|
1757
|
-
"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 },
|
|
1758
1754
|
// 16 depth bits
|
|
1759
|
-
"depth24plus": { gl: import_constants5.
|
|
1760
|
-
"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 },
|
|
1761
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.
|
|
1762
|
-
"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 },
|
|
1763
1759
|
// "depth24unorm-stencil8" feature
|
|
1764
|
-
"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 },
|
|
1765
1761
|
// "depth32float-stencil8" feature
|
|
1766
|
-
"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 },
|
|
1767
1763
|
// BC compressed formats: check device.features.has("texture-compression-bc");
|
|
1768
|
-
"bc1-rgb-unorm-webgl": { gl: import_constants5.
|
|
1769
|
-
"bc1-rgb-unorm-srgb-webgl": { gl: import_constants5.
|
|
1770
|
-
"bc1-rgba-unorm": { gl: import_constants5.
|
|
1771
|
-
"bc1-rgba-unorm-srgb": { gl: import_constants5.
|
|
1772
|
-
"bc2-rgba-unorm": { gl: import_constants5.
|
|
1773
|
-
"bc2-rgba-unorm-srgb": { gl: import_constants5.
|
|
1774
|
-
"bc3-rgba-unorm": { gl: import_constants5.
|
|
1775
|
-
"bc3-rgba-unorm-srgb": { gl: import_constants5.
|
|
1776
|
-
"bc4-r-unorm": { gl: import_constants5.
|
|
1777
|
-
"bc4-r-snorm": { gl: import_constants5.
|
|
1778
|
-
"bc5-rg-unorm": { gl: import_constants5.
|
|
1779
|
-
"bc5-rg-snorm": { gl: import_constants5.
|
|
1780
|
-
"bc6h-rgb-ufloat": { gl: import_constants5.
|
|
1781
|
-
"bc6h-rgb-float": { gl: import_constants5.
|
|
1782
|
-
"bc7-rgba-unorm": { gl: import_constants5.
|
|
1783
|
-
"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 },
|
|
1784
1780
|
// WEBGL_compressed_texture_etc: device.features.has("texture-compression-etc2")
|
|
1785
1781
|
// Note: Supposedly guaranteed availability compressed formats in WebGL2, but through CPU decompression
|
|
1786
|
-
"etc2-rgb8unorm": { gl: import_constants5.
|
|
1787
|
-
"etc2-rgb8unorm-srgb": { gl: import_constants5.
|
|
1788
|
-
"etc2-rgb8a1unorm": { gl: import_constants5.
|
|
1789
|
-
"etc2-rgb8a1unorm-srgb": { gl: import_constants5.
|
|
1790
|
-
"etc2-rgba8unorm": { gl: import_constants5.
|
|
1791
|
-
"etc2-rgba8unorm-srgb": { gl: import_constants5.
|
|
1792
|
-
"eac-r11unorm": { gl: import_constants5.
|
|
1793
|
-
"eac-r11snorm": { gl: import_constants5.
|
|
1794
|
-
"eac-rg11unorm": { gl: import_constants5.
|
|
1795
|
-
"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 },
|
|
1796
1792
|
// X_ASTC compressed formats: device.features.has("texture-compression-astc")
|
|
1797
|
-
"astc-4x4-unorm": { gl: import_constants5.
|
|
1798
|
-
"astc-4x4-unorm-srgb": { gl: import_constants5.
|
|
1799
|
-
"astc-5x4-unorm": { gl: import_constants5.
|
|
1800
|
-
"astc-5x4-unorm-srgb": { gl: import_constants5.
|
|
1801
|
-
"astc-5x5-unorm": { gl: import_constants5.
|
|
1802
|
-
"astc-5x5-unorm-srgb": { gl: import_constants5.
|
|
1803
|
-
"astc-6x5-unorm": { gl: import_constants5.
|
|
1804
|
-
"astc-6x5-unorm-srgb": { gl: import_constants5.
|
|
1805
|
-
"astc-6x6-unorm": { gl: import_constants5.
|
|
1806
|
-
"astc-6x6-unorm-srgb": { gl: import_constants5.
|
|
1807
|
-
"astc-8x5-unorm": { gl: import_constants5.
|
|
1808
|
-
"astc-8x5-unorm-srgb": { gl: import_constants5.
|
|
1809
|
-
"astc-8x6-unorm": { gl: import_constants5.
|
|
1810
|
-
"astc-8x6-unorm-srgb": { gl: import_constants5.
|
|
1811
|
-
"astc-8x8-unorm": { gl: import_constants5.
|
|
1812
|
-
"astc-8x8-unorm-srgb": { gl: import_constants5.
|
|
1813
|
-
"astc-10x5-unorm": { gl: import_constants5.
|
|
1814
|
-
"astc-10x5-unorm-srgb": { gl: import_constants5.
|
|
1815
|
-
"astc-10x6-unorm": { gl: import_constants5.
|
|
1816
|
-
"astc-10x6-unorm-srgb": { gl: import_constants5.
|
|
1817
|
-
"astc-10x8-unorm": { gl: import_constants5.
|
|
1818
|
-
"astc-10x8-unorm-srgb": { gl: import_constants5.
|
|
1819
|
-
"astc-10x10-unorm": { gl: import_constants5.
|
|
1820
|
-
"astc-10x10-unorm-srgb": { gl: import_constants5.
|
|
1821
|
-
"astc-12x10-unorm": { gl: import_constants5.
|
|
1822
|
-
"astc-12x10-unorm-srgb": { gl: import_constants5.
|
|
1823
|
-
"astc-12x12-unorm": { gl: import_constants5.
|
|
1824
|
-
"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 },
|
|
1825
1821
|
// WEBGL_compressed_texture_pvrtc
|
|
1826
|
-
"pvrtc-rgb4unorm-webgl": { gl: import_constants5.
|
|
1827
|
-
"pvrtc-rgba4unorm-webgl": { gl: import_constants5.
|
|
1828
|
-
"pvrtc-rbg2unorm-webgl": { gl: import_constants5.
|
|
1829
|
-
"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 },
|
|
1830
1826
|
// WEBGL_compressed_texture_etc1
|
|
1831
|
-
"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 },
|
|
1832
1828
|
// WEBGL_compressed_texture_atc
|
|
1833
|
-
"atc-rgb-unorm-webgl": { gl: import_constants5.
|
|
1834
|
-
"atc-rgba-unorm-webgl": { gl: import_constants5.
|
|
1835
|
-
"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 }
|
|
1836
1832
|
};
|
|
1837
1833
|
var DATA_FORMAT_CHANNELS = {
|
|
1838
|
-
[import_constants5.
|
|
1839
|
-
[import_constants5.
|
|
1840
|
-
[import_constants5.
|
|
1841
|
-
[import_constants5.
|
|
1842
|
-
[import_constants5.
|
|
1843
|
-
[import_constants5.
|
|
1844
|
-
[import_constants5.
|
|
1845
|
-
[import_constants5.
|
|
1846
|
-
[import_constants5.
|
|
1847
|
-
[import_constants5.
|
|
1848
|
-
[import_constants5.
|
|
1849
|
-
[import_constants5.
|
|
1850
|
-
[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
|
|
1851
1847
|
};
|
|
1852
1848
|
var TYPE_SIZES = {
|
|
1853
|
-
[import_constants5.
|
|
1854
|
-
[import_constants5.
|
|
1855
|
-
[import_constants5.
|
|
1856
|
-
[import_constants5.
|
|
1857
|
-
[import_constants5.
|
|
1858
|
-
[import_constants5.
|
|
1859
|
-
[import_constants5.
|
|
1860
|
-
[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
|
|
1861
1857
|
};
|
|
1862
1858
|
function isTextureFormatSupported(gl, formatOrGL) {
|
|
1863
1859
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
@@ -1953,12 +1949,12 @@ function getDepthStencilAttachmentWebGL(format) {
|
|
|
1953
1949
|
}
|
|
1954
1950
|
return info.attachment;
|
|
1955
1951
|
}
|
|
1956
|
-
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) {
|
|
1957
1953
|
let texture = null;
|
|
1958
1954
|
let framebuffer = null;
|
|
1959
1955
|
try {
|
|
1960
1956
|
texture = gl.createTexture();
|
|
1961
|
-
gl.bindTexture(import_constants5.
|
|
1957
|
+
gl.bindTexture(import_constants5.GL.TEXTURE_2D, texture);
|
|
1962
1958
|
const level = 0;
|
|
1963
1959
|
const width = 1;
|
|
1964
1960
|
const height = 1;
|
|
@@ -1976,10 +1972,10 @@ function _checkFloat32ColorAttachment(gl, internalFormat = gl.RGBA, srcFormat =
|
|
|
1976
1972
|
pixel
|
|
1977
1973
|
);
|
|
1978
1974
|
framebuffer = gl.createFramebuffer();
|
|
1979
|
-
gl.bindFramebuffer(import_constants5.
|
|
1980
|
-
gl.framebufferTexture2D(import_constants5.
|
|
1981
|
-
const status = gl.checkFramebufferStatus(import_constants5.
|
|
1982
|
-
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);
|
|
1983
1979
|
return status;
|
|
1984
1980
|
} finally {
|
|
1985
1981
|
gl.deleteTexture(texture);
|
|
@@ -1994,42 +1990,42 @@ function getTextureFormatBytesPerPixel(formatOrGL, isWebGL23) {
|
|
|
1994
1990
|
return channels * channelSize;
|
|
1995
1991
|
}
|
|
1996
1992
|
function getWebGLPixelDataFormat(dataFormat, integer, normalized, format) {
|
|
1997
|
-
if (format === import_constants5.
|
|
1993
|
+
if (format === import_constants5.GL.RGBA || format === import_constants5.GL.RGB) {
|
|
1998
1994
|
return format;
|
|
1999
1995
|
}
|
|
2000
1996
|
switch (dataFormat) {
|
|
2001
1997
|
case "r":
|
|
2002
|
-
return integer && !normalized ? import_constants5.
|
|
1998
|
+
return integer && !normalized ? import_constants5.GL.RED_INTEGER : import_constants5.GL.RED;
|
|
2003
1999
|
case "rg":
|
|
2004
|
-
return integer && !normalized ? import_constants5.
|
|
2000
|
+
return integer && !normalized ? import_constants5.GL.RG_INTEGER : import_constants5.GL.RG;
|
|
2005
2001
|
case "rgb":
|
|
2006
|
-
return integer && !normalized ? import_constants5.
|
|
2002
|
+
return integer && !normalized ? import_constants5.GL.RGB_INTEGER : import_constants5.GL.RGB;
|
|
2007
2003
|
case "rgba":
|
|
2008
|
-
return integer && !normalized ? import_constants5.
|
|
2004
|
+
return integer && !normalized ? import_constants5.GL.RGBA_INTEGER : import_constants5.GL.RGBA;
|
|
2009
2005
|
default:
|
|
2010
|
-
return import_constants5.
|
|
2006
|
+
return import_constants5.GL.RGBA;
|
|
2011
2007
|
}
|
|
2012
2008
|
}
|
|
2013
2009
|
function getWebGLDataType(dataType) {
|
|
2014
2010
|
switch (dataType) {
|
|
2015
2011
|
case "uint8":
|
|
2016
|
-
return import_constants5.
|
|
2012
|
+
return import_constants5.GL.UNSIGNED_BYTE;
|
|
2017
2013
|
case "sint8":
|
|
2018
|
-
return import_constants5.
|
|
2014
|
+
return import_constants5.GL.BYTE;
|
|
2019
2015
|
case "uint16":
|
|
2020
|
-
return import_constants5.
|
|
2016
|
+
return import_constants5.GL.UNSIGNED_SHORT;
|
|
2021
2017
|
case "sint16":
|
|
2022
|
-
return import_constants5.
|
|
2018
|
+
return import_constants5.GL.SHORT;
|
|
2023
2019
|
case "uint32":
|
|
2024
|
-
return import_constants5.
|
|
2020
|
+
return import_constants5.GL.UNSIGNED_INT;
|
|
2025
2021
|
case "sint32":
|
|
2026
|
-
return import_constants5.
|
|
2022
|
+
return import_constants5.GL.INT;
|
|
2027
2023
|
case "float16":
|
|
2028
|
-
return import_constants5.
|
|
2024
|
+
return import_constants5.GL.HALF_FLOAT;
|
|
2029
2025
|
case "float32":
|
|
2030
|
-
return import_constants5.
|
|
2026
|
+
return import_constants5.GL.FLOAT;
|
|
2031
2027
|
default:
|
|
2032
|
-
return import_constants5.
|
|
2028
|
+
return import_constants5.GL.UNSIGNED_BYTE;
|
|
2033
2029
|
}
|
|
2034
2030
|
}
|
|
2035
2031
|
|
|
@@ -2131,39 +2127,39 @@ var WEBGL_FEATURES = {
|
|
|
2131
2127
|
};
|
|
2132
2128
|
|
|
2133
2129
|
// src/adapter/device-helpers/device-limits.ts
|
|
2134
|
-
var import_constants6 =
|
|
2130
|
+
var import_constants6 = require("@luma.gl/constants");
|
|
2135
2131
|
function getDeviceLimits(gl) {
|
|
2136
2132
|
const gl2 = getWebGL2Context(gl);
|
|
2137
2133
|
return {
|
|
2138
2134
|
maxTextureDimension1D: 0,
|
|
2139
2135
|
// WebGL does not support 1D textures
|
|
2140
|
-
maxTextureDimension2D: gl.getParameter(import_constants6.
|
|
2141
|
-
maxTextureDimension3D: gl2 ? gl2.getParameter(import_constants6.
|
|
2142
|
-
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,
|
|
2143
2139
|
maxBindGroups: 1,
|
|
2144
2140
|
// TBD
|
|
2145
2141
|
maxDynamicUniformBuffersPerPipelineLayout: 0,
|
|
2146
2142
|
// TBD
|
|
2147
2143
|
maxDynamicStorageBuffersPerPipelineLayout: 0,
|
|
2148
2144
|
// TBD
|
|
2149
|
-
maxSampledTexturesPerShaderStage: gl.getParameter(import_constants6.
|
|
2145
|
+
maxSampledTexturesPerShaderStage: gl.getParameter(import_constants6.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
|
|
2150
2146
|
// TBD
|
|
2151
|
-
maxSamplersPerShaderStage: gl.getParameter(import_constants6.
|
|
2147
|
+
maxSamplersPerShaderStage: gl.getParameter(import_constants6.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
|
|
2152
2148
|
maxStorageBuffersPerShaderStage: 0,
|
|
2153
2149
|
// TBD
|
|
2154
2150
|
maxStorageTexturesPerShaderStage: 0,
|
|
2155
2151
|
// TBD
|
|
2156
|
-
maxUniformBuffersPerShaderStage: gl2 ? gl2.getParameter(import_constants6.
|
|
2157
|
-
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,
|
|
2158
2154
|
maxStorageBufferBindingSize: 0,
|
|
2159
|
-
minUniformBufferOffsetAlignment: gl2 ? gl2.getParameter(import_constants6.
|
|
2155
|
+
minUniformBufferOffsetAlignment: gl2 ? gl2.getParameter(import_constants6.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT) : 0,
|
|
2160
2156
|
minStorageBufferOffsetAlignment: 0,
|
|
2161
2157
|
// TBD
|
|
2162
2158
|
maxVertexBuffers: 0,
|
|
2163
|
-
maxVertexAttributes: gl.getParameter(import_constants6.
|
|
2159
|
+
maxVertexAttributes: gl.getParameter(import_constants6.GL.MAX_VERTEX_ATTRIBS),
|
|
2164
2160
|
maxVertexBufferArrayStride: 2048,
|
|
2165
2161
|
// TBD, this is just the default value from WebGPU
|
|
2166
|
-
maxInterStageShaderComponents: gl2 ? gl2.getParameter(import_constants6.
|
|
2162
|
+
maxInterStageShaderComponents: gl2 ? gl2.getParameter(import_constants6.GL.MAX_VARYING_COMPONENTS) : 0,
|
|
2167
2163
|
maxComputeWorkgroupStorageSize: 0,
|
|
2168
2164
|
// WebGL does not support compute shaders
|
|
2169
2165
|
maxComputeInvocationsPerWorkgroup: 0,
|
|
@@ -2187,89 +2183,89 @@ function getWebGLLimits(gl) {
|
|
|
2187
2183
|
return gl2 ? gl2.getParameter(pname) : defaultValue || 0;
|
|
2188
2184
|
}
|
|
2189
2185
|
return {
|
|
2190
|
-
[import_constants6.
|
|
2191
|
-
[import_constants6.
|
|
2192
|
-
[import_constants6.
|
|
2193
|
-
[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),
|
|
2194
2190
|
// GLint
|
|
2195
|
-
[import_constants6.
|
|
2191
|
+
[import_constants6.GL.MAX_TEXTURE_IMAGE_UNITS]: get(import_constants6.GL.MAX_TEXTURE_IMAGE_UNITS),
|
|
2196
2192
|
// GLint
|
|
2197
|
-
[import_constants6.
|
|
2193
|
+
[import_constants6.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS]: get(import_constants6.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
|
|
2198
2194
|
// GLint
|
|
2199
|
-
[import_constants6.
|
|
2195
|
+
[import_constants6.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS]: get(import_constants6.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
|
|
2200
2196
|
// GLint
|
|
2201
|
-
[import_constants6.
|
|
2197
|
+
[import_constants6.GL.MAX_RENDERBUFFER_SIZE]: get(import_constants6.GL.MAX_RENDERBUFFER_SIZE),
|
|
2202
2198
|
// GLint
|
|
2203
|
-
[import_constants6.
|
|
2199
|
+
[import_constants6.GL.MAX_VARYING_VECTORS]: get(import_constants6.GL.MAX_VARYING_VECTORS),
|
|
2204
2200
|
// GLint
|
|
2205
|
-
[import_constants6.
|
|
2201
|
+
[import_constants6.GL.MAX_VERTEX_ATTRIBS]: get(import_constants6.GL.MAX_VERTEX_ATTRIBS),
|
|
2206
2202
|
// GLint
|
|
2207
|
-
[import_constants6.
|
|
2203
|
+
[import_constants6.GL.MAX_VERTEX_UNIFORM_VECTORS]: get(import_constants6.GL.MAX_VERTEX_UNIFORM_VECTORS),
|
|
2208
2204
|
// GLint
|
|
2209
|
-
[import_constants6.
|
|
2205
|
+
[import_constants6.GL.MAX_FRAGMENT_UNIFORM_VECTORS]: get(import_constants6.GL.MAX_FRAGMENT_UNIFORM_VECTORS),
|
|
2210
2206
|
// GLint
|
|
2211
|
-
[import_constants6.
|
|
2207
|
+
[import_constants6.GL.MAX_VIEWPORT_DIMS]: get(import_constants6.GL.MAX_VIEWPORT_DIMS),
|
|
2212
2208
|
// Extensions
|
|
2213
|
-
[import_constants6.
|
|
2209
|
+
[import_constants6.GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT]: get(import_constants6.GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT),
|
|
2214
2210
|
// getMaxAnistropy(),
|
|
2215
2211
|
// WebGL2 Limits
|
|
2216
|
-
[import_constants6.
|
|
2212
|
+
[import_constants6.GL.MAX_3D_TEXTURE_SIZE]: get2(import_constants6.GL.MAX_3D_TEXTURE_SIZE),
|
|
2217
2213
|
// GLint
|
|
2218
|
-
[import_constants6.
|
|
2214
|
+
[import_constants6.GL.MAX_ARRAY_TEXTURE_LAYERS]: get2(import_constants6.GL.MAX_ARRAY_TEXTURE_LAYERS),
|
|
2219
2215
|
// GLint
|
|
2220
|
-
[import_constants6.
|
|
2216
|
+
[import_constants6.GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: get2(import_constants6.GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL),
|
|
2221
2217
|
// GLint64
|
|
2222
|
-
[import_constants6.
|
|
2218
|
+
[import_constants6.GL.MAX_COLOR_ATTACHMENTS]: get2(import_constants6.GL.MAX_COLOR_ATTACHMENTS),
|
|
2223
2219
|
// GLint
|
|
2224
|
-
[import_constants6.
|
|
2220
|
+
[import_constants6.GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: get2(import_constants6.GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS),
|
|
2225
2221
|
// GLint64
|
|
2226
|
-
[import_constants6.
|
|
2222
|
+
[import_constants6.GL.MAX_COMBINED_UNIFORM_BLOCKS]: get2(import_constants6.GL.MAX_COMBINED_UNIFORM_BLOCKS),
|
|
2227
2223
|
// GLint
|
|
2228
|
-
[import_constants6.
|
|
2224
|
+
[import_constants6.GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: get2(import_constants6.GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS),
|
|
2229
2225
|
// GLint64
|
|
2230
|
-
[import_constants6.
|
|
2226
|
+
[import_constants6.GL.MAX_DRAW_BUFFERS]: get2(import_constants6.GL.MAX_DRAW_BUFFERS),
|
|
2231
2227
|
// GLint
|
|
2232
|
-
[import_constants6.
|
|
2228
|
+
[import_constants6.GL.MAX_ELEMENT_INDEX]: get2(import_constants6.GL.MAX_ELEMENT_INDEX),
|
|
2233
2229
|
// GLint64
|
|
2234
|
-
[import_constants6.
|
|
2230
|
+
[import_constants6.GL.MAX_ELEMENTS_INDICES]: get2(import_constants6.GL.MAX_ELEMENTS_INDICES),
|
|
2235
2231
|
// GLint
|
|
2236
|
-
[import_constants6.
|
|
2232
|
+
[import_constants6.GL.MAX_ELEMENTS_VERTICES]: get2(import_constants6.GL.MAX_ELEMENTS_VERTICES),
|
|
2237
2233
|
// GLint
|
|
2238
|
-
[import_constants6.
|
|
2234
|
+
[import_constants6.GL.MAX_FRAGMENT_INPUT_COMPONENTS]: get2(import_constants6.GL.MAX_FRAGMENT_INPUT_COMPONENTS),
|
|
2239
2235
|
// GLint
|
|
2240
|
-
[import_constants6.
|
|
2236
|
+
[import_constants6.GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: get2(import_constants6.GL.MAX_FRAGMENT_UNIFORM_BLOCKS),
|
|
2241
2237
|
// GLint
|
|
2242
|
-
[import_constants6.
|
|
2238
|
+
[import_constants6.GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: get2(import_constants6.GL.MAX_FRAGMENT_UNIFORM_COMPONENTS),
|
|
2243
2239
|
// GLint
|
|
2244
|
-
[import_constants6.
|
|
2240
|
+
[import_constants6.GL.MAX_SAMPLES]: get2(import_constants6.GL.MAX_SAMPLES),
|
|
2245
2241
|
// GLint
|
|
2246
|
-
[import_constants6.
|
|
2242
|
+
[import_constants6.GL.MAX_SERVER_WAIT_TIMEOUT]: get2(import_constants6.GL.MAX_SERVER_WAIT_TIMEOUT),
|
|
2247
2243
|
// GLint64
|
|
2248
|
-
[import_constants6.
|
|
2244
|
+
[import_constants6.GL.MAX_TEXTURE_LOD_BIAS]: get2(import_constants6.GL.MAX_TEXTURE_LOD_BIAS),
|
|
2249
2245
|
// GLfloat
|
|
2250
|
-
[import_constants6.
|
|
2246
|
+
[import_constants6.GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: get2(import_constants6.GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS),
|
|
2251
2247
|
// GLint
|
|
2252
|
-
[import_constants6.
|
|
2248
|
+
[import_constants6.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: get2(import_constants6.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS),
|
|
2253
2249
|
// GLint
|
|
2254
|
-
[import_constants6.
|
|
2250
|
+
[import_constants6.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: get2(import_constants6.GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS),
|
|
2255
2251
|
// GLint
|
|
2256
|
-
[import_constants6.
|
|
2252
|
+
[import_constants6.GL.MAX_UNIFORM_BLOCK_SIZE]: get2(import_constants6.GL.MAX_UNIFORM_BLOCK_SIZE),
|
|
2257
2253
|
// GLint64
|
|
2258
|
-
[import_constants6.
|
|
2254
|
+
[import_constants6.GL.MAX_UNIFORM_BUFFER_BINDINGS]: get2(import_constants6.GL.MAX_UNIFORM_BUFFER_BINDINGS),
|
|
2259
2255
|
// GLint
|
|
2260
|
-
[import_constants6.
|
|
2256
|
+
[import_constants6.GL.MAX_VARYING_COMPONENTS]: get2(import_constants6.GL.MAX_VARYING_COMPONENTS),
|
|
2261
2257
|
// GLint
|
|
2262
|
-
[import_constants6.
|
|
2258
|
+
[import_constants6.GL.MAX_VERTEX_OUTPUT_COMPONENTS]: get2(import_constants6.GL.MAX_VERTEX_OUTPUT_COMPONENTS),
|
|
2263
2259
|
// GLint
|
|
2264
|
-
[import_constants6.
|
|
2260
|
+
[import_constants6.GL.MAX_VERTEX_UNIFORM_BLOCKS]: get2(import_constants6.GL.MAX_VERTEX_UNIFORM_BLOCKS),
|
|
2265
2261
|
// GLint
|
|
2266
|
-
[import_constants6.
|
|
2262
|
+
[import_constants6.GL.MAX_VERTEX_UNIFORM_COMPONENTS]: get2(import_constants6.GL.MAX_VERTEX_UNIFORM_COMPONENTS),
|
|
2267
2263
|
// GLint
|
|
2268
|
-
[import_constants6.
|
|
2264
|
+
[import_constants6.GL.MIN_PROGRAM_TEXEL_OFFSET]: get2(import_constants6.GL.MIN_PROGRAM_TEXEL_OFFSET),
|
|
2269
2265
|
// GLint
|
|
2270
|
-
[import_constants6.
|
|
2266
|
+
[import_constants6.GL.MAX_PROGRAM_TEXEL_OFFSET]: get2(import_constants6.GL.MAX_PROGRAM_TEXEL_OFFSET),
|
|
2271
2267
|
// GLint
|
|
2272
|
-
[import_constants6.
|
|
2268
|
+
[import_constants6.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: get2(import_constants6.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT)
|
|
2273
2269
|
// GLint
|
|
2274
2270
|
};
|
|
2275
2271
|
}
|
|
@@ -2279,7 +2275,7 @@ var import_api15 = require("@luma.gl/api");
|
|
|
2279
2275
|
|
|
2280
2276
|
// src/adapter/resources/webgl-framebuffer.ts
|
|
2281
2277
|
var import_api14 = require("@luma.gl/api");
|
|
2282
|
-
var import_constants13 =
|
|
2278
|
+
var import_constants13 = require("@luma.gl/constants");
|
|
2283
2279
|
|
|
2284
2280
|
// src/adapter/resources/webgl-texture.ts
|
|
2285
2281
|
var import_api9 = require("@luma.gl/api");
|
|
@@ -2321,7 +2317,7 @@ var import_constants8 = require("@luma.gl/constants");
|
|
|
2321
2317
|
|
|
2322
2318
|
// src/adapter/converters/device-parameters.ts
|
|
2323
2319
|
var import_api6 = require("@luma.gl/api");
|
|
2324
|
-
var import_constants7 =
|
|
2320
|
+
var import_constants7 = require("@luma.gl/constants");
|
|
2325
2321
|
function withGLParameters(device, parameters, func) {
|
|
2326
2322
|
if ((0, import_api6.isObjectEmpty)(parameters)) {
|
|
2327
2323
|
return func(device);
|
|
@@ -2352,23 +2348,23 @@ function setDeviceParameters(device, parameters) {
|
|
|
2352
2348
|
if (parameters.cullMode) {
|
|
2353
2349
|
switch (parameters.cullMode) {
|
|
2354
2350
|
case "none":
|
|
2355
|
-
gl.disable(import_constants7.
|
|
2351
|
+
gl.disable(import_constants7.GL.CULL_FACE);
|
|
2356
2352
|
break;
|
|
2357
2353
|
case "front":
|
|
2358
|
-
gl.enable(import_constants7.
|
|
2359
|
-
gl.cullFace(import_constants7.
|
|
2354
|
+
gl.enable(import_constants7.GL.CULL_FACE);
|
|
2355
|
+
gl.cullFace(import_constants7.GL.FRONT);
|
|
2360
2356
|
break;
|
|
2361
2357
|
case "back":
|
|
2362
|
-
gl.enable(import_constants7.
|
|
2363
|
-
gl.cullFace(import_constants7.
|
|
2358
|
+
gl.enable(import_constants7.GL.CULL_FACE);
|
|
2359
|
+
gl.cullFace(import_constants7.GL.BACK);
|
|
2364
2360
|
break;
|
|
2365
2361
|
}
|
|
2366
2362
|
}
|
|
2367
2363
|
if (parameters.frontFace) {
|
|
2368
2364
|
gl.frontFace(
|
|
2369
2365
|
map("frontFace", parameters.frontFace, {
|
|
2370
|
-
ccw: import_constants7.
|
|
2371
|
-
cw: import_constants7.
|
|
2366
|
+
ccw: import_constants7.GL.CCW,
|
|
2367
|
+
cw: import_constants7.GL.CW
|
|
2372
2368
|
})
|
|
2373
2369
|
);
|
|
2374
2370
|
}
|
|
@@ -2379,13 +2375,13 @@ function setDeviceParameters(device, parameters) {
|
|
|
2379
2375
|
gl.depthMask(mapBoolean("depthWriteEnabled", parameters.depthWriteEnabled));
|
|
2380
2376
|
}
|
|
2381
2377
|
if (parameters.depthCompare) {
|
|
2382
|
-
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);
|
|
2383
2379
|
gl.depthFunc(convertCompareFunction("depthCompare", parameters.depthCompare));
|
|
2384
2380
|
}
|
|
2385
2381
|
if (parameters.stencilWriteMask) {
|
|
2386
2382
|
const mask = parameters.stencilWriteMask;
|
|
2387
|
-
gl.stencilMaskSeparate(import_constants7.
|
|
2388
|
-
gl.stencilMaskSeparate(import_constants7.
|
|
2383
|
+
gl.stencilMaskSeparate(import_constants7.GL.FRONT, mask);
|
|
2384
|
+
gl.stencilMaskSeparate(import_constants7.GL.BACK, mask);
|
|
2389
2385
|
}
|
|
2390
2386
|
if (parameters.stencilReadMask) {
|
|
2391
2387
|
import_api6.log.warn("stencilReadMask not supported under WebGL");
|
|
@@ -2393,9 +2389,9 @@ function setDeviceParameters(device, parameters) {
|
|
|
2393
2389
|
if (parameters.stencilCompare) {
|
|
2394
2390
|
const mask = parameters.stencilReadMask || 4294967295;
|
|
2395
2391
|
const glValue = convertCompareFunction("depthCompare", parameters.stencilCompare);
|
|
2396
|
-
parameters.stencilCompare !== "always" ? gl.enable(import_constants7.
|
|
2397
|
-
gl.stencilFuncSeparate(import_constants7.
|
|
2398
|
-
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);
|
|
2399
2395
|
}
|
|
2400
2396
|
if (parameters.stencilPassOperation && parameters.stencilFailOperation && parameters.stencilDepthFailOperation) {
|
|
2401
2397
|
const dppass = convertStencilOperation("stencilPassOperation", parameters.stencilPassOperation);
|
|
@@ -2404,32 +2400,32 @@ function setDeviceParameters(device, parameters) {
|
|
|
2404
2400
|
"stencilDepthFailOperation",
|
|
2405
2401
|
parameters.stencilDepthFailOperation
|
|
2406
2402
|
);
|
|
2407
|
-
gl.stencilOpSeparate(import_constants7.
|
|
2408
|
-
gl.stencilOpSeparate(import_constants7.
|
|
2403
|
+
gl.stencilOpSeparate(import_constants7.GL.FRONT, sfail, dpfail, dppass);
|
|
2404
|
+
gl.stencilOpSeparate(import_constants7.GL.BACK, sfail, dpfail, dppass);
|
|
2409
2405
|
}
|
|
2410
2406
|
}
|
|
2411
2407
|
function convertCompareFunction(parameter, value) {
|
|
2412
2408
|
return map(parameter, value, {
|
|
2413
|
-
never: import_constants7.
|
|
2414
|
-
less: import_constants7.
|
|
2415
|
-
equal: import_constants7.
|
|
2416
|
-
"less-equal": import_constants7.
|
|
2417
|
-
greater: import_constants7.
|
|
2418
|
-
"not-equal": import_constants7.
|
|
2419
|
-
"greater-equal": import_constants7.
|
|
2420
|
-
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
|
|
2421
2417
|
});
|
|
2422
2418
|
}
|
|
2423
2419
|
function convertStencilOperation(parameter, value) {
|
|
2424
2420
|
return map(parameter, value, {
|
|
2425
|
-
keep: import_constants7.
|
|
2426
|
-
zero: import_constants7.
|
|
2427
|
-
replace: import_constants7.
|
|
2428
|
-
invert: import_constants7.
|
|
2429
|
-
"increment-clamp": import_constants7.
|
|
2430
|
-
"decrement-clamp": import_constants7.
|
|
2431
|
-
"increment-wrap": import_constants7.
|
|
2432
|
-
"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
|
|
2433
2429
|
});
|
|
2434
2430
|
}
|
|
2435
2431
|
function message(parameter, value) {
|
|
@@ -2521,7 +2517,7 @@ function updateSamplerParametersForNPOT(parameters) {
|
|
|
2521
2517
|
|
|
2522
2518
|
// src/adapter/resources/webgl-buffer.ts
|
|
2523
2519
|
var import_api7 = require("@luma.gl/api");
|
|
2524
|
-
var import_constants9 =
|
|
2520
|
+
var import_constants9 = require("@luma.gl/constants");
|
|
2525
2521
|
var DEBUG_DATA_LENGTH = 10;
|
|
2526
2522
|
var WEBGLBuffer = class extends import_api7.Buffer {
|
|
2527
2523
|
// accessor: {};
|
|
@@ -2586,7 +2582,7 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2586
2582
|
write(data, byteOffset = 0) {
|
|
2587
2583
|
const srcOffset = 0;
|
|
2588
2584
|
const byteLength = void 0;
|
|
2589
|
-
const target = this.device.isWebGL2 ? import_constants9.
|
|
2585
|
+
const target = this.device.isWebGL2 ? import_constants9.GL.COPY_WRITE_BUFFER : this.target;
|
|
2590
2586
|
this.gl.bindBuffer(target, this.handle);
|
|
2591
2587
|
if (srcOffset !== 0 || byteLength !== void 0) {
|
|
2592
2588
|
this.device.assertWebGL2();
|
|
@@ -2602,9 +2598,9 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2602
2598
|
this.device.assertWebGL2();
|
|
2603
2599
|
const data = new Uint8Array(byteLength);
|
|
2604
2600
|
const dstOffset = 0;
|
|
2605
|
-
this.gl.bindBuffer(import_constants9.
|
|
2606
|
-
this.gl2.getBufferSubData(import_constants9.
|
|
2607
|
-
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);
|
|
2608
2604
|
return data;
|
|
2609
2605
|
});
|
|
2610
2606
|
}
|
|
@@ -2621,27 +2617,27 @@ var WEBGLBuffer = class extends import_api7.Buffer {
|
|
|
2621
2617
|
};
|
|
2622
2618
|
function getWebGLTarget(usage) {
|
|
2623
2619
|
if (usage & import_api7.Buffer.INDEX) {
|
|
2624
|
-
return import_constants9.
|
|
2620
|
+
return import_constants9.GL.ELEMENT_ARRAY_BUFFER;
|
|
2625
2621
|
}
|
|
2626
2622
|
if (usage & import_api7.Buffer.VERTEX) {
|
|
2627
|
-
return import_constants9.
|
|
2623
|
+
return import_constants9.GL.ARRAY_BUFFER;
|
|
2628
2624
|
}
|
|
2629
2625
|
if (usage & import_api7.Buffer.UNIFORM) {
|
|
2630
|
-
return import_constants9.
|
|
2626
|
+
return import_constants9.GL.UNIFORM_BUFFER;
|
|
2631
2627
|
}
|
|
2632
|
-
return import_constants9.
|
|
2628
|
+
return import_constants9.GL.ARRAY_BUFFER;
|
|
2633
2629
|
}
|
|
2634
2630
|
function getWebGLUsage(usage) {
|
|
2635
2631
|
if (usage & import_api7.Buffer.INDEX) {
|
|
2636
|
-
return import_constants9.
|
|
2632
|
+
return import_constants9.GL.STATIC_DRAW;
|
|
2637
2633
|
}
|
|
2638
2634
|
if (usage & import_api7.Buffer.VERTEX) {
|
|
2639
|
-
return import_constants9.
|
|
2635
|
+
return import_constants9.GL.STATIC_DRAW;
|
|
2640
2636
|
}
|
|
2641
2637
|
if (usage & import_api7.Buffer.UNIFORM) {
|
|
2642
|
-
return import_constants9.
|
|
2638
|
+
return import_constants9.GL.DYNAMIC_DRAW;
|
|
2643
2639
|
}
|
|
2644
|
-
return import_constants9.
|
|
2640
|
+
return import_constants9.GL.DYNAMIC_DRAW;
|
|
2645
2641
|
}
|
|
2646
2642
|
|
|
2647
2643
|
// src/adapter/resources/webgl-sampler.ts
|
|
@@ -3403,7 +3399,7 @@ function logParameters(parameters) {
|
|
|
3403
3399
|
|
|
3404
3400
|
// src/adapter/objects/webgl-renderbuffer.ts
|
|
3405
3401
|
var import_api13 = require("@luma.gl/api");
|
|
3406
|
-
var import_constants12 =
|
|
3402
|
+
var import_constants12 = require("@luma.gl/constants");
|
|
3407
3403
|
|
|
3408
3404
|
// src/adapter/objects/webgl-resource.ts
|
|
3409
3405
|
var import_api12 = require("@luma.gl/api");
|
|
@@ -3669,13 +3665,13 @@ var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
|
3669
3665
|
const { format, width, height, samples } = props;
|
|
3670
3666
|
(0, import_api13.assert)(format, "Needs format");
|
|
3671
3667
|
this.trackDeallocatedMemory();
|
|
3672
|
-
this.gl.bindRenderbuffer(import_constants12.
|
|
3668
|
+
this.gl.bindRenderbuffer(import_constants12.GL.RENDERBUFFER, this.handle);
|
|
3673
3669
|
if (samples !== 0 && this.device.isWebGL2) {
|
|
3674
|
-
this.gl2.renderbufferStorageMultisample(import_constants12.
|
|
3670
|
+
this.gl2.renderbufferStorageMultisample(import_constants12.GL.RENDERBUFFER, samples, this.glFormat, width, height);
|
|
3675
3671
|
} else {
|
|
3676
|
-
this.gl.renderbufferStorage(import_constants12.
|
|
3672
|
+
this.gl.renderbufferStorage(import_constants12.GL.RENDERBUFFER, this.glFormat, width, height);
|
|
3677
3673
|
}
|
|
3678
|
-
this.gl.bindRenderbuffer(import_constants12.
|
|
3674
|
+
this.gl.bindRenderbuffer(import_constants12.GL.RENDERBUFFER, null);
|
|
3679
3675
|
this.trackAllocatedMemory(
|
|
3680
3676
|
width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.glFormat, this.device.isWebGL2)
|
|
3681
3677
|
);
|
|
@@ -3689,7 +3685,7 @@ var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
|
3689
3685
|
this.trackDeallocatedMemory();
|
|
3690
3686
|
}
|
|
3691
3687
|
_bindHandle(handle) {
|
|
3692
|
-
this.gl.bindRenderbuffer(import_constants12.
|
|
3688
|
+
this.gl.bindRenderbuffer(import_constants12.GL.RENDERBUFFER, handle);
|
|
3693
3689
|
}
|
|
3694
3690
|
};
|
|
3695
3691
|
var WEBGLRenderbuffer = _WEBGLRenderbuffer;
|
|
@@ -3715,10 +3711,10 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3715
3711
|
if (!isDefaultFramebuffer) {
|
|
3716
3712
|
device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
|
|
3717
3713
|
this.autoCreateAttachmentTextures();
|
|
3718
|
-
this.gl.bindFramebuffer(import_constants13.
|
|
3714
|
+
this.gl.bindFramebuffer(import_constants13.GL.FRAMEBUFFER, this.handle);
|
|
3719
3715
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
3720
3716
|
const attachment = this.colorAttachments[i];
|
|
3721
|
-
const attachmentPoint = import_constants13.
|
|
3717
|
+
const attachmentPoint = import_constants13.GL.COLOR_ATTACHMENT0 + i;
|
|
3722
3718
|
if (attachment) {
|
|
3723
3719
|
this._attachOne(attachmentPoint, attachment);
|
|
3724
3720
|
}
|
|
@@ -3729,7 +3725,7 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3729
3725
|
this.depthStencilAttachment
|
|
3730
3726
|
);
|
|
3731
3727
|
}
|
|
3732
|
-
this.gl.bindFramebuffer(import_constants13.
|
|
3728
|
+
this.gl.bindFramebuffer(import_constants13.GL.FRAMEBUFFER, null);
|
|
3733
3729
|
}
|
|
3734
3730
|
if (props.check !== false) {
|
|
3735
3731
|
this._checkStatus();
|
|
@@ -3749,9 +3745,9 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3749
3745
|
/** Check the status */
|
|
3750
3746
|
_checkStatus() {
|
|
3751
3747
|
const { gl } = this;
|
|
3752
|
-
const prevHandle2 = gl.bindFramebuffer(import_constants13.
|
|
3753
|
-
const status = gl.checkFramebufferStatus(import_constants13.
|
|
3754
|
-
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);
|
|
3755
3751
|
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
3756
3752
|
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
3757
3753
|
}
|
|
@@ -3808,9 +3804,9 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3808
3804
|
}
|
|
3809
3805
|
_attachWEBGLRenderbuffer(attachment, renderbuffer) {
|
|
3810
3806
|
this.gl.framebufferRenderbuffer(
|
|
3811
|
-
import_constants13.
|
|
3807
|
+
import_constants13.GL.FRAMEBUFFER,
|
|
3812
3808
|
attachment,
|
|
3813
|
-
import_constants13.
|
|
3809
|
+
import_constants13.GL.RENDERBUFFER,
|
|
3814
3810
|
renderbuffer.handle
|
|
3815
3811
|
);
|
|
3816
3812
|
}
|
|
@@ -3824,17 +3820,17 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3824
3820
|
const { gl, gl2 } = this.device;
|
|
3825
3821
|
gl.bindTexture(texture.target, texture.handle);
|
|
3826
3822
|
switch (texture.target) {
|
|
3827
|
-
case import_constants13.
|
|
3828
|
-
case import_constants13.
|
|
3823
|
+
case import_constants13.GL.TEXTURE_2D_ARRAY:
|
|
3824
|
+
case import_constants13.GL.TEXTURE_3D:
|
|
3829
3825
|
this.device.assertWebGL2();
|
|
3830
|
-
gl2 == null ? void 0 : gl2.framebufferTextureLayer(import_constants13.
|
|
3826
|
+
gl2 == null ? void 0 : gl2.framebufferTextureLayer(import_constants13.GL.FRAMEBUFFER, attachment, texture.target, level, layer);
|
|
3831
3827
|
break;
|
|
3832
|
-
case import_constants13.
|
|
3828
|
+
case import_constants13.GL.TEXTURE_CUBE_MAP:
|
|
3833
3829
|
const face = mapIndexToCubeMapFace(layer);
|
|
3834
|
-
gl.framebufferTexture2D(import_constants13.
|
|
3830
|
+
gl.framebufferTexture2D(import_constants13.GL.FRAMEBUFFER, attachment, face, texture.handle, level);
|
|
3835
3831
|
break;
|
|
3836
|
-
case import_constants13.
|
|
3837
|
-
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);
|
|
3838
3834
|
break;
|
|
3839
3835
|
default:
|
|
3840
3836
|
(0, import_api14.assert)(false, "Illegal texture type");
|
|
@@ -3843,21 +3839,21 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
|
|
|
3843
3839
|
}
|
|
3844
3840
|
};
|
|
3845
3841
|
function mapIndexToCubeMapFace(layer) {
|
|
3846
|
-
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;
|
|
3847
3843
|
}
|
|
3848
3844
|
function _getFrameBufferStatus(status) {
|
|
3849
3845
|
switch (status) {
|
|
3850
|
-
case import_constants13.
|
|
3846
|
+
case import_constants13.GL.FRAMEBUFFER_COMPLETE:
|
|
3851
3847
|
return "success";
|
|
3852
|
-
case import_constants13.
|
|
3848
|
+
case import_constants13.GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
|
3853
3849
|
return "Mismatched attachments";
|
|
3854
|
-
case import_constants13.
|
|
3850
|
+
case import_constants13.GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
|
3855
3851
|
return "No attachments";
|
|
3856
|
-
case import_constants13.
|
|
3852
|
+
case import_constants13.GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
|
|
3857
3853
|
return "Height/width mismatch";
|
|
3858
|
-
case import_constants13.
|
|
3854
|
+
case import_constants13.GL.FRAMEBUFFER_UNSUPPORTED:
|
|
3859
3855
|
return "Unsupported or split attachments";
|
|
3860
|
-
case import_constants13.
|
|
3856
|
+
case import_constants13.GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
|
|
3861
3857
|
return "Samples mismatch";
|
|
3862
3858
|
default:
|
|
3863
3859
|
return `${status}`;
|
|
@@ -3974,7 +3970,7 @@ function initializeSpectorJS(props) {
|
|
|
3974
3970
|
|
|
3975
3971
|
// src/context/debug/webgl-developer-tools.ts
|
|
3976
3972
|
var import_api17 = require("@luma.gl/api");
|
|
3977
|
-
var import_constants14 =
|
|
3973
|
+
var import_constants14 = require("@luma.gl/constants");
|
|
3978
3974
|
var WEBGL_DEBUG_CDN_URL = "https://unpkg.com/webgl-debug@2.0.1/index.js";
|
|
3979
3975
|
function getContextData2(gl) {
|
|
3980
3976
|
gl.luma = gl.luma || {};
|
|
@@ -4008,15 +4004,15 @@ function getDebugContext(gl, props) {
|
|
|
4008
4004
|
if (data.debugContext) {
|
|
4009
4005
|
return data.debugContext;
|
|
4010
4006
|
}
|
|
4011
|
-
globalThis.WebGLDebugUtils.init(__spreadValues(__spreadValues({}, import_constants14.
|
|
4007
|
+
globalThis.WebGLDebugUtils.init(__spreadValues(__spreadValues({}, import_constants14.GL), gl));
|
|
4012
4008
|
const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(
|
|
4013
4009
|
gl,
|
|
4014
4010
|
onGLError.bind(null, props),
|
|
4015
4011
|
onValidateGLFunc.bind(null, props)
|
|
4016
4012
|
);
|
|
4017
|
-
for (const key in import_constants14.
|
|
4018
|
-
if (!(key in glDebug) && typeof import_constants14.
|
|
4019
|
-
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];
|
|
4020
4016
|
}
|
|
4021
4017
|
}
|
|
4022
4018
|
class WebGLDebugContext {
|
|
@@ -4073,13 +4069,13 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
4073
4069
|
}
|
|
4074
4070
|
}
|
|
4075
4071
|
|
|
4076
|
-
// src/classic/buffer.ts
|
|
4072
|
+
// src/classic/buffer-with-accessor.ts
|
|
4077
4073
|
var import_api19 = require("@luma.gl/api");
|
|
4078
|
-
var import_constants17 =
|
|
4074
|
+
var import_constants17 = require("@luma.gl/constants");
|
|
4079
4075
|
|
|
4080
4076
|
// src/classic/accessor.ts
|
|
4081
4077
|
var import_api18 = require("@luma.gl/api");
|
|
4082
|
-
var import_constants16 =
|
|
4078
|
+
var import_constants16 = require("@luma.gl/constants");
|
|
4083
4079
|
|
|
4084
4080
|
// src/classic/typed-array-utils.ts
|
|
4085
4081
|
var import_constants15 = require("@luma.gl/constants");
|
|
@@ -4136,7 +4132,7 @@ function getTypedArrayFromGLType(glType, options) {
|
|
|
4136
4132
|
var DEFAULT_ACCESSOR_VALUES = {
|
|
4137
4133
|
offset: 0,
|
|
4138
4134
|
stride: 0,
|
|
4139
|
-
type: import_constants16.
|
|
4135
|
+
type: import_constants16.GL.FLOAT,
|
|
4140
4136
|
size: 1,
|
|
4141
4137
|
divisor: 0,
|
|
4142
4138
|
normalized: false,
|
|
@@ -4150,12 +4146,12 @@ var PROP_CHECKS = {
|
|
|
4150
4146
|
};
|
|
4151
4147
|
var Accessor = class {
|
|
4152
4148
|
static getBytesPerElement(accessor) {
|
|
4153
|
-
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.
|
|
4149
|
+
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.GL.FLOAT);
|
|
4154
4150
|
return ArrayType.BYTES_PER_ELEMENT;
|
|
4155
4151
|
}
|
|
4156
4152
|
static getBytesPerVertex(accessor) {
|
|
4157
4153
|
(0, import_api18.assert)(accessor.size);
|
|
4158
|
-
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.
|
|
4154
|
+
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.GL.FLOAT);
|
|
4159
4155
|
return ArrayType.BYTES_PER_ELEMENT * accessor.size;
|
|
4160
4156
|
}
|
|
4161
4157
|
// Combines (merges) a list of accessors. On top of default values
|
|
@@ -4186,7 +4182,7 @@ var Accessor = class {
|
|
|
4186
4182
|
props = (0, import_api18.checkProps)("Accessor", props, PROP_CHECKS);
|
|
4187
4183
|
if (props.type !== void 0) {
|
|
4188
4184
|
this.type = props.type;
|
|
4189
|
-
if (props.type === import_constants16.
|
|
4185
|
+
if (props.type === import_constants16.GL.INT || props.type === import_constants16.GL.UNSIGNED_INT) {
|
|
4190
4186
|
this.integer = true;
|
|
4191
4187
|
}
|
|
4192
4188
|
}
|
|
@@ -4249,7 +4245,7 @@ var Accessor = class {
|
|
|
4249
4245
|
}
|
|
4250
4246
|
};
|
|
4251
4247
|
|
|
4252
|
-
// src/classic/buffer.ts
|
|
4248
|
+
// src/classic/buffer-with-accessor.ts
|
|
4253
4249
|
var DEBUG_DATA_LENGTH2 = 10;
|
|
4254
4250
|
var DEPRECATED_PROPS = {
|
|
4255
4251
|
offset: "accessor.offset",
|
|
@@ -4287,7 +4283,7 @@ function getWEBGLBufferProps(props) {
|
|
|
4287
4283
|
}
|
|
4288
4284
|
return bufferProps;
|
|
4289
4285
|
}
|
|
4290
|
-
var
|
|
4286
|
+
var BufferWithAccessor = class extends WEBGLBuffer {
|
|
4291
4287
|
constructor(device, props = {}) {
|
|
4292
4288
|
super(WebGLDevice.attach(device), getWEBGLBufferProps(props));
|
|
4293
4289
|
this.setAccessor(Object.assign({}, props, props.accessor));
|
|
@@ -4321,7 +4317,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4321
4317
|
props = { byteLength: props };
|
|
4322
4318
|
}
|
|
4323
4319
|
props = (0, import_api19.checkProps)("Buffer", props, PROP_CHECKS_INITIALIZE);
|
|
4324
|
-
this.webglUsage = props.webglUsage || import_constants17.
|
|
4320
|
+
this.webglUsage = props.webglUsage || import_constants17.GL.STATIC_DRAW;
|
|
4325
4321
|
this.debugData = null;
|
|
4326
4322
|
this.setAccessor(Object.assign({}, props, props.accessor));
|
|
4327
4323
|
if (props.data) {
|
|
@@ -4375,7 +4371,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4375
4371
|
const { data, offset = 0, srcOffset = 0 } = options;
|
|
4376
4372
|
const byteLength = options.byteLength || options.length;
|
|
4377
4373
|
(0, import_api19.assert)(data);
|
|
4378
|
-
const target = this.gl.webgl2 ? import_constants17.
|
|
4374
|
+
const target = this.gl.webgl2 ? import_constants17.GL.COPY_WRITE_BUFFER : this.target;
|
|
4379
4375
|
this.gl.bindBuffer(target, this.handle);
|
|
4380
4376
|
if (srcOffset !== 0 || byteLength !== void 0) {
|
|
4381
4377
|
assertWebGL2Context(this.gl);
|
|
@@ -4396,11 +4392,11 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4396
4392
|
const { sourceBuffer, readOffset = 0, writeOffset = 0, size } = options;
|
|
4397
4393
|
const { gl, gl2 } = this;
|
|
4398
4394
|
assertWebGL2Context(gl);
|
|
4399
|
-
gl.bindBuffer(import_constants17.
|
|
4400
|
-
gl.bindBuffer(import_constants17.
|
|
4401
|
-
gl2 == null ? void 0 : gl2.copyBufferSubData(import_constants17.
|
|
4402
|
-
gl.bindBuffer(import_constants17.
|
|
4403
|
-
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);
|
|
4404
4400
|
this.debugData = null;
|
|
4405
4401
|
return this;
|
|
4406
4402
|
}
|
|
@@ -4413,7 +4409,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4413
4409
|
let { dstData = null, length = 0 } = options || {};
|
|
4414
4410
|
const { srcByteOffset = 0, dstOffset = 0 } = options || {};
|
|
4415
4411
|
assertWebGL2Context(this.gl);
|
|
4416
|
-
const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.
|
|
4412
|
+
const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.GL.FLOAT, { clamped: false });
|
|
4417
4413
|
const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);
|
|
4418
4414
|
const dstElementOffset = dstOffset;
|
|
4419
4415
|
let dstAvailableElementCount;
|
|
@@ -4432,9 +4428,9 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4432
4428
|
length = length || copyElementCount;
|
|
4433
4429
|
(0, import_api19.assert)(length <= copyElementCount);
|
|
4434
4430
|
dstData = dstData || new ArrayType(dstElementCount);
|
|
4435
|
-
this.gl.bindBuffer(import_constants17.
|
|
4436
|
-
(_a = this.gl2) == null ? void 0 : _a.getBufferSubData(import_constants17.
|
|
4437
|
-
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);
|
|
4438
4434
|
return dstData;
|
|
4439
4435
|
}
|
|
4440
4436
|
/**
|
|
@@ -4454,7 +4450,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4454
4450
|
offset = 0,
|
|
4455
4451
|
size
|
|
4456
4452
|
} = options || {};
|
|
4457
|
-
if (target === import_constants17.
|
|
4453
|
+
if (target === import_constants17.GL.UNIFORM_BUFFER || target === import_constants17.GL.TRANSFORM_FEEDBACK_BUFFER) {
|
|
4458
4454
|
if (size !== void 0) {
|
|
4459
4455
|
(_a = this.gl2) == null ? void 0 : _a.bindBufferRange(target, index, this.handle, offset, size);
|
|
4460
4456
|
} else {
|
|
@@ -4469,7 +4465,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4469
4465
|
unbind(options) {
|
|
4470
4466
|
var _a;
|
|
4471
4467
|
const { target = this.target, index = this.accessor && this.accessor.index } = options || {};
|
|
4472
|
-
const isIndexedBuffer = target === import_constants17.
|
|
4468
|
+
const isIndexedBuffer = target === import_constants17.GL.UNIFORM_BUFFER || target === import_constants17.GL.TRANSFORM_FEEDBACK_BUFFER;
|
|
4473
4469
|
if (isIndexedBuffer) {
|
|
4474
4470
|
(_a = this.gl2) == null ? void 0 : _a.bindBufferBase(target, index, null);
|
|
4475
4471
|
} else {
|
|
@@ -4530,10 +4526,10 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4530
4526
|
// Binding a buffer for the first time locks the type
|
|
4531
4527
|
// In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type
|
|
4532
4528
|
_getTarget() {
|
|
4533
|
-
return this.gl.webgl2 ? import_constants17.
|
|
4529
|
+
return this.gl.webgl2 ? import_constants17.GL.COPY_WRITE_BUFFER : this.target;
|
|
4534
4530
|
}
|
|
4535
4531
|
_getAvailableElementCount(srcByteOffset) {
|
|
4536
|
-
const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.
|
|
4532
|
+
const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.GL.FLOAT, { clamped: false });
|
|
4537
4533
|
const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;
|
|
4538
4534
|
return this.getElementCount() - sourceElementOffset;
|
|
4539
4535
|
}
|
|
@@ -4560,7 +4556,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
|
|
|
4560
4556
|
|
|
4561
4557
|
// src/adapter/resources/webgl-shader.ts
|
|
4562
4558
|
var import_api20 = require("@luma.gl/api");
|
|
4563
|
-
var import_constants18 =
|
|
4559
|
+
var import_constants18 = require("@luma.gl/constants");
|
|
4564
4560
|
|
|
4565
4561
|
// src/adapter/helpers/get-shader-info.ts
|
|
4566
4562
|
function getShaderInfo(source, defaultName) {
|
|
@@ -4626,10 +4622,10 @@ var WEBGLShader = class extends import_api20.Shader {
|
|
|
4626
4622
|
this.device = device;
|
|
4627
4623
|
switch (this.props.stage) {
|
|
4628
4624
|
case "vertex":
|
|
4629
|
-
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);
|
|
4630
4626
|
break;
|
|
4631
4627
|
case "fragment":
|
|
4632
|
-
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);
|
|
4633
4629
|
break;
|
|
4634
4630
|
default:
|
|
4635
4631
|
throw new Error(this.props.stage);
|
|
@@ -4657,7 +4653,7 @@ ${source2}`;
|
|
|
4657
4653
|
const { gl } = this.device;
|
|
4658
4654
|
gl.shaderSource(this.handle, source);
|
|
4659
4655
|
gl.compileShader(this.handle);
|
|
4660
|
-
const compileStatus = gl.getShaderParameter(this.handle, import_constants18.
|
|
4656
|
+
const compileStatus = gl.getShaderParameter(this.handle, import_constants18.GL.COMPILE_STATUS);
|
|
4661
4657
|
if (!compileStatus) {
|
|
4662
4658
|
const shaderLog = gl.getShaderInfoLog(this.handle);
|
|
4663
4659
|
const parsedLog = shaderLog ? parseShaderCompilerLog(shaderLog) : [];
|
|
@@ -4797,10 +4793,10 @@ var WEBGLRenderPass = class extends import_api21.RenderPass {
|
|
|
4797
4793
|
|
|
4798
4794
|
// src/adapter/resources/webgl-render-pipeline.ts
|
|
4799
4795
|
var import_api23 = require("@luma.gl/api");
|
|
4800
|
-
var import_constants25 =
|
|
4796
|
+
var import_constants25 = require("@luma.gl/constants");
|
|
4801
4797
|
|
|
4802
4798
|
// src/adapter/helpers/get-shader-layout.ts
|
|
4803
|
-
var import_constants22 =
|
|
4799
|
+
var import_constants22 = require("@luma.gl/constants");
|
|
4804
4800
|
|
|
4805
4801
|
// src/adapter/helpers/uniforms.ts
|
|
4806
4802
|
var import_constants20 = require("@luma.gl/constants");
|
|
@@ -4878,7 +4874,7 @@ function decodeAttributeType(attributeType) {
|
|
|
4878
4874
|
}
|
|
4879
4875
|
|
|
4880
4876
|
// src/adapter/converters/vertex-formats.ts
|
|
4881
|
-
var import_constants21 =
|
|
4877
|
+
var import_constants21 = require("@luma.gl/constants");
|
|
4882
4878
|
function getVertexFormat(type, components) {
|
|
4883
4879
|
const base = getDataFormat(type);
|
|
4884
4880
|
switch (components) {
|
|
@@ -4896,11 +4892,11 @@ function getVertexFormat(type, components) {
|
|
|
4896
4892
|
}
|
|
4897
4893
|
function getDataFormat(type) {
|
|
4898
4894
|
switch (type) {
|
|
4899
|
-
case import_constants21.
|
|
4895
|
+
case import_constants21.GL.INT:
|
|
4900
4896
|
return "sint32";
|
|
4901
|
-
case import_constants21.
|
|
4897
|
+
case import_constants21.GL.UNSIGNED_INT:
|
|
4902
4898
|
return "uint32";
|
|
4903
|
-
case import_constants21.
|
|
4899
|
+
case import_constants21.GL.FLOAT:
|
|
4904
4900
|
return "float32";
|
|
4905
4901
|
default:
|
|
4906
4902
|
throw new Error(String(type));
|
|
@@ -4919,7 +4915,7 @@ function getShaderLayout(gl, program) {
|
|
|
4919
4915
|
const size = Math.min(attribute.accessor.size, 4);
|
|
4920
4916
|
const format = (
|
|
4921
4917
|
// attribute.accessor.format ||
|
|
4922
|
-
getVertexFormat(attribute.accessor.type || import_constants22.
|
|
4918
|
+
getVertexFormat(attribute.accessor.type || import_constants22.GL.FLOAT, size)
|
|
4923
4919
|
);
|
|
4924
4920
|
shaderLayout.attributes.push({
|
|
4925
4921
|
name: attribute.name,
|
|
@@ -5008,7 +5004,7 @@ function readVaryings(gl, program) {
|
|
|
5008
5004
|
}
|
|
5009
5005
|
const gl2 = gl;
|
|
5010
5006
|
const varyings = [];
|
|
5011
|
-
const count = gl.getProgramParameter(program, import_constants22.
|
|
5007
|
+
const count = gl.getProgramParameter(program, import_constants22.GL.TRANSFORM_FEEDBACK_VARYINGS);
|
|
5012
5008
|
for (let location = 0; location < count; location++) {
|
|
5013
5009
|
const activeInfo = gl2.getTransformFeedbackVarying(program, location);
|
|
5014
5010
|
if (!activeInfo) {
|
|
@@ -5025,7 +5021,7 @@ function readVaryings(gl, program) {
|
|
|
5025
5021
|
}
|
|
5026
5022
|
function readUniformBindings(gl, program) {
|
|
5027
5023
|
const uniforms = [];
|
|
5028
|
-
const uniformCount = gl.getProgramParameter(program, import_constants22.
|
|
5024
|
+
const uniformCount = gl.getProgramParameter(program, import_constants22.GL.ACTIVE_UNIFORMS);
|
|
5029
5025
|
for (let i = 0; i < uniformCount; i++) {
|
|
5030
5026
|
const activeInfo = gl.getActiveUniform(program, i);
|
|
5031
5027
|
if (!activeInfo) {
|
|
@@ -5064,22 +5060,22 @@ function readUniformBlocks(gl, program) {
|
|
|
5064
5060
|
const gl2 = gl;
|
|
5065
5061
|
const getBlockParameter = (blockIndex, pname) => gl2.getActiveUniformBlockParameter(program, blockIndex, pname);
|
|
5066
5062
|
const uniformBlocks = [];
|
|
5067
|
-
const blockCount = gl2.getProgramParameter(program, import_constants22.
|
|
5063
|
+
const blockCount = gl2.getProgramParameter(program, import_constants22.GL.ACTIVE_UNIFORM_BLOCKS);
|
|
5068
5064
|
for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {
|
|
5069
5065
|
const blockInfo = {
|
|
5070
5066
|
name: gl2.getActiveUniformBlockName(program, blockIndex) || "",
|
|
5071
|
-
location: getBlockParameter(blockIndex, import_constants22.
|
|
5072
|
-
byteLength: getBlockParameter(blockIndex, import_constants22.
|
|
5073
|
-
vertex: getBlockParameter(blockIndex, import_constants22.
|
|
5074
|
-
fragment: getBlockParameter(blockIndex, import_constants22.
|
|
5075
|
-
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),
|
|
5076
5072
|
uniforms: []
|
|
5077
5073
|
};
|
|
5078
|
-
const uniformIndices = getBlockParameter(blockIndex, import_constants22.
|
|
5079
|
-
const uniformType = gl2.getActiveUniforms(program, uniformIndices, import_constants22.
|
|
5080
|
-
const uniformArrayLength = gl2.getActiveUniforms(program, uniformIndices, import_constants22.
|
|
5081
|
-
const uniformOffset = gl2.getActiveUniforms(program, uniformIndices, import_constants22.
|
|
5082
|
-
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);
|
|
5083
5079
|
for (let i = 0; i < blockInfo.uniformCount; ++i) {
|
|
5084
5080
|
const activeInfo = gl2.getActiveUniform(program, uniformIndices[i]);
|
|
5085
5081
|
if (!activeInfo) {
|
|
@@ -5102,21 +5098,21 @@ function readUniformBlocks(gl, program) {
|
|
|
5102
5098
|
return uniformBlocks;
|
|
5103
5099
|
}
|
|
5104
5100
|
var SAMPLER_UNIFORMS_GL_TO_GPU = {
|
|
5105
|
-
[import_constants22.
|
|
5106
|
-
[import_constants22.
|
|
5107
|
-
[import_constants22.
|
|
5108
|
-
[import_constants22.
|
|
5109
|
-
[import_constants22.
|
|
5110
|
-
[import_constants22.
|
|
5111
|
-
[import_constants22.
|
|
5112
|
-
[import_constants22.
|
|
5113
|
-
[import_constants22.
|
|
5114
|
-
[import_constants22.
|
|
5115
|
-
[import_constants22.
|
|
5116
|
-
[import_constants22.
|
|
5117
|
-
[import_constants22.
|
|
5118
|
-
[import_constants22.
|
|
5119
|
-
[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"]
|
|
5120
5116
|
};
|
|
5121
5117
|
function getSamplerInfo(type) {
|
|
5122
5118
|
const sampler = SAMPLER_UNIFORMS_GL_TO_GPU[type];
|
|
@@ -5147,26 +5143,26 @@ function parseUniformName(name) {
|
|
|
5147
5143
|
}
|
|
5148
5144
|
|
|
5149
5145
|
// src/adapter/helpers/set-uniform.ts
|
|
5150
|
-
var import_constants23 =
|
|
5146
|
+
var import_constants23 = require("@luma.gl/constants");
|
|
5151
5147
|
function setUniform(gl, location, type, value) {
|
|
5152
5148
|
const gl2 = gl;
|
|
5153
5149
|
if (typeof value === "number") {
|
|
5154
5150
|
switch (type) {
|
|
5155
|
-
case import_constants23.
|
|
5156
|
-
case import_constants23.
|
|
5157
|
-
case import_constants23.
|
|
5158
|
-
case import_constants23.
|
|
5159
|
-
case import_constants23.
|
|
5160
|
-
case import_constants23.
|
|
5161
|
-
case import_constants23.
|
|
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.
|
|
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:
|
|
5170
5166
|
return gl.uniform1i(location, value);
|
|
5171
5167
|
}
|
|
5172
5168
|
}
|
|
@@ -5178,55 +5174,55 @@ function setUniform(gl, location, type, value) {
|
|
|
5178
5174
|
}
|
|
5179
5175
|
const arrayValue = typeof value === "number" ? [value] : value;
|
|
5180
5176
|
switch (type) {
|
|
5181
|
-
case import_constants23.
|
|
5177
|
+
case import_constants23.GL.FLOAT:
|
|
5182
5178
|
return gl.uniform1fv(location, arrayValue);
|
|
5183
|
-
case import_constants23.
|
|
5179
|
+
case import_constants23.GL.FLOAT_VEC2:
|
|
5184
5180
|
return gl.uniform2fv(location, arrayValue);
|
|
5185
|
-
case import_constants23.
|
|
5181
|
+
case import_constants23.GL.FLOAT_VEC3:
|
|
5186
5182
|
return gl.uniform3fv(location, arrayValue);
|
|
5187
|
-
case import_constants23.
|
|
5183
|
+
case import_constants23.GL.FLOAT_VEC4:
|
|
5188
5184
|
return gl.uniform4fv(location, arrayValue);
|
|
5189
|
-
case import_constants23.
|
|
5185
|
+
case import_constants23.GL.INT:
|
|
5190
5186
|
return gl.uniform1iv(location, arrayValue);
|
|
5191
|
-
case import_constants23.
|
|
5187
|
+
case import_constants23.GL.INT_VEC2:
|
|
5192
5188
|
return gl.uniform2iv(location, arrayValue);
|
|
5193
|
-
case import_constants23.
|
|
5189
|
+
case import_constants23.GL.INT_VEC3:
|
|
5194
5190
|
return gl.uniform3iv(location, arrayValue);
|
|
5195
|
-
case import_constants23.
|
|
5191
|
+
case import_constants23.GL.INT_VEC4:
|
|
5196
5192
|
return gl.uniform4iv(location, arrayValue);
|
|
5197
|
-
case import_constants23.
|
|
5193
|
+
case import_constants23.GL.BOOL:
|
|
5198
5194
|
return gl.uniform1iv(location, arrayValue);
|
|
5199
|
-
case import_constants23.
|
|
5195
|
+
case import_constants23.GL.BOOL_VEC2:
|
|
5200
5196
|
return gl.uniform2iv(location, arrayValue);
|
|
5201
|
-
case import_constants23.
|
|
5197
|
+
case import_constants23.GL.BOOL_VEC3:
|
|
5202
5198
|
return gl.uniform3iv(location, arrayValue);
|
|
5203
|
-
case import_constants23.
|
|
5199
|
+
case import_constants23.GL.BOOL_VEC4:
|
|
5204
5200
|
return gl.uniform4iv(location, arrayValue);
|
|
5205
|
-
case import_constants23.
|
|
5201
|
+
case import_constants23.GL.UNSIGNED_INT:
|
|
5206
5202
|
return gl2.uniform1uiv(location, arrayValue, 1);
|
|
5207
|
-
case import_constants23.
|
|
5203
|
+
case import_constants23.GL.UNSIGNED_INT_VEC2:
|
|
5208
5204
|
return gl2.uniform2uiv(location, arrayValue, 2);
|
|
5209
|
-
case import_constants23.
|
|
5205
|
+
case import_constants23.GL.UNSIGNED_INT_VEC3:
|
|
5210
5206
|
return gl2.uniform3uiv(location, arrayValue, 3);
|
|
5211
|
-
case import_constants23.
|
|
5207
|
+
case import_constants23.GL.UNSIGNED_INT_VEC4:
|
|
5212
5208
|
return gl2.uniform4uiv(location, arrayValue, 4);
|
|
5213
|
-
case import_constants23.
|
|
5209
|
+
case import_constants23.GL.FLOAT_MAT2:
|
|
5214
5210
|
return gl.uniformMatrix2fv(location, false, arrayValue);
|
|
5215
|
-
case import_constants23.
|
|
5211
|
+
case import_constants23.GL.FLOAT_MAT3:
|
|
5216
5212
|
return gl.uniformMatrix3fv(location, false, arrayValue);
|
|
5217
|
-
case import_constants23.
|
|
5213
|
+
case import_constants23.GL.FLOAT_MAT4:
|
|
5218
5214
|
return gl.uniformMatrix4fv(location, false, arrayValue);
|
|
5219
|
-
case import_constants23.
|
|
5215
|
+
case import_constants23.GL.FLOAT_MAT2x3:
|
|
5220
5216
|
return gl2.uniformMatrix2x3fv(location, false, arrayValue);
|
|
5221
|
-
case import_constants23.
|
|
5217
|
+
case import_constants23.GL.FLOAT_MAT2x4:
|
|
5222
5218
|
return gl2.uniformMatrix2x4fv(location, false, arrayValue);
|
|
5223
|
-
case import_constants23.
|
|
5219
|
+
case import_constants23.GL.FLOAT_MAT3x2:
|
|
5224
5220
|
return gl2.uniformMatrix3x2fv(location, false, arrayValue);
|
|
5225
|
-
case import_constants23.
|
|
5221
|
+
case import_constants23.GL.FLOAT_MAT3x4:
|
|
5226
5222
|
return gl2.uniformMatrix3x4fv(location, false, arrayValue);
|
|
5227
|
-
case import_constants23.
|
|
5223
|
+
case import_constants23.GL.FLOAT_MAT4x2:
|
|
5228
5224
|
return gl2.uniformMatrix4x2fv(location, false, arrayValue);
|
|
5229
|
-
case import_constants23.
|
|
5225
|
+
case import_constants23.GL.FLOAT_MAT4x3:
|
|
5230
5226
|
return gl2.uniformMatrix4x3fv(location, false, arrayValue);
|
|
5231
5227
|
}
|
|
5232
5228
|
throw new Error("Illegal uniform");
|
|
@@ -5234,7 +5230,7 @@ function setUniform(gl, location, type, value) {
|
|
|
5234
5230
|
|
|
5235
5231
|
// src/adapter/objects/webgl-vertex-array-object.ts
|
|
5236
5232
|
var import_api22 = require("@luma.gl/api");
|
|
5237
|
-
var import_constants24 =
|
|
5233
|
+
var import_constants24 = require("@luma.gl/constants");
|
|
5238
5234
|
var import_env = require("@probe.gl/env");
|
|
5239
5235
|
var ERR_ELEMENTS = "elements must be GL.ELEMENT_ARRAY_BUFFER";
|
|
5240
5236
|
var WEBGLVertexArrayObject = class extends WebGLResource {
|
|
@@ -5257,15 +5253,15 @@ var WEBGLVertexArrayObject = class extends WebGLResource {
|
|
|
5257
5253
|
// Set (bind) an elements buffer, for indexed rendering.
|
|
5258
5254
|
// Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported
|
|
5259
5255
|
setElementBuffer(elementBuffer = null, opts = {}) {
|
|
5260
|
-
(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);
|
|
5261
5257
|
this.bind(() => {
|
|
5262
|
-
this.gl.bindBuffer(import_constants24.
|
|
5258
|
+
this.gl.bindBuffer(import_constants24.GL.ELEMENT_ARRAY_BUFFER, elementBuffer ? elementBuffer.handle : null);
|
|
5263
5259
|
});
|
|
5264
5260
|
return this;
|
|
5265
5261
|
}
|
|
5266
5262
|
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
5267
5263
|
setBuffer(location, buffer, accessor) {
|
|
5268
|
-
if (buffer.target === import_constants24.
|
|
5264
|
+
if (buffer.target === import_constants24.GL.ELEMENT_ARRAY_BUFFER) {
|
|
5269
5265
|
return this.setElementBuffer(buffer, accessor);
|
|
5270
5266
|
}
|
|
5271
5267
|
const { size, type, stride, offset, normalized, integer, divisor } = accessor;
|
|
@@ -5324,7 +5320,7 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5324
5320
|
this.device.setSpectorMetadata(this.handle, { id: this.props.id });
|
|
5325
5321
|
this.vs = (0, import_api23.cast)(props.vs);
|
|
5326
5322
|
this.fs = (0, import_api23.cast)(props.fs);
|
|
5327
|
-
const { varyings, bufferMode = import_constants25.
|
|
5323
|
+
const { varyings, bufferMode = import_constants25.GL.SEPARATE_ATTRIBS } = props;
|
|
5328
5324
|
if (varyings && varyings.length > 0) {
|
|
5329
5325
|
this.device.assertWebGL2();
|
|
5330
5326
|
this.varyings = varyings;
|
|
@@ -5421,7 +5417,7 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5421
5417
|
} = options;
|
|
5422
5418
|
const drawMode = getDrawMode(this.props.topology);
|
|
5423
5419
|
const isIndexed = Boolean(this._indexBuffer);
|
|
5424
|
-
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;
|
|
5425
5421
|
const isInstanced = Number(options.instanceCount) > 0;
|
|
5426
5422
|
if (!this._areTexturesRenderable() || options.vertexCount === 0) {
|
|
5427
5423
|
return false;
|
|
@@ -5521,15 +5517,15 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5521
5517
|
case "uniform":
|
|
5522
5518
|
const { name } = binding;
|
|
5523
5519
|
const location = gl2.getUniformBlockIndex(this.handle, name);
|
|
5524
|
-
if (location === import_constants25.
|
|
5520
|
+
if (location === import_constants25.GL.INVALID_INDEX) {
|
|
5525
5521
|
throw new Error(`Invalid uniform block name ${name}`);
|
|
5526
5522
|
}
|
|
5527
5523
|
gl2.uniformBlockBinding(this.handle, uniformBufferIndex, location);
|
|
5528
5524
|
if (value instanceof WEBGLBuffer) {
|
|
5529
|
-
gl2.bindBufferBase(import_constants25.
|
|
5525
|
+
gl2.bindBufferBase(import_constants25.GL.UNIFORM_BUFFER, uniformBufferIndex, value.handle);
|
|
5530
5526
|
} else {
|
|
5531
5527
|
gl2.bindBufferRange(
|
|
5532
|
-
import_constants25.
|
|
5528
|
+
import_constants25.GL.UNIFORM_BUFFER,
|
|
5533
5529
|
uniformBufferIndex,
|
|
5534
5530
|
value.buffer.handle,
|
|
5535
5531
|
value.offset || 0,
|
|
@@ -5543,7 +5539,7 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5543
5539
|
throw new Error("texture");
|
|
5544
5540
|
}
|
|
5545
5541
|
const texture = value;
|
|
5546
|
-
gl2.activeTexture(import_constants25.
|
|
5542
|
+
gl2.activeTexture(import_constants25.GL.TEXTURE0 + textureUnit);
|
|
5547
5543
|
gl2.bindTexture(texture.target, texture.handle);
|
|
5548
5544
|
textureUnit += 1;
|
|
5549
5545
|
break;
|
|
@@ -5556,9 +5552,10 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5556
5552
|
}
|
|
5557
5553
|
}
|
|
5558
5554
|
_applyUniforms() {
|
|
5555
|
+
var _a;
|
|
5559
5556
|
for (const uniformLayout of this.layout.uniforms || []) {
|
|
5560
5557
|
const { name, location, type, textureUnit } = uniformLayout;
|
|
5561
|
-
const value = this.uniforms[name]
|
|
5558
|
+
const value = (_a = this.uniforms[name]) != null ? _a : textureUnit;
|
|
5562
5559
|
if (value !== void 0) {
|
|
5563
5560
|
setUniform(this.device.gl, location, type, value);
|
|
5564
5561
|
}
|
|
@@ -5568,19 +5565,19 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
|
|
|
5568
5565
|
function getDrawMode(topology) {
|
|
5569
5566
|
switch (topology) {
|
|
5570
5567
|
case "point-list":
|
|
5571
|
-
return import_constants25.
|
|
5568
|
+
return import_constants25.GL.POINTS;
|
|
5572
5569
|
case "line-list":
|
|
5573
|
-
return import_constants25.
|
|
5570
|
+
return import_constants25.GL.LINES;
|
|
5574
5571
|
case "line-strip":
|
|
5575
|
-
return import_constants25.
|
|
5572
|
+
return import_constants25.GL.LINE_STRIP;
|
|
5576
5573
|
case "line-loop":
|
|
5577
|
-
return import_constants25.
|
|
5574
|
+
return import_constants25.GL.LINE_LOOP;
|
|
5578
5575
|
case "triangle-list":
|
|
5579
|
-
return import_constants25.
|
|
5576
|
+
return import_constants25.GL.TRIANGLES;
|
|
5580
5577
|
case "triangle-strip":
|
|
5581
|
-
return import_constants25.
|
|
5578
|
+
return import_constants25.GL.TRIANGLE_STRIP;
|
|
5582
5579
|
case "triangle-fan":
|
|
5583
|
-
return import_constants25.
|
|
5580
|
+
return import_constants25.GL.TRIANGLE_FAN;
|
|
5584
5581
|
default:
|
|
5585
5582
|
throw new Error(topology);
|
|
5586
5583
|
}
|
|
@@ -5588,19 +5585,19 @@ function getDrawMode(topology) {
|
|
|
5588
5585
|
function getGLPrimitive(topology) {
|
|
5589
5586
|
switch (topology) {
|
|
5590
5587
|
case "point-list":
|
|
5591
|
-
return import_constants25.
|
|
5588
|
+
return import_constants25.GL.POINTS;
|
|
5592
5589
|
case "line-list":
|
|
5593
|
-
return import_constants25.
|
|
5590
|
+
return import_constants25.GL.LINES;
|
|
5594
5591
|
case "line-strip":
|
|
5595
|
-
return import_constants25.
|
|
5592
|
+
return import_constants25.GL.LINES;
|
|
5596
5593
|
case "line-loop":
|
|
5597
|
-
return import_constants25.
|
|
5594
|
+
return import_constants25.GL.LINES;
|
|
5598
5595
|
case "triangle-list":
|
|
5599
|
-
return import_constants25.
|
|
5596
|
+
return import_constants25.GL.TRIANGLES;
|
|
5600
5597
|
case "triangle-strip":
|
|
5601
|
-
return import_constants25.
|
|
5598
|
+
return import_constants25.GL.TRIANGLES;
|
|
5602
5599
|
case "triangle-fan":
|
|
5603
|
-
return import_constants25.
|
|
5600
|
+
return import_constants25.GL.TRIANGLES;
|
|
5604
5601
|
default:
|
|
5605
5602
|
throw new Error(topology);
|
|
5606
5603
|
}
|
|
@@ -5614,7 +5611,7 @@ var import_api25 = require("@luma.gl/api");
|
|
|
5614
5611
|
|
|
5615
5612
|
// src/adapter/resources/webgl-command-buffer.ts
|
|
5616
5613
|
var import_api24 = require("@luma.gl/api");
|
|
5617
|
-
var import_constants26 =
|
|
5614
|
+
var import_constants26 = require("@luma.gl/constants");
|
|
5618
5615
|
function cast3(value) {
|
|
5619
5616
|
return value;
|
|
5620
5617
|
}
|
|
@@ -5649,17 +5646,17 @@ function _copyBufferToBuffer(device, options) {
|
|
|
5649
5646
|
const destination = cast3(options.destination);
|
|
5650
5647
|
const gl2 = device.assertWebGL2();
|
|
5651
5648
|
if (gl2) {
|
|
5652
|
-
gl2.bindBuffer(import_constants26.
|
|
5653
|
-
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);
|
|
5654
5651
|
gl2.copyBufferSubData(
|
|
5655
|
-
import_constants26.
|
|
5656
|
-
import_constants26.
|
|
5652
|
+
import_constants26.GL.COPY_READ_BUFFER,
|
|
5653
|
+
import_constants26.GL.COPY_WRITE_BUFFER,
|
|
5657
5654
|
(_a = options.sourceOffset) != null ? _a : 0,
|
|
5658
5655
|
(_b = options.destinationOffset) != null ? _b : 0,
|
|
5659
5656
|
options.size
|
|
5660
5657
|
);
|
|
5661
|
-
gl2.bindBuffer(import_constants26.
|
|
5662
|
-
gl2.bindBuffer(import_constants26.
|
|
5658
|
+
gl2.bindBuffer(import_constants26.GL.COPY_READ_BUFFER, null);
|
|
5659
|
+
gl2.bindBuffer(import_constants26.GL.COPY_WRITE_BUFFER, null);
|
|
5663
5660
|
} else {
|
|
5664
5661
|
throw new Error("copyBufferToBuffer not implemented in WebGL1");
|
|
5665
5662
|
}
|
|
@@ -5710,10 +5707,10 @@ function _copyTextureToBuffer(device, options) {
|
|
|
5710
5707
|
const webglBuffer = destination;
|
|
5711
5708
|
const sourceWidth = width || framebuffer.width;
|
|
5712
5709
|
const sourceHeight = height || framebuffer.height;
|
|
5713
|
-
const sourceFormat = import_constants26.
|
|
5714
|
-
const sourceType = import_constants26.
|
|
5715
|
-
gl2.bindBuffer(import_constants26.
|
|
5716
|
-
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);
|
|
5717
5714
|
gl2.readPixels(
|
|
5718
5715
|
origin[0],
|
|
5719
5716
|
origin[1],
|
|
@@ -5724,8 +5721,8 @@ function _copyTextureToBuffer(device, options) {
|
|
|
5724
5721
|
byteOffset
|
|
5725
5722
|
);
|
|
5726
5723
|
} finally {
|
|
5727
|
-
gl2.bindBuffer(import_constants26.
|
|
5728
|
-
gl2.bindFramebuffer(import_constants26.
|
|
5724
|
+
gl2.bindBuffer(import_constants26.GL.PIXEL_PACK_BUFFER, null);
|
|
5725
|
+
gl2.bindFramebuffer(import_constants26.GL.FRAMEBUFFER, null);
|
|
5729
5726
|
if (destroyFramebuffer) {
|
|
5730
5727
|
framebuffer.destroy();
|
|
5731
5728
|
}
|
|
@@ -5756,11 +5753,11 @@ function _copyTextureToTexture(device, options) {
|
|
|
5756
5753
|
// depthOrArrayLayers = 0
|
|
5757
5754
|
} = options;
|
|
5758
5755
|
const destinationMipmaplevel = 0;
|
|
5759
|
-
const destinationInternalFormat = import_constants26.
|
|
5756
|
+
const destinationInternalFormat = import_constants26.GL.RGBA;
|
|
5760
5757
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
5761
5758
|
const [sourceX, sourceY] = origin;
|
|
5762
5759
|
const isSubCopy = false;
|
|
5763
|
-
device.gl.bindFramebuffer(import_constants26.
|
|
5760
|
+
device.gl.bindFramebuffer(import_constants26.GL.FRAMEBUFFER, framebuffer.handle);
|
|
5764
5761
|
let texture = null;
|
|
5765
5762
|
let textureTarget;
|
|
5766
5763
|
if (destination instanceof WEBGLTexture) {
|
|
@@ -5789,7 +5786,7 @@ function _copyTextureToTexture(device, options) {
|
|
|
5789
5786
|
if (texture) {
|
|
5790
5787
|
texture.unbind();
|
|
5791
5788
|
}
|
|
5792
|
-
device.gl.bindFramebuffer(import_constants26.
|
|
5789
|
+
device.gl.bindFramebuffer(import_constants26.GL.FRAMEBUFFER, prevHandle || null);
|
|
5793
5790
|
if (destroyFramebuffer) {
|
|
5794
5791
|
framebuffer.destroy();
|
|
5795
5792
|
}
|
|
@@ -6011,7 +6008,7 @@ var _WebGLDevice = class extends import_api26.Device {
|
|
|
6011
6008
|
}
|
|
6012
6009
|
createBuffer(props) {
|
|
6013
6010
|
const newProps = this._getBufferProps(props);
|
|
6014
|
-
return new
|
|
6011
|
+
return new BufferWithAccessor(this, newProps);
|
|
6015
6012
|
}
|
|
6016
6013
|
_createTexture(props) {
|
|
6017
6014
|
return new WEBGLTexture(this, props);
|
|
@@ -6133,3 +6130,180 @@ function isWebGL22(gl) {
|
|
|
6133
6130
|
}
|
|
6134
6131
|
return Boolean(gl && gl._version === 2);
|
|
6135
6132
|
}
|
|
6133
|
+
|
|
6134
|
+
// src/classic/clear.ts
|
|
6135
|
+
var import_api27 = require("@luma.gl/api");
|
|
6136
|
+
var GL_DEPTH_BUFFER_BIT2 = 256;
|
|
6137
|
+
var GL_STENCIL_BUFFER_BIT2 = 1024;
|
|
6138
|
+
var GL_COLOR_BUFFER_BIT2 = 16384;
|
|
6139
|
+
var ERR_ARGUMENTS = "clear: bad arguments";
|
|
6140
|
+
function clear(gl, options) {
|
|
6141
|
+
const device = WebGLDevice.attach(gl);
|
|
6142
|
+
const { framebuffer = null, color = null, depth = null, stencil = null } = options || {};
|
|
6143
|
+
const parameters = {};
|
|
6144
|
+
if (framebuffer) {
|
|
6145
|
+
parameters.framebuffer = framebuffer;
|
|
6146
|
+
}
|
|
6147
|
+
let clearFlags = 0;
|
|
6148
|
+
if (color) {
|
|
6149
|
+
clearFlags |= GL_COLOR_BUFFER_BIT2;
|
|
6150
|
+
if (color !== true) {
|
|
6151
|
+
parameters.clearColor = color;
|
|
6152
|
+
}
|
|
6153
|
+
}
|
|
6154
|
+
if (depth) {
|
|
6155
|
+
clearFlags |= GL_DEPTH_BUFFER_BIT2;
|
|
6156
|
+
if (depth !== true) {
|
|
6157
|
+
parameters.clearDepth = depth;
|
|
6158
|
+
}
|
|
6159
|
+
}
|
|
6160
|
+
if (stencil) {
|
|
6161
|
+
clearFlags |= GL_STENCIL_BUFFER_BIT2;
|
|
6162
|
+
if (depth !== true) {
|
|
6163
|
+
parameters.clearStencil = depth;
|
|
6164
|
+
}
|
|
6165
|
+
}
|
|
6166
|
+
(0, import_api27.assert)(clearFlags !== 0, ERR_ARGUMENTS);
|
|
6167
|
+
withParameters(device.gl, parameters, () => {
|
|
6168
|
+
device.gl.clear(clearFlags);
|
|
6169
|
+
});
|
|
6170
|
+
}
|
|
6171
|
+
|
|
6172
|
+
// src/classic/copy-and-blit.ts
|
|
6173
|
+
var import_api29 = require("@luma.gl/api");
|
|
6174
|
+
var import_constants28 = require("@luma.gl/constants");
|
|
6175
|
+
|
|
6176
|
+
// src/classic/format-utils.ts
|
|
6177
|
+
var import_api28 = require("@luma.gl/api");
|
|
6178
|
+
var import_constants27 = require("@luma.gl/constants");
|
|
6179
|
+
function glFormatToComponents(format) {
|
|
6180
|
+
switch (format) {
|
|
6181
|
+
case import_constants27.GL.ALPHA:
|
|
6182
|
+
case import_constants27.GL.R32F:
|
|
6183
|
+
case import_constants27.GL.RED:
|
|
6184
|
+
return 1;
|
|
6185
|
+
case import_constants27.GL.RG32F:
|
|
6186
|
+
case import_constants27.GL.RG:
|
|
6187
|
+
return 2;
|
|
6188
|
+
case import_constants27.GL.RGB:
|
|
6189
|
+
case import_constants27.GL.RGB32F:
|
|
6190
|
+
return 3;
|
|
6191
|
+
case import_constants27.GL.RGBA:
|
|
6192
|
+
case import_constants27.GL.RGBA32F:
|
|
6193
|
+
return 4;
|
|
6194
|
+
default:
|
|
6195
|
+
(0, import_api28.assert)(false);
|
|
6196
|
+
return 0;
|
|
6197
|
+
}
|
|
6198
|
+
}
|
|
6199
|
+
function glTypeToBytes(type) {
|
|
6200
|
+
switch (type) {
|
|
6201
|
+
case import_constants27.GL.UNSIGNED_BYTE:
|
|
6202
|
+
return 1;
|
|
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:
|
|
6206
|
+
return 2;
|
|
6207
|
+
case import_constants27.GL.FLOAT:
|
|
6208
|
+
return 4;
|
|
6209
|
+
default:
|
|
6210
|
+
(0, import_api28.assert)(false);
|
|
6211
|
+
return 0;
|
|
6212
|
+
}
|
|
6213
|
+
}
|
|
6214
|
+
|
|
6215
|
+
// src/classic/copy-and-blit.ts
|
|
6216
|
+
function readPixelsToArray(source, options) {
|
|
6217
|
+
const { sourceX = 0, sourceY = 0, sourceFormat = import_constants28.GL.RGBA } = options || {};
|
|
6218
|
+
let {
|
|
6219
|
+
sourceAttachment = import_constants28.GL.COLOR_ATTACHMENT0,
|
|
6220
|
+
// TODO - support gl.readBuffer
|
|
6221
|
+
target = null,
|
|
6222
|
+
// following parameters are auto deduced if not provided
|
|
6223
|
+
sourceWidth,
|
|
6224
|
+
sourceHeight,
|
|
6225
|
+
sourceType
|
|
6226
|
+
} = options || {};
|
|
6227
|
+
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
6228
|
+
(0, import_api29.assert)(framebuffer);
|
|
6229
|
+
const { gl, handle } = framebuffer;
|
|
6230
|
+
sourceWidth = sourceWidth || framebuffer.width;
|
|
6231
|
+
sourceHeight = sourceHeight || framebuffer.height;
|
|
6232
|
+
if (sourceAttachment === import_constants28.GL.COLOR_ATTACHMENT0 && handle === null) {
|
|
6233
|
+
sourceAttachment = import_constants28.GL.FRONT;
|
|
6234
|
+
}
|
|
6235
|
+
const attachment = sourceAttachment - import_constants28.GL.COLOR_ATTACHMENT0;
|
|
6236
|
+
sourceType = sourceType || framebuffer.colorAttachments[attachment].type;
|
|
6237
|
+
target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);
|
|
6238
|
+
sourceType = sourceType || getGLTypeFromTypedArray(target);
|
|
6239
|
+
const prevHandle2 = gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, handle);
|
|
6240
|
+
gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);
|
|
6241
|
+
gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, prevHandle2 || null);
|
|
6242
|
+
if (deleteFramebuffer) {
|
|
6243
|
+
framebuffer.destroy();
|
|
6244
|
+
}
|
|
6245
|
+
return target;
|
|
6246
|
+
}
|
|
6247
|
+
function readPixelsToBuffer(source, options) {
|
|
6248
|
+
const { sourceX = 0, sourceY = 0, sourceFormat = import_constants28.GL.RGBA, targetByteOffset = 0 } = options || {};
|
|
6249
|
+
let { target, sourceWidth, sourceHeight, sourceType } = options || {};
|
|
6250
|
+
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
6251
|
+
(0, import_api29.assert)(framebuffer);
|
|
6252
|
+
sourceWidth = sourceWidth || framebuffer.width;
|
|
6253
|
+
sourceHeight = sourceHeight || framebuffer.height;
|
|
6254
|
+
const webglFramebuffer = framebuffer;
|
|
6255
|
+
const gl2 = webglFramebuffer.device.assertWebGL2();
|
|
6256
|
+
sourceType = sourceType || (target ? target.type : import_constants28.GL.UNSIGNED_BYTE);
|
|
6257
|
+
if (!target) {
|
|
6258
|
+
const components = glFormatToComponents(sourceFormat);
|
|
6259
|
+
const byteCount = glTypeToBytes(sourceType);
|
|
6260
|
+
const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;
|
|
6261
|
+
target = new BufferWithAccessor(gl2, { byteLength, accessor: { type: sourceType, size: components } });
|
|
6262
|
+
}
|
|
6263
|
+
target.bind({ target: import_constants28.GL.PIXEL_PACK_BUFFER });
|
|
6264
|
+
withParameters(gl2, { framebuffer }, () => {
|
|
6265
|
+
gl2.readPixels(
|
|
6266
|
+
sourceX,
|
|
6267
|
+
sourceY,
|
|
6268
|
+
sourceWidth,
|
|
6269
|
+
sourceHeight,
|
|
6270
|
+
sourceFormat,
|
|
6271
|
+
sourceType,
|
|
6272
|
+
targetByteOffset
|
|
6273
|
+
);
|
|
6274
|
+
});
|
|
6275
|
+
target.unbind({ target: import_constants28.GL.PIXEL_PACK_BUFFER });
|
|
6276
|
+
if (deleteFramebuffer) {
|
|
6277
|
+
framebuffer.destroy();
|
|
6278
|
+
}
|
|
6279
|
+
return target;
|
|
6280
|
+
}
|
|
6281
|
+
function getFramebuffer2(source) {
|
|
6282
|
+
if (!(source instanceof import_api29.Framebuffer)) {
|
|
6283
|
+
return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
|
|
6284
|
+
}
|
|
6285
|
+
return { framebuffer: source, deleteFramebuffer: false };
|
|
6286
|
+
}
|
|
6287
|
+
function toFramebuffer(texture, props) {
|
|
6288
|
+
const { device, width, height, id } = texture;
|
|
6289
|
+
const framebuffer = device.createFramebuffer(
|
|
6290
|
+
__spreadProps(__spreadValues({}, props), {
|
|
6291
|
+
id: `framebuffer-for-${id}`,
|
|
6292
|
+
width,
|
|
6293
|
+
height,
|
|
6294
|
+
colorAttachments: [
|
|
6295
|
+
texture
|
|
6296
|
+
]
|
|
6297
|
+
})
|
|
6298
|
+
);
|
|
6299
|
+
return framebuffer;
|
|
6300
|
+
}
|
|
6301
|
+
function getPixelArray(pixelArray, type, format, width, height) {
|
|
6302
|
+
if (pixelArray) {
|
|
6303
|
+
return pixelArray;
|
|
6304
|
+
}
|
|
6305
|
+
type = type || import_constants28.GL.UNSIGNED_BYTE;
|
|
6306
|
+
const ArrayType = getTypedArrayFromGLType(type, { clamped: false });
|
|
6307
|
+
const components = glFormatToComponents(format);
|
|
6308
|
+
return new ArrayType(width * height * components);
|
|
6309
|
+
}
|