@luma.gl/webgl 9.0.0-beta.5 → 9.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +71 -11
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +3 -2
- package/dist/adapter/converters/shader-formats.d.ts.map +1 -1
- package/dist/adapter/converters/shader-formats.js +40 -20
- package/dist/adapter/converters/texture-formats.d.ts +10 -7
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +76 -64
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +2 -1
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +18 -5
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +77 -43
- package/dist/adapter/device-helpers/webgl-device-info.d.ts +2 -1
- package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-info.js +17 -14
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts +33 -48
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-limits.js +42 -87
- package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -1
- package/dist/adapter/helpers/decode-webgl-types.js +2 -1
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +6 -5
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js +3 -2
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +2 -1
- package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.js +2 -1
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +2 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +2 -2
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +24 -11
- package/dist/adapter/objects/webgl-resource.d.ts +2 -24
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +6 -100
- package/dist/adapter/resources/webgl-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +2 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +7 -6
- package/dist/adapter/resources/webgl-command-encoder.d.ts +8 -3
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +4 -2
- package/dist/adapter/resources/webgl-external-texture.js +3 -2
- package/dist/adapter/resources/webgl-framebuffer.d.ts +6 -8
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +25 -23
- package/dist/adapter/resources/webgl-query-set.d.ts +44 -0
- package/dist/adapter/resources/webgl-query-set.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-query-set.js +136 -0
- package/dist/adapter/resources/webgl-render-pass.d.ts +3 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +15 -7
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +4 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +34 -49
- package/dist/adapter/resources/webgl-sampler.d.ts +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +3 -2
- package/dist/adapter/resources/webgl-shader.d.ts +3 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +12 -6
- package/dist/adapter/resources/webgl-texture-view.d.ts +14 -0
- package/dist/adapter/resources/webgl-texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-texture-view.js +18 -0
- package/dist/adapter/resources/webgl-texture.d.ts +4 -3
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +12 -7
- package/dist/adapter/resources/webgl-transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js +2 -2
- package/dist/adapter/resources/webgl-vertex-array.d.ts +3 -3
- package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +5 -4
- package/dist/adapter/webgl-canvas-context.d.ts +2 -2
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +3 -2
- package/dist/adapter/webgl-device.d.ts +29 -27
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +90 -94
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +4 -3
- package/dist/classic/clear.d.ts.map +1 -1
- package/dist/classic/clear.js +3 -2
- package/dist/classic/copy-and-blit.d.ts +1 -1
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +5 -4
- package/dist/classic/format-utils.d.ts +2 -2
- package/dist/classic/format-utils.d.ts.map +1 -1
- package/dist/classic/format-utils.js +2 -1
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +2 -1
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +2 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +7 -6
- package/dist/context/helpers/create-browser-context.d.ts +35 -0
- package/dist/context/helpers/create-browser-context.d.ts.map +1 -0
- package/dist/context/helpers/create-browser-context.js +67 -0
- package/dist/context/helpers/webgl-context-data.d.ts +13 -0
- package/dist/context/helpers/webgl-context-data.d.ts.map +1 -0
- package/dist/context/helpers/webgl-context-data.js +21 -0
- package/dist/context/helpers/webgl-extensions.d.ts +4 -0
- package/dist/context/helpers/webgl-extensions.d.ts.map +1 -0
- package/dist/context/helpers/webgl-extensions.js +10 -0
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +4 -3
- package/dist/context/parameters/webgl-parameter-tables.d.ts +10 -0
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +29 -16
- package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.js +2 -1
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +5 -4
- package/dist/context/state-tracker/with-parameters.d.ts +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +5 -4
- package/dist/dist.dev.js +941 -730
- package/dist/index.cjs +732 -565
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +25 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist.min.js +5 -5
- package/package.json +4 -4
- package/src/adapter/converters/device-parameters.ts +105 -16
- package/src/adapter/converters/sampler-parameters.ts +12 -3
- package/src/adapter/converters/shader-formats.ts +47 -22
- package/src/adapter/converters/texture-formats.ts +87 -66
- package/src/adapter/converters/vertex-formats.ts +3 -3
- package/src/adapter/device-helpers/webgl-device-features.ts +83 -51
- package/src/adapter/device-helpers/webgl-device-info.ts +28 -19
- package/src/adapter/device-helpers/webgl-device-limits.ts +46 -150
- package/src/adapter/helpers/decode-webgl-types.ts +13 -7
- package/src/adapter/helpers/get-shader-layout.ts +4 -3
- package/src/adapter/helpers/parse-shader-compiler-log.ts +10 -6
- package/src/adapter/helpers/set-uniform.ts +2 -1
- package/src/adapter/helpers/webgl-topology-utils.ts +10 -3
- package/src/adapter/objects/constants-to-keys.ts +2 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +35 -13
- package/src/adapter/objects/webgl-resource.ts +6 -124
- package/src/adapter/resources/webgl-buffer.ts +4 -3
- package/src/adapter/resources/webgl-command-buffer.ts +5 -5
- package/src/adapter/resources/webgl-command-encoder.ts +14 -11
- package/src/adapter/resources/webgl-external-texture.ts +3 -2
- package/src/adapter/resources/webgl-framebuffer.ts +34 -29
- package/src/adapter/resources/webgl-query-set.ts +171 -0
- package/src/adapter/resources/webgl-render-pass.ts +17 -8
- package/src/adapter/resources/webgl-render-pipeline.ts +41 -48
- package/src/adapter/resources/webgl-sampler.ts +2 -1
- package/src/adapter/resources/webgl-shader.ts +12 -5
- package/src/adapter/resources/webgl-texture-view.ts +28 -0
- package/src/adapter/resources/webgl-texture.ts +9 -2
- package/src/adapter/resources/webgl-transform-feedback.ts +2 -7
- package/src/adapter/resources/webgl-vertex-array.ts +4 -3
- package/src/adapter/webgl-canvas-context.ts +6 -4
- package/src/adapter/webgl-device.ts +94 -90
- package/src/classic/accessor.ts +5 -4
- package/src/classic/clear.ts +12 -6
- package/src/classic/copy-and-blit.ts +11 -4
- package/src/classic/format-utils.ts +2 -1
- package/src/classic/typed-array-utils.ts +3 -7
- package/src/context/debug/spector.ts +9 -6
- package/src/context/debug/webgl-developer-tools.ts +27 -14
- package/src/context/{context → helpers}/create-browser-context.ts +3 -2
- package/src/context/helpers/webgl-context-data.ts +31 -0
- package/src/context/helpers/webgl-extensions.ts +17 -0
- package/src/context/parameters/unified-parameter-api.ts +2 -1
- package/src/context/parameters/webgl-parameter-tables.ts +69 -32
- package/src/context/state-tracker/deep-array-equal.ts +2 -1
- package/src/context/state-tracker/track-context-state.ts +11 -6
- package/src/context/state-tracker/with-parameters.ts +7 -2
- package/src/index.ts +3 -2
- package/src/types.ts +2 -1
- package/src/context/context/context-data.ts +0 -44
package/dist/index.cjs
CHANGED
|
@@ -56,8 +56,7 @@ __export(dist_exports, {
|
|
|
56
56
|
module.exports = __toCommonJS(dist_exports);
|
|
57
57
|
|
|
58
58
|
// dist/adapter/webgl-device.js
|
|
59
|
-
var
|
|
60
|
-
var import_env3 = require("@probe.gl/env");
|
|
59
|
+
var import_core29 = require("@luma.gl/core");
|
|
61
60
|
|
|
62
61
|
// dist/context/state-tracker/track-context-state.js
|
|
63
62
|
var import_core = require("@luma.gl/core");
|
|
@@ -122,14 +121,6 @@ var GL_PARAMETER_DEFAULTS = {
|
|
|
122
121
|
[import_constants.GL.STENCIL_BACK_PASS_DEPTH_PASS]: import_constants.GL.KEEP,
|
|
123
122
|
// Dynamic value: We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame.
|
|
124
123
|
[import_constants.GL.VIEWPORT]: [0, 0, 1024, 1024],
|
|
125
|
-
// WEBGL1 PIXEL PACK/UNPACK MODES
|
|
126
|
-
[import_constants.GL.PACK_ALIGNMENT]: 4,
|
|
127
|
-
[import_constants.GL.UNPACK_ALIGNMENT]: 4,
|
|
128
|
-
[import_constants.GL.UNPACK_FLIP_Y_WEBGL]: false,
|
|
129
|
-
[import_constants.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: false,
|
|
130
|
-
[import_constants.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: import_constants.GL.BROWSER_DEFAULT_WEBGL,
|
|
131
|
-
// WEBGL2 / EXTENSIONS
|
|
132
|
-
// gl1: 'OES_standard_derivatives'
|
|
133
124
|
[import_constants.GL.TRANSFORM_FEEDBACK_BINDING]: null,
|
|
134
125
|
[import_constants.GL.COPY_READ_BUFFER_BINDING]: null,
|
|
135
126
|
[import_constants.GL.COPY_WRITE_BUFFER_BINDING]: null,
|
|
@@ -138,6 +129,11 @@ var GL_PARAMETER_DEFAULTS = {
|
|
|
138
129
|
[import_constants.GL.FRAGMENT_SHADER_DERIVATIVE_HINT]: import_constants.GL.DONT_CARE,
|
|
139
130
|
[import_constants.GL.READ_FRAMEBUFFER_BINDING]: null,
|
|
140
131
|
[import_constants.GL.RASTERIZER_DISCARD]: false,
|
|
132
|
+
[import_constants.GL.PACK_ALIGNMENT]: 4,
|
|
133
|
+
[import_constants.GL.UNPACK_ALIGNMENT]: 4,
|
|
134
|
+
[import_constants.GL.UNPACK_FLIP_Y_WEBGL]: false,
|
|
135
|
+
[import_constants.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: false,
|
|
136
|
+
[import_constants.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: import_constants.GL.BROWSER_DEFAULT_WEBGL,
|
|
141
137
|
[import_constants.GL.PACK_ROW_LENGTH]: 0,
|
|
142
138
|
[import_constants.GL.PACK_SKIP_PIXELS]: 0,
|
|
143
139
|
[import_constants.GL.PACK_SKIP_ROWS]: 0,
|
|
@@ -234,14 +230,29 @@ var GL_PARAMETER_SETTERS = {
|
|
|
234
230
|
[import_constants.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: "stencilOpBack",
|
|
235
231
|
[import_constants.GL.STENCIL_BACK_PASS_DEPTH_PASS]: "stencilOpBack",
|
|
236
232
|
[import_constants.GL.VIEWPORT]: (gl, value) => gl.viewport(...value),
|
|
237
|
-
//
|
|
233
|
+
// WEBGL2 EXTENSIONS
|
|
234
|
+
// EXT_depth_clamp https://registry.khronos.org/webgl/extensions/EXT_depth_clamp/
|
|
235
|
+
[import_constants.GL.DEPTH_CLAMP_EXT]: enable,
|
|
236
|
+
// WEBGL_provoking_vertex https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/
|
|
237
|
+
// [GL.PROVOKING_VERTEX_WEBL]: TODO - extension function needed
|
|
238
|
+
// WEBGL_polygon_mode https://registry.khronos.org/webgl/extensions/WEBGL_polygon_mode/
|
|
239
|
+
// POLYGON_MODE_WEBGL TODO - extension function needed
|
|
240
|
+
[import_constants.GL.POLYGON_OFFSET_LINE_WEBGL]: enable,
|
|
241
|
+
// WEBGL_clip_cull_distance https://registry.khronos.org/webgl/extensions/WEBGL_clip_cull_distance/
|
|
242
|
+
[import_constants.GL.CLIP_DISTANCE0_WEBGL]: enable,
|
|
243
|
+
[import_constants.GL.CLIP_DISTANCE1_WEBGL]: enable,
|
|
244
|
+
[import_constants.GL.CLIP_DISTANCE2_WEBGL]: enable,
|
|
245
|
+
[import_constants.GL.CLIP_DISTANCE3_WEBGL]: enable,
|
|
246
|
+
[import_constants.GL.CLIP_DISTANCE4_WEBGL]: enable,
|
|
247
|
+
[import_constants.GL.CLIP_DISTANCE5_WEBGL]: enable,
|
|
248
|
+
[import_constants.GL.CLIP_DISTANCE6_WEBGL]: enable,
|
|
249
|
+
[import_constants.GL.CLIP_DISTANCE7_WEBGL]: enable,
|
|
250
|
+
// PIXEL PACK/UNPACK MODES
|
|
238
251
|
[import_constants.GL.PACK_ALIGNMENT]: pixelStorei,
|
|
239
252
|
[import_constants.GL.UNPACK_ALIGNMENT]: pixelStorei,
|
|
240
253
|
[import_constants.GL.UNPACK_FLIP_Y_WEBGL]: pixelStorei,
|
|
241
254
|
[import_constants.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: pixelStorei,
|
|
242
255
|
[import_constants.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: pixelStorei,
|
|
243
|
-
// WEBGL2 PIXEL PACK/UNPACK MODES
|
|
244
|
-
// RASTERIZER_DISCARD ...
|
|
245
256
|
[import_constants.GL.PACK_ROW_LENGTH]: pixelStorei,
|
|
246
257
|
[import_constants.GL.PACK_SKIP_PIXELS]: pixelStorei,
|
|
247
258
|
[import_constants.GL.PACK_SKIP_ROWS]: pixelStorei,
|
|
@@ -741,7 +752,7 @@ function installProgramSpy(gl) {
|
|
|
741
752
|
};
|
|
742
753
|
}
|
|
743
754
|
|
|
744
|
-
// dist/context/
|
|
755
|
+
// dist/context/helpers/create-browser-context.js
|
|
745
756
|
var DEFAULT_CONTEXT_PROPS = {
|
|
746
757
|
powerPreference: "high-performance",
|
|
747
758
|
// After all, most apps are using WebGL for performance reasons
|
|
@@ -774,10 +785,21 @@ function createBrowserContext(canvas, props) {
|
|
|
774
785
|
|
|
775
786
|
// dist/adapter/device-helpers/webgl-device-info.js
|
|
776
787
|
var import_constants2 = require("@luma.gl/constants");
|
|
777
|
-
|
|
788
|
+
|
|
789
|
+
// dist/context/helpers/webgl-extensions.js
|
|
790
|
+
function getWebGLExtension(gl, name, extensions) {
|
|
791
|
+
if (extensions[name] === void 0) {
|
|
792
|
+
extensions[name] = gl.getExtension(name) || null;
|
|
793
|
+
}
|
|
794
|
+
return extensions[name];
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// dist/adapter/device-helpers/webgl-device-info.js
|
|
798
|
+
function getDeviceInfo(gl, extensions) {
|
|
778
799
|
const vendorMasked = gl.getParameter(import_constants2.GL.VENDOR);
|
|
779
800
|
const rendererMasked = gl.getParameter(import_constants2.GL.RENDERER);
|
|
780
|
-
|
|
801
|
+
getWebGLExtension(gl, "WEBGL_debug_renderer_info", extensions);
|
|
802
|
+
const ext = extensions.WEBGL_debug_renderer_info;
|
|
781
803
|
const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : import_constants2.GL.VENDOR);
|
|
782
804
|
const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : import_constants2.GL.RENDERER);
|
|
783
805
|
const vendor = vendorUnmasked || vendorMasked;
|
|
@@ -844,6 +866,9 @@ function identifyGPUType(vendor, renderer) {
|
|
|
844
866
|
}
|
|
845
867
|
}
|
|
846
868
|
|
|
869
|
+
// dist/adapter/device-helpers/webgl-device-features.js
|
|
870
|
+
var import_core3 = require("@luma.gl/core");
|
|
871
|
+
|
|
847
872
|
// dist/adapter/converters/texture-formats.js
|
|
848
873
|
var import_core2 = require("@luma.gl/core");
|
|
849
874
|
var import_constants4 = require("@luma.gl/constants");
|
|
@@ -887,6 +912,14 @@ var texture_compression_etc2 = "texture-compression-etc2";
|
|
|
887
912
|
var texture_compression_etc1_webgl = "texture-compression-etc1-webgl";
|
|
888
913
|
var texture_compression_pvrtc_webgl = "texture-compression-pvrtc-webgl";
|
|
889
914
|
var texture_compression_atc_webgl = "texture-compression-atc-webgl";
|
|
915
|
+
var float32_renderable = "float32-renderable-webgl";
|
|
916
|
+
var float16_renderable = "float16-renderable-webgl";
|
|
917
|
+
var rgb9e5ufloat_renderable = "rgb9e5ufloat_renderable-webgl";
|
|
918
|
+
var snorm8_renderable = "snorm8-renderable-webgl";
|
|
919
|
+
var norm16_renderable = "norm16-renderable-webgl";
|
|
920
|
+
var snorm16_renderable = "snorm16-renderable-webgl";
|
|
921
|
+
var float32_filterable = "float32-filterable";
|
|
922
|
+
var float16_filterable = "float16-filterable-webgl";
|
|
890
923
|
var X_S3TC = "WEBGL_compressed_texture_s3tc";
|
|
891
924
|
var X_S3TC_SRGB = "WEBGL_compressed_texture_s3tc_srgb";
|
|
892
925
|
var X_RGTC = "EXT_texture_compression_rgtc";
|
|
@@ -896,15 +929,18 @@ var X_ASTC = "WEBGL_compressed_texture_astc";
|
|
|
896
929
|
var X_ETC1 = "WEBGL_compressed_texture_etc1";
|
|
897
930
|
var X_PVRTC = "WEBGL_compressed_texture_pvrtc";
|
|
898
931
|
var X_ATC = "WEBGL_compressed_texture_atc";
|
|
899
|
-
var
|
|
900
|
-
var
|
|
901
|
-
var
|
|
932
|
+
var EXT_texture_norm16 = "EXT_texture_norm16";
|
|
933
|
+
var EXT_render_snorm = "EXT_render_snorm";
|
|
934
|
+
var EXT_color_buffer_float = "EXT_color_buffer_float";
|
|
935
|
+
var TEXTURE_FEATURES = {
|
|
902
936
|
"float32-renderable-webgl": ["EXT_color_buffer_float"],
|
|
903
|
-
// [false, 'EXT_color_buffer_float'],
|
|
904
937
|
"float16-renderable-webgl": ["EXT_color_buffer_half_float"],
|
|
905
|
-
"
|
|
906
|
-
"
|
|
907
|
-
"
|
|
938
|
+
"rgb9e5ufloat_renderable-webgl": ["WEBGL_render_shared_exponent"],
|
|
939
|
+
"snorm8-renderable-webgl": [EXT_render_snorm],
|
|
940
|
+
"norm16-renderable-webgl": [EXT_texture_norm16],
|
|
941
|
+
"snorm16-renderable-webgl": [EXT_texture_norm16, EXT_render_snorm],
|
|
942
|
+
"float32-filterable": ["OES_texture_float_linear"],
|
|
943
|
+
"float16-filterable-webgl": ["OES_texture_half_float_linear"],
|
|
908
944
|
"texture-filterable-anisotropic-webgl": ["EXT_texture_filter_anisotropic"],
|
|
909
945
|
"texture-blend-float-webgl": ["EXT_float_blend"],
|
|
910
946
|
"texture-compression-bc": [X_S3TC, X_S3TC_SRGB, X_RGTC, X_BPTC],
|
|
@@ -918,13 +954,12 @@ var TEXTURE_FEATURE_CHECKS = {
|
|
|
918
954
|
"texture-compression-pvrtc-webgl": [X_PVRTC],
|
|
919
955
|
"texture-compression-atc-webgl": [X_ATC]
|
|
920
956
|
};
|
|
921
|
-
function
|
|
922
|
-
|
|
923
|
-
return extensions.every((extension) => gl.getExtension(extension));
|
|
957
|
+
function isTextureFeature(feature) {
|
|
958
|
+
return feature in TEXTURE_FEATURES;
|
|
924
959
|
}
|
|
925
|
-
function
|
|
926
|
-
const
|
|
927
|
-
return
|
|
960
|
+
function checkTextureFeature(gl, feature, extensions) {
|
|
961
|
+
const textureExtensions = TEXTURE_FEATURES[feature] || [];
|
|
962
|
+
return textureExtensions.every((extension) => getWebGLExtension(gl, extension, extensions));
|
|
928
963
|
}
|
|
929
964
|
var TEXTURE_FORMATS = {
|
|
930
965
|
// Unsized formats that leave the precision up to the driver.
|
|
@@ -950,19 +985,19 @@ var TEXTURE_FORMATS = {
|
|
|
950
985
|
// 'rgba8unorm-srgb-unsized': {gl: GL.SRGB_ALPHA_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
951
986
|
// 8-bit formats
|
|
952
987
|
"r8unorm": { gl: import_constants4.GL.R8, b: 1, c: 1, renderbuffer: true },
|
|
953
|
-
"r8snorm": { gl: import_constants4.GL.R8_SNORM, b: 1, c: 1 },
|
|
988
|
+
"r8snorm": { gl: import_constants4.GL.R8_SNORM, b: 1, c: 1, render: snorm8_renderable },
|
|
954
989
|
"r8uint": { gl: import_constants4.GL.R8UI, b: 1, c: 1, renderbuffer: true },
|
|
955
990
|
"r8sint": { gl: import_constants4.GL.R8I, b: 1, c: 1, renderbuffer: true },
|
|
956
991
|
// 16-bit formats
|
|
957
992
|
"rg8unorm": { gl: import_constants4.GL.RG8, b: 2, c: 2, renderbuffer: true },
|
|
958
|
-
"rg8snorm": { gl: import_constants4.GL.RG8_SNORM, b: 2, c: 2 },
|
|
993
|
+
"rg8snorm": { gl: import_constants4.GL.RG8_SNORM, b: 2, c: 2, render: snorm8_renderable },
|
|
959
994
|
"rg8uint": { gl: import_constants4.GL.RG8UI, b: 2, c: 2, renderbuffer: true },
|
|
960
995
|
"rg8sint": { gl: import_constants4.GL.RG8I, b: 2, c: 2, renderbuffer: true },
|
|
961
996
|
"r16uint": { gl: import_constants4.GL.R16UI, b: 2, c: 1, renderbuffer: true },
|
|
962
997
|
"r16sint": { gl: import_constants4.GL.R16I, b: 2, c: 1, renderbuffer: true },
|
|
963
|
-
"r16float": { gl: import_constants4.GL.R16F, b: 2, c: 1, render:
|
|
964
|
-
"r16unorm-webgl": { gl: import_constants4.GL.R16_EXT, b: 2, c: 1, f:
|
|
965
|
-
"r16snorm-webgl": { gl: import_constants4.GL.R16_SNORM_EXT, b: 2, c: 1, f:
|
|
998
|
+
"r16float": { gl: import_constants4.GL.R16F, b: 2, c: 1, render: float16_renderable, filter: "float16-filterable-webgl", renderbuffer: true },
|
|
999
|
+
"r16unorm-webgl": { gl: import_constants4.GL.R16_EXT, b: 2, c: 1, f: norm16_renderable, renderbuffer: true },
|
|
1000
|
+
"r16snorm-webgl": { gl: import_constants4.GL.R16_SNORM_EXT, b: 2, c: 1, f: snorm16_renderable },
|
|
966
1001
|
// Packed 16-bit formats
|
|
967
1002
|
"rgba4unorm-webgl": { gl: import_constants4.GL.RGBA4, b: 2, c: 4, wgpu: false, renderbuffer: true },
|
|
968
1003
|
"rgb565unorm-webgl": { gl: import_constants4.GL.RGB565, b: 2, c: 4, wgpu: false, renderbuffer: true },
|
|
@@ -973,7 +1008,7 @@ var TEXTURE_FORMATS = {
|
|
|
973
1008
|
// 32-bit formats
|
|
974
1009
|
"rgba8unorm": { gl: import_constants4.GL.RGBA8, b: 4, c: 2, bpp: 4 },
|
|
975
1010
|
"rgba8unorm-srgb": { gl: import_constants4.GL.SRGB8_ALPHA8, b: 4, c: 4, bpp: 4 },
|
|
976
|
-
"rgba8snorm": { gl: import_constants4.GL.RGBA8_SNORM, b: 4, c: 4 },
|
|
1011
|
+
"rgba8snorm": { gl: import_constants4.GL.RGBA8_SNORM, b: 4, c: 4, render: snorm8_renderable },
|
|
977
1012
|
"rgba8uint": { gl: import_constants4.GL.RGBA8UI, b: 4, c: 4, bpp: 4 },
|
|
978
1013
|
"rgba8sint": { gl: import_constants4.GL.RGBA8I, b: 4, c: 4, bpp: 4 },
|
|
979
1014
|
// reverse colors, webgpu only
|
|
@@ -982,42 +1017,45 @@ var TEXTURE_FORMATS = {
|
|
|
982
1017
|
"rg16uint": { gl: import_constants4.GL.RG16UI, b: 4, c: 1, bpp: 4 },
|
|
983
1018
|
"rg16sint": { gl: import_constants4.GL.RG16I, b: 4, c: 2, bpp: 4 },
|
|
984
1019
|
// When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
|
|
985
|
-
"rg16float": { gl: import_constants4.GL.RG16F, bpp: 4, b: 4, c: 2, render:
|
|
986
|
-
"rg16unorm-webgl": { gl: import_constants4.GL.RG16_EXT, b: 2, c: 2,
|
|
987
|
-
"rg16snorm-webgl": { gl: import_constants4.GL.RG16_SNORM_EXT, b: 2, c: 2,
|
|
1020
|
+
"rg16float": { gl: import_constants4.GL.RG16F, bpp: 4, b: 4, c: 2, render: float16_renderable, filter: float16_filterable, renderbuffer: true },
|
|
1021
|
+
"rg16unorm-webgl": { gl: import_constants4.GL.RG16_EXT, b: 2, c: 2, render: norm16_renderable },
|
|
1022
|
+
"rg16snorm-webgl": { gl: import_constants4.GL.RG16_SNORM_EXT, b: 2, c: 2, render: snorm16_renderable },
|
|
988
1023
|
"r32uint": { gl: import_constants4.GL.R32UI, b: 4, c: 1, bpp: 4, renderbuffer: true },
|
|
989
1024
|
"r32sint": { gl: import_constants4.GL.R32I, b: 4, c: 1, bpp: 4, renderbuffer: true },
|
|
990
|
-
"r32float": { gl: import_constants4.GL.R32F, bpp: 4, b: 4, c: 1, render:
|
|
1025
|
+
"r32float": { gl: import_constants4.GL.R32F, bpp: 4, b: 4, c: 1, render: float32_renderable, filter: float32_filterable },
|
|
991
1026
|
// Packed 32-bit formats
|
|
992
|
-
"rgb9e5ufloat": { gl: import_constants4.GL.RGB9_E5, b: 4, c: 3, p: 1, render:
|
|
993
|
-
|
|
1027
|
+
"rgb9e5ufloat": { gl: import_constants4.GL.RGB9_E5, b: 4, c: 3, p: 1, render: rgb9e5ufloat_renderable },
|
|
1028
|
+
// , filter: true},
|
|
1029
|
+
"rg11b10ufloat": { gl: import_constants4.GL.R11F_G11F_B10F, b: 4, c: 3, p: 1, render: float32_renderable, renderbuffer: true },
|
|
994
1030
|
"rgb10a2unorm": { gl: import_constants4.GL.RGB10_A2, b: 4, c: 4, p: 1, renderbuffer: true },
|
|
995
|
-
"
|
|
1031
|
+
"rgb10a2uint-webgl": { b: 4, c: 4, gl: import_constants4.GL.RGB10_A2UI, p: 1, wgpu: false, bpp: 4, renderbuffer: true },
|
|
996
1032
|
// 48-bit formats
|
|
997
|
-
"rgb16unorm-webgl": { gl: import_constants4.GL.RGB16_EXT, b: 2, c: 3, f:
|
|
998
|
-
|
|
1033
|
+
"rgb16unorm-webgl": { gl: import_constants4.GL.RGB16_EXT, b: 2, c: 3, f: norm16_renderable },
|
|
1034
|
+
// rgb not renderable
|
|
1035
|
+
"rgb16snorm-webgl": { gl: import_constants4.GL.RGB16_SNORM_EXT, b: 2, c: 3, f: norm16_renderable },
|
|
1036
|
+
// rgb not renderable
|
|
999
1037
|
// 64-bit formats
|
|
1000
1038
|
"rg32uint": { gl: import_constants4.GL.RG32UI, b: 8, c: 2, renderbuffer: true },
|
|
1001
1039
|
"rg32sint": { gl: import_constants4.GL.RG32I, b: 8, c: 2, renderbuffer: true },
|
|
1002
|
-
"rg32float": { gl: import_constants4.GL.RG32F, b: 8, c: 2, render:
|
|
1040
|
+
"rg32float": { gl: import_constants4.GL.RG32F, b: 8, c: 2, render: float32_renderable, filter: float32_filterable, renderbuffer: true },
|
|
1003
1041
|
"rgba16uint": { gl: import_constants4.GL.RGBA16UI, b: 8, c: 4, renderbuffer: true },
|
|
1004
1042
|
"rgba16sint": { gl: import_constants4.GL.RGBA16I, b: 8, c: 4, renderbuffer: true },
|
|
1005
|
-
"rgba16float": { gl: import_constants4.GL.RGBA16F, b: 8, c: 4, render:
|
|
1006
|
-
"rgba16unorm-webgl": { gl: import_constants4.GL.RGBA16_EXT, b: 2, c: 4,
|
|
1007
|
-
"rgba16snorm-webgl": { gl: import_constants4.GL.RGBA16_SNORM_EXT, b: 2, c: 4,
|
|
1043
|
+
"rgba16float": { gl: import_constants4.GL.RGBA16F, b: 8, c: 4, render: float16_renderable, filter: float16_filterable },
|
|
1044
|
+
"rgba16unorm-webgl": { gl: import_constants4.GL.RGBA16_EXT, b: 2, c: 4, render: norm16_renderable, renderbuffer: true },
|
|
1045
|
+
"rgba16snorm-webgl": { gl: import_constants4.GL.RGBA16_SNORM_EXT, b: 2, c: 4, render: snorm16_renderable },
|
|
1008
1046
|
// 96-bit formats (deprecated!)
|
|
1009
1047
|
"rgb32float-webgl": {
|
|
1010
1048
|
gl: import_constants4.GL.RGB32F,
|
|
1011
|
-
render:
|
|
1012
|
-
filter:
|
|
1013
|
-
gl2ext:
|
|
1049
|
+
render: float32_renderable,
|
|
1050
|
+
filter: float32_filterable,
|
|
1051
|
+
gl2ext: EXT_color_buffer_float,
|
|
1014
1052
|
dataFormat: import_constants4.GL.RGB,
|
|
1015
1053
|
types: [import_constants4.GL.FLOAT]
|
|
1016
1054
|
},
|
|
1017
1055
|
// 128-bit formats
|
|
1018
1056
|
"rgba32uint": { gl: import_constants4.GL.RGBA32UI, b: 16, c: 4, renderbuffer: true },
|
|
1019
1057
|
"rgba32sint": { gl: import_constants4.GL.RGBA32I, b: 16, c: 4, renderbuffer: true },
|
|
1020
|
-
"rgba32float": { gl: import_constants4.GL.RGBA32F, b: 16, c: 4, render:
|
|
1058
|
+
"rgba32float": { gl: import_constants4.GL.RGBA32F, b: 16, c: 4, render: float32_renderable, filter: float32_filterable, renderbuffer: true },
|
|
1021
1059
|
// Depth and stencil formats
|
|
1022
1060
|
"stencil8": { gl: import_constants4.GL.STENCIL_INDEX8, b: 1, c: 1, attachment: import_constants4.GL.STENCIL_ATTACHMENT, renderbuffer: true },
|
|
1023
1061
|
// 8 stencil bits
|
|
@@ -1126,7 +1164,7 @@ var TYPE_SIZES = {
|
|
|
1126
1164
|
[import_constants4.GL.BYTE]: 1,
|
|
1127
1165
|
[import_constants4.GL.UNSIGNED_BYTE]: 1
|
|
1128
1166
|
};
|
|
1129
|
-
function isTextureFormatSupported(gl, formatOrGL) {
|
|
1167
|
+
function isTextureFormatSupported(gl, formatOrGL, extensions) {
|
|
1130
1168
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
1131
1169
|
const info = TEXTURE_FORMATS[format];
|
|
1132
1170
|
if (!info) {
|
|
@@ -1137,13 +1175,13 @@ function isTextureFormatSupported(gl, formatOrGL) {
|
|
|
1137
1175
|
}
|
|
1138
1176
|
const extension = info.x || info.gl2ext;
|
|
1139
1177
|
if (extension) {
|
|
1140
|
-
return Boolean(gl
|
|
1178
|
+
return Boolean(getWebGLExtension(gl, extension, extensions));
|
|
1141
1179
|
}
|
|
1142
1180
|
return true;
|
|
1143
1181
|
}
|
|
1144
|
-
function isRenderbufferFormatSupported(gl, format) {
|
|
1182
|
+
function isRenderbufferFormatSupported(gl, format, extensions) {
|
|
1145
1183
|
var _a;
|
|
1146
|
-
return isTextureFormatSupported(gl, format) && ((_a = TEXTURE_FORMATS[format]) == null ? void 0 : _a.renderbuffer);
|
|
1184
|
+
return isTextureFormatSupported(gl, format, extensions) && ((_a = TEXTURE_FORMATS[format]) == null ? void 0 : _a.renderbuffer);
|
|
1147
1185
|
}
|
|
1148
1186
|
function convertGLToTextureFormat(format) {
|
|
1149
1187
|
if (typeof format === "string") {
|
|
@@ -1163,9 +1201,9 @@ function convertTextureFormatToGL(format) {
|
|
|
1163
1201
|
}
|
|
1164
1202
|
return webglFormat;
|
|
1165
1203
|
}
|
|
1166
|
-
function isTextureFormatFilterable(gl, formatOrGL) {
|
|
1204
|
+
function isTextureFormatFilterable(gl, formatOrGL, extensions) {
|
|
1167
1205
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
1168
|
-
if (!isTextureFormatSupported(gl, format)) {
|
|
1206
|
+
if (!isTextureFormatSupported(gl, format, extensions)) {
|
|
1169
1207
|
return false;
|
|
1170
1208
|
}
|
|
1171
1209
|
try {
|
|
@@ -1177,16 +1215,16 @@ function isTextureFormatFilterable(gl, formatOrGL) {
|
|
|
1177
1215
|
return false;
|
|
1178
1216
|
}
|
|
1179
1217
|
if (format.endsWith("32float")) {
|
|
1180
|
-
return Boolean(gl
|
|
1218
|
+
return Boolean(getWebGLExtension(gl, "OES_texture_float_linear, extensions", extensions));
|
|
1181
1219
|
}
|
|
1182
1220
|
if (format.endsWith("16float")) {
|
|
1183
|
-
return Boolean(gl
|
|
1221
|
+
return Boolean(getWebGLExtension(gl, "OES_texture_half_float_linear, extensions", extensions));
|
|
1184
1222
|
}
|
|
1185
1223
|
return true;
|
|
1186
1224
|
}
|
|
1187
|
-
function isTextureFormatRenderable(gl, formatOrGL) {
|
|
1225
|
+
function isTextureFormatRenderable(gl, formatOrGL, extensions) {
|
|
1188
1226
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
1189
|
-
if (!isTextureFormatSupported(gl, format)) {
|
|
1227
|
+
if (!isTextureFormatSupported(gl, format, extensions)) {
|
|
1190
1228
|
return false;
|
|
1191
1229
|
}
|
|
1192
1230
|
if (typeof format === "number") {
|
|
@@ -1240,187 +1278,188 @@ function getWebGLPixelDataFormat(dataFormat, integer, normalized, format) {
|
|
|
1240
1278
|
}
|
|
1241
1279
|
|
|
1242
1280
|
// dist/adapter/device-helpers/webgl-device-features.js
|
|
1243
|
-
function getDeviceFeatures(gl) {
|
|
1244
|
-
const features = getWebGLFeatures(gl);
|
|
1245
|
-
for (const textureFeature of getTextureFeatures(gl)) {
|
|
1246
|
-
features.add(textureFeature);
|
|
1247
|
-
}
|
|
1248
|
-
return features;
|
|
1249
|
-
}
|
|
1250
|
-
function getWebGLFeatures(gl) {
|
|
1251
|
-
gl.getExtension("EXT_color_buffer_float");
|
|
1252
|
-
const features = /* @__PURE__ */ new Set();
|
|
1253
|
-
for (const feature of Object.keys(WEBGL_FEATURES)) {
|
|
1254
|
-
if (isFeatureSupported(gl, feature)) {
|
|
1255
|
-
features.add(feature);
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
return features;
|
|
1259
|
-
}
|
|
1260
|
-
function isFeatureSupported(gl, feature) {
|
|
1261
|
-
const featureInfo = WEBGL_FEATURES[feature];
|
|
1262
|
-
return typeof featureInfo === "string" ? Boolean(gl.getExtension(featureInfo)) : Boolean(featureInfo);
|
|
1263
|
-
}
|
|
1264
1281
|
var WEBGL_FEATURES = {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
"
|
|
1269
|
-
"
|
|
1282
|
+
// optional WebGPU features
|
|
1283
|
+
"depth-clip-control": "EXT_depth_clamp",
|
|
1284
|
+
// TODO these seem subtly different
|
|
1285
|
+
// 'timestamp-query' // GPUQueryType "timestamp-query"
|
|
1286
|
+
// "indirect-first-instance"
|
|
1287
|
+
// Textures are handled by getTextureFeatures()
|
|
1288
|
+
// 'depth24unorm-stencil8' // GPUTextureFormat 'depth24unorm-stencil8'
|
|
1289
|
+
// 'depth32float-stencil8' // GPUTextureFormat 'depth32float-stencil8'
|
|
1290
|
+
// optional WebGL features
|
|
1270
1291
|
"timer-query-webgl": "EXT_disjoint_timer_query_webgl2",
|
|
1271
|
-
"
|
|
1292
|
+
"compilation-status-async-webgl": "KHR_parallel_shader_compile",
|
|
1293
|
+
"polygon-mode-webgl": "WEBGL_polygon_mode",
|
|
1294
|
+
"provoking-vertex-webgl": "WEBGL_provoking_vertex",
|
|
1295
|
+
"shader-clip-cull-distance-webgl": "WEBGL_clip_cull_distance",
|
|
1296
|
+
"shader-noperspective-interpolation-webgl": "NV_shader_noperspective_interpolation",
|
|
1297
|
+
"shader-conservative-depth-webgl": "EXT_conservative_depth"
|
|
1272
1298
|
// Textures are handled by getTextureFeatures()
|
|
1273
1299
|
};
|
|
1300
|
+
var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
|
|
1301
|
+
gl;
|
|
1302
|
+
extensions;
|
|
1303
|
+
testedFeatures = /* @__PURE__ */ new Set();
|
|
1304
|
+
constructor(gl, extensions) {
|
|
1305
|
+
super();
|
|
1306
|
+
this.gl = gl;
|
|
1307
|
+
this.extensions = extensions;
|
|
1308
|
+
getWebGLExtension(gl, "EXT_color_buffer_float", extensions);
|
|
1309
|
+
}
|
|
1310
|
+
*[Symbol.iterator]() {
|
|
1311
|
+
for (const feature of Object.keys(WEBGL_FEATURES)) {
|
|
1312
|
+
if (this.has(feature)) {
|
|
1313
|
+
yield feature;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
for (const feature of Object.keys(TEXTURE_FEATURES)) {
|
|
1317
|
+
if (this.has(feature)) {
|
|
1318
|
+
yield feature;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
return [];
|
|
1322
|
+
}
|
|
1323
|
+
has(feature) {
|
|
1324
|
+
if (!this.testedFeatures.has(feature)) {
|
|
1325
|
+
this.testedFeatures.add(feature);
|
|
1326
|
+
if (isTextureFeature(feature) && checkTextureFeature(this.gl, feature, this.extensions)) {
|
|
1327
|
+
this.features.add(feature);
|
|
1328
|
+
}
|
|
1329
|
+
if (this.getWebGLFeature(feature)) {
|
|
1330
|
+
this.features.add(feature);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
return this.features.has(feature);
|
|
1334
|
+
}
|
|
1335
|
+
/** Extract all WebGL features */
|
|
1336
|
+
getWebGLFeature(feature) {
|
|
1337
|
+
const featureInfo = WEBGL_FEATURES[feature];
|
|
1338
|
+
const isSupported = typeof featureInfo === "string" ? Boolean(getWebGLExtension(this.gl, featureInfo, this.extensions)) : Boolean(featureInfo);
|
|
1339
|
+
return isSupported;
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1274
1342
|
|
|
1275
1343
|
// dist/adapter/device-helpers/webgl-device-limits.js
|
|
1344
|
+
var import_core4 = require("@luma.gl/core");
|
|
1276
1345
|
var import_constants5 = require("@luma.gl/constants");
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
// WebGL does not support 1D textures
|
|
1281
|
-
maxTextureDimension2D: gl.getParameter(import_constants5.GL.MAX_TEXTURE_SIZE),
|
|
1282
|
-
maxTextureDimension3D: gl.getParameter(import_constants5.GL.MAX_3D_TEXTURE_SIZE),
|
|
1283
|
-
maxTextureArrayLayers: gl.getParameter(import_constants5.GL.MAX_ARRAY_TEXTURE_LAYERS),
|
|
1284
|
-
maxBindGroups: 1,
|
|
1285
|
-
// TBD - if we emulate bind groups we could support any number...
|
|
1286
|
-
maxDynamicUniformBuffersPerPipelineLayout: 0,
|
|
1287
|
-
// TBD
|
|
1288
|
-
maxDynamicStorageBuffersPerPipelineLayout: 0,
|
|
1289
|
-
// TBD
|
|
1290
|
-
maxSampledTexturesPerShaderStage: gl.getParameter(import_constants5.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
|
|
1291
|
-
// TBD
|
|
1292
|
-
maxSamplersPerShaderStage: gl.getParameter(import_constants5.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
|
|
1293
|
-
maxStorageBuffersPerShaderStage: 0,
|
|
1294
|
-
// TBD
|
|
1295
|
-
maxStorageTexturesPerShaderStage: 0,
|
|
1296
|
-
// TBD
|
|
1297
|
-
maxUniformBuffersPerShaderStage: gl.getParameter(import_constants5.GL.MAX_UNIFORM_BUFFER_BINDINGS),
|
|
1298
|
-
maxUniformBufferBindingSize: gl.getParameter(import_constants5.GL.MAX_UNIFORM_BLOCK_SIZE),
|
|
1299
|
-
maxStorageBufferBindingSize: 0,
|
|
1300
|
-
minUniformBufferOffsetAlignment: gl.getParameter(import_constants5.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT),
|
|
1301
|
-
minStorageBufferOffsetAlignment: 0,
|
|
1302
|
-
// TBD
|
|
1303
|
-
maxVertexBuffers: 0,
|
|
1304
|
-
maxVertexAttributes: gl.getParameter(import_constants5.GL.MAX_VERTEX_ATTRIBS),
|
|
1305
|
-
maxVertexBufferArrayStride: 2048,
|
|
1306
|
-
// TBD, this is just the default value from WebGPU
|
|
1307
|
-
maxInterStageShaderComponents: gl.getParameter(import_constants5.GL.MAX_VARYING_COMPONENTS),
|
|
1308
|
-
maxComputeWorkgroupStorageSize: 0,
|
|
1309
|
-
// WebGL does not support compute shaders
|
|
1310
|
-
maxComputeInvocationsPerWorkgroup: 0,
|
|
1311
|
-
// WebGL does not support compute shaders
|
|
1312
|
-
maxComputeWorkgroupSizeX: 0,
|
|
1313
|
-
// WebGL does not support compute shaders
|
|
1314
|
-
maxComputeWorkgroupSizeY: 0,
|
|
1315
|
-
// WebGL does not support compute shaders
|
|
1316
|
-
maxComputeWorkgroupSizeZ: 0,
|
|
1317
|
-
// WebGL does not support compute shaders
|
|
1318
|
-
maxComputeWorkgroupsPerDimension: 0
|
|
1319
|
-
// WebGL does not support compute shaders
|
|
1320
|
-
};
|
|
1321
|
-
}
|
|
1322
|
-
function getWebGLLimits(gl) {
|
|
1323
|
-
function get(pname) {
|
|
1324
|
-
return gl.getParameter(pname);
|
|
1346
|
+
var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
|
|
1347
|
+
get maxTextureDimension1D() {
|
|
1348
|
+
return 0;
|
|
1325
1349
|
}
|
|
1326
|
-
|
|
1327
|
-
|
|
1350
|
+
// WebGL does not support 1D textures
|
|
1351
|
+
get maxTextureDimension2D() {
|
|
1352
|
+
return this.getParameter(import_constants5.GL.MAX_TEXTURE_SIZE);
|
|
1328
1353
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1354
|
+
get maxTextureDimension3D() {
|
|
1355
|
+
return this.getParameter(import_constants5.GL.MAX_3D_TEXTURE_SIZE);
|
|
1356
|
+
}
|
|
1357
|
+
get maxTextureArrayLayers() {
|
|
1358
|
+
return this.getParameter(import_constants5.GL.MAX_ARRAY_TEXTURE_LAYERS);
|
|
1359
|
+
}
|
|
1360
|
+
get maxBindGroups() {
|
|
1361
|
+
return 0;
|
|
1362
|
+
}
|
|
1363
|
+
get maxDynamicUniformBuffersPerPipelineLayout() {
|
|
1364
|
+
return 0;
|
|
1365
|
+
}
|
|
1366
|
+
// TBD
|
|
1367
|
+
get maxDynamicStorageBuffersPerPipelineLayout() {
|
|
1368
|
+
return 0;
|
|
1369
|
+
}
|
|
1370
|
+
// TBD
|
|
1371
|
+
get maxSampledTexturesPerShaderStage() {
|
|
1372
|
+
return this.getParameter(import_constants5.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
1373
|
+
}
|
|
1374
|
+
// ) TBD
|
|
1375
|
+
get maxSamplersPerShaderStage() {
|
|
1376
|
+
return this.getParameter(import_constants5.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
|
1377
|
+
}
|
|
1378
|
+
get maxStorageBuffersPerShaderStage() {
|
|
1379
|
+
return 0;
|
|
1380
|
+
}
|
|
1381
|
+
// TBD
|
|
1382
|
+
get maxStorageTexturesPerShaderStage() {
|
|
1383
|
+
return 0;
|
|
1384
|
+
}
|
|
1385
|
+
// TBD
|
|
1386
|
+
get maxUniformBuffersPerShaderStage() {
|
|
1387
|
+
return this.getParameter(import_constants5.GL.MAX_UNIFORM_BUFFER_BINDINGS);
|
|
1388
|
+
}
|
|
1389
|
+
get maxUniformBufferBindingSize() {
|
|
1390
|
+
return this.getParameter(import_constants5.GL.MAX_UNIFORM_BLOCK_SIZE);
|
|
1391
|
+
}
|
|
1392
|
+
get maxStorageBufferBindingSize() {
|
|
1393
|
+
return 0;
|
|
1394
|
+
}
|
|
1395
|
+
get minUniformBufferOffsetAlignment() {
|
|
1396
|
+
return this.getParameter(import_constants5.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT);
|
|
1397
|
+
}
|
|
1398
|
+
get minStorageBufferOffsetAlignment() {
|
|
1399
|
+
return 0;
|
|
1400
|
+
}
|
|
1401
|
+
get maxVertexBuffers() {
|
|
1402
|
+
return 16;
|
|
1403
|
+
}
|
|
1404
|
+
// WebGL 2 supports 16 buffers, see https://github.com/gpuweb/gpuweb/issues/4284
|
|
1405
|
+
get maxVertexAttributes() {
|
|
1406
|
+
return this.getParameter(import_constants5.GL.MAX_VERTEX_ATTRIBS);
|
|
1407
|
+
}
|
|
1408
|
+
get maxVertexBufferArrayStride() {
|
|
1409
|
+
return 2048;
|
|
1410
|
+
}
|
|
1411
|
+
// TBD, this is just the default value from WebGPU
|
|
1412
|
+
get maxInterStageShaderComponents() {
|
|
1413
|
+
return this.getParameter(import_constants5.GL.MAX_VARYING_COMPONENTS);
|
|
1414
|
+
}
|
|
1415
|
+
get maxComputeWorkgroupStorageSize() {
|
|
1416
|
+
return 0;
|
|
1417
|
+
}
|
|
1418
|
+
// WebGL does not support compute shaders
|
|
1419
|
+
get maxComputeInvocationsPerWorkgroup() {
|
|
1420
|
+
return 0;
|
|
1421
|
+
}
|
|
1422
|
+
// WebGL does not support compute shaders
|
|
1423
|
+
get maxComputeWorkgroupSizeX() {
|
|
1424
|
+
return 0;
|
|
1425
|
+
}
|
|
1426
|
+
// WebGL does not support compute shaders
|
|
1427
|
+
get maxComputeWorkgroupSizeY() {
|
|
1428
|
+
return 0;
|
|
1429
|
+
}
|
|
1430
|
+
// WebGL does not support compute shaders
|
|
1431
|
+
get maxComputeWorkgroupSizeZ() {
|
|
1432
|
+
return 0;
|
|
1433
|
+
}
|
|
1434
|
+
// WebGL does not support compute shaders
|
|
1435
|
+
get maxComputeWorkgroupsPerDimension() {
|
|
1436
|
+
return 0;
|
|
1437
|
+
}
|
|
1438
|
+
// WebGL does not support compute shaders
|
|
1439
|
+
// PRIVATE
|
|
1440
|
+
gl;
|
|
1441
|
+
limits = {};
|
|
1442
|
+
constructor(gl) {
|
|
1443
|
+
super();
|
|
1444
|
+
this.gl = gl;
|
|
1445
|
+
}
|
|
1446
|
+
getParameter(parameter) {
|
|
1447
|
+
if (this.limits[parameter] === void 0) {
|
|
1448
|
+
this.limits[parameter] = this.gl.getParameter(parameter);
|
|
1449
|
+
}
|
|
1450
|
+
return this.limits[parameter];
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1414
1453
|
|
|
1415
1454
|
// dist/adapter/webgl-canvas-context.js
|
|
1416
|
-
var
|
|
1455
|
+
var import_core13 = require("@luma.gl/core");
|
|
1417
1456
|
|
|
1418
1457
|
// dist/adapter/resources/webgl-framebuffer.js
|
|
1419
|
-
var
|
|
1458
|
+
var import_core12 = require("@luma.gl/core");
|
|
1420
1459
|
var import_constants12 = require("@luma.gl/constants");
|
|
1421
1460
|
|
|
1422
1461
|
// dist/adapter/resources/webgl-texture.js
|
|
1423
|
-
var
|
|
1462
|
+
var import_core9 = require("@luma.gl/core");
|
|
1424
1463
|
var import_constants10 = require("@luma.gl/constants");
|
|
1425
1464
|
|
|
1426
1465
|
// dist/context/state-tracker/with-parameters.js
|
|
@@ -1457,10 +1496,10 @@ function isObjectEmpty2(object) {
|
|
|
1457
1496
|
var import_constants7 = require("@luma.gl/constants");
|
|
1458
1497
|
|
|
1459
1498
|
// dist/adapter/converters/device-parameters.js
|
|
1460
|
-
var
|
|
1499
|
+
var import_core5 = require("@luma.gl/core");
|
|
1461
1500
|
var import_constants6 = require("@luma.gl/constants");
|
|
1462
1501
|
function withDeviceAndGLParameters(device, parameters, glParameters, func) {
|
|
1463
|
-
if ((0,
|
|
1502
|
+
if ((0, import_core5.isObjectEmpty)(parameters)) {
|
|
1464
1503
|
return func(device);
|
|
1465
1504
|
}
|
|
1466
1505
|
pushContextState(device.gl);
|
|
@@ -1473,7 +1512,7 @@ function withDeviceAndGLParameters(device, parameters, glParameters, func) {
|
|
|
1473
1512
|
}
|
|
1474
1513
|
}
|
|
1475
1514
|
function withDeviceParameters(device, parameters, func) {
|
|
1476
|
-
if ((0,
|
|
1515
|
+
if ((0, import_core5.isObjectEmpty)(parameters)) {
|
|
1477
1516
|
return func(device);
|
|
1478
1517
|
}
|
|
1479
1518
|
pushContextState(device.gl);
|
|
@@ -1508,9 +1547,66 @@ function setDeviceParameters(device, parameters) {
|
|
|
1508
1547
|
cw: import_constants6.GL.CW
|
|
1509
1548
|
}));
|
|
1510
1549
|
}
|
|
1550
|
+
if (parameters.unclippedDepth) {
|
|
1551
|
+
if (device.features.has("depth-clip-control")) {
|
|
1552
|
+
gl.enable(import_constants6.GL.DEPTH_CLAMP_EXT);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1511
1555
|
if (parameters.depthBias !== void 0) {
|
|
1512
1556
|
gl.polygonOffset(parameters.depthBias, parameters.depthBiasSlopeScale || 0);
|
|
1513
1557
|
}
|
|
1558
|
+
if (device.features.has("provoking-vertex-webgl")) {
|
|
1559
|
+
const extensions = webglDevice.getExtension("WEBGL_provoking_vertex");
|
|
1560
|
+
const ext = extensions.WEBGL_provoking_vertex;
|
|
1561
|
+
if (parameters.provokingVertex) {
|
|
1562
|
+
const vertex = map("provokingVertex", parameters.provokingVertex, {
|
|
1563
|
+
first: import_constants6.GL.FIRST_VERTEX_CONVENTION_WEBGL,
|
|
1564
|
+
last: import_constants6.GL.LAST_VERTEX_CONVENTION_WEBGL
|
|
1565
|
+
});
|
|
1566
|
+
ext == null ? void 0 : ext.provokingVertexWEBGL(vertex);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
if (device.features.has("polygon-mode-webgl")) {
|
|
1570
|
+
const extensions = webglDevice.getExtension("WEBGL_polygon_mode");
|
|
1571
|
+
const ext = extensions.WEBGL_polygon_mode;
|
|
1572
|
+
if (parameters.polygonMode) {
|
|
1573
|
+
const mode = map("polygonMode", parameters.provokingVertex, {
|
|
1574
|
+
fill: import_constants6.GL.FILL_WEBGL,
|
|
1575
|
+
lint: import_constants6.GL.LINE_WEBGL
|
|
1576
|
+
});
|
|
1577
|
+
ext == null ? void 0 : ext.polygonModeWEBGL(import_constants6.GL.FRONT, mode);
|
|
1578
|
+
ext == null ? void 0 : ext.polygonModeWEBGL(import_constants6.GL.BACK, mode);
|
|
1579
|
+
}
|
|
1580
|
+
if (parameters.polygonOffsetLine) {
|
|
1581
|
+
gl.enable(import_constants6.GL.POLYGON_OFFSET_LINE_WEBGL);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
if (device.features.has("shader-clip-cull-distance-webgl")) {
|
|
1585
|
+
if (parameters.clipDistance0) {
|
|
1586
|
+
gl.enable(import_constants6.GL.CLIP_DISTANCE0_WEBGL);
|
|
1587
|
+
}
|
|
1588
|
+
if (parameters.clipDistance1) {
|
|
1589
|
+
gl.enable(import_constants6.GL.CLIP_DISTANCE1_WEBGL);
|
|
1590
|
+
}
|
|
1591
|
+
if (parameters.clipDistance2) {
|
|
1592
|
+
gl.enable(import_constants6.GL.CLIP_DISTANCE2_WEBGL);
|
|
1593
|
+
}
|
|
1594
|
+
if (parameters.clipDistance3) {
|
|
1595
|
+
gl.enable(import_constants6.GL.CLIP_DISTANCE3_WEBGL);
|
|
1596
|
+
}
|
|
1597
|
+
if (parameters.clipDistance4) {
|
|
1598
|
+
gl.enable(import_constants6.GL.CLIP_DISTANCE4_WEBGL);
|
|
1599
|
+
}
|
|
1600
|
+
if (parameters.clipDistance5) {
|
|
1601
|
+
gl.enable(import_constants6.GL.CLIP_DISTANCE5_WEBGL);
|
|
1602
|
+
}
|
|
1603
|
+
if (parameters.clipDistance6) {
|
|
1604
|
+
gl.enable(import_constants6.GL.CLIP_DISTANCE6_WEBGL);
|
|
1605
|
+
}
|
|
1606
|
+
if (parameters.clipDistance7) {
|
|
1607
|
+
gl.enable(import_constants6.GL.CLIP_DISTANCE7_WEBGL);
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1514
1610
|
if (parameters.depthWriteEnabled !== void 0) {
|
|
1515
1611
|
gl.depthMask(mapBoolean("depthWriteEnabled", parameters.depthWriteEnabled));
|
|
1516
1612
|
}
|
|
@@ -1524,7 +1620,7 @@ function setDeviceParameters(device, parameters) {
|
|
|
1524
1620
|
gl.stencilMaskSeparate(import_constants6.GL.BACK, mask);
|
|
1525
1621
|
}
|
|
1526
1622
|
if (parameters.stencilReadMask) {
|
|
1527
|
-
|
|
1623
|
+
import_core5.log.warn("stencilReadMask not supported under WebGL");
|
|
1528
1624
|
}
|
|
1529
1625
|
if (parameters.stencilCompare) {
|
|
1530
1626
|
const mask = parameters.stencilReadMask || 4294967295;
|
|
@@ -1578,17 +1674,17 @@ function convertStencilOperation(parameter, value) {
|
|
|
1578
1674
|
}
|
|
1579
1675
|
function convertBlendOperationToEquation(parameter, value) {
|
|
1580
1676
|
return map(parameter, value, {
|
|
1581
|
-
|
|
1582
|
-
|
|
1677
|
+
add: import_constants6.GL.FUNC_ADD,
|
|
1678
|
+
subtract: import_constants6.GL.FUNC_SUBTRACT,
|
|
1583
1679
|
"reverse-subtract": import_constants6.GL.FUNC_REVERSE_SUBTRACT,
|
|
1584
|
-
|
|
1585
|
-
|
|
1680
|
+
min: import_constants6.GL.MIN,
|
|
1681
|
+
max: import_constants6.GL.MAX
|
|
1586
1682
|
});
|
|
1587
1683
|
}
|
|
1588
1684
|
function convertBlendFactorToFunction(parameter, value) {
|
|
1589
1685
|
return map(parameter, value, {
|
|
1590
|
-
|
|
1591
|
-
|
|
1686
|
+
one: import_constants6.GL.ONE,
|
|
1687
|
+
zero: import_constants6.GL.ZERO,
|
|
1592
1688
|
"src-color": import_constants6.GL.SRC_COLOR,
|
|
1593
1689
|
"one-minus-src-color": import_constants6.GL.ONE_MINUS_SRC_COLOR,
|
|
1594
1690
|
"dst-color": import_constants6.GL.DST_COLOR,
|
|
@@ -1678,9 +1774,9 @@ function convertMinFilterMode(minFilter, mipmapFilter) {
|
|
|
1678
1774
|
}
|
|
1679
1775
|
|
|
1680
1776
|
// dist/adapter/resources/webgl-buffer.js
|
|
1681
|
-
var
|
|
1777
|
+
var import_core6 = require("@luma.gl/core");
|
|
1682
1778
|
var import_constants8 = require("@luma.gl/constants");
|
|
1683
|
-
var WEBGLBuffer = class extends
|
|
1779
|
+
var WEBGLBuffer = class extends import_core6.Buffer {
|
|
1684
1780
|
device;
|
|
1685
1781
|
gl;
|
|
1686
1782
|
handle;
|
|
@@ -1725,7 +1821,7 @@ var WEBGLBuffer = class extends import_core4.Buffer {
|
|
|
1725
1821
|
}
|
|
1726
1822
|
// Allocate a GPU buffer of specified size.
|
|
1727
1823
|
_initWithByteLength(byteLength) {
|
|
1728
|
-
(0,
|
|
1824
|
+
(0, import_core6.assert)(byteLength >= 0);
|
|
1729
1825
|
let data = byteLength;
|
|
1730
1826
|
if (byteLength === 0) {
|
|
1731
1827
|
data = new Float32Array(0);
|
|
@@ -1779,34 +1875,34 @@ var WEBGLBuffer = class extends import_core4.Buffer {
|
|
|
1779
1875
|
}
|
|
1780
1876
|
};
|
|
1781
1877
|
function getWebGLTarget(usage) {
|
|
1782
|
-
if (usage &
|
|
1878
|
+
if (usage & import_core6.Buffer.INDEX) {
|
|
1783
1879
|
return import_constants8.GL.ELEMENT_ARRAY_BUFFER;
|
|
1784
1880
|
}
|
|
1785
|
-
if (usage &
|
|
1881
|
+
if (usage & import_core6.Buffer.VERTEX) {
|
|
1786
1882
|
return import_constants8.GL.ARRAY_BUFFER;
|
|
1787
1883
|
}
|
|
1788
|
-
if (usage &
|
|
1884
|
+
if (usage & import_core6.Buffer.UNIFORM) {
|
|
1789
1885
|
return import_constants8.GL.UNIFORM_BUFFER;
|
|
1790
1886
|
}
|
|
1791
1887
|
return import_constants8.GL.ARRAY_BUFFER;
|
|
1792
1888
|
}
|
|
1793
1889
|
function getWebGLUsage(usage) {
|
|
1794
|
-
if (usage &
|
|
1890
|
+
if (usage & import_core6.Buffer.INDEX) {
|
|
1795
1891
|
return import_constants8.GL.STATIC_DRAW;
|
|
1796
1892
|
}
|
|
1797
|
-
if (usage &
|
|
1893
|
+
if (usage & import_core6.Buffer.VERTEX) {
|
|
1798
1894
|
return import_constants8.GL.STATIC_DRAW;
|
|
1799
1895
|
}
|
|
1800
|
-
if (usage &
|
|
1896
|
+
if (usage & import_core6.Buffer.UNIFORM) {
|
|
1801
1897
|
return import_constants8.GL.DYNAMIC_DRAW;
|
|
1802
1898
|
}
|
|
1803
1899
|
return import_constants8.GL.STATIC_DRAW;
|
|
1804
1900
|
}
|
|
1805
1901
|
|
|
1806
1902
|
// dist/adapter/resources/webgl-sampler.js
|
|
1807
|
-
var
|
|
1903
|
+
var import_core7 = require("@luma.gl/core");
|
|
1808
1904
|
var import_constants9 = require("@luma.gl/constants");
|
|
1809
|
-
var WEBGLSampler = class extends
|
|
1905
|
+
var WEBGLSampler = class extends import_core7.Sampler {
|
|
1810
1906
|
device;
|
|
1811
1907
|
handle;
|
|
1812
1908
|
parameters;
|
|
@@ -1843,6 +1939,22 @@ var WEBGLSampler = class extends import_core5.Sampler {
|
|
|
1843
1939
|
}
|
|
1844
1940
|
};
|
|
1845
1941
|
|
|
1942
|
+
// dist/adapter/resources/webgl-texture-view.js
|
|
1943
|
+
var import_core8 = require("@luma.gl/core");
|
|
1944
|
+
var WEBGLTextureView = class extends import_core8.TextureView {
|
|
1945
|
+
device;
|
|
1946
|
+
gl;
|
|
1947
|
+
handle;
|
|
1948
|
+
texture;
|
|
1949
|
+
constructor(device, props) {
|
|
1950
|
+
super(device, { ...import_core8.Texture.defaultProps, ...props });
|
|
1951
|
+
this.device = device;
|
|
1952
|
+
this.gl = this.device.gl;
|
|
1953
|
+
this.handle = null;
|
|
1954
|
+
this.texture = props.texture;
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1846
1958
|
// dist/adapter/resources/webgl-texture.js
|
|
1847
1959
|
var DEFAULT_WEBGL_TEXTURE_PROPS = {
|
|
1848
1960
|
// deprecated
|
|
@@ -1854,13 +1966,14 @@ var DEFAULT_WEBGL_TEXTURE_PROPS = {
|
|
|
1854
1966
|
textureUnit: void 0,
|
|
1855
1967
|
target: void 0
|
|
1856
1968
|
};
|
|
1857
|
-
var _WEBGLTexture = class extends
|
|
1969
|
+
var _WEBGLTexture = class extends import_core9.Texture {
|
|
1858
1970
|
MAX_ATTRIBUTES;
|
|
1859
1971
|
device;
|
|
1860
1972
|
gl;
|
|
1861
1973
|
handle;
|
|
1862
|
-
|
|
1974
|
+
// (TODO - currently unused in WebGL, but WebGL 2 does support sampler objects) */
|
|
1863
1975
|
sampler = void 0;
|
|
1976
|
+
view = void 0;
|
|
1864
1977
|
// data;
|
|
1865
1978
|
glFormat = void 0;
|
|
1866
1979
|
type = void 0;
|
|
@@ -1895,7 +2008,7 @@ var _WEBGLTexture = class extends import_core6.Texture {
|
|
|
1895
2008
|
this.target = getWebGLTextureTarget(this.props);
|
|
1896
2009
|
this.loaded = false;
|
|
1897
2010
|
if (typeof ((_a = this.props) == null ? void 0 : _a.data) === "string") {
|
|
1898
|
-
Object.assign(this.props, { data: (0,
|
|
2011
|
+
Object.assign(this.props, { data: (0, import_core9.loadImage)(this.props.data) });
|
|
1899
2012
|
}
|
|
1900
2013
|
this.initialize(this.props);
|
|
1901
2014
|
Object.seal(this);
|
|
@@ -1972,6 +2085,7 @@ var _WEBGLTexture = class extends import_core6.Texture {
|
|
|
1972
2085
|
});
|
|
1973
2086
|
this.setSampler(props.sampler);
|
|
1974
2087
|
this._setSamplerParameters(parameters);
|
|
2088
|
+
this.view = new WEBGLTextureView(this.device, { ...this.props, texture: this });
|
|
1975
2089
|
if (mipmaps) {
|
|
1976
2090
|
this.generateMipmap();
|
|
1977
2091
|
}
|
|
@@ -2133,7 +2247,7 @@ var _WEBGLTexture = class extends import_core6.Texture {
|
|
|
2133
2247
|
}
|
|
2134
2248
|
break;
|
|
2135
2249
|
default:
|
|
2136
|
-
(0,
|
|
2250
|
+
(0, import_core9.assert)(false, "Unknown image data type");
|
|
2137
2251
|
}
|
|
2138
2252
|
});
|
|
2139
2253
|
if (data && data.byteLength) {
|
|
@@ -2160,7 +2274,7 @@ var _WEBGLTexture = class extends import_core6.Texture {
|
|
|
2160
2274
|
width,
|
|
2161
2275
|
height
|
|
2162
2276
|
}));
|
|
2163
|
-
(0,
|
|
2277
|
+
(0, import_core9.assert)(this.depth === 1, "texSubImage not supported for 3D textures");
|
|
2164
2278
|
if (!data) {
|
|
2165
2279
|
data = pixels;
|
|
2166
2280
|
}
|
|
@@ -2200,7 +2314,7 @@ var _WEBGLTexture = class extends import_core6.Texture {
|
|
|
2200
2314
|
* rendering can be faster.
|
|
2201
2315
|
*/
|
|
2202
2316
|
copyFramebuffer(opts = {}) {
|
|
2203
|
-
|
|
2317
|
+
import_core9.log.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")();
|
|
2204
2318
|
return null;
|
|
2205
2319
|
}
|
|
2206
2320
|
getActiveUnit() {
|
|
@@ -2272,9 +2386,9 @@ var _WEBGLTexture = class extends import_core6.Texture {
|
|
|
2272
2386
|
} else {
|
|
2273
2387
|
size = { width, height };
|
|
2274
2388
|
}
|
|
2275
|
-
(0,
|
|
2276
|
-
(0,
|
|
2277
|
-
(0,
|
|
2389
|
+
(0, import_core9.assert)(size, "Could not deduced texture size");
|
|
2390
|
+
(0, import_core9.assert)(width === void 0 || size.width === width, "Deduced texture width does not match supplied width");
|
|
2391
|
+
(0, import_core9.assert)(height === void 0 || size.height === height, "Deduced texture height does not match supplied height");
|
|
2278
2392
|
return size;
|
|
2279
2393
|
}
|
|
2280
2394
|
// CUBE MAP METHODS
|
|
@@ -2290,7 +2404,7 @@ var _WEBGLTexture = class extends import_core6.Texture {
|
|
|
2290
2404
|
this.bind();
|
|
2291
2405
|
_WEBGLTexture.FACES.forEach((face, index) => {
|
|
2292
2406
|
if (resolvedFaces[index].length > 1 && this.props.mipmaps !== false) {
|
|
2293
|
-
|
|
2407
|
+
import_core9.log.warn(`${this.id} has mipmap and multiple LODs.`)();
|
|
2294
2408
|
}
|
|
2295
2409
|
resolvedFaces[index].forEach((image, lodLevel) => {
|
|
2296
2410
|
if (width && height) {
|
|
@@ -2383,7 +2497,7 @@ var _WEBGLTexture = class extends import_core6.Texture {
|
|
|
2383
2497
|
* Sets sampler parameters on texture
|
|
2384
2498
|
*/
|
|
2385
2499
|
_setSamplerParameters(parameters) {
|
|
2386
|
-
if ((0,
|
|
2500
|
+
if ((0, import_core9.isObjectEmpty)(parameters)) {
|
|
2387
2501
|
return;
|
|
2388
2502
|
}
|
|
2389
2503
|
logParameters(parameters);
|
|
@@ -2432,35 +2546,17 @@ function getWebGLTextureTarget(props) {
|
|
|
2432
2546
|
}
|
|
2433
2547
|
}
|
|
2434
2548
|
function logParameters(parameters) {
|
|
2435
|
-
|
|
2549
|
+
import_core9.log.log(1, "texture sampler parameters", parameters)();
|
|
2436
2550
|
}
|
|
2437
2551
|
|
|
2438
2552
|
// dist/adapter/objects/webgl-renderbuffer.js
|
|
2439
|
-
var
|
|
2553
|
+
var import_core11 = require("@luma.gl/core");
|
|
2440
2554
|
var import_constants11 = require("@luma.gl/constants");
|
|
2441
2555
|
|
|
2442
2556
|
// dist/adapter/objects/webgl-resource.js
|
|
2443
|
-
var
|
|
2444
|
-
|
|
2445
|
-
// dist/adapter/objects/constants-to-keys.js
|
|
2446
|
-
var import_core7 = require("@luma.gl/core");
|
|
2447
|
-
function getKeyValue(gl, name) {
|
|
2448
|
-
if (typeof name !== "string") {
|
|
2449
|
-
return name;
|
|
2450
|
-
}
|
|
2451
|
-
const number = Number(name);
|
|
2452
|
-
if (!isNaN(number)) {
|
|
2453
|
-
return number;
|
|
2454
|
-
}
|
|
2455
|
-
name = name.replace(/^.*\./, "");
|
|
2456
|
-
const value = gl[name];
|
|
2457
|
-
(0, import_core7.assert)(value !== void 0, `Accessing undefined constant GL.${name}`);
|
|
2458
|
-
return value;
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
|
-
// dist/adapter/objects/webgl-resource.js
|
|
2557
|
+
var import_core10 = require("@luma.gl/core");
|
|
2462
2558
|
var ERR_RESOURCE_METHOD_UNDEFINED = "Resource subclass must define virtual methods";
|
|
2463
|
-
var WebGLResource = class extends
|
|
2559
|
+
var WebGLResource = class extends import_core10.Resource {
|
|
2464
2560
|
device;
|
|
2465
2561
|
gl;
|
|
2466
2562
|
gl2;
|
|
@@ -2475,7 +2571,7 @@ var WebGLResource = class extends import_core8.Resource {
|
|
|
2475
2571
|
const { id } = props || {};
|
|
2476
2572
|
this.gl = gl;
|
|
2477
2573
|
this.gl2 = gl;
|
|
2478
|
-
this.id = id || (0,
|
|
2574
|
+
this.id = id || (0, import_core10.uid)(this.constructor.name);
|
|
2479
2575
|
this._handle = props == null ? void 0 : props.handle;
|
|
2480
2576
|
if (this._handle === void 0) {
|
|
2481
2577
|
this._handle = this._createHandle();
|
|
@@ -2519,85 +2615,9 @@ var WebGLResource = class extends import_core8.Resource {
|
|
|
2519
2615
|
unbind() {
|
|
2520
2616
|
this.bind(null);
|
|
2521
2617
|
}
|
|
2522
|
-
/**
|
|
2523
|
-
* Query a Resource parameter
|
|
2524
|
-
*
|
|
2525
|
-
* @param name
|
|
2526
|
-
* @return param
|
|
2527
|
-
*/
|
|
2528
|
-
getParameter(pname, props = {}) {
|
|
2529
|
-
pname = getKeyValue(this.gl, pname);
|
|
2530
|
-
(0, import_core8.assert)(pname);
|
|
2531
|
-
const parameters = this.constructor.PARAMETERS || {};
|
|
2532
|
-
const parameter = parameters[pname];
|
|
2533
|
-
if (parameter) {
|
|
2534
|
-
const parameterAvailable = !("extension" in parameter) || this.gl.getExtension(parameter.extension);
|
|
2535
|
-
if (!parameterAvailable) {
|
|
2536
|
-
return parameter.webgl2;
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2539
|
-
return this._getParameter(pname, props);
|
|
2540
|
-
}
|
|
2541
|
-
// Many resources support a getParameter call -
|
|
2542
|
-
// getParameters will get all parameters - slow but useful for debugging
|
|
2543
|
-
// eslint-disable-next-line complexity
|
|
2544
|
-
getParameters(options = {}) {
|
|
2545
|
-
const { parameters, keys } = options;
|
|
2546
|
-
const PARAMETERS = this.constructor.PARAMETERS || {};
|
|
2547
|
-
const values = {};
|
|
2548
|
-
const parameterKeys = parameters || Object.keys(PARAMETERS);
|
|
2549
|
-
for (const pname of parameterKeys) {
|
|
2550
|
-
const parameter = PARAMETERS[pname];
|
|
2551
|
-
const parameterAvailable = parameter && (!("extension" in parameter) || this.gl.getExtension(parameter.extension));
|
|
2552
|
-
if (parameterAvailable) {
|
|
2553
|
-
const key = keys ? this.device.getGLKey(pname) : pname;
|
|
2554
|
-
values[key] = this.getParameter(pname, options);
|
|
2555
|
-
if (keys && parameter.type === "GLenum") {
|
|
2556
|
-
values[key] = this.device.getGLKey(values[key]);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
return values;
|
|
2561
|
-
}
|
|
2562
|
-
/**
|
|
2563
|
-
* Update a Resource setting
|
|
2564
|
-
*
|
|
2565
|
-
* @todo - cache parameter to avoid issuing WebGL calls?
|
|
2566
|
-
*
|
|
2567
|
-
* @param pname - parameter (GL constant, value or key)
|
|
2568
|
-
* @param value {GLint|GLfloat|GLenum}
|
|
2569
|
-
* @return returns self to enable chaining
|
|
2570
|
-
*/
|
|
2571
|
-
setParameter(pname, value) {
|
|
2572
|
-
pname = getKeyValue(this.gl, pname);
|
|
2573
|
-
(0, import_core8.assert)(pname);
|
|
2574
|
-
const parameters = this.constructor.PARAMETERS || {};
|
|
2575
|
-
const parameter = parameters[pname];
|
|
2576
|
-
if (parameter) {
|
|
2577
|
-
const parameterAvailable = !("extension" in parameter) || this.gl.getExtension(parameter.extension);
|
|
2578
|
-
if (!parameterAvailable) {
|
|
2579
|
-
throw new Error("Parameter not available on this platform");
|
|
2580
|
-
}
|
|
2581
|
-
if (parameter.type === "GLenum") {
|
|
2582
|
-
value = getKeyValue(value);
|
|
2583
|
-
}
|
|
2584
|
-
}
|
|
2585
|
-
this._setParameter(pname, value);
|
|
2586
|
-
return this;
|
|
2587
|
-
}
|
|
2588
|
-
/*
|
|
2589
|
-
* Batch update resource parameters
|
|
2590
|
-
* Assumes the subclass supports a setParameter call
|
|
2591
|
-
*/
|
|
2592
|
-
setParameters(parameters) {
|
|
2593
|
-
for (const pname in parameters) {
|
|
2594
|
-
this.setParameter(pname, parameters[pname]);
|
|
2595
|
-
}
|
|
2596
|
-
return this;
|
|
2597
|
-
}
|
|
2598
2618
|
// Install stubs for removed methods
|
|
2599
2619
|
stubRemovedMethods(className, version, methodNames) {
|
|
2600
|
-
return (0,
|
|
2620
|
+
return (0, import_core10.stubRemovedMethods)(this, className, version, methodNames);
|
|
2601
2621
|
}
|
|
2602
2622
|
// PUBLIC VIRTUAL METHODS
|
|
2603
2623
|
initialize(props) {
|
|
@@ -2646,7 +2666,7 @@ var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
|
2646
2666
|
/** WebGL format constant */
|
|
2647
2667
|
glFormat;
|
|
2648
2668
|
static isTextureFormatSupported(device, format) {
|
|
2649
|
-
return isRenderbufferFormatSupported(device.gl, format);
|
|
2669
|
+
return isRenderbufferFormatSupported(device.gl, format, device._extensions);
|
|
2650
2670
|
}
|
|
2651
2671
|
constructor(device, props) {
|
|
2652
2672
|
if (typeof props.format === "number") {
|
|
@@ -2666,7 +2686,7 @@ var _WEBGLRenderbuffer = class extends WebGLResource {
|
|
|
2666
2686
|
/** Creates and initializes a renderbuffer object's data store */
|
|
2667
2687
|
_initialize(props) {
|
|
2668
2688
|
const { format, width, height, samples } = props;
|
|
2669
|
-
(0,
|
|
2689
|
+
(0, import_core11.assert)(format, "Needs format");
|
|
2670
2690
|
this.trackDeallocatedMemory();
|
|
2671
2691
|
this.gl.bindRenderbuffer(import_constants11.GL.RENDERBUFFER, this.handle);
|
|
2672
2692
|
if (samples !== 0) {
|
|
@@ -2702,7 +2722,7 @@ __publicField(WEBGLRenderbuffer, "defaultProps", {
|
|
|
2702
2722
|
});
|
|
2703
2723
|
|
|
2704
2724
|
// dist/adapter/resources/webgl-framebuffer.js
|
|
2705
|
-
var WEBGLFramebuffer = class extends
|
|
2725
|
+
var WEBGLFramebuffer = class extends import_core12.Framebuffer {
|
|
2706
2726
|
device;
|
|
2707
2727
|
gl;
|
|
2708
2728
|
handle;
|
|
@@ -2727,13 +2747,16 @@ var WEBGLFramebuffer = class extends import_core10.Framebuffer {
|
|
|
2727
2747
|
}
|
|
2728
2748
|
}
|
|
2729
2749
|
if (this.depthStencilAttachment) {
|
|
2730
|
-
this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.format), this.depthStencilAttachment);
|
|
2750
|
+
this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format), this.depthStencilAttachment);
|
|
2751
|
+
}
|
|
2752
|
+
if (props.check !== false) {
|
|
2753
|
+
const status = this.gl.checkFramebufferStatus(import_constants12.GL.FRAMEBUFFER);
|
|
2754
|
+
if (status !== import_constants12.GL.FRAMEBUFFER_COMPLETE) {
|
|
2755
|
+
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
2756
|
+
}
|
|
2731
2757
|
}
|
|
2732
2758
|
this.gl.bindFramebuffer(import_constants12.GL.FRAMEBUFFER, null);
|
|
2733
2759
|
}
|
|
2734
|
-
if (props.check !== false) {
|
|
2735
|
-
this._checkStatus();
|
|
2736
|
-
}
|
|
2737
2760
|
}
|
|
2738
2761
|
/** destroys any auto created resources etc. */
|
|
2739
2762
|
destroy() {
|
|
@@ -2743,16 +2766,6 @@ var WEBGLFramebuffer = class extends import_core10.Framebuffer {
|
|
|
2743
2766
|
}
|
|
2744
2767
|
}
|
|
2745
2768
|
// PRIVATE
|
|
2746
|
-
/** Check the status */
|
|
2747
|
-
_checkStatus() {
|
|
2748
|
-
const { gl } = this;
|
|
2749
|
-
const prevHandle = gl.bindFramebuffer(import_constants12.GL.FRAMEBUFFER, this.handle);
|
|
2750
|
-
const status = gl.checkFramebufferStatus(import_constants12.GL.FRAMEBUFFER);
|
|
2751
|
-
gl.bindFramebuffer(import_constants12.GL.FRAMEBUFFER, prevHandle || null);
|
|
2752
|
-
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
2753
|
-
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
2754
|
-
}
|
|
2755
|
-
}
|
|
2756
2769
|
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
2757
2770
|
createDepthStencilTexture(format) {
|
|
2758
2771
|
return new WEBGLRenderbuffer(this.device, {
|
|
@@ -2781,10 +2794,10 @@ var WEBGLFramebuffer = class extends import_core10.Framebuffer {
|
|
|
2781
2794
|
height = this.gl.drawingBufferHeight;
|
|
2782
2795
|
}
|
|
2783
2796
|
for (const colorAttachment of this.colorAttachments) {
|
|
2784
|
-
colorAttachment.resize({ width, height });
|
|
2797
|
+
colorAttachment.texture.resize({ width, height });
|
|
2785
2798
|
}
|
|
2786
2799
|
if (this.depthStencilAttachment) {
|
|
2787
|
-
this.depthStencilAttachment.resize({ width, height });
|
|
2800
|
+
this.depthStencilAttachment.texture.resize({ width, height });
|
|
2788
2801
|
}
|
|
2789
2802
|
return this;
|
|
2790
2803
|
}
|
|
@@ -2800,6 +2813,10 @@ var WEBGLFramebuffer = class extends import_core10.Framebuffer {
|
|
|
2800
2813
|
} else if (attachment instanceof WEBGLTexture) {
|
|
2801
2814
|
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
2802
2815
|
return attachment;
|
|
2816
|
+
} else if (attachment instanceof WEBGLTextureView) {
|
|
2817
|
+
const textureView = attachment;
|
|
2818
|
+
this._attachTexture(attachmentPoint, textureView.texture, textureView.props.baseMipLevel, textureView.props.baseArrayLayer);
|
|
2819
|
+
return attachment.texture;
|
|
2803
2820
|
}
|
|
2804
2821
|
throw new Error("attach");
|
|
2805
2822
|
}
|
|
@@ -2828,7 +2845,7 @@ var WEBGLFramebuffer = class extends import_core10.Framebuffer {
|
|
|
2828
2845
|
gl.framebufferTexture2D(import_constants12.GL.FRAMEBUFFER, attachment, import_constants12.GL.TEXTURE_2D, texture.handle, level);
|
|
2829
2846
|
break;
|
|
2830
2847
|
default:
|
|
2831
|
-
(0,
|
|
2848
|
+
(0, import_core12.assert)(false, "Illegal texture type");
|
|
2832
2849
|
}
|
|
2833
2850
|
gl.bindTexture(texture.target, null);
|
|
2834
2851
|
}
|
|
@@ -2856,7 +2873,7 @@ function _getFrameBufferStatus(status) {
|
|
|
2856
2873
|
}
|
|
2857
2874
|
|
|
2858
2875
|
// dist/adapter/webgl-canvas-context.js
|
|
2859
|
-
var WebGLCanvasContext = class extends
|
|
2876
|
+
var WebGLCanvasContext = class extends import_core13.CanvasContext {
|
|
2860
2877
|
device;
|
|
2861
2878
|
presentationSize;
|
|
2862
2879
|
_framebuffer = null;
|
|
@@ -2907,9 +2924,9 @@ var WebGLCanvasContext = class extends import_core11.CanvasContext {
|
|
|
2907
2924
|
};
|
|
2908
2925
|
|
|
2909
2926
|
// dist/context/debug/spector.js
|
|
2910
|
-
var
|
|
2927
|
+
var import_core14 = require("@luma.gl/core");
|
|
2911
2928
|
var DEFAULT_SPECTOR_PROPS = {
|
|
2912
|
-
spector:
|
|
2929
|
+
spector: import_core14.log.get("spector") || import_core14.log.get("inspect")
|
|
2913
2930
|
};
|
|
2914
2931
|
var SPECTOR_CDN_URL = "https://spectorcdn.babylonjs.com/spector.bundle.js";
|
|
2915
2932
|
var LOG_LEVEL = 1;
|
|
@@ -2918,9 +2935,9 @@ var initialized = false;
|
|
|
2918
2935
|
async function loadSpectorJS(props) {
|
|
2919
2936
|
if (!globalThis.SPECTOR) {
|
|
2920
2937
|
try {
|
|
2921
|
-
await (0,
|
|
2938
|
+
await (0, import_core14.loadScript)(SPECTOR_CDN_URL);
|
|
2922
2939
|
} catch (error) {
|
|
2923
|
-
|
|
2940
|
+
import_core14.log.warn(String(error));
|
|
2924
2941
|
}
|
|
2925
2942
|
}
|
|
2926
2943
|
}
|
|
@@ -2930,7 +2947,7 @@ function initializeSpectorJS(props) {
|
|
|
2930
2947
|
return null;
|
|
2931
2948
|
}
|
|
2932
2949
|
if (!spector && globalThis.SPECTOR) {
|
|
2933
|
-
|
|
2950
|
+
import_core14.log.probe(LOG_LEVEL, "SPECTOR found and initialized")();
|
|
2934
2951
|
spector = new globalThis.SPECTOR.Spector();
|
|
2935
2952
|
if (globalThis.luma) {
|
|
2936
2953
|
globalThis.luma.spector = spector;
|
|
@@ -2942,9 +2959,9 @@ function initializeSpectorJS(props) {
|
|
|
2942
2959
|
if (!initialized) {
|
|
2943
2960
|
initialized = true;
|
|
2944
2961
|
spector.spyCanvases();
|
|
2945
|
-
spector == null ? void 0 : spector.onCaptureStarted.add((capture) =>
|
|
2962
|
+
spector == null ? void 0 : spector.onCaptureStarted.add((capture) => import_core14.log.info("Spector capture started:", capture)());
|
|
2946
2963
|
spector == null ? void 0 : spector.onCapture.add((capture) => {
|
|
2947
|
-
|
|
2964
|
+
import_core14.log.info("Spector capture complete:", capture)();
|
|
2948
2965
|
spector == null ? void 0 : spector.getResultUI();
|
|
2949
2966
|
spector == null ? void 0 : spector.resultView.display();
|
|
2950
2967
|
spector == null ? void 0 : spector.resultView.addCapture(capture);
|
|
@@ -2956,7 +2973,7 @@ function initializeSpectorJS(props) {
|
|
|
2956
2973
|
}
|
|
2957
2974
|
spector == null ? void 0 : spector.startCapture(props == null ? void 0 : props.canvas, 500);
|
|
2958
2975
|
new Promise((resolve) => setTimeout(resolve, 2e3)).then((_) => {
|
|
2959
|
-
|
|
2976
|
+
import_core14.log.info("Spector capture stopped after 2 seconds")();
|
|
2960
2977
|
spector == null ? void 0 : spector.stopCapture();
|
|
2961
2978
|
});
|
|
2962
2979
|
}
|
|
@@ -2964,11 +2981,11 @@ function initializeSpectorJS(props) {
|
|
|
2964
2981
|
}
|
|
2965
2982
|
|
|
2966
2983
|
// dist/context/debug/webgl-developer-tools.js
|
|
2967
|
-
var
|
|
2984
|
+
var import_core15 = require("@luma.gl/core");
|
|
2968
2985
|
var import_constants13 = require("@luma.gl/constants");
|
|
2969
2986
|
var import_env = require("@probe.gl/env");
|
|
2970
2987
|
var WEBGL_DEBUG_CDN_URL = "https://unpkg.com/webgl-debug@2.0.1/index.js";
|
|
2971
|
-
function
|
|
2988
|
+
function getWebGLContextData(gl) {
|
|
2972
2989
|
gl.luma = gl.luma || {};
|
|
2973
2990
|
return gl.luma;
|
|
2974
2991
|
}
|
|
@@ -2976,7 +2993,7 @@ async function loadWebGLDeveloperTools() {
|
|
|
2976
2993
|
if ((0, import_env.isBrowser)() && !globalThis.WebGLDebugUtils) {
|
|
2977
2994
|
globalThis.global = globalThis.global || globalThis;
|
|
2978
2995
|
globalThis.global.module = {};
|
|
2979
|
-
await (0,
|
|
2996
|
+
await (0, import_core15.loadScript)(WEBGL_DEBUG_CDN_URL);
|
|
2980
2997
|
}
|
|
2981
2998
|
}
|
|
2982
2999
|
function makeDebugContext(gl, props = {}) {
|
|
@@ -2986,15 +3003,15 @@ function makeDebugContext(gl, props = {}) {
|
|
|
2986
3003
|
return props.debug ? getDebugContext(gl, props) : getRealContext(gl);
|
|
2987
3004
|
}
|
|
2988
3005
|
function getRealContext(gl) {
|
|
2989
|
-
const data =
|
|
3006
|
+
const data = getWebGLContextData(gl);
|
|
2990
3007
|
return data.realContext ? data.realContext : gl;
|
|
2991
3008
|
}
|
|
2992
3009
|
function getDebugContext(gl, props) {
|
|
2993
3010
|
if (!globalThis.WebGLDebugUtils) {
|
|
2994
|
-
|
|
3011
|
+
import_core15.log.warn("webgl-debug not loaded")();
|
|
2995
3012
|
return gl;
|
|
2996
3013
|
}
|
|
2997
|
-
const data =
|
|
3014
|
+
const data = getWebGLContextData(gl);
|
|
2998
3015
|
if (data.debugContext) {
|
|
2999
3016
|
return data.debugContext;
|
|
3000
3017
|
}
|
|
@@ -3026,7 +3043,7 @@ function onGLError(props, err, functionName, args) {
|
|
|
3026
3043
|
const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);
|
|
3027
3044
|
const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);
|
|
3028
3045
|
const message2 = `${errorMessage} in gl.${functionName}(${functionArgs})`;
|
|
3029
|
-
|
|
3046
|
+
import_core15.log.error(message2)();
|
|
3030
3047
|
debugger;
|
|
3031
3048
|
if (props.throwOnError) {
|
|
3032
3049
|
throw new Error(message2);
|
|
@@ -3034,9 +3051,9 @@ function onGLError(props, err, functionName, args) {
|
|
|
3034
3051
|
}
|
|
3035
3052
|
function onValidateGLFunc(props, functionName, functionArgs) {
|
|
3036
3053
|
let functionString = "";
|
|
3037
|
-
if (
|
|
3054
|
+
if (import_core15.log.level >= 1) {
|
|
3038
3055
|
functionString = getFunctionString(functionName, functionArgs);
|
|
3039
|
-
|
|
3056
|
+
import_core15.log.log(1, functionString)();
|
|
3040
3057
|
}
|
|
3041
3058
|
if (props.break && props.break.length > 0) {
|
|
3042
3059
|
functionString = functionString || getFunctionString(functionName, functionArgs);
|
|
@@ -3051,7 +3068,7 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
3051
3068
|
if (props.throwOnError) {
|
|
3052
3069
|
throw new Error(`Undefined argument: ${functionString}`);
|
|
3053
3070
|
} else {
|
|
3054
|
-
|
|
3071
|
+
import_core15.log.error(`Undefined argument: ${functionString}`)();
|
|
3055
3072
|
debugger;
|
|
3056
3073
|
}
|
|
3057
3074
|
}
|
|
@@ -3059,7 +3076,7 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
3059
3076
|
}
|
|
3060
3077
|
|
|
3061
3078
|
// dist/adapter/resources/webgl-shader.js
|
|
3062
|
-
var
|
|
3079
|
+
var import_core16 = require("@luma.gl/core");
|
|
3063
3080
|
var import_constants14 = require("@luma.gl/constants");
|
|
3064
3081
|
|
|
3065
3082
|
// dist/adapter/helpers/parse-shader-compiler-log.js
|
|
@@ -3107,7 +3124,7 @@ function getMessageType(messageType) {
|
|
|
3107
3124
|
}
|
|
3108
3125
|
|
|
3109
3126
|
// dist/adapter/resources/webgl-shader.js
|
|
3110
|
-
var WEBGLShader = class extends
|
|
3127
|
+
var WEBGLShader = class extends import_core16.Shader {
|
|
3111
3128
|
device;
|
|
3112
3129
|
handle;
|
|
3113
3130
|
constructor(device, props) {
|
|
@@ -3140,6 +3157,11 @@ var WEBGLShader = class extends import_core14.Shader {
|
|
|
3140
3157
|
const log9 = this.device.gl.getShaderInfoLog(this.handle);
|
|
3141
3158
|
return parseShaderCompilerLog(log9);
|
|
3142
3159
|
}
|
|
3160
|
+
getTranslatedSource() {
|
|
3161
|
+
const extensions = this.device.getExtension("WEBGL_debug_shaders");
|
|
3162
|
+
const ext = extensions.WEBGL_debug_shaders;
|
|
3163
|
+
return ext == null ? void 0 : ext.getTranslatedShaderSource(this.handle);
|
|
3164
|
+
}
|
|
3143
3165
|
// PRIVATE METHODS
|
|
3144
3166
|
/** Compile a shader and get compilation status */
|
|
3145
3167
|
async _compile(source) {
|
|
@@ -3149,11 +3171,11 @@ ${source2}`;
|
|
|
3149
3171
|
const { gl } = this.device;
|
|
3150
3172
|
gl.shaderSource(this.handle, source);
|
|
3151
3173
|
gl.compileShader(this.handle);
|
|
3152
|
-
if (
|
|
3174
|
+
if (import_core16.log.level === 0) {
|
|
3153
3175
|
this.compilationStatus = "pending";
|
|
3154
3176
|
return;
|
|
3155
3177
|
}
|
|
3156
|
-
if (!this.device.features.has("
|
|
3178
|
+
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
3157
3179
|
this._getCompilationStatus();
|
|
3158
3180
|
if (this.compilationStatus === "error") {
|
|
3159
3181
|
throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
|
|
@@ -3161,9 +3183,9 @@ ${source2}`;
|
|
|
3161
3183
|
this.debugShader();
|
|
3162
3184
|
return;
|
|
3163
3185
|
}
|
|
3164
|
-
|
|
3186
|
+
import_core16.log.once(1, "Shader compilation is asynchronous")();
|
|
3165
3187
|
await this._waitForCompilationComplete();
|
|
3166
|
-
|
|
3188
|
+
import_core16.log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();
|
|
3167
3189
|
this._getCompilationStatus();
|
|
3168
3190
|
this.debugShader();
|
|
3169
3191
|
}
|
|
@@ -3171,13 +3193,13 @@ ${source2}`;
|
|
|
3171
3193
|
async _waitForCompilationComplete() {
|
|
3172
3194
|
const waitMs = async (ms) => await new Promise((resolve) => setTimeout(resolve, ms));
|
|
3173
3195
|
const DELAY_MS = 10;
|
|
3174
|
-
if (!this.device.features.has("
|
|
3196
|
+
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
3175
3197
|
await waitMs(DELAY_MS);
|
|
3176
3198
|
return;
|
|
3177
3199
|
}
|
|
3178
3200
|
const { gl } = this.device;
|
|
3179
3201
|
for (; ; ) {
|
|
3180
|
-
const complete = gl.getShaderParameter(this.handle, import_constants14.GL.
|
|
3202
|
+
const complete = gl.getShaderParameter(this.handle, import_constants14.GL.COMPLETION_STATUS_KHR);
|
|
3181
3203
|
if (complete) {
|
|
3182
3204
|
return;
|
|
3183
3205
|
}
|
|
@@ -3188,20 +3210,20 @@ ${source2}`;
|
|
|
3188
3210
|
* Get the shader compilation status
|
|
3189
3211
|
* TODO - Load log even when no error reported, to catch warnings?
|
|
3190
3212
|
* https://gamedev.stackexchange.com/questions/30429/how-to-detect-glsl-warnings
|
|
3191
|
-
|
|
3213
|
+
*/
|
|
3192
3214
|
_getCompilationStatus() {
|
|
3193
3215
|
this.compilationStatus = this.device.gl.getShaderParameter(this.handle, import_constants14.GL.COMPILE_STATUS) ? "success" : "error";
|
|
3194
3216
|
}
|
|
3195
3217
|
};
|
|
3196
3218
|
|
|
3197
3219
|
// dist/adapter/resources/webgl-render-pass.js
|
|
3198
|
-
var
|
|
3220
|
+
var import_core17 = require("@luma.gl/core");
|
|
3199
3221
|
var import_constants15 = require("@luma.gl/constants");
|
|
3200
3222
|
var GL_DEPTH_BUFFER_BIT = 256;
|
|
3201
3223
|
var GL_STENCIL_BUFFER_BIT = 1024;
|
|
3202
3224
|
var GL_COLOR_BUFFER_BIT = 16384;
|
|
3203
3225
|
var GL_COLOR = 6144;
|
|
3204
|
-
var WEBGLRenderPass = class extends
|
|
3226
|
+
var WEBGLRenderPass = class extends import_core17.RenderPass {
|
|
3205
3227
|
device;
|
|
3206
3228
|
/** Parameters that should be applied before each draw call */
|
|
3207
3229
|
glParameters;
|
|
@@ -3224,7 +3246,6 @@ var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
|
3224
3246
|
}
|
|
3225
3247
|
insertDebugMarker(markerLabel) {
|
|
3226
3248
|
}
|
|
3227
|
-
// writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;
|
|
3228
3249
|
// beginOcclusionQuery(queryIndex: number): void;
|
|
3229
3250
|
// endOcclusionQuery(): void;
|
|
3230
3251
|
// executeBundles(bundles: Iterable<GPURenderBundle>): void;
|
|
@@ -3263,7 +3284,15 @@ var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
|
3263
3284
|
this.glParameters = glParameters;
|
|
3264
3285
|
setGLParameters(this.device, glParameters);
|
|
3265
3286
|
}
|
|
3266
|
-
|
|
3287
|
+
beginOcclusionQuery(queryIndex) {
|
|
3288
|
+
const webglQuerySet = this.props.occlusionQuerySet;
|
|
3289
|
+
webglQuerySet == null ? void 0 : webglQuerySet.beginOcclusionQuery();
|
|
3290
|
+
}
|
|
3291
|
+
endOcclusionQuery() {
|
|
3292
|
+
const webglQuerySet = this.props.occlusionQuerySet;
|
|
3293
|
+
webglQuerySet == null ? void 0 : webglQuerySet.endOcclusionQuery();
|
|
3294
|
+
}
|
|
3295
|
+
// PRIVATE
|
|
3267
3296
|
/**
|
|
3268
3297
|
* Optionally clears depth, color and stencil buffers based on parameters
|
|
3269
3298
|
*/
|
|
@@ -3310,15 +3339,15 @@ var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
|
3310
3339
|
};
|
|
3311
3340
|
|
|
3312
3341
|
// dist/adapter/resources/webgl-render-pipeline.js
|
|
3313
|
-
var
|
|
3314
|
-
var
|
|
3342
|
+
var import_core19 = require("@luma.gl/core");
|
|
3343
|
+
var import_core20 = require("@luma.gl/core");
|
|
3315
3344
|
var import_constants22 = require("@luma.gl/constants");
|
|
3316
3345
|
|
|
3317
3346
|
// dist/adapter/helpers/get-shader-layout.js
|
|
3318
3347
|
var import_constants19 = require("@luma.gl/constants");
|
|
3319
3348
|
|
|
3320
3349
|
// dist/classic/accessor.js
|
|
3321
|
-
var
|
|
3350
|
+
var import_core18 = require("@luma.gl/core");
|
|
3322
3351
|
var import_constants17 = require("@luma.gl/constants");
|
|
3323
3352
|
|
|
3324
3353
|
// dist/classic/typed-array-utils.js
|
|
@@ -3403,7 +3432,7 @@ var Accessor = class {
|
|
|
3403
3432
|
return ArrayType.BYTES_PER_ELEMENT;
|
|
3404
3433
|
}
|
|
3405
3434
|
static getBytesPerVertex(accessor) {
|
|
3406
|
-
(0,
|
|
3435
|
+
(0, import_core18.assert)(accessor.size);
|
|
3407
3436
|
const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants17.GL.FLOAT);
|
|
3408
3437
|
return ArrayType.BYTES_PER_ELEMENT * accessor.size;
|
|
3409
3438
|
}
|
|
@@ -3432,7 +3461,7 @@ var Accessor = class {
|
|
|
3432
3461
|
// PRIVATE
|
|
3433
3462
|
// eslint-disable-next-line complexity, max-statements
|
|
3434
3463
|
_assign(props = {}) {
|
|
3435
|
-
props = (0,
|
|
3464
|
+
props = (0, import_core18.checkProps)("Accessor", props, PROP_CHECKS);
|
|
3436
3465
|
if (props.type !== void 0) {
|
|
3437
3466
|
this.type = props.type;
|
|
3438
3467
|
if (props.type === import_constants17.GL.INT || props.type === import_constants17.GL.UNSIGNED_INT) {
|
|
@@ -3922,7 +3951,7 @@ function getGLPrimitive(topology) {
|
|
|
3922
3951
|
|
|
3923
3952
|
// dist/adapter/resources/webgl-render-pipeline.js
|
|
3924
3953
|
var LOG_PROGRAM_PERF_PRIORITY = 4;
|
|
3925
|
-
var WEBGLRenderPipeline = class extends
|
|
3954
|
+
var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
|
|
3926
3955
|
/** The WebGL device that created this render pipeline */
|
|
3927
3956
|
device;
|
|
3928
3957
|
/** Handle to underlying WebGL program */
|
|
@@ -3947,20 +3976,22 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
3947
3976
|
this.device = device;
|
|
3948
3977
|
this.handle = this.props.handle || this.device.gl.createProgram();
|
|
3949
3978
|
this.device.setSpectorMetadata(this.handle, { id: this.props.id });
|
|
3950
|
-
this.vs = (0,
|
|
3951
|
-
this.fs = (0,
|
|
3979
|
+
this.vs = (0, import_core19.cast)(props.vs);
|
|
3980
|
+
this.fs = (0, import_core19.cast)(props.fs);
|
|
3952
3981
|
const { varyings, bufferMode = import_constants22.GL.SEPARATE_ATTRIBS } = props;
|
|
3953
3982
|
if (varyings && varyings.length > 0) {
|
|
3954
3983
|
this.varyings = varyings;
|
|
3955
3984
|
this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
3956
3985
|
}
|
|
3957
3986
|
this._linkShaders();
|
|
3987
|
+
import_core19.log.time(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
3958
3988
|
this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
|
|
3959
|
-
|
|
3989
|
+
import_core19.log.timeEnd(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
3990
|
+
this.shaderLayout = (0, import_core20.mergeShaderLayout)(this.introspectedLayout, props.shaderLayout);
|
|
3960
3991
|
switch (this.props.topology) {
|
|
3961
3992
|
case "triangle-fan-webgl":
|
|
3962
3993
|
case "line-loop-webgl":
|
|
3963
|
-
|
|
3994
|
+
import_core19.log.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);
|
|
3964
3995
|
break;
|
|
3965
3996
|
default:
|
|
3966
3997
|
}
|
|
@@ -3980,11 +4011,11 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
3980
4011
|
const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name) || this.shaderLayout.bindings.find((binding2) => binding2.name === `${name}Uniforms`);
|
|
3981
4012
|
if (!binding) {
|
|
3982
4013
|
const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
|
|
3983
|
-
|
|
4014
|
+
import_core19.log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
|
|
3984
4015
|
continue;
|
|
3985
4016
|
}
|
|
3986
4017
|
if (!value) {
|
|
3987
|
-
|
|
4018
|
+
import_core19.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
|
|
3988
4019
|
}
|
|
3989
4020
|
switch (binding.type) {
|
|
3990
4021
|
case "uniform":
|
|
@@ -3993,12 +4024,12 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
3993
4024
|
}
|
|
3994
4025
|
break;
|
|
3995
4026
|
case "texture":
|
|
3996
|
-
if (!(value instanceof WEBGLTexture || value instanceof WEBGLFramebuffer)) {
|
|
4027
|
+
if (!(value instanceof WEBGLTextureView || value instanceof WEBGLTexture || value instanceof WEBGLFramebuffer)) {
|
|
3997
4028
|
throw new Error("texture value");
|
|
3998
4029
|
}
|
|
3999
4030
|
break;
|
|
4000
4031
|
case "sampler":
|
|
4001
|
-
|
|
4032
|
+
import_core19.log.warn(`Ignoring sampler ${name}`)();
|
|
4002
4033
|
break;
|
|
4003
4034
|
default:
|
|
4004
4035
|
throw new Error(binding.type);
|
|
@@ -4006,14 +4037,6 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
4006
4037
|
this.bindings[name] = value;
|
|
4007
4038
|
}
|
|
4008
4039
|
}
|
|
4009
|
-
/** This function is @deprecated, use uniform buffers */
|
|
4010
|
-
setUniforms(uniforms) {
|
|
4011
|
-
const { bindings } = (0, import_core17.splitUniformsAndBindings)(uniforms);
|
|
4012
|
-
Object.keys(bindings).forEach((name) => {
|
|
4013
|
-
import_core17.log.warn(`Unsupported value "${JSON.stringify(bindings[name])}" used in setUniforms() for key ${name}. Use setBindings() instead?`)();
|
|
4014
|
-
});
|
|
4015
|
-
Object.assign(this.uniforms, uniforms);
|
|
4016
|
-
}
|
|
4017
4040
|
/** @todo needed for portable model
|
|
4018
4041
|
* @note The WebGL API is offers many ways to draw things
|
|
4019
4042
|
* This function unifies those ways into a single call using common parameters with sane defaults
|
|
@@ -4074,6 +4097,14 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
4074
4097
|
vertexArray.unbindAfterRender(renderPass);
|
|
4075
4098
|
return true;
|
|
4076
4099
|
}
|
|
4100
|
+
// DEPRECATED METHODS
|
|
4101
|
+
setUniformsWebGL(uniforms) {
|
|
4102
|
+
const { bindings } = (0, import_core19.splitUniformsAndBindings)(uniforms);
|
|
4103
|
+
Object.keys(bindings).forEach((name) => {
|
|
4104
|
+
import_core19.log.warn(`Unsupported value "${JSON.stringify(bindings[name])}" used in setUniforms() for key ${name}. Use setBindings() instead?`)();
|
|
4105
|
+
});
|
|
4106
|
+
Object.assign(this.uniforms, uniforms);
|
|
4107
|
+
}
|
|
4077
4108
|
// PRIVATE METHODS
|
|
4078
4109
|
// setAttributes(attributes: Record<string, Buffer>): void {}
|
|
4079
4110
|
// setBindings(bindings: Record<string, Binding>): void {}
|
|
@@ -4081,19 +4112,19 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
4081
4112
|
const { gl } = this.device;
|
|
4082
4113
|
gl.attachShader(this.handle, this.vs.handle);
|
|
4083
4114
|
gl.attachShader(this.handle, this.fs.handle);
|
|
4084
|
-
|
|
4115
|
+
import_core19.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
|
|
4085
4116
|
gl.linkProgram(this.handle);
|
|
4086
|
-
|
|
4087
|
-
if (
|
|
4117
|
+
import_core19.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
|
|
4118
|
+
if (import_core19.log.level === 0) {
|
|
4088
4119
|
}
|
|
4089
|
-
if (!this.device.features.has("
|
|
4120
|
+
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
4090
4121
|
const status2 = this._getLinkStatus();
|
|
4091
4122
|
this._reportLinkStatus(status2);
|
|
4092
4123
|
return;
|
|
4093
4124
|
}
|
|
4094
|
-
|
|
4125
|
+
import_core19.log.once(1, "RenderPipeline linking is asynchronous")();
|
|
4095
4126
|
await this._waitForLinkComplete();
|
|
4096
|
-
|
|
4127
|
+
import_core19.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
|
|
4097
4128
|
const status = this._getLinkStatus();
|
|
4098
4129
|
this._reportLinkStatus(status);
|
|
4099
4130
|
}
|
|
@@ -4140,13 +4171,13 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
4140
4171
|
async _waitForLinkComplete() {
|
|
4141
4172
|
const waitMs = async (ms) => await new Promise((resolve) => setTimeout(resolve, ms));
|
|
4142
4173
|
const DELAY_MS = 10;
|
|
4143
|
-
if (!this.device.features.has("
|
|
4174
|
+
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
4144
4175
|
await waitMs(DELAY_MS);
|
|
4145
4176
|
return;
|
|
4146
4177
|
}
|
|
4147
4178
|
const { gl } = this.device;
|
|
4148
4179
|
for (; ; ) {
|
|
4149
|
-
const complete = gl.getProgramParameter(this.handle, import_constants22.GL.
|
|
4180
|
+
const complete = gl.getProgramParameter(this.handle, import_constants22.GL.COMPLETION_STATUS_KHR);
|
|
4150
4181
|
if (complete) {
|
|
4151
4182
|
return;
|
|
4152
4183
|
}
|
|
@@ -4207,14 +4238,16 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
4207
4238
|
uniformBufferIndex += 1;
|
|
4208
4239
|
break;
|
|
4209
4240
|
case "texture":
|
|
4210
|
-
if (!(value instanceof WEBGLTexture || value instanceof WEBGLFramebuffer)) {
|
|
4241
|
+
if (!(value instanceof WEBGLTextureView || value instanceof WEBGLTexture || value instanceof WEBGLFramebuffer)) {
|
|
4211
4242
|
throw new Error("texture");
|
|
4212
4243
|
}
|
|
4213
4244
|
let texture;
|
|
4214
|
-
if (value instanceof
|
|
4245
|
+
if (value instanceof WEBGLTextureView) {
|
|
4246
|
+
texture = value.texture;
|
|
4247
|
+
} else if (value instanceof WEBGLTexture) {
|
|
4215
4248
|
texture = value;
|
|
4216
4249
|
} else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTexture) {
|
|
4217
|
-
|
|
4250
|
+
import_core19.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
|
|
4218
4251
|
texture = value.colorAttachments[0];
|
|
4219
4252
|
} else {
|
|
4220
4253
|
throw new Error("No texture");
|
|
@@ -4247,15 +4280,15 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
4247
4280
|
};
|
|
4248
4281
|
|
|
4249
4282
|
// dist/adapter/resources/webgl-command-encoder.js
|
|
4250
|
-
var
|
|
4283
|
+
var import_core22 = require("@luma.gl/core");
|
|
4251
4284
|
|
|
4252
4285
|
// dist/adapter/resources/webgl-command-buffer.js
|
|
4253
|
-
var
|
|
4286
|
+
var import_core21 = require("@luma.gl/core");
|
|
4254
4287
|
var import_constants23 = require("@luma.gl/constants");
|
|
4255
4288
|
function cast2(value) {
|
|
4256
4289
|
return value;
|
|
4257
4290
|
}
|
|
4258
|
-
var WEBGLCommandBuffer = class extends
|
|
4291
|
+
var WEBGLCommandBuffer = class extends import_core21.CommandBuffer {
|
|
4259
4292
|
device;
|
|
4260
4293
|
commands = [];
|
|
4261
4294
|
constructor(device) {
|
|
@@ -4335,7 +4368,7 @@ function _copyTextureToBuffer(device, options) {
|
|
|
4335
4368
|
const webglBuffer = destination;
|
|
4336
4369
|
const sourceWidth = width || framebuffer.width;
|
|
4337
4370
|
const sourceHeight = height || framebuffer.height;
|
|
4338
|
-
const sourceParams = getWebGLTextureParameters(framebuffer.texture.format);
|
|
4371
|
+
const sourceParams = getWebGLTextureParameters(framebuffer.texture.props.format);
|
|
4339
4372
|
const sourceFormat = sourceParams.dataFormat;
|
|
4340
4373
|
const sourceType = sourceParams.type;
|
|
4341
4374
|
device.gl.bindBuffer(import_constants23.GL.PIXEL_PACK_BUFFER, webglBuffer.handle);
|
|
@@ -4413,7 +4446,7 @@ function _copyTextureToTexture(device, options) {
|
|
|
4413
4446
|
return texture;
|
|
4414
4447
|
}
|
|
4415
4448
|
function getFramebuffer(source) {
|
|
4416
|
-
if (source instanceof
|
|
4449
|
+
if (source instanceof import_core21.Texture) {
|
|
4417
4450
|
const { width, height, id } = source;
|
|
4418
4451
|
const framebuffer = source.device.createFramebuffer({
|
|
4419
4452
|
id: `framebuffer-for-${id}`,
|
|
@@ -4427,7 +4460,7 @@ function getFramebuffer(source) {
|
|
|
4427
4460
|
}
|
|
4428
4461
|
|
|
4429
4462
|
// dist/adapter/resources/webgl-command-encoder.js
|
|
4430
|
-
var WEBGLCommandEncoder = class extends
|
|
4463
|
+
var WEBGLCommandEncoder = class extends import_core22.CommandEncoder {
|
|
4431
4464
|
device;
|
|
4432
4465
|
commandBuffer;
|
|
4433
4466
|
constructor(device, props) {
|
|
@@ -4461,13 +4494,15 @@ var WEBGLCommandEncoder = class extends import_core20.CommandEncoder {
|
|
|
4461
4494
|
}
|
|
4462
4495
|
insertDebugMarker(markerLabel) {
|
|
4463
4496
|
}
|
|
4497
|
+
resolveQuerySet(querySet, destination, options) {
|
|
4498
|
+
}
|
|
4464
4499
|
};
|
|
4465
4500
|
|
|
4466
4501
|
// dist/adapter/resources/webgl-vertex-array.js
|
|
4467
|
-
var
|
|
4502
|
+
var import_core23 = require("@luma.gl/core");
|
|
4468
4503
|
var import_constants24 = require("@luma.gl/constants");
|
|
4469
4504
|
var import_env2 = require("@probe.gl/env");
|
|
4470
|
-
var WEBGLVertexArray = class extends
|
|
4505
|
+
var WEBGLVertexArray = class extends import_core23.VertexArray {
|
|
4471
4506
|
get [Symbol.toStringTag]() {
|
|
4472
4507
|
return "VertexArray";
|
|
4473
4508
|
}
|
|
@@ -4531,7 +4566,7 @@ var WEBGLVertexArray = class extends import_core21.VertexArray {
|
|
|
4531
4566
|
this.attributes[location] = buffer;
|
|
4532
4567
|
}
|
|
4533
4568
|
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
4534
|
-
|
|
4569
|
+
setConstantWebGL(location, value) {
|
|
4535
4570
|
this._enable(location, false);
|
|
4536
4571
|
this.attributes[location] = value;
|
|
4537
4572
|
}
|
|
@@ -4559,7 +4594,7 @@ var WEBGLVertexArray = class extends import_core21.VertexArray {
|
|
|
4559
4594
|
for (let location = 0; location < this.maxVertexAttributes; ++location) {
|
|
4560
4595
|
const constant = this.attributes[location];
|
|
4561
4596
|
if (ArrayBuffer.isView(constant)) {
|
|
4562
|
-
this.device.
|
|
4597
|
+
this.device.setConstantAttributeWebGL(location, constant);
|
|
4563
4598
|
}
|
|
4564
4599
|
}
|
|
4565
4600
|
}
|
|
@@ -4637,8 +4672,8 @@ var WEBGLVertexArray = class extends import_core21.VertexArray {
|
|
|
4637
4672
|
this.buffer = this.buffer || this.device.createBuffer({ byteLength });
|
|
4638
4673
|
updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
|
|
4639
4674
|
if (updateNeeded) {
|
|
4640
|
-
const typedArray = (0,
|
|
4641
|
-
(0,
|
|
4675
|
+
const typedArray = (0, import_core23.getScratchArray)(value.constructor, length);
|
|
4676
|
+
(0, import_core23.fillArray)({ target: typedArray, source: constantValue, start: 0, count: length });
|
|
4642
4677
|
this.buffer.write(typedArray);
|
|
4643
4678
|
this.bufferValue = value;
|
|
4644
4679
|
}
|
|
@@ -4664,9 +4699,9 @@ function compareConstantArrayValues(v1, v2) {
|
|
|
4664
4699
|
}
|
|
4665
4700
|
|
|
4666
4701
|
// dist/adapter/resources/webgl-transform-feedback.js
|
|
4667
|
-
var
|
|
4702
|
+
var import_core24 = require("@luma.gl/core");
|
|
4668
4703
|
var import_constants25 = require("@luma.gl/constants");
|
|
4669
|
-
var WEBGLTransformFeedback = class extends
|
|
4704
|
+
var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
|
|
4670
4705
|
device;
|
|
4671
4706
|
gl;
|
|
4672
4707
|
handle;
|
|
@@ -4729,7 +4764,7 @@ var WEBGLTransformFeedback = class extends import_core22.TransformFeedback {
|
|
|
4729
4764
|
const { buffer, byteLength, byteOffset } = this._getBufferRange(bufferOrRange);
|
|
4730
4765
|
if (location < 0) {
|
|
4731
4766
|
this.unusedBuffers[locationOrName] = buffer;
|
|
4732
|
-
|
|
4767
|
+
import_core24.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
|
|
4733
4768
|
return;
|
|
4734
4769
|
}
|
|
4735
4770
|
this.buffers[location] = { buffer, byteLength, byteOffset };
|
|
@@ -4815,57 +4850,187 @@ function isIndex(value) {
|
|
|
4815
4850
|
return /^\d+$/.test(value);
|
|
4816
4851
|
}
|
|
4817
4852
|
|
|
4853
|
+
// dist/adapter/resources/webgl-query-set.js
|
|
4854
|
+
var import_core25 = require("@luma.gl/core");
|
|
4855
|
+
var import_constants26 = require("@luma.gl/constants");
|
|
4856
|
+
var WEBGLQuerySet = class extends import_core25.QuerySet {
|
|
4857
|
+
device;
|
|
4858
|
+
handle;
|
|
4859
|
+
target = null;
|
|
4860
|
+
_queryPending = false;
|
|
4861
|
+
_pollingPromise = null;
|
|
4862
|
+
get [Symbol.toStringTag]() {
|
|
4863
|
+
return "Query";
|
|
4864
|
+
}
|
|
4865
|
+
// Create a query class
|
|
4866
|
+
constructor(device, props) {
|
|
4867
|
+
super(device, props);
|
|
4868
|
+
this.device = device;
|
|
4869
|
+
if (props.count > 1) {
|
|
4870
|
+
throw new Error("WebGL QuerySet can only have one value");
|
|
4871
|
+
}
|
|
4872
|
+
this.handle = this.device.gl.createQuery();
|
|
4873
|
+
Object.seal(this);
|
|
4874
|
+
}
|
|
4875
|
+
destroy() {
|
|
4876
|
+
this.device.gl.deleteQuery(this.handle);
|
|
4877
|
+
}
|
|
4878
|
+
// FOR RENDER PASS AND COMMAND ENCODER
|
|
4879
|
+
/**
|
|
4880
|
+
* Shortcut for timer query (dependent on extension in both WebGL1 and 2)
|
|
4881
|
+
* Measures GPU time delta between this call and a matching `end` call in the
|
|
4882
|
+
* GPU instruction stream.
|
|
4883
|
+
*/
|
|
4884
|
+
beginTimestampQuery() {
|
|
4885
|
+
return this._begin(import_constants26.GL.TIME_ELAPSED_EXT);
|
|
4886
|
+
}
|
|
4887
|
+
endTimestampQuery() {
|
|
4888
|
+
this._end();
|
|
4889
|
+
}
|
|
4890
|
+
// Shortcut for occlusion queries
|
|
4891
|
+
beginOcclusionQuery(options) {
|
|
4892
|
+
return this._begin((options == null ? void 0 : options.conservative) ? import_constants26.GL.ANY_SAMPLES_PASSED_CONSERVATIVE : import_constants26.GL.ANY_SAMPLES_PASSED);
|
|
4893
|
+
}
|
|
4894
|
+
endOcclusionQuery() {
|
|
4895
|
+
this._end();
|
|
4896
|
+
}
|
|
4897
|
+
// Shortcut for transformFeedbackQuery
|
|
4898
|
+
beginTransformFeedbackQuery() {
|
|
4899
|
+
return this._begin(import_constants26.GL.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
|
|
4900
|
+
}
|
|
4901
|
+
endTransformFeedbackQuery() {
|
|
4902
|
+
this._end();
|
|
4903
|
+
}
|
|
4904
|
+
async resolveQuery() {
|
|
4905
|
+
const value = await this.pollQuery();
|
|
4906
|
+
return [value];
|
|
4907
|
+
}
|
|
4908
|
+
// PRIVATE METHODS
|
|
4909
|
+
/**
|
|
4910
|
+
* Due to OpenGL API limitations, after calling `begin()` on one Query
|
|
4911
|
+
* instance, `end()` must be called on that same instance before
|
|
4912
|
+
* calling `begin()` on another query. While there can be multiple
|
|
4913
|
+
* outstanding queries representing disjoint `begin()`/`end()` intervals.
|
|
4914
|
+
* It is not possible to interleave or overlap `begin` and `end` calls.
|
|
4915
|
+
*/
|
|
4916
|
+
_begin(target) {
|
|
4917
|
+
if (this._queryPending) {
|
|
4918
|
+
return;
|
|
4919
|
+
}
|
|
4920
|
+
this.target = target;
|
|
4921
|
+
this.device.gl.beginQuery(this.target, this.handle);
|
|
4922
|
+
return;
|
|
4923
|
+
}
|
|
4924
|
+
// ends the current query
|
|
4925
|
+
_end() {
|
|
4926
|
+
if (this._queryPending) {
|
|
4927
|
+
return;
|
|
4928
|
+
}
|
|
4929
|
+
if (this.target) {
|
|
4930
|
+
this.device.gl.endQuery(this.target);
|
|
4931
|
+
this.target = null;
|
|
4932
|
+
this._queryPending = true;
|
|
4933
|
+
}
|
|
4934
|
+
return;
|
|
4935
|
+
}
|
|
4936
|
+
// Returns true if the query result is available
|
|
4937
|
+
isResultAvailable() {
|
|
4938
|
+
if (!this._queryPending) {
|
|
4939
|
+
return false;
|
|
4940
|
+
}
|
|
4941
|
+
const resultAvailable = this.device.gl.getQueryParameter(this.handle, import_constants26.GL.QUERY_RESULT_AVAILABLE);
|
|
4942
|
+
if (resultAvailable) {
|
|
4943
|
+
this._queryPending = false;
|
|
4944
|
+
}
|
|
4945
|
+
return resultAvailable;
|
|
4946
|
+
}
|
|
4947
|
+
// Timing query is disjoint, i.e. results are invalid
|
|
4948
|
+
isTimerDisjoint() {
|
|
4949
|
+
return this.device.gl.getParameter(import_constants26.GL.GPU_DISJOINT_EXT);
|
|
4950
|
+
}
|
|
4951
|
+
// Returns query result.
|
|
4952
|
+
getResult() {
|
|
4953
|
+
return this.device.gl.getQueryParameter(this.handle, import_constants26.GL.QUERY_RESULT);
|
|
4954
|
+
}
|
|
4955
|
+
// Returns the query result, converted to milliseconds to match JavaScript conventions.
|
|
4956
|
+
getTimerMilliseconds() {
|
|
4957
|
+
return this.getResult() / 1e6;
|
|
4958
|
+
}
|
|
4959
|
+
// Polls the query
|
|
4960
|
+
pollQuery(limit = Number.POSITIVE_INFINITY) {
|
|
4961
|
+
if (this._pollingPromise) {
|
|
4962
|
+
return this._pollingPromise;
|
|
4963
|
+
}
|
|
4964
|
+
let counter = 0;
|
|
4965
|
+
this._pollingPromise = new Promise((resolve, reject) => {
|
|
4966
|
+
const poll = () => {
|
|
4967
|
+
if (this.isResultAvailable()) {
|
|
4968
|
+
resolve(this.getResult());
|
|
4969
|
+
this._pollingPromise = null;
|
|
4970
|
+
} else if (counter++ > limit) {
|
|
4971
|
+
reject("Timed out");
|
|
4972
|
+
this._pollingPromise = null;
|
|
4973
|
+
} else {
|
|
4974
|
+
requestAnimationFrame(poll);
|
|
4975
|
+
}
|
|
4976
|
+
};
|
|
4977
|
+
requestAnimationFrame(poll);
|
|
4978
|
+
});
|
|
4979
|
+
return this._pollingPromise;
|
|
4980
|
+
}
|
|
4981
|
+
};
|
|
4982
|
+
|
|
4818
4983
|
// dist/classic/copy-and-blit.js
|
|
4819
|
-
var
|
|
4820
|
-
var
|
|
4984
|
+
var import_core27 = require("@luma.gl/core");
|
|
4985
|
+
var import_constants28 = require("@luma.gl/constants");
|
|
4821
4986
|
|
|
4822
4987
|
// dist/classic/format-utils.js
|
|
4823
|
-
var
|
|
4824
|
-
var
|
|
4988
|
+
var import_core26 = require("@luma.gl/core");
|
|
4989
|
+
var import_constants27 = require("@luma.gl/constants");
|
|
4825
4990
|
function glFormatToComponents(format) {
|
|
4826
4991
|
switch (format) {
|
|
4827
|
-
case
|
|
4828
|
-
case
|
|
4829
|
-
case
|
|
4992
|
+
case import_constants27.GL.ALPHA:
|
|
4993
|
+
case import_constants27.GL.R32F:
|
|
4994
|
+
case import_constants27.GL.RED:
|
|
4830
4995
|
return 1;
|
|
4831
|
-
case
|
|
4832
|
-
case
|
|
4996
|
+
case import_constants27.GL.RG32F:
|
|
4997
|
+
case import_constants27.GL.RG:
|
|
4833
4998
|
return 2;
|
|
4834
|
-
case
|
|
4835
|
-
case
|
|
4999
|
+
case import_constants27.GL.RGB:
|
|
5000
|
+
case import_constants27.GL.RGB32F:
|
|
4836
5001
|
return 3;
|
|
4837
|
-
case
|
|
4838
|
-
case
|
|
5002
|
+
case import_constants27.GL.RGBA:
|
|
5003
|
+
case import_constants27.GL.RGBA32F:
|
|
4839
5004
|
return 4;
|
|
4840
5005
|
default:
|
|
4841
|
-
(0,
|
|
5006
|
+
(0, import_core26.assert)(false);
|
|
4842
5007
|
return 0;
|
|
4843
5008
|
}
|
|
4844
5009
|
}
|
|
4845
5010
|
function glTypeToBytes(type) {
|
|
4846
5011
|
switch (type) {
|
|
4847
|
-
case
|
|
5012
|
+
case import_constants27.GL.UNSIGNED_BYTE:
|
|
4848
5013
|
return 1;
|
|
4849
|
-
case
|
|
4850
|
-
case
|
|
4851
|
-
case
|
|
5014
|
+
case import_constants27.GL.UNSIGNED_SHORT_5_6_5:
|
|
5015
|
+
case import_constants27.GL.UNSIGNED_SHORT_4_4_4_4:
|
|
5016
|
+
case import_constants27.GL.UNSIGNED_SHORT_5_5_5_1:
|
|
4852
5017
|
return 2;
|
|
4853
|
-
case
|
|
5018
|
+
case import_constants27.GL.FLOAT:
|
|
4854
5019
|
return 4;
|
|
4855
5020
|
default:
|
|
4856
|
-
(0,
|
|
5021
|
+
(0, import_core26.assert)(false);
|
|
4857
5022
|
return 0;
|
|
4858
5023
|
}
|
|
4859
5024
|
}
|
|
4860
5025
|
|
|
4861
5026
|
// dist/classic/copy-and-blit.js
|
|
4862
5027
|
function readPixelsToArray(source, options) {
|
|
4863
|
-
var _a;
|
|
5028
|
+
var _a, _b;
|
|
4864
5029
|
const {
|
|
4865
5030
|
sourceX = 0,
|
|
4866
5031
|
sourceY = 0,
|
|
4867
|
-
sourceFormat =
|
|
4868
|
-
sourceAttachment =
|
|
5032
|
+
sourceFormat = import_constants28.GL.RGBA,
|
|
5033
|
+
sourceAttachment = import_constants28.GL.COLOR_ATTACHMENT0
|
|
4869
5034
|
// TODO - support gl.readBuffer
|
|
4870
5035
|
} = options || {};
|
|
4871
5036
|
let {
|
|
@@ -4876,31 +5041,31 @@ function readPixelsToArray(source, options) {
|
|
|
4876
5041
|
sourceType
|
|
4877
5042
|
} = options || {};
|
|
4878
5043
|
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
4879
|
-
(0,
|
|
5044
|
+
(0, import_core27.assert)(framebuffer);
|
|
4880
5045
|
const { gl, handle } = framebuffer;
|
|
4881
5046
|
sourceWidth = sourceWidth || framebuffer.width;
|
|
4882
5047
|
sourceHeight = sourceHeight || framebuffer.height;
|
|
4883
|
-
const attachment = sourceAttachment -
|
|
4884
|
-
sourceType = sourceType || ((_a = framebuffer.colorAttachments[attachment]) == null ? void 0 : _a.type) ||
|
|
5048
|
+
const attachment = sourceAttachment - import_constants28.GL.COLOR_ATTACHMENT0;
|
|
5049
|
+
sourceType = sourceType || ((_b = (_a = framebuffer.colorAttachments[attachment]) == null ? void 0 : _a.texture) == null ? void 0 : _b.type) || import_constants28.GL.UNSIGNED_BYTE;
|
|
4885
5050
|
target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);
|
|
4886
5051
|
sourceType = sourceType || getGLTypeFromTypedArray(target);
|
|
4887
|
-
const prevHandle = gl.bindFramebuffer(
|
|
5052
|
+
const prevHandle = gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, handle);
|
|
4888
5053
|
gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);
|
|
4889
|
-
gl.bindFramebuffer(
|
|
5054
|
+
gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, prevHandle || null);
|
|
4890
5055
|
if (deleteFramebuffer) {
|
|
4891
5056
|
framebuffer.destroy();
|
|
4892
5057
|
}
|
|
4893
5058
|
return target;
|
|
4894
5059
|
}
|
|
4895
5060
|
function readPixelsToBuffer(source, options) {
|
|
4896
|
-
const { target, sourceX = 0, sourceY = 0, sourceFormat =
|
|
5061
|
+
const { target, sourceX = 0, sourceY = 0, sourceFormat = import_constants28.GL.RGBA, targetByteOffset = 0 } = options || {};
|
|
4897
5062
|
let { sourceWidth, sourceHeight, sourceType } = options || {};
|
|
4898
5063
|
const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
|
|
4899
|
-
(0,
|
|
5064
|
+
(0, import_core27.assert)(framebuffer);
|
|
4900
5065
|
sourceWidth = sourceWidth || framebuffer.width;
|
|
4901
5066
|
sourceHeight = sourceHeight || framebuffer.height;
|
|
4902
5067
|
const webglFramebuffer = framebuffer;
|
|
4903
|
-
sourceType = sourceType ||
|
|
5068
|
+
sourceType = sourceType || import_constants28.GL.UNSIGNED_BYTE;
|
|
4904
5069
|
let webglBufferTarget = target;
|
|
4905
5070
|
if (!webglBufferTarget) {
|
|
4906
5071
|
const components = glFormatToComponents(sourceFormat);
|
|
@@ -4924,7 +5089,7 @@ function readPixelsToBuffer(source, options) {
|
|
|
4924
5089
|
return webglBufferTarget;
|
|
4925
5090
|
}
|
|
4926
5091
|
function getFramebuffer2(source) {
|
|
4927
|
-
if (!(source instanceof
|
|
5092
|
+
if (!(source instanceof import_core27.Framebuffer)) {
|
|
4928
5093
|
return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
|
|
4929
5094
|
}
|
|
4930
5095
|
return { framebuffer: source, deleteFramebuffer: false };
|
|
@@ -4944,14 +5109,14 @@ function getPixelArray(pixelArray, type, format, width, height) {
|
|
|
4944
5109
|
if (pixelArray) {
|
|
4945
5110
|
return pixelArray;
|
|
4946
5111
|
}
|
|
4947
|
-
type = type ||
|
|
5112
|
+
type = type || import_constants28.GL.UNSIGNED_BYTE;
|
|
4948
5113
|
const ArrayType = getTypedArrayFromGLType(type, { clamped: false });
|
|
4949
5114
|
const components = glFormatToComponents(format);
|
|
4950
5115
|
return new ArrayType(width * height * components);
|
|
4951
5116
|
}
|
|
4952
5117
|
|
|
4953
5118
|
// dist/classic/clear.js
|
|
4954
|
-
var
|
|
5119
|
+
var import_core28 = require("@luma.gl/core");
|
|
4955
5120
|
var GL_DEPTH_BUFFER_BIT2 = 256;
|
|
4956
5121
|
var GL_STENCIL_BUFFER_BIT2 = 1024;
|
|
4957
5122
|
var GL_COLOR_BUFFER_BIT2 = 16384;
|
|
@@ -4981,7 +5146,7 @@ function clear(device, options) {
|
|
|
4981
5146
|
parameters.clearStencil = depth;
|
|
4982
5147
|
}
|
|
4983
5148
|
}
|
|
4984
|
-
(0,
|
|
5149
|
+
(0, import_core28.assert)(clearFlags !== 0, ERR_ARGUMENTS);
|
|
4985
5150
|
withGLParameters(device, parameters, () => {
|
|
4986
5151
|
const gl = device.gl;
|
|
4987
5152
|
gl.clear(clearFlags);
|
|
@@ -4990,25 +5155,18 @@ function clear(device, options) {
|
|
|
4990
5155
|
|
|
4991
5156
|
// dist/adapter/webgl-device.js
|
|
4992
5157
|
var LOG_LEVEL2 = 1;
|
|
4993
|
-
var _WebGLDevice = class extends
|
|
5158
|
+
var _WebGLDevice = class extends import_core29.Device {
|
|
4994
5159
|
static isSupported() {
|
|
4995
5160
|
return typeof WebGL2RenderingContext !== "undefined";
|
|
4996
5161
|
}
|
|
5162
|
+
/** The underlying WebGL context */
|
|
5163
|
+
handle;
|
|
5164
|
+
features;
|
|
5165
|
+
limits;
|
|
4997
5166
|
info;
|
|
4998
5167
|
canvasContext;
|
|
4999
|
-
handle;
|
|
5000
|
-
get features() {
|
|
5001
|
-
this._features = this._features || getDeviceFeatures(this.gl);
|
|
5002
|
-
return this._features;
|
|
5003
|
-
}
|
|
5004
|
-
get limits() {
|
|
5005
|
-
this._limits = this._limits || getDeviceLimits(this.gl);
|
|
5006
|
-
return this._limits;
|
|
5007
|
-
}
|
|
5008
5168
|
lost;
|
|
5009
5169
|
_resolveContextLost;
|
|
5010
|
-
_features;
|
|
5011
|
-
_limits;
|
|
5012
5170
|
//
|
|
5013
5171
|
// Static methods, expected to be present by `luma.createDevice()`
|
|
5014
5172
|
//
|
|
@@ -5022,7 +5180,7 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5022
5180
|
if (gl instanceof _WebGLDevice) {
|
|
5023
5181
|
return gl;
|
|
5024
5182
|
}
|
|
5025
|
-
if ((gl == null ? void 0 : gl.device) instanceof
|
|
5183
|
+
if ((gl == null ? void 0 : gl.device) instanceof import_core29.Device) {
|
|
5026
5184
|
return gl.device;
|
|
5027
5185
|
}
|
|
5028
5186
|
if (!isWebGL(gl)) {
|
|
@@ -5031,26 +5189,28 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5031
5189
|
return new _WebGLDevice({ gl });
|
|
5032
5190
|
}
|
|
5033
5191
|
static async create(props = {}) {
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5192
|
+
var _a;
|
|
5193
|
+
import_core29.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created")();
|
|
5194
|
+
const promises = [];
|
|
5195
|
+
if (props.debug) {
|
|
5196
|
+
promises.push(loadWebGLDeveloperTools());
|
|
5037
5197
|
}
|
|
5038
|
-
if (
|
|
5039
|
-
|
|
5198
|
+
if (props.spector) {
|
|
5199
|
+
promises.push(loadSpectorJS());
|
|
5040
5200
|
}
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
await loadSpectorJS();
|
|
5201
|
+
if (typeof props.canvas === "string") {
|
|
5202
|
+
promises.push(import_core29.CanvasContext.pageLoaded);
|
|
5044
5203
|
}
|
|
5045
|
-
|
|
5046
|
-
|
|
5204
|
+
await Promise.all(promises);
|
|
5205
|
+
import_core29.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
|
|
5206
|
+
if ((_a = props.gl) == null ? void 0 : _a.device) {
|
|
5047
5207
|
return _WebGLDevice.attach(props.gl);
|
|
5048
5208
|
}
|
|
5049
5209
|
const device = new _WebGLDevice(props);
|
|
5050
5210
|
const message2 = `Created ${device.info.type}${device.debug ? " debug" : ""} context: ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5211
|
+
import_core29.log.probe(LOG_LEVEL2, message2)();
|
|
5212
|
+
import_core29.log.table(LOG_LEVEL2, device.info)();
|
|
5213
|
+
import_core29.log.groupEnd(LOG_LEVEL2)();
|
|
5054
5214
|
return device;
|
|
5055
5215
|
}
|
|
5056
5216
|
//
|
|
@@ -5058,54 +5218,57 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5058
5218
|
//
|
|
5059
5219
|
constructor(props) {
|
|
5060
5220
|
var _a, _b;
|
|
5061
|
-
super({ ...props, id: props.id || (0,
|
|
5221
|
+
super({ ...props, id: props.id || (0, import_core29.uid)("webgl-device") });
|
|
5062
5222
|
const device = (_a = props.gl) == null ? void 0 : _a.device;
|
|
5063
5223
|
if (device) {
|
|
5064
5224
|
throw new Error(`WebGL context already attached to device ${device.id}`);
|
|
5065
5225
|
}
|
|
5066
|
-
const canvas =
|
|
5226
|
+
const canvas = ((_b = props.gl) == null ? void 0 : _b.canvas) || props.canvas;
|
|
5067
5227
|
this.canvasContext = new WebGLCanvasContext(this, { ...props, canvas });
|
|
5068
5228
|
this.lost = new Promise((resolve) => {
|
|
5069
5229
|
this._resolveContextLost = resolve;
|
|
5070
5230
|
});
|
|
5071
|
-
const onContextLost = (event) => {
|
|
5072
|
-
var _a2;
|
|
5073
|
-
return (_a2 = this._resolveContextLost) == null ? void 0 : _a2.call(this, {
|
|
5074
|
-
reason: "destroyed",
|
|
5075
|
-
message: "Computer entered sleep mode, or too many apps or browser tabs are using the GPU."
|
|
5076
|
-
});
|
|
5077
|
-
};
|
|
5078
5231
|
let gl = props.gl || null;
|
|
5079
|
-
gl
|
|
5232
|
+
gl ||= createBrowserContext(this.canvasContext.canvas, {
|
|
5233
|
+
...props,
|
|
5234
|
+
onContextLost: (event) => {
|
|
5235
|
+
var _a2;
|
|
5236
|
+
return (_a2 = this._resolveContextLost) == null ? void 0 : _a2.call(this, {
|
|
5237
|
+
reason: "destroyed",
|
|
5238
|
+
message: "Entered sleep mode, or too many apps or browser tabs are using the GPU."
|
|
5239
|
+
});
|
|
5240
|
+
}
|
|
5241
|
+
});
|
|
5080
5242
|
if (!gl) {
|
|
5081
5243
|
throw new Error("WebGL context creation failed");
|
|
5082
5244
|
}
|
|
5083
5245
|
this.handle = gl;
|
|
5084
|
-
this.gl =
|
|
5085
|
-
this.canvasContext.resize();
|
|
5086
|
-
this.info = getDeviceInfo(this.gl);
|
|
5246
|
+
this.gl = gl;
|
|
5087
5247
|
this.gl.device = this;
|
|
5088
|
-
this.gl._version =
|
|
5248
|
+
this.gl._version = 2;
|
|
5249
|
+
this.info = getDeviceInfo(this.gl, this._extensions);
|
|
5250
|
+
this.features = new WebGLDeviceFeatures(this.gl, this._extensions);
|
|
5251
|
+
this.limits = new WebGLDeviceLimits(this.gl);
|
|
5252
|
+
this.canvasContext.resize();
|
|
5089
5253
|
const { enable: enable2 = true, copyState = false } = props;
|
|
5090
5254
|
trackContextState(this.gl, {
|
|
5091
5255
|
enable: enable2,
|
|
5092
5256
|
copyState,
|
|
5093
|
-
log: (...args) =>
|
|
5257
|
+
log: (...args) => import_core29.log.log(1, ...args)()
|
|
5094
5258
|
});
|
|
5095
|
-
if (
|
|
5259
|
+
if (props.debug) {
|
|
5096
5260
|
this.gl = makeDebugContext(this.gl, { ...props, throwOnError: true });
|
|
5097
5261
|
this.debug = true;
|
|
5098
|
-
|
|
5099
|
-
|
|
5262
|
+
import_core29.log.level = Math.max(import_core29.log.level, 1);
|
|
5263
|
+
import_core29.log.warn("WebGL debug mode activated. Performance reduced.")();
|
|
5100
5264
|
}
|
|
5101
|
-
if (
|
|
5102
|
-
|
|
5103
|
-
this.spector = initializeSpectorJS({ ...this.props, canvas: canvas2 });
|
|
5265
|
+
if (props.spector) {
|
|
5266
|
+
this.spectorJS = initializeSpectorJS({ ...this.props, canvas: this.handle.canvas });
|
|
5104
5267
|
}
|
|
5105
5268
|
}
|
|
5106
5269
|
/**
|
|
5107
5270
|
* Destroys the context
|
|
5108
|
-
* @note Has no effect for browser contexts, there is no browser API for destroying contexts
|
|
5271
|
+
* @note Has no effect for WebGL browser contexts, there is no browser API for destroying contexts
|
|
5109
5272
|
*/
|
|
5110
5273
|
destroy() {
|
|
5111
5274
|
}
|
|
@@ -5116,13 +5279,13 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5116
5279
|
return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];
|
|
5117
5280
|
}
|
|
5118
5281
|
isTextureFormatSupported(format) {
|
|
5119
|
-
return isTextureFormatSupported(this.gl, format);
|
|
5282
|
+
return isTextureFormatSupported(this.gl, format, this._extensions);
|
|
5120
5283
|
}
|
|
5121
5284
|
isTextureFormatFilterable(format) {
|
|
5122
|
-
return isTextureFormatFilterable(this.gl, format);
|
|
5285
|
+
return isTextureFormatFilterable(this.gl, format, this._extensions);
|
|
5123
5286
|
}
|
|
5124
5287
|
isTextureFormatRenderable(format) {
|
|
5125
|
-
return isTextureFormatRenderable(this.gl, format);
|
|
5288
|
+
return isTextureFormatRenderable(this.gl, format, this._extensions);
|
|
5126
5289
|
}
|
|
5127
5290
|
// IMPLEMENTATION OF ABSTRACT DEVICE
|
|
5128
5291
|
createCanvasContext(props) {
|
|
@@ -5147,12 +5310,18 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5147
5310
|
createFramebuffer(props) {
|
|
5148
5311
|
return new WEBGLFramebuffer(this, props);
|
|
5149
5312
|
}
|
|
5150
|
-
createRenderPipeline(props) {
|
|
5151
|
-
return new WEBGLRenderPipeline(this, props);
|
|
5152
|
-
}
|
|
5153
5313
|
createVertexArray(props) {
|
|
5154
5314
|
return new WEBGLVertexArray(this, props);
|
|
5155
5315
|
}
|
|
5316
|
+
createTransformFeedback(props) {
|
|
5317
|
+
return new WEBGLTransformFeedback(this, props);
|
|
5318
|
+
}
|
|
5319
|
+
createQuerySet(props) {
|
|
5320
|
+
return new WEBGLQuerySet(this, props);
|
|
5321
|
+
}
|
|
5322
|
+
createRenderPipeline(props) {
|
|
5323
|
+
return new WEBGLRenderPipeline(this, props);
|
|
5324
|
+
}
|
|
5156
5325
|
beginRenderPass(props) {
|
|
5157
5326
|
return new WEBGLRenderPass(this, props);
|
|
5158
5327
|
}
|
|
@@ -5162,9 +5331,6 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5162
5331
|
beginComputePass(props) {
|
|
5163
5332
|
throw new Error("ComputePass not supported in WebGL");
|
|
5164
5333
|
}
|
|
5165
|
-
createTransformFeedback(props) {
|
|
5166
|
-
return new WEBGLTransformFeedback(this, props);
|
|
5167
|
-
}
|
|
5168
5334
|
renderPass = null;
|
|
5169
5335
|
getDefaultRenderPass() {
|
|
5170
5336
|
this.renderPass = this.renderPass || this.beginRenderPass({
|
|
@@ -5187,7 +5353,7 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5187
5353
|
}
|
|
5188
5354
|
//
|
|
5189
5355
|
// TEMPORARY HACKS - will be removed in v9.1
|
|
5190
|
-
//
|
|
5356
|
+
//
|
|
5191
5357
|
/** @deprecated - should use command encoder */
|
|
5192
5358
|
readPixelsToArrayWebGL(source, options) {
|
|
5193
5359
|
return readPixelsToArray(source, options);
|
|
@@ -5220,13 +5386,7 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5220
5386
|
_extensions = {};
|
|
5221
5387
|
_polyfilled = false;
|
|
5222
5388
|
/** Instance of Spector.js (if initialized) */
|
|
5223
|
-
|
|
5224
|
-
_webglLimits;
|
|
5225
|
-
/** Return WebGL specific limits */
|
|
5226
|
-
get webglLimits() {
|
|
5227
|
-
this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);
|
|
5228
|
-
return this._webglLimits;
|
|
5229
|
-
}
|
|
5389
|
+
spectorJS;
|
|
5230
5390
|
/**
|
|
5231
5391
|
* Triggers device (or WebGL context) loss.
|
|
5232
5392
|
* @note primarily intended for testing how application reacts to device loss
|
|
@@ -5234,7 +5394,8 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5234
5394
|
loseDevice() {
|
|
5235
5395
|
var _a;
|
|
5236
5396
|
let deviceLossTriggered = false;
|
|
5237
|
-
const
|
|
5397
|
+
const extensions = this.getExtension("WEBGL_lose_context");
|
|
5398
|
+
const ext = extensions.WEBGL_lose_context;
|
|
5238
5399
|
if (ext) {
|
|
5239
5400
|
deviceLossTriggered = true;
|
|
5240
5401
|
ext.loseContext();
|
|
@@ -5283,11 +5444,12 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5283
5444
|
* so they need to be updated before every render
|
|
5284
5445
|
* @todo - remember/cache values to avoid setting them unnecessarily?
|
|
5285
5446
|
*/
|
|
5286
|
-
|
|
5287
|
-
|
|
5447
|
+
setConstantAttributeWebGL(location, constant) {
|
|
5448
|
+
const maxVertexAttributes = this.limits.maxVertexAttributes;
|
|
5449
|
+
this._constants = this._constants || new Array(maxVertexAttributes).fill(null);
|
|
5288
5450
|
const currentConstant = this._constants[location];
|
|
5289
5451
|
if (currentConstant && compareConstantArrayValues2(currentConstant, constant)) {
|
|
5290
|
-
|
|
5452
|
+
import_core29.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
|
|
5291
5453
|
}
|
|
5292
5454
|
this._constants[location] = constant;
|
|
5293
5455
|
switch (constant.constructor) {
|
|
@@ -5301,9 +5463,14 @@ var _WebGLDevice = class extends import_core26.Device {
|
|
|
5301
5463
|
setConstantUintArray(this, location, constant);
|
|
5302
5464
|
break;
|
|
5303
5465
|
default:
|
|
5304
|
-
(0,
|
|
5466
|
+
(0, import_core29.assert)(false);
|
|
5305
5467
|
}
|
|
5306
5468
|
}
|
|
5469
|
+
/** Ensure extensions are only requested once */
|
|
5470
|
+
getExtension(name) {
|
|
5471
|
+
getWebGLExtension(this.gl, name, this._extensions);
|
|
5472
|
+
return this._extensions;
|
|
5473
|
+
}
|
|
5307
5474
|
};
|
|
5308
5475
|
var WebGLDevice = _WebGLDevice;
|
|
5309
5476
|
//
|
|
@@ -5331,7 +5498,7 @@ function setConstantFloatArray(device, location, array) {
|
|
|
5331
5498
|
device.gl.vertexAttrib4fv(location, array);
|
|
5332
5499
|
break;
|
|
5333
5500
|
default:
|
|
5334
|
-
(0,
|
|
5501
|
+
(0, import_core29.assert)(false);
|
|
5335
5502
|
}
|
|
5336
5503
|
}
|
|
5337
5504
|
function setConstantIntArray(device, location, array) {
|