@luma.gl/webgl 9.0.0-alpha.14 → 9.0.0-alpha.16
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.js +199 -136
- package/dist/adapter/converters/renderbuffer-formats.d.ts +1 -1
- package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.js +62 -176
- package/dist/adapter/converters/sampler-parameters.js +149 -206
- package/dist/adapter/converters/texture-formats.d.ts +2 -2
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +437 -890
- package/dist/adapter/converters/vertex-formats.js +15 -33
- package/dist/adapter/device-helpers/device-features.js +119 -100
- package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +88 -86
- package/dist/adapter/device-helpers/get-device-info.js +42 -43
- package/dist/adapter/device-helpers/is-old-ie.js +9 -6
- package/dist/adapter/helpers/attribute-utils.js +50 -74
- package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
- package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
- package/dist/adapter/helpers/get-shader-info.js +27 -0
- package/dist/adapter/helpers/get-shader-layout.js +307 -296
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js +32 -33
- package/dist/adapter/helpers/set-uniform.js +67 -110
- package/dist/adapter/helpers/uniforms.js +80 -85
- package/dist/adapter/objects/constants-to-keys.js +33 -33
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +67 -86
- package/dist/adapter/objects/webgl-resource.js +213 -205
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +74 -76
- package/dist/adapter/resources/webgl-buffer.js +150 -147
- package/dist/adapter/resources/webgl-command-buffer.d.ts +5 -5
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +39 -55
- package/dist/adapter/resources/webgl-command-encoder.js +25 -49
- package/dist/adapter/resources/webgl-external-texture.js +91 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +231 -258
- package/dist/adapter/resources/webgl-render-pass.d.ts +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +8 -18
- package/dist/adapter/resources/webgl-render-pipeline.js +316 -378
- package/dist/adapter/resources/webgl-sampler.js +42 -47
- package/dist/adapter/resources/webgl-shader.d.ts +1 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +58 -68
- package/dist/adapter/resources/webgl-texture.d.ts +5 -5
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +661 -815
- package/dist/adapter/webgl-canvas-context.js +55 -49
- package/dist/adapter/webgl-device.js +288 -338
- package/dist/bundle.js +1 -2
- package/dist/classic/accessor.js +120 -127
- package/dist/classic/buffer.d.ts +1 -1
- package/dist/classic/buffer.d.ts.map +1 -1
- package/dist/classic/buffer.js +325 -356
- package/dist/classic/typed-array-utils.d.ts +1 -1
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +91 -101
- package/dist/context/context/create-browser-context.d.ts +1 -2
- package/dist/context/context/create-browser-context.d.ts.map +1 -1
- package/dist/context/context/create-browser-context.js +61 -52
- package/dist/context/context/create-headless-context.d.ts +1 -1
- package/dist/context/context/create-headless-context.d.ts.map +1 -1
- package/dist/context/context/create-headless-context.js +26 -33
- package/dist/context/context/webgl-checks.js +25 -20
- package/dist/context/debug/spector.d.ts +1 -2
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +53 -62
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +106 -93
- package/dist/context/parameters/unified-parameter-api.js +91 -55
- package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +462 -423
- package/dist/context/polyfill/context-data.js +16 -12
- package/dist/context/polyfill/get-parameter-polyfill.js +91 -76
- package/dist/context/polyfill/polyfill-context.js +75 -80
- package/dist/context/polyfill/polyfill-table.js +133 -139
- package/dist/context/polyfill/polyfill-vertex-array-object.js +255 -297
- package/dist/context/state-tracker/deep-array-equal.js +16 -18
- package/dist/context/state-tracker/track-context-state.js +183 -161
- package/dist/context/state-tracker/with-parameters.js +43 -35
- package/dist/dist.min.js +1 -0
- package/dist/es5/adapter/converters/device-parameters.js +3 -38
- package/dist/es5/adapter/converters/device-parameters.js.map +1 -1
- package/dist/es5/adapter/converters/renderbuffer-formats.js +2 -14
- package/dist/es5/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/es5/adapter/converters/sampler-parameters.js +2 -65
- package/dist/es5/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/es5/adapter/converters/texture-formats.js +9 -81
- package/dist/es5/adapter/converters/texture-formats.js.map +1 -1
- package/dist/es5/adapter/converters/vertex-formats.js +0 -12
- package/dist/es5/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/es5/adapter/device-helpers/device-features.js +6 -40
- package/dist/es5/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/es5/adapter/device-helpers/device-limits.js +0 -10
- package/dist/es5/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/es5/adapter/device-helpers/get-device-info.js +0 -10
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/es5/adapter/helpers/attribute-utils.js +3 -25
- package/dist/es5/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/es5/adapter/helpers/get-shader-info.js +31 -0
- package/dist/es5/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/es5/adapter/helpers/get-shader-layout.js +23 -101
- package/dist/es5/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +6 -24
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/es5/adapter/helpers/set-uniform.js +0 -33
- package/dist/es5/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/es5/adapter/helpers/uniforms.js +13 -37
- package/dist/es5/adapter/helpers/uniforms.js.map +1 -1
- package/dist/es5/adapter/objects/constants-to-keys.js +1 -12
- package/dist/es5/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-renderbuffer.js +5 -33
- package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-resource.js +6 -60
- package/dist/es5/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js +7 -35
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-buffer.js +20 -66
- package/dist/es5/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-command-buffer.js +6 -32
- package/dist/es5/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -18
- package/dist/es5/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-framebuffer.js +10 -82
- package/dist/es5/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-render-pass.js +2 -19
- package/dist/es5/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-render-pipeline.js +24 -133
- package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-sampler.js +2 -28
- package/dist/es5/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-shader.js +13 -52
- package/dist/es5/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-texture.js +137 -291
- package/dist/es5/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/es5/adapter/webgl-canvas-context.js +0 -24
- package/dist/es5/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/es5/adapter/webgl-device.js +40 -127
- package/dist/es5/adapter/webgl-device.js.map +1 -1
- package/dist/es5/bundle.js +0 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/classic/accessor.js +1 -31
- package/dist/es5/classic/accessor.js.map +1 -1
- package/dist/es5/classic/buffer.js +32 -102
- package/dist/es5/classic/buffer.js.map +1 -1
- package/dist/es5/classic/typed-array-utils.js +10 -37
- package/dist/es5/classic/typed-array-utils.js.map +1 -1
- package/dist/es5/context/context/create-browser-context.js +4 -21
- package/dist/es5/context/context/create-browser-context.js.map +1 -1
- package/dist/es5/context/context/create-headless-context.js +8 -21
- package/dist/es5/context/context/create-headless-context.js.map +1 -1
- package/dist/es5/context/context/webgl-checks.js +4 -14
- package/dist/es5/context/context/webgl-checks.js.map +1 -1
- package/dist/es5/context/debug/spector.js +20 -54
- package/dist/es5/context/debug/spector.js.map +1 -1
- package/dist/es5/context/debug/webgl-developer-tools.js +19 -65
- package/dist/es5/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/es5/context/parameters/unified-parameter-api.js +3 -28
- package/dist/es5/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/es5/context/parameters/webgl-parameter-tables.js +18 -65
- package/dist/es5/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/es5/context/polyfill/context-data.js +0 -3
- package/dist/es5/context/polyfill/context-data.js.map +1 -1
- package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -12
- package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-context.js +8 -33
- package/dist/es5/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-table.js +3 -27
- package/dist/es5/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/es5/context/state-tracker/deep-array-equal.js +0 -5
- package/dist/es5/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/es5/context/state-tracker/track-context-state.js +10 -53
- package/dist/es5/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/es5/context/state-tracker/with-parameters.js +1 -13
- package/dist/es5/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/es5/index.js +72 -99
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/init.js +0 -3
- package/dist/es5/init.js.map +1 -1
- package/dist/es5/types/webgl.js +0 -1
- package/dist/es5/types/webgl.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/adapter/converters/device-parameters.js +0 -20
- package/dist/esm/adapter/converters/device-parameters.js.map +1 -1
- package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -4
- package/dist/esm/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/esm/adapter/converters/sampler-parameters.js +2 -57
- package/dist/esm/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/esm/adapter/converters/texture-formats.js +8 -52
- package/dist/esm/adapter/converters/texture-formats.js.map +1 -1
- package/dist/esm/adapter/converters/vertex-formats.js +0 -9
- package/dist/esm/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/esm/adapter/device-helpers/device-features.js +2 -19
- package/dist/esm/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/esm/adapter/device-helpers/device-limits.js +0 -3
- package/dist/esm/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/esm/adapter/device-helpers/get-device-info.js +0 -6
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js +2 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/esm/adapter/helpers/attribute-utils.js +0 -17
- package/dist/esm/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/esm/adapter/helpers/get-shader-info.js +25 -0
- package/dist/esm/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/esm/adapter/helpers/get-shader-layout.js +2 -48
- package/dist/esm/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -7
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/esm/adapter/helpers/set-uniform.js +0 -30
- package/dist/esm/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/esm/adapter/helpers/uniforms.js +0 -10
- package/dist/esm/adapter/helpers/uniforms.js.map +1 -1
- package/dist/esm/adapter/objects/constants-to-keys.js +0 -7
- package/dist/esm/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-renderbuffer.js +2 -18
- package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-resource.js +10 -57
- package/dist/esm/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js +5 -15
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-buffer.js +12 -40
- package/dist/esm/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-command-buffer.js +2 -17
- package/dist/esm/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -12
- package/dist/esm/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -60
- package/dist/esm/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-render-pass.js +1 -8
- package/dist/esm/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -89
- package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-sampler.js +0 -12
- package/dist/esm/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-shader.js +2 -16
- package/dist/esm/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-texture.js +36 -154
- package/dist/esm/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/esm/adapter/webgl-canvas-context.js +0 -14
- package/dist/esm/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/esm/adapter/webgl-device.js +19 -89
- package/dist/esm/adapter/webgl-device.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/classic/accessor.js +10 -34
- package/dist/esm/classic/accessor.js.map +1 -1
- package/dist/esm/classic/buffer.js +15 -71
- package/dist/esm/classic/buffer.js.map +1 -1
- package/dist/esm/classic/typed-array-utils.js +0 -20
- package/dist/esm/classic/typed-array-utils.js.map +1 -1
- package/dist/esm/context/context/create-browser-context.js +6 -14
- package/dist/esm/context/context/create-browser-context.js.map +1 -1
- package/dist/esm/context/context/create-headless-context.js +2 -6
- package/dist/esm/context/context/create-headless-context.js.map +1 -1
- package/dist/esm/context/context/webgl-checks.js +0 -3
- package/dist/esm/context/context/webgl-checks.js.map +1 -1
- package/dist/esm/context/debug/spector.js +2 -14
- package/dist/esm/context/debug/spector.js.map +1 -1
- package/dist/esm/context/debug/webgl-developer-tools.js +4 -22
- package/dist/esm/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/esm/context/parameters/unified-parameter-api.js +2 -13
- package/dist/esm/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -19
- package/dist/esm/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/esm/context/polyfill/context-data.js +0 -2
- package/dist/esm/context/polyfill/context-data.js.map +1 -1
- package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -5
- package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-context.js +14 -21
- package/dist/esm/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-table.js +0 -23
- package/dist/esm/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/esm/context/state-tracker/deep-array-equal.js +0 -4
- package/dist/esm/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/esm/context/state-tracker/track-context-state.js +11 -45
- package/dist/esm/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/esm/context/state-tracker/with-parameters.js +0 -6
- package/dist/esm/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/types/webgl.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/index.js +39 -25
- package/dist/init.js +1 -2
- package/dist/types/webgl.d.ts +20 -20
- package/dist/types/webgl.d.ts.map +1 -1
- package/dist/types/webgl.js +0 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/package.json +8 -8
- package/src/adapter/helpers/get-shader-info.ts +37 -0
- package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
- package/src/adapter/resources/webgl-render-pass.ts +1 -1
- package/src/adapter/resources/webgl-shader.ts +2 -2
- package/src/adapter/webgl-device.ts +1 -1
- package/src/context/debug/webgl-developer-tools.ts +0 -1
- package/src/types/webgl.ts +4 -4
- package/dist/adapter/converters/device-parameters.js.map +0 -1
- package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/adapter/converters/texture-formats.js.map +0 -1
- package/dist/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/adapter/helpers/uniforms.js.map +0 -1
- package/dist/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/adapter/webgl-device.js.map +0 -1
- package/dist/bundle.js.map +0 -1
- package/dist/classic/accessor.js.map +0 -1
- package/dist/classic/buffer.js.map +0 -1
- package/dist/classic/typed-array-utils.js.map +0 -1
- package/dist/context/context/create-browser-context.js.map +0 -1
- package/dist/context/context/create-headless-context.js.map +0 -1
- package/dist/context/context/webgl-checks.js.map +0 -1
- package/dist/context/debug/spector.js.map +0 -1
- package/dist/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/context/polyfill/context-data.js.map +0 -1
- package/dist/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/types/webgl.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -24,138 +24,101 @@ export default class WebGLDevice extends Device {
|
|
|
24
24
|
static isSupported() {
|
|
25
25
|
return typeof WebGLRenderingContext !== 'undefined' || isHeadlessGLRegistered();
|
|
26
26
|
}
|
|
27
|
-
|
|
28
27
|
get features() {
|
|
29
28
|
this._features = this._features || getDeviceFeatures(this.gl);
|
|
30
29
|
return this._features;
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
get limits() {
|
|
34
32
|
this._limits = this._limits || getDeviceLimits(this.gl);
|
|
35
33
|
return this._limits;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
35
|
static attach(gl) {
|
|
39
36
|
if (gl instanceof WebGLDevice) {
|
|
40
37
|
return gl;
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
if ((gl === null || gl === void 0 ? void 0 : gl.device) instanceof Device) {
|
|
44
40
|
return gl.device;
|
|
45
41
|
}
|
|
46
|
-
|
|
47
42
|
if (!isWebGL(gl)) {
|
|
48
43
|
throw new Error('Invalid WebGLRenderingContext');
|
|
49
44
|
}
|
|
50
|
-
|
|
51
45
|
return new WebGLDevice({
|
|
52
46
|
gl: gl
|
|
53
47
|
});
|
|
54
48
|
}
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
static async create() {
|
|
50
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
51
|
log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created');
|
|
58
|
-
|
|
59
52
|
if (typeof props.canvas === 'string') {
|
|
60
53
|
await CanvasContext.pageLoaded;
|
|
61
54
|
}
|
|
62
|
-
|
|
63
55
|
if (props.debug) {
|
|
64
56
|
await loadWebGLDeveloperTools();
|
|
65
57
|
}
|
|
66
|
-
|
|
67
58
|
if (props.spector) {
|
|
68
59
|
await loadSpectorJS();
|
|
69
60
|
}
|
|
70
|
-
|
|
71
61
|
log.probe(LOG_LEVEL + 1, 'DOM is loaded')();
|
|
72
|
-
|
|
73
62
|
if (props.gl && props.gl.device) {
|
|
74
63
|
return WebGLDevice.attach(props.gl);
|
|
75
64
|
}
|
|
76
|
-
|
|
77
65
|
return new WebGLDevice(props);
|
|
78
66
|
}
|
|
79
|
-
|
|
80
67
|
constructor(props) {
|
|
81
68
|
var _props$gl;
|
|
82
|
-
|
|
83
|
-
|
|
69
|
+
super({
|
|
70
|
+
...props,
|
|
84
71
|
id: props.id || uid('webgl-device')
|
|
85
72
|
});
|
|
86
|
-
|
|
87
73
|
_defineProperty(this, "info", void 0);
|
|
88
|
-
|
|
89
74
|
_defineProperty(this, "canvasContext", void 0);
|
|
90
|
-
|
|
91
75
|
_defineProperty(this, "handle", void 0);
|
|
92
|
-
|
|
93
76
|
_defineProperty(this, "lost", void 0);
|
|
94
|
-
|
|
95
77
|
_defineProperty(this, "_resolveContextLost", void 0);
|
|
96
|
-
|
|
97
78
|
_defineProperty(this, "_features", void 0);
|
|
98
|
-
|
|
99
79
|
_defineProperty(this, "_limits", void 0);
|
|
100
|
-
|
|
101
80
|
_defineProperty(this, "renderPass", null);
|
|
102
|
-
|
|
103
81
|
_defineProperty(this, "gl", void 0);
|
|
104
|
-
|
|
105
82
|
_defineProperty(this, "gl2", null);
|
|
106
|
-
|
|
107
83
|
_defineProperty(this, "debug", false);
|
|
108
|
-
|
|
109
84
|
_defineProperty(this, "isWebGL1", void 0);
|
|
110
|
-
|
|
111
85
|
_defineProperty(this, "isWebGL2", void 0);
|
|
112
|
-
|
|
113
86
|
_defineProperty(this, "_canvasSizeInfo", {
|
|
114
87
|
clientWidth: 0,
|
|
115
88
|
clientHeight: 0,
|
|
116
89
|
devicePixelRatio: 1
|
|
117
90
|
});
|
|
118
|
-
|
|
119
91
|
_defineProperty(this, "_extensions", {});
|
|
120
|
-
|
|
121
92
|
_defineProperty(this, "_polyfilled", false);
|
|
122
|
-
|
|
123
93
|
_defineProperty(this, "spector", void 0);
|
|
124
|
-
|
|
125
94
|
_defineProperty(this, "_webglLimits", void 0);
|
|
126
|
-
|
|
127
95
|
const device = (_props$gl = props.gl) === null || _props$gl === void 0 ? void 0 : _props$gl.device;
|
|
128
|
-
|
|
129
96
|
if (device) {
|
|
130
97
|
throw new Error("WebGL context already attached to device ".concat(device.id));
|
|
131
98
|
}
|
|
132
|
-
|
|
133
99
|
this.canvasContext = new WebGLCanvasContext(this, props);
|
|
134
100
|
this.lost = new Promise(resolve => {
|
|
135
101
|
this._resolveContextLost = resolve;
|
|
136
102
|
});
|
|
137
|
-
|
|
138
103
|
const onContextLost = event => {
|
|
139
104
|
var _this$_resolveContext;
|
|
140
|
-
|
|
141
105
|
return (_this$_resolveContext = this._resolveContextLost) === null || _this$_resolveContext === void 0 ? void 0 : _this$_resolveContext.call(this, {
|
|
142
106
|
reason: 'destroyed',
|
|
143
107
|
message: 'Computer entered sleep mode, or too many apps or browser tabs are using the GPU.'
|
|
144
108
|
});
|
|
145
109
|
};
|
|
146
|
-
|
|
147
110
|
let gl = props.gl || null;
|
|
148
|
-
gl = gl || (isBrowser() ? createBrowserContext(this.canvasContext.canvas, {
|
|
111
|
+
gl = gl || (isBrowser() ? createBrowserContext(this.canvasContext.canvas, {
|
|
112
|
+
...props,
|
|
149
113
|
onContextLost
|
|
150
114
|
}) : null);
|
|
151
|
-
gl = gl || (!isBrowser() ? createHeadlessContext({
|
|
115
|
+
gl = gl || (!isBrowser() ? createHeadlessContext({
|
|
116
|
+
...props,
|
|
152
117
|
onContextLost
|
|
153
118
|
}) : null);
|
|
154
|
-
|
|
155
119
|
if (!gl) {
|
|
156
120
|
throw new Error('WebGL context creation failed');
|
|
157
121
|
}
|
|
158
|
-
|
|
159
122
|
this.handle = gl;
|
|
160
123
|
this.gl = this.handle;
|
|
161
124
|
this.gl2 = this.gl;
|
|
@@ -172,11 +135,16 @@ export default class WebGLDevice extends Device {
|
|
|
172
135
|
trackContextState(this.gl, {
|
|
173
136
|
enable,
|
|
174
137
|
copyState,
|
|
175
|
-
log: (
|
|
138
|
+
log: function () {
|
|
139
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
140
|
+
args[_key] = arguments[_key];
|
|
141
|
+
}
|
|
142
|
+
return log.log(1, ...args)();
|
|
143
|
+
}
|
|
176
144
|
});
|
|
177
|
-
|
|
178
145
|
if (isBrowser() && props.debug) {
|
|
179
|
-
this.gl = makeDebugContext(this.gl, {
|
|
146
|
+
this.gl = makeDebugContext(this.gl, {
|
|
147
|
+
...props,
|
|
180
148
|
webgl2: this.isWebGL2,
|
|
181
149
|
throwOnError: true
|
|
182
150
|
});
|
|
@@ -185,162 +153,124 @@ export default class WebGLDevice extends Device {
|
|
|
185
153
|
log.level = Math.max(log.level, 1);
|
|
186
154
|
log.warn('WebGL debug mode activated. Performance reduced.')();
|
|
187
155
|
}
|
|
188
|
-
|
|
189
156
|
if (isBrowser() && props.spector) {
|
|
190
157
|
const canvas = this.handle.canvas || props.canvas;
|
|
191
|
-
this.spector = initializeSpectorJS({
|
|
158
|
+
this.spector = initializeSpectorJS({
|
|
159
|
+
...this.props,
|
|
192
160
|
canvas
|
|
193
161
|
});
|
|
194
162
|
}
|
|
195
|
-
|
|
196
163
|
const message = "Created ".concat(this.info.type).concat(this.debug ? ' debug' : '', " context: ").concat(this.info.vendor, ", ").concat(this.info.renderer, " for canvas: ").concat(this.canvasContext.id);
|
|
197
164
|
log.probe(LOG_LEVEL, message)();
|
|
198
165
|
log.groupEnd(LOG_LEVEL)();
|
|
199
166
|
}
|
|
200
|
-
|
|
201
167
|
destroy() {
|
|
202
168
|
const ext = this.gl.getExtension('STACKGL_destroy_context');
|
|
203
|
-
|
|
204
169
|
if (ext) {
|
|
205
170
|
ext.destroy();
|
|
206
171
|
}
|
|
207
172
|
}
|
|
208
|
-
|
|
209
173
|
get isLost() {
|
|
210
174
|
return this.gl.isContextLost();
|
|
211
175
|
}
|
|
212
|
-
|
|
213
176
|
getSize() {
|
|
214
177
|
return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];
|
|
215
178
|
}
|
|
216
|
-
|
|
217
179
|
isTextureFormatSupported(format) {
|
|
218
180
|
return isTextureFormatSupported(this.gl, format);
|
|
219
181
|
}
|
|
220
|
-
|
|
221
182
|
isTextureFormatFilterable(format) {
|
|
222
183
|
return isTextureFormatFilterable(this.gl, format);
|
|
223
184
|
}
|
|
224
|
-
|
|
225
185
|
isTextureFormatRenderable(format) {
|
|
226
186
|
return isTextureFormatRenderable(this.gl, format);
|
|
227
187
|
}
|
|
228
|
-
|
|
229
188
|
assertWebGL2() {
|
|
230
189
|
if (!this.gl2) {
|
|
231
190
|
throw new Error('Requires WebGL2');
|
|
232
191
|
}
|
|
233
|
-
|
|
234
192
|
return this.gl2;
|
|
235
193
|
}
|
|
236
|
-
|
|
237
194
|
createCanvasContext(props) {
|
|
238
195
|
throw new Error('WebGL only supports a single canvas');
|
|
239
196
|
}
|
|
240
|
-
|
|
241
197
|
_createBuffer(props) {
|
|
242
198
|
return new ClassicBuffer(this, props);
|
|
243
199
|
}
|
|
244
|
-
|
|
245
200
|
_createTexture(props) {
|
|
246
201
|
return new WEBGLTexture(this, props);
|
|
247
202
|
}
|
|
248
|
-
|
|
249
203
|
createExternalTexture(props) {
|
|
250
204
|
throw new Error('createExternalTexture() not implemented');
|
|
251
205
|
}
|
|
252
|
-
|
|
253
206
|
createSampler(props) {
|
|
254
207
|
return new WEBGLSampler(this, props);
|
|
255
208
|
}
|
|
256
|
-
|
|
257
209
|
createShader(props) {
|
|
258
210
|
return new WEBGLShader(this, props);
|
|
259
211
|
}
|
|
260
|
-
|
|
261
212
|
createFramebuffer(props) {
|
|
262
213
|
return new WEBGLFramebuffer(this, props);
|
|
263
214
|
}
|
|
264
|
-
|
|
265
215
|
createRenderPipeline(props) {
|
|
266
216
|
return new WEBGLRenderPipeline(this, props);
|
|
267
217
|
}
|
|
268
|
-
|
|
269
218
|
beginRenderPass(props) {
|
|
270
219
|
return new WEBGLRenderPass(this, props);
|
|
271
220
|
}
|
|
272
|
-
|
|
273
221
|
createComputePipeline(props) {
|
|
274
222
|
throw new Error('ComputePipeline not supported in WebGL');
|
|
275
223
|
}
|
|
276
|
-
|
|
277
224
|
beginComputePass(props) {
|
|
278
225
|
throw new Error('compute shaders not supported in WebGL');
|
|
279
226
|
}
|
|
280
|
-
|
|
281
227
|
getDefaultRenderPass() {
|
|
282
228
|
this.renderPass = this.renderPass || this.beginRenderPass({
|
|
283
229
|
framebuffer: this.canvasContext.getCurrentFramebuffer()
|
|
284
230
|
});
|
|
285
231
|
return this.renderPass;
|
|
286
232
|
}
|
|
287
|
-
|
|
288
233
|
submit() {
|
|
289
234
|
var _this$renderPass;
|
|
290
|
-
|
|
291
|
-
(_this$renderPass = this.renderPass) === null || _this$renderPass === void 0 ? void 0 : _this$renderPass.endPass();
|
|
235
|
+
(_this$renderPass = this.renderPass) === null || _this$renderPass === void 0 ? void 0 : _this$renderPass.end();
|
|
292
236
|
this.renderPass = null;
|
|
293
237
|
}
|
|
294
|
-
|
|
295
238
|
get webglLimits() {
|
|
296
239
|
this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);
|
|
297
240
|
return this._webglLimits;
|
|
298
241
|
}
|
|
299
|
-
|
|
300
242
|
loseDevice() {
|
|
301
243
|
var _this$_resolveContext2;
|
|
302
|
-
|
|
303
244
|
const ext = this.gl.getExtension('WEBGL_lose_context');
|
|
304
|
-
|
|
305
245
|
if (ext) {
|
|
306
246
|
ext.loseContext();
|
|
307
247
|
}
|
|
308
|
-
|
|
309
248
|
(_this$_resolveContext2 = this._resolveContextLost) === null || _this$_resolveContext2 === void 0 ? void 0 : _this$_resolveContext2.call(this, {
|
|
310
249
|
reason: 'destroyed',
|
|
311
250
|
message: 'Application triggered context loss'
|
|
312
251
|
});
|
|
313
252
|
}
|
|
314
|
-
|
|
315
253
|
pushState() {
|
|
316
254
|
pushContextState(this.gl);
|
|
317
255
|
}
|
|
318
|
-
|
|
319
256
|
popState() {
|
|
320
257
|
popContextState(this.gl);
|
|
321
258
|
}
|
|
322
|
-
|
|
323
259
|
}
|
|
324
|
-
|
|
325
260
|
_defineProperty(WebGLDevice, "type", 'webgl');
|
|
326
|
-
|
|
327
261
|
function isWebGL(gl) {
|
|
328
262
|
if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {
|
|
329
263
|
return true;
|
|
330
264
|
}
|
|
331
|
-
|
|
332
265
|
if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
|
|
333
266
|
return true;
|
|
334
267
|
}
|
|
335
|
-
|
|
336
268
|
return Boolean(gl && Number.isFinite(gl._version));
|
|
337
269
|
}
|
|
338
|
-
|
|
339
270
|
function isWebGL2(gl) {
|
|
340
271
|
if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
|
|
341
272
|
return true;
|
|
342
273
|
}
|
|
343
|
-
|
|
344
274
|
return Boolean(gl && gl._version === 2);
|
|
345
275
|
}
|
|
346
276
|
//# sourceMappingURL=webgl-device.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapter/webgl-device.ts"],"names":["Device","CanvasContext","log","uid","isBrowser","polyfillContext","popContextState","pushContextState","trackContextState","createBrowserContext","createHeadlessContext","isHeadlessGLRegistered","getDeviceInfo","getDeviceFeatures","getDeviceLimits","getWebGLLimits","WebGLCanvasContext","loadSpectorJS","initializeSpectorJS","loadWebGLDeveloperTools","makeDebugContext","isTextureFormatSupported","isTextureFormatRenderable","isTextureFormatFilterable","ClassicBuffer","WEBGLShader","WEBGLSampler","WEBGLTexture","WEBGLFramebuffer","WEBGLRenderPass","WEBGLRenderPipeline","LOG_LEVEL","WebGLDevice","isSupported","WebGLRenderingContext","features","_features","gl","limits","_limits","attach","device","isWebGL","Error","create","props","groupCollapsed","canvas","pageLoaded","debug","spector","probe","constructor","id","clientWidth","clientHeight","devicePixelRatio","canvasContext","lost","Promise","resolve","_resolveContextLost","onContextLost","event","reason","message","handle","gl2","isWebGL2","isWebGL1","info","_version","enable","copyState","args","webgl2","throwOnError","level","Math","max","warn","type","vendor","renderer","groupEnd","destroy","ext","getExtension","isLost","isContextLost","getSize","drawingBufferWidth","drawingBufferHeight","format","assertWebGL2","createCanvasContext","_createBuffer","_createTexture","createExternalTexture","createSampler","createShader","createFramebuffer","createRenderPipeline","beginRenderPass","createComputePipeline","beginComputePass","getDefaultRenderPass","renderPass","framebuffer","getCurrentFramebuffer","submit","endPass","webglLimits","_webglLimits","loseDevice","loseContext","pushState","popState","WebGL2RenderingContext","Boolean","Number","isFinite"],"mappings":";AASA,SAAQA,MAAR,EAAgBC,aAAhB,EAA+BC,GAA/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,CAAC,KAAK+B,EAAN,CAAf;AACD;;AAnV6C;;gBAA3BL,W,UAKG,O;;AAkVxB,SAASU,OAAT,CAAiBL,EAAjB,EAAmC;AACjC,MAAI,OAAOH,qBAAP,KAAiC,WAAjC,IAAgDG,EAAE,YAAYH,qBAAlE,EAAyF;AACvF,WAAO,IAAP;AACD;;AACD,MAAI,OAAOoF,sBAAP,KAAkC,WAAlC,IAAiDjF,EAAE,YAAYiF,sBAAnE,EAA2F;AACzF,WAAO,IAAP;AACD;;AAED,SAAOC,OAAO,CAAClF,EAAE,IAAImF,MAAM,CAACC,QAAP,CAAgBpF,EAAE,CAACkC,QAAnB,CAAP,CAAd;AACD;;AAGD,SAASH,QAAT,CAAkB/B,EAAlB,EAAoC;AAClC,MAAI,OAAOiF,sBAAP,KAAkC,WAAlC,IAAiDjF,EAAE,YAAYiF,sBAAnE,EAA2F;AACzF,WAAO,IAAP;AACD;;AAED,SAAOC,OAAO,CAAClF,EAAE,IAAIA,EAAE,CAACkC,QAAH,KAAgB,CAAvB,CAAd;AACD","sourcesContent":["// luma.gl, MIT license\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n TextureFormat\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/api';\nimport {isBrowser} from '@probe.gl/env';\nimport {polyfillContext} from '../context/polyfill/polyfill-context';\nimport {popContextState, pushContextState, trackContextState} from '../context/state-tracker/track-context-state';\nimport {createBrowserContext} from '../context/context/create-browser-context';\nimport {\n createHeadlessContext,\n isHeadlessGLRegistered\n} from '../context/context/create-headless-context';\nimport {getDeviceInfo} from './device-helpers/get-device-info';\nimport {getDeviceFeatures} from './device-helpers/device-features';\nimport {getDeviceLimits, getWebGLLimits, WebGLLimits} from './device-helpers/device-limits';\nimport WebGLCanvasContext from './webgl-canvas-context';\nimport {loadSpectorJS, initializeSpectorJS} from '../context/debug/spector';\nimport {loadWebGLDeveloperTools, makeDebugContext} from '../context/debug/webgl-developer-tools';\nimport {\n isTextureFormatSupported,\n isTextureFormatRenderable,\n isTextureFormatFilterable\n} from './converters/texture-formats';\n\n// WebGL classes\nimport type {\n BufferProps,\n ShaderProps,\n // Sampler,\n SamplerProps,\n TextureProps,\n ExternalTexture,\n ExternalTextureProps,\n FramebufferProps,\n // RenderPipeline,\n RenderPipelineProps,\n ComputePipeline,\n ComputePipelineProps,\n // RenderPass,\n RenderPassProps,\n ComputePass,\n ComputePassProps\n} from '@luma.gl/api';\n\nimport ClassicBuffer from '../classic/buffer';\nimport WEBGLBuffer from './resources/webgl-buffer';\nimport WEBGLShader from './resources/webgl-shader';\nimport WEBGLSampler from './resources/webgl-sampler';\nimport WEBGLTexture from './resources/webgl-texture';\nimport WEBGLFramebuffer from './resources/webgl-framebuffer';\nimport WEBGLRenderPass from './resources/webgl-render-pass';\nimport WEBGLRenderPipeline from './resources/webgl-render-pipeline';\n\nconst LOG_LEVEL = 1;\n\n/** WebGPU style Device API for a WebGL context */\nexport default class WebGLDevice extends Device {\n //\n // Public `Device` API\n //\n\n static type: string = 'webgl';\n\n static isSupported(): boolean {\n return typeof WebGLRenderingContext !== 'undefined' || isHeadlessGLRegistered();\n }\n\n readonly info: DeviceInfo;\n readonly canvasContext: WebGLCanvasContext;\n\n readonly handle: WebGLRenderingContext;\n\n get features(): Set<DeviceFeature> {\n this._features = this._features || getDeviceFeatures(this.gl);\n return this._features;\n }\n\n get limits(): DeviceLimits {\n this._limits = this._limits || getDeviceLimits(this.gl);\n return this._limits;\n }\n\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n private _resolveContextLost?: (value: {reason: 'destroyed'; message: string}) => void;\n private _features?: Set<DeviceFeature>;\n private _limits?: DeviceLimits;\n\n //\n // Static methods, expected to be present by `luma.createDevice()`\n //\n\n /**\n * Get a device instance from a GL context\n * Creates and instruments the device if not already created\n * @param gl\n * @returns\n */\n static attach(gl: Device | WebGLRenderingContext | WebGL2RenderingContext): WebGLDevice {\n if (gl instanceof WebGLDevice) {\n return gl;\n }\n // @ts-expect-error\n if (gl?.device instanceof Device) {\n // @ts-expect-error\n return gl.device as WebGLDevice;\n }\n if (!isWebGL(gl)) {\n throw new Error('Invalid WebGLRenderingContext');\n }\n return new WebGLDevice({gl: gl as WebGLRenderingContext});\n }\n\n static async create(props: DeviceProps = {}): Promise<WebGLDevice> {\n log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created');\n\n // Wait for page to load. Only wait when props. canvas is string\n // to avoid setting page onload callback unless necessary\n if (typeof props.canvas === 'string') {\n await CanvasContext.pageLoaded;\n }\n\n // Load webgl and spector debug scripts from CDN if requested\n if (props.debug) {\n await loadWebGLDeveloperTools();\n }\n // @ts-expect-error spector not on props\n if (props.spector) {\n await loadSpectorJS();\n }\n\n log.probe(LOG_LEVEL + 1, 'DOM is loaded')();\n\n // @ts-expect-error\n if (props.gl && props.gl.device) {\n return WebGLDevice.attach(props.gl);\n }\n\n return new WebGLDevice(props);\n }\n\n //\n // Public API\n //\n\n constructor(props: DeviceProps) {\n super({...props, id: props.id || uid('webgl-device')});\n\n // If attaching to an already attached context, return the attached device\n // @ts-expect-error device is attached to context\n const device: WebGLDevice | undefined = props.gl?.device;\n if (device) {\n throw new Error(`WebGL context already attached to device ${device.id}`);\n }\n\n // Create and instrument context\n this.canvasContext = new WebGLCanvasContext(this, props);\n\n this.lost = new Promise<{reason: 'destroyed'; message: string}>((resolve) => {\n this._resolveContextLost = resolve;\n });\n\n const onContextLost = (event: Event) =>\n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Computer entered sleep mode, or too many apps or browser tabs are using the GPU.'\n });\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext | null = props.gl || null;\n gl =\n gl ||\n (isBrowser() ? createBrowserContext(this.canvasContext.canvas, {...props, onContextLost}) : null);\n gl = gl || (!isBrowser() ? createHeadlessContext({...props, onContextLost}) : null);\n\n if (!gl) {\n throw new Error('WebGL context creation failed');\n }\n\n this.handle = gl;\n this.gl = this.handle;\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.isWebGL2 = isWebGL2(this.gl);\n this.isWebGL1 = !this.isWebGL2;\n\n // luma Device fields\n this.info = getDeviceInfo(this.gl);\n\n // @ts-expect-error Link webgl context back to device\n this.gl.device = this;\n // @ts-expect-error Annotate webgl context to handle\n this.gl._version = this.isWebGL2 ? 2 : 1;\n\n // Add subset of WebGL2 methods to WebGL1 context\n polyfillContext(this.gl);\n\n // Install context state tracking\n // @ts-expect-error - hidden parameters\n const {enable = true, copyState = false} = props;\n trackContextState(this.gl, {\n enable,\n copyState,\n log: (...args: any[]) => log.log(1, ...args)()\n });\n\n // DEBUG contexts: Add debug instrumentation to the context, force log level to at least 1\n if (isBrowser() && props.debug) {\n this.gl = makeDebugContext(this.gl, {...props, webgl2: this.isWebGL2, throwOnError: true});\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.debug = true;\n log.level = Math.max(log.level, 1);\n log.warn('WebGL debug mode activated. Performance reduced.')();\n }\n\n // @ts-expect-error spector not on props\n if (isBrowser() && props.spector) {\n const canvas = this.handle.canvas || (props.canvas as HTMLCanvasElement);\n this.spector = initializeSpectorJS({...this.props, canvas});\n }\n\n // Log some debug info about the newly created context\n const message = `\\\nCreated ${this.info.type}${this.debug ? ' debug' : ''} context: \\\n${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;\n log.probe(LOG_LEVEL, message)();\n\n log.groupEnd(LOG_LEVEL)();\n }\n\n /**\n * Destroys the context\n * @note Has no effect for browser contexts, there is no browser API for destroying contexts\n */\n destroy(): void {\n const ext = this.gl.getExtension('STACKGL_destroy_context');\n if (ext) {\n ext.destroy();\n }\n }\n\n get isLost(): boolean {\n return this.gl.isContextLost();\n }\n\n getSize(): [number, number] {\n return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];\n }\n\n isTextureFormatSupported(format: TextureFormat): boolean {\n return isTextureFormatSupported(this.gl, format);\n }\n\n isTextureFormatFilterable(format: TextureFormat): boolean {\n return isTextureFormatFilterable(this.gl, format);\n }\n\n isTextureFormatRenderable(format: TextureFormat): boolean {\n return isTextureFormatRenderable(this.gl, format);\n }\n\n // WEBGL SPECIFIC METHODS\n\n /** Returns a WebGL2RenderingContext or throws an error */\n assertWebGL2(): WebGL2RenderingContext {\n if (!this.gl2) {\n throw new Error('Requires WebGL2');\n }\n return this.gl2;\n }\n\n // IMPLEMENTATION OF ABSTRACT DEVICE\n\n createCanvasContext(props?: CanvasContextProps): CanvasContext {\n throw new Error('WebGL only supports a single canvas');\n }\n\n _createBuffer(props: BufferProps): WEBGLBuffer {\n return new ClassicBuffer(this, props);\n }\n\n _createTexture(props: TextureProps): WEBGLTexture {\n return new WEBGLTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): ExternalTexture {\n throw new Error('createExternalTexture() not implemented'); // return new Program(props);\n }\n\n createSampler(props: SamplerProps): WEBGLSampler {\n return new WEBGLSampler(this, props);\n }\n\n createShader(props: ShaderProps): WEBGLShader {\n return new WEBGLShader(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WEBGLFramebuffer {\n return new WEBGLFramebuffer(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline {\n return new WEBGLRenderPipeline(this, props);\n }\n\n beginRenderPass(props: RenderPassProps): WEBGLRenderPass {\n return new WEBGLRenderPass(this, props);\n }\n\n createComputePipeline(props?: ComputePipelineProps): ComputePipeline {\n throw new Error('ComputePipeline not supported in WebGL');\n }\n\n beginComputePass(props: ComputePassProps): ComputePass {\n throw new Error('compute shaders not supported in WebGL');\n }\n\n private renderPass: WEBGLRenderPass | null = null;\n\n getDefaultRenderPass(): WEBGLRenderPass {\n this.renderPass =\n this.renderPass ||\n this.beginRenderPass({\n framebuffer: this.canvasContext.getCurrentFramebuffer()\n });\n return this.renderPass;\n }\n\n /**\n * Offscreen Canvas Support: Commit the frame\n * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit\n * Chrome's offscreen canvas does not require gl.commit\n */\n submit(): void {\n this.renderPass?.endPass();\n this.renderPass = null;\n // this.canvasContext.commit();\n }\n\n //\n // WebGL-only API (not part of `Device` API)\n //\n\n /** WebGL1 typed context. Can always be used. */\n readonly gl: WebGLRenderingContext;\n /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */\n readonly gl2: WebGL2RenderingContext | null = null;\n readonly debug: boolean = false;\n\n /** `true` if this is a WebGL1 context. @note `false` if WebGL2 */\n readonly isWebGL1: boolean;\n /** `true` if this is a WebGL2 context. @note `false` if WebGL1 */\n readonly isWebGL2: boolean;\n\n /** State used by luma.gl classes: TODO - move to canvasContext*/\n readonly _canvasSizeInfo = {clientWidth: 0, clientHeight: 0, devicePixelRatio: 1};\n\n /** State used by luma.gl classes - TODO - not used? */\n readonly _extensions: Record<string, any> = {};\n _polyfilled: boolean = false;\n\n /** Instance of Spector.js (if initialized) */\n spector;\n\n private _webglLimits?: WebGLLimits;\n\n /** Return WebGL specific limits */\n get webglLimits() : WebGLLimits {\n this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);\n return this._webglLimits;\n }\n\n /**\n * Loses the context\n * @note Triggers context loss, mainly for testing\n * @todo Promote to `Device` API?\n */\n loseDevice(): void {\n const ext = this.gl.getExtension('WEBGL_lose_context');\n if (ext) {\n ext.loseContext();\n }\n // loseContext should trigger context loss callback but \n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Application triggered context loss'\n });\n }\n\n /** Save current WebGL context state onto an internal stack */\n pushState(): void {\n pushContextState(this.gl);\n }\n\n /** Restores previously saved context state */\n popState(): void {\n popContextState(this.gl);\n }\n}\n\n/** Check if supplied parameter is a WebGLRenderingContext */\nfunction isWebGL(gl: any): boolean {\n if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {\n return true;\n }\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && Number.isFinite(gl._version));\n}\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nfunction isWebGL2(gl: any): boolean {\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && gl._version === 2);\n}\n"],"file":"webgl-device.js"}
|
|
1
|
+
{"version":3,"file":"webgl-device.js","names":["Device","CanvasContext","log","uid","isBrowser","polyfillContext","popContextState","pushContextState","trackContextState","createBrowserContext","createHeadlessContext","isHeadlessGLRegistered","getDeviceInfo","getDeviceFeatures","getDeviceLimits","getWebGLLimits","WebGLCanvasContext","loadSpectorJS","initializeSpectorJS","loadWebGLDeveloperTools","makeDebugContext","isTextureFormatSupported","isTextureFormatRenderable","isTextureFormatFilterable","ClassicBuffer","WEBGLShader","WEBGLSampler","WEBGLTexture","WEBGLFramebuffer","WEBGLRenderPass","WEBGLRenderPipeline","LOG_LEVEL","WebGLDevice","isSupported","WebGLRenderingContext","features","_features","gl","limits","_limits","attach","device","isWebGL","Error","create","props","arguments","length","undefined","groupCollapsed","canvas","pageLoaded","debug","spector","probe","constructor","_props$gl","id","_defineProperty","clientWidth","clientHeight","devicePixelRatio","concat","canvasContext","lost","Promise","resolve","_resolveContextLost","onContextLost","event","_this$_resolveContext","call","reason","message","handle","gl2","isWebGL2","isWebGL1","info","_version","enable","copyState","_len","args","Array","_key","webgl2","throwOnError","level","Math","max","warn","type","vendor","renderer","groupEnd","destroy","ext","getExtension","isLost","isContextLost","getSize","drawingBufferWidth","drawingBufferHeight","format","assertWebGL2","createCanvasContext","_createBuffer","_createTexture","createExternalTexture","createSampler","createShader","createFramebuffer","createRenderPipeline","beginRenderPass","createComputePipeline","beginComputePass","getDefaultRenderPass","renderPass","framebuffer","getCurrentFramebuffer","submit","_this$renderPass","end","webglLimits","_webglLimits","loseDevice","_this$_resolveContext2","loseContext","pushState","popState","WebGL2RenderingContext","Boolean","Number","isFinite"],"sources":["../../../src/adapter/webgl-device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n TextureFormat\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/api';\nimport {isBrowser} from '@probe.gl/env';\nimport {polyfillContext} from '../context/polyfill/polyfill-context';\nimport {popContextState, pushContextState, trackContextState} from '../context/state-tracker/track-context-state';\nimport {createBrowserContext} from '../context/context/create-browser-context';\nimport {\n createHeadlessContext,\n isHeadlessGLRegistered\n} from '../context/context/create-headless-context';\nimport {getDeviceInfo} from './device-helpers/get-device-info';\nimport {getDeviceFeatures} from './device-helpers/device-features';\nimport {getDeviceLimits, getWebGLLimits, WebGLLimits} from './device-helpers/device-limits';\nimport WebGLCanvasContext from './webgl-canvas-context';\nimport {loadSpectorJS, initializeSpectorJS} from '../context/debug/spector';\nimport {loadWebGLDeveloperTools, makeDebugContext} from '../context/debug/webgl-developer-tools';\nimport {\n isTextureFormatSupported,\n isTextureFormatRenderable,\n isTextureFormatFilterable\n} from './converters/texture-formats';\n\n// WebGL classes\nimport type {\n BufferProps,\n ShaderProps,\n // Sampler,\n SamplerProps,\n TextureProps,\n ExternalTexture,\n ExternalTextureProps,\n FramebufferProps,\n // RenderPipeline,\n RenderPipelineProps,\n ComputePipeline,\n ComputePipelineProps,\n // RenderPass,\n RenderPassProps,\n ComputePass,\n ComputePassProps\n} from '@luma.gl/api';\n\nimport ClassicBuffer from '../classic/buffer';\nimport WEBGLBuffer from './resources/webgl-buffer';\nimport WEBGLShader from './resources/webgl-shader';\nimport WEBGLSampler from './resources/webgl-sampler';\nimport WEBGLTexture from './resources/webgl-texture';\nimport WEBGLFramebuffer from './resources/webgl-framebuffer';\nimport WEBGLRenderPass from './resources/webgl-render-pass';\nimport WEBGLRenderPipeline from './resources/webgl-render-pipeline';\n\nconst LOG_LEVEL = 1;\n\n/** WebGPU style Device API for a WebGL context */\nexport default class WebGLDevice extends Device {\n //\n // Public `Device` API\n //\n\n static type: string = 'webgl';\n\n static isSupported(): boolean {\n return typeof WebGLRenderingContext !== 'undefined' || isHeadlessGLRegistered();\n }\n\n readonly info: DeviceInfo;\n readonly canvasContext: WebGLCanvasContext;\n\n readonly handle: WebGLRenderingContext;\n\n get features(): Set<DeviceFeature> {\n this._features = this._features || getDeviceFeatures(this.gl);\n return this._features;\n }\n\n get limits(): DeviceLimits {\n this._limits = this._limits || getDeviceLimits(this.gl);\n return this._limits;\n }\n\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n private _resolveContextLost?: (value: {reason: 'destroyed'; message: string}) => void;\n private _features?: Set<DeviceFeature>;\n private _limits?: DeviceLimits;\n\n //\n // Static methods, expected to be present by `luma.createDevice()`\n //\n\n /**\n * Get a device instance from a GL context\n * Creates and instruments the device if not already created\n * @param gl\n * @returns\n */\n static attach(gl: Device | WebGLRenderingContext | WebGL2RenderingContext): WebGLDevice {\n if (gl instanceof WebGLDevice) {\n return gl;\n }\n // @ts-expect-error\n if (gl?.device instanceof Device) {\n // @ts-expect-error\n return gl.device as WebGLDevice;\n }\n if (!isWebGL(gl)) {\n throw new Error('Invalid WebGLRenderingContext');\n }\n return new WebGLDevice({gl: gl as WebGLRenderingContext});\n }\n\n static async create(props: DeviceProps = {}): Promise<WebGLDevice> {\n log.groupCollapsed(LOG_LEVEL, 'WebGLDevice created');\n\n // Wait for page to load. Only wait when props. canvas is string\n // to avoid setting page onload callback unless necessary\n if (typeof props.canvas === 'string') {\n await CanvasContext.pageLoaded;\n }\n\n // Load webgl and spector debug scripts from CDN if requested\n if (props.debug) {\n await loadWebGLDeveloperTools();\n }\n // @ts-expect-error spector not on props\n if (props.spector) {\n await loadSpectorJS();\n }\n\n log.probe(LOG_LEVEL + 1, 'DOM is loaded')();\n\n // @ts-expect-error\n if (props.gl && props.gl.device) {\n return WebGLDevice.attach(props.gl);\n }\n\n return new WebGLDevice(props);\n }\n\n //\n // Public API\n //\n\n constructor(props: DeviceProps) {\n super({...props, id: props.id || uid('webgl-device')});\n\n // If attaching to an already attached context, return the attached device\n // @ts-expect-error device is attached to context\n const device: WebGLDevice | undefined = props.gl?.device;\n if (device) {\n throw new Error(`WebGL context already attached to device ${device.id}`);\n }\n\n // Create and instrument context\n this.canvasContext = new WebGLCanvasContext(this, props);\n\n this.lost = new Promise<{reason: 'destroyed'; message: string}>((resolve) => {\n this._resolveContextLost = resolve;\n });\n\n const onContextLost = (event: Event) =>\n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Computer entered sleep mode, or too many apps or browser tabs are using the GPU.'\n });\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext | null = props.gl || null;\n gl =\n gl ||\n (isBrowser() ? createBrowserContext(this.canvasContext.canvas, {...props, onContextLost}) : null);\n gl = gl || (!isBrowser() ? createHeadlessContext({...props, onContextLost}) : null);\n\n if (!gl) {\n throw new Error('WebGL context creation failed');\n }\n\n this.handle = gl;\n this.gl = this.handle;\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.isWebGL2 = isWebGL2(this.gl);\n this.isWebGL1 = !this.isWebGL2;\n\n // luma Device fields\n this.info = getDeviceInfo(this.gl);\n\n // @ts-expect-error Link webgl context back to device\n this.gl.device = this;\n // @ts-expect-error Annotate webgl context to handle\n this.gl._version = this.isWebGL2 ? 2 : 1;\n\n // Add subset of WebGL2 methods to WebGL1 context\n polyfillContext(this.gl);\n\n // Install context state tracking\n // @ts-expect-error - hidden parameters\n const {enable = true, copyState = false} = props;\n trackContextState(this.gl, {\n enable,\n copyState,\n log: (...args: any[]) => log.log(1, ...args)()\n });\n\n // DEBUG contexts: Add debug instrumentation to the context, force log level to at least 1\n if (isBrowser() && props.debug) {\n this.gl = makeDebugContext(this.gl, {...props, webgl2: this.isWebGL2, throwOnError: true});\n this.gl2 = this.gl as WebGL2RenderingContext;\n this.debug = true;\n log.level = Math.max(log.level, 1);\n log.warn('WebGL debug mode activated. Performance reduced.')();\n }\n\n // @ts-expect-error spector not on props\n if (isBrowser() && props.spector) {\n const canvas = this.handle.canvas || (props.canvas as HTMLCanvasElement);\n this.spector = initializeSpectorJS({...this.props, canvas});\n }\n\n // Log some debug info about the newly created context\n const message = `\\\nCreated ${this.info.type}${this.debug ? ' debug' : ''} context: \\\n${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;\n log.probe(LOG_LEVEL, message)();\n\n log.groupEnd(LOG_LEVEL)();\n }\n\n /**\n * Destroys the context\n * @note Has no effect for browser contexts, there is no browser API for destroying contexts\n */\n destroy(): void {\n const ext = this.gl.getExtension('STACKGL_destroy_context');\n if (ext) {\n ext.destroy();\n }\n }\n\n get isLost(): boolean {\n return this.gl.isContextLost();\n }\n\n getSize(): [number, number] {\n return [this.gl.drawingBufferWidth, this.gl.drawingBufferHeight];\n }\n\n isTextureFormatSupported(format: TextureFormat): boolean {\n return isTextureFormatSupported(this.gl, format);\n }\n\n isTextureFormatFilterable(format: TextureFormat): boolean {\n return isTextureFormatFilterable(this.gl, format);\n }\n\n isTextureFormatRenderable(format: TextureFormat): boolean {\n return isTextureFormatRenderable(this.gl, format);\n }\n\n // WEBGL SPECIFIC METHODS\n\n /** Returns a WebGL2RenderingContext or throws an error */\n assertWebGL2(): WebGL2RenderingContext {\n if (!this.gl2) {\n throw new Error('Requires WebGL2');\n }\n return this.gl2;\n }\n\n // IMPLEMENTATION OF ABSTRACT DEVICE\n\n createCanvasContext(props?: CanvasContextProps): CanvasContext {\n throw new Error('WebGL only supports a single canvas');\n }\n\n _createBuffer(props: BufferProps): WEBGLBuffer {\n return new ClassicBuffer(this, props);\n }\n\n _createTexture(props: TextureProps): WEBGLTexture {\n return new WEBGLTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): ExternalTexture {\n throw new Error('createExternalTexture() not implemented'); // return new Program(props);\n }\n\n createSampler(props: SamplerProps): WEBGLSampler {\n return new WEBGLSampler(this, props);\n }\n\n createShader(props: ShaderProps): WEBGLShader {\n return new WEBGLShader(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WEBGLFramebuffer {\n return new WEBGLFramebuffer(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline {\n return new WEBGLRenderPipeline(this, props);\n }\n\n beginRenderPass(props: RenderPassProps): WEBGLRenderPass {\n return new WEBGLRenderPass(this, props);\n }\n\n createComputePipeline(props?: ComputePipelineProps): ComputePipeline {\n throw new Error('ComputePipeline not supported in WebGL');\n }\n\n beginComputePass(props: ComputePassProps): ComputePass {\n throw new Error('compute shaders not supported in WebGL');\n }\n\n private renderPass: WEBGLRenderPass | null = null;\n\n getDefaultRenderPass(): WEBGLRenderPass {\n this.renderPass =\n this.renderPass ||\n this.beginRenderPass({\n framebuffer: this.canvasContext.getCurrentFramebuffer()\n });\n return this.renderPass;\n }\n\n /**\n * Offscreen Canvas Support: Commit the frame\n * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit\n * Chrome's offscreen canvas does not require gl.commit\n */\n submit(): void {\n this.renderPass?.end();\n this.renderPass = null;\n // this.canvasContext.commit();\n }\n\n //\n // WebGL-only API (not part of `Device` API)\n //\n\n /** WebGL1 typed context. Can always be used. */\n readonly gl: WebGLRenderingContext;\n /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */\n readonly gl2: WebGL2RenderingContext | null = null;\n readonly debug: boolean = false;\n\n /** `true` if this is a WebGL1 context. @note `false` if WebGL2 */\n readonly isWebGL1: boolean;\n /** `true` if this is a WebGL2 context. @note `false` if WebGL1 */\n readonly isWebGL2: boolean;\n\n /** State used by luma.gl classes: TODO - move to canvasContext*/\n readonly _canvasSizeInfo = {clientWidth: 0, clientHeight: 0, devicePixelRatio: 1};\n\n /** State used by luma.gl classes - TODO - not used? */\n readonly _extensions: Record<string, any> = {};\n _polyfilled: boolean = false;\n\n /** Instance of Spector.js (if initialized) */\n spector;\n\n private _webglLimits?: WebGLLimits;\n\n /** Return WebGL specific limits */\n get webglLimits() : WebGLLimits {\n this._webglLimits = this._webglLimits || getWebGLLimits(this.gl);\n return this._webglLimits;\n }\n\n /**\n * Loses the context\n * @note Triggers context loss, mainly for testing\n * @todo Promote to `Device` API?\n */\n loseDevice(): void {\n const ext = this.gl.getExtension('WEBGL_lose_context');\n if (ext) {\n ext.loseContext();\n }\n // loseContext should trigger context loss callback but \n this._resolveContextLost?.({\n reason: 'destroyed',\n message: 'Application triggered context loss'\n });\n }\n\n /** Save current WebGL context state onto an internal stack */\n pushState(): void {\n pushContextState(this.gl);\n }\n\n /** Restores previously saved context state */\n popState(): void {\n popContextState(this.gl);\n }\n}\n\n/** Check if supplied parameter is a WebGLRenderingContext */\nfunction isWebGL(gl: any): boolean {\n if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {\n return true;\n }\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && Number.isFinite(gl._version));\n}\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nfunction isWebGL2(gl: any): boolean {\n if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n return true;\n }\n // Look for debug contexts, headless gl etc\n return Boolean(gl && gl._version === 2);\n}\n"],"mappings":";AASA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,QAAO,cAAc;AAC5D,SAAQC,SAAS,QAAO,eAAe;AACvC,SAAQC,eAAe,QAAO,sCAAsC;AACpE,SAAQC,eAAe,EAAEC,gBAAgB,EAAEC,iBAAiB,QAAO,8CAA8C;AACjH,SAAQC,oBAAoB,QAAO,2CAA2C;AAC9E,SACEC,qBAAqB,EACrBC,sBAAsB,QACjB,4CAA4C;AACnD,SAAQC,aAAa,QAAO,kCAAkC;AAC9D,SAAQC,iBAAiB,QAAO,kCAAkC;AAClE,SAAQC,eAAe,EAAEC,cAAc,QAAoB,gCAAgC;AAC3F,OAAOC,kBAAkB,MAAM,wBAAw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;MACPA,GAAG,CAAC+B,WAAW,EAAE;IACnB;IAEA,CAAAD,sBAAA,OAAI,CAAC5D,mBAAmB,cAAA4D,sBAAA,uBAAxBA,sBAAA,CAAAxD,IAAA,KAAI,EAAuB;MACzBC,MAAM,EAAE,WAAW;MACnBC,OAAO,EAAE;IACX,CAAC,CAAC;EACJ;EAGAwD,SAASA,CAAA,EAAS;IAChB1H,gBAAgB,CAAC,IAAI,CAAC8B,EAAE,CAAC;EAC3B;EAGA6F,QAAQA,CAAA,EAAS;IACf5H,eAAe,CAAC,IAAI,CAAC+B,EAAE,CAAC;EAC1B;AACF;AAACqB,eAAA,CApVoB1B,WAAW,UAKR,OAAO;AAkV/B,SAASU,OAAOA,CAACL,EAAO,EAAW;EACjC,IAAI,OAAOH,qBAAqB,KAAK,WAAW,IAAIG,EAAE,YAAYH,qBAAqB,EAAE;IACvF,OAAO,IAAI;EACb;EACA,IAAI,OAAOiG,sBAAsB,KAAK,WAAW,IAAI9F,EAAE,YAAY8F,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAAC/F,EAAE,IAAIgG,MAAM,CAACC,QAAQ,CAACjG,EAAE,CAAC0C,QAAQ,CAAC,CAAC;AACpD;AAGA,SAASH,QAAQA,CAACvC,EAAO,EAAW;EAClC,IAAI,OAAO8F,sBAAsB,KAAK,WAAW,IAAI9F,EAAE,YAAY8F,sBAAsB,EAAE;IACzF,OAAO,IAAI;EACb;EAEA,OAAOC,OAAO,CAAC/F,EAAE,IAAIA,EAAE,CAAC0C,QAAQ,KAAK,CAAC,CAAC;AACzC"}
|
package/dist/esm/bundle.js
CHANGED
package/dist/esm/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","luma","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.luma = globalThis.luma || {};\nmodule.exports = Object.assign(globalThis.luma, moduleExports);\n"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,IAAI,GAAGD,UAAU,CAACC,IAAI,IAAI,CAAC,CAAC;AACvCC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,IAAI,EAAEH,aAAa,CAAC"}
|
|
@@ -22,95 +22,75 @@ export default class Accessor {
|
|
|
22
22
|
const ArrayType = getTypedArrayFromGLType(accessor.type || GL.FLOAT);
|
|
23
23
|
return ArrayType.BYTES_PER_ELEMENT;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
static getBytesPerVertex(accessor) {
|
|
27
26
|
assert(accessor.size);
|
|
28
27
|
const ArrayType = getTypedArrayFromGLType(accessor.type || GL.FLOAT);
|
|
29
28
|
return ArrayType.BYTES_PER_ELEMENT * accessor.size;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
static resolve() {
|
|
31
|
+
for (var _len = arguments.length, accessors = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
|
+
accessors[_key] = arguments[_key];
|
|
33
|
+
}
|
|
33
34
|
return new Accessor(...[DEFAULT_ACCESSOR_VALUES, ...accessors]);
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
constructor(...accessors) {
|
|
36
|
+
constructor() {
|
|
37
37
|
_defineProperty(this, "offset", void 0);
|
|
38
|
-
|
|
39
38
|
_defineProperty(this, "stride", void 0);
|
|
40
|
-
|
|
41
39
|
_defineProperty(this, "type", void 0);
|
|
42
|
-
|
|
43
40
|
_defineProperty(this, "size", void 0);
|
|
44
|
-
|
|
45
41
|
_defineProperty(this, "divisor", void 0);
|
|
46
|
-
|
|
47
42
|
_defineProperty(this, "normalized", void 0);
|
|
48
|
-
|
|
49
43
|
_defineProperty(this, "integer", void 0);
|
|
50
|
-
|
|
51
44
|
_defineProperty(this, "buffer", void 0);
|
|
52
|
-
|
|
53
45
|
_defineProperty(this, "index", void 0);
|
|
54
|
-
|
|
46
|
+
for (var _len2 = arguments.length, accessors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
47
|
+
accessors[_key2] = arguments[_key2];
|
|
48
|
+
}
|
|
55
49
|
accessors.forEach(accessor => this._assign(accessor));
|
|
56
50
|
Object.freeze(this);
|
|
57
51
|
}
|
|
58
|
-
|
|
59
52
|
toString() {
|
|
60
53
|
return JSON.stringify(this);
|
|
61
54
|
}
|
|
62
|
-
|
|
63
55
|
get BYTES_PER_ELEMENT() {
|
|
64
56
|
return Accessor.getBytesPerElement(this);
|
|
65
57
|
}
|
|
66
|
-
|
|
67
58
|
get BYTES_PER_VERTEX() {
|
|
68
59
|
return Accessor.getBytesPerVertex(this);
|
|
69
60
|
}
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
_assign() {
|
|
62
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
72
63
|
props = checkProps('Accessor', props, PROP_CHECKS);
|
|
73
|
-
|
|
74
64
|
if (props.type !== undefined) {
|
|
75
65
|
this.type = props.type;
|
|
76
|
-
|
|
77
66
|
if (props.type === GL.INT || props.type === GL.UNSIGNED_INT) {
|
|
78
67
|
this.integer = true;
|
|
79
68
|
}
|
|
80
69
|
}
|
|
81
|
-
|
|
82
70
|
if (props.size !== undefined) {
|
|
83
71
|
this.size = props.size;
|
|
84
72
|
}
|
|
85
|
-
|
|
86
73
|
if (props.offset !== undefined) {
|
|
87
74
|
this.offset = props.offset;
|
|
88
75
|
}
|
|
89
|
-
|
|
90
76
|
if (props.stride !== undefined) {
|
|
91
77
|
this.stride = props.stride;
|
|
92
78
|
}
|
|
93
|
-
|
|
94
79
|
if (props.normalize !== undefined) {
|
|
95
80
|
this.normalized = props.normalize;
|
|
96
81
|
}
|
|
97
|
-
|
|
98
82
|
if (props.normalized !== undefined) {
|
|
99
83
|
this.normalized = props.normalized;
|
|
100
84
|
}
|
|
101
|
-
|
|
102
85
|
if (props.integer !== undefined) {
|
|
103
86
|
this.integer = props.integer;
|
|
104
87
|
}
|
|
105
|
-
|
|
106
88
|
if (props.divisor !== undefined) {
|
|
107
89
|
this.divisor = props.divisor;
|
|
108
90
|
}
|
|
109
|
-
|
|
110
91
|
if (props.buffer !== undefined) {
|
|
111
92
|
this.buffer = props.buffer;
|
|
112
93
|
}
|
|
113
|
-
|
|
114
94
|
if (props.index !== undefined) {
|
|
115
95
|
if (typeof props.index === 'boolean') {
|
|
116
96
|
this.index = props.index ? 1 : 0;
|
|
@@ -118,15 +98,12 @@ export default class Accessor {
|
|
|
118
98
|
this.index = props.index;
|
|
119
99
|
}
|
|
120
100
|
}
|
|
121
|
-
|
|
122
101
|
if (props.instanced !== undefined) {
|
|
123
102
|
this.divisor = props.instanced ? 1 : 0;
|
|
124
103
|
}
|
|
125
|
-
|
|
126
104
|
if (props.isInstanced !== undefined) {
|
|
127
105
|
this.divisor = props.isInstanced ? 1 : 0;
|
|
128
106
|
}
|
|
129
|
-
|
|
130
107
|
if (this.offset === undefined) delete this.offset;
|
|
131
108
|
if (this.stride === undefined) delete this.stride;
|
|
132
109
|
if (this.type === undefined) delete this.type;
|
|
@@ -138,7 +115,6 @@ export default class Accessor {
|
|
|
138
115
|
if (this.index === undefined) delete this.index;
|
|
139
116
|
return this;
|
|
140
117
|
}
|
|
141
|
-
|
|
142
118
|
}
|
|
143
119
|
export { DEFAULT_ACCESSOR_VALUES };
|
|
144
120
|
//# sourceMappingURL=accessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"accessor.js","names":["assert","checkProps","GL","getTypedArrayFromGLType","DEFAULT_ACCESSOR_VALUES","offset","stride","type","FLOAT","size","divisor","normalized","integer","PROP_CHECKS","deprecatedProps","instanced","isInstanced","Accessor","getBytesPerElement","accessor","ArrayType","BYTES_PER_ELEMENT","getBytesPerVertex","resolve","_len","arguments","length","accessors","Array","_key","constructor","_defineProperty","_len2","_key2","forEach","_assign","Object","freeze","toString","JSON","stringify","BYTES_PER_VERTEX","props","undefined","INT","UNSIGNED_INT","normalize","buffer","index"],"sources":["../../../src/classic/accessor.ts"],"sourcesContent":["import {assert, checkProps, Buffer, AccessorObject} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {getTypedArrayFromGLType} from './typed-array-utils';\n\nconst DEFAULT_ACCESSOR_VALUES = {\n offset: 0,\n stride: 0,\n type: GL.FLOAT,\n size: 1,\n divisor: 0,\n normalized: false,\n integer: false\n};\n\nconst PROP_CHECKS = {\n deprecatedProps: {\n instanced: 'divisor',\n isInstanced: 'divisor'\n }\n};\n\nexport default class Accessor implements AccessorObject {\n offset?: number;\n stride?: number;\n type?: number;\n size?: number;\n divisor?: number;\n normalized?: boolean;\n integer?: boolean;\n\n buffer?: Buffer;\n index?: number;\n\n static getBytesPerElement(accessor: Accessor | AccessorObject): number {\n // TODO: using `FLOAT` when type is not specified,\n // ensure this assumption is valid or force API to specify type.\n const ArrayType = getTypedArrayFromGLType(accessor.type || GL.FLOAT);\n return ArrayType.BYTES_PER_ELEMENT;\n }\n\n static getBytesPerVertex(accessor: AccessorObject): number {\n assert(accessor.size);\n // TODO: using `FLOAT` when type is not specified,\n // ensure this assumption is valid or force API to specify type.\n const ArrayType = getTypedArrayFromGLType(accessor.type || GL.FLOAT);\n return ArrayType.BYTES_PER_ELEMENT * accessor.size;\n }\n\n // Combines (merges) a list of accessors. On top of default values\n // Usually [programAccessor, bufferAccessor, appAccessor]\n // All props will be set in the returned object.\n // TODO check for conflicts between values in the supplied accessors\n static resolve(...accessors: AccessorObject[]): Accessor {\n return new Accessor(...[DEFAULT_ACCESSOR_VALUES, ...accessors]); // Default values\n }\n\n constructor(...accessors: AccessorObject[]) {\n accessors.forEach((accessor) => this._assign(accessor)); // Merge in sequence\n Object.freeze(this);\n }\n\n toString(): string {\n return JSON.stringify(this);\n }\n\n // ACCESSORS\n\n // TODO - remove>\n get BYTES_PER_ELEMENT(): number {\n return Accessor.getBytesPerElement(this);\n }\n\n get BYTES_PER_VERTEX(): number {\n return Accessor.getBytesPerVertex(this);\n }\n\n // PRIVATE\n\n // eslint-disable-next-line complexity, max-statements\n _assign(props: AccessorObject = {}): this {\n props = checkProps('Accessor', props, PROP_CHECKS);\n\n if (props.type !== undefined) {\n this.type = props.type;\n\n // Auto-deduce integer type?\n if (props.type === GL.INT || props.type === GL.UNSIGNED_INT) {\n this.integer = true;\n }\n }\n if (props.size !== undefined) {\n this.size = props.size;\n }\n if (props.offset !== undefined) {\n this.offset = props.offset;\n }\n if (props.stride !== undefined) {\n this.stride = props.stride;\n }\n // @ts-expect-error\n if (props.normalize !== undefined) {\n // @ts-expect-error\n this.normalized = props.normalize;\n }\n if (props.normalized !== undefined) {\n this.normalized = props.normalized;\n }\n if (props.integer !== undefined) {\n this.integer = props.integer;\n }\n\n // INSTANCE DIVISOR\n if (props.divisor !== undefined) {\n this.divisor = props.divisor;\n }\n\n // Buffer is optional\n if (props.buffer !== undefined) {\n this.buffer = props.buffer;\n }\n\n // The binding index (for binding e.g. Transform feedbacks and Uniform buffers)\n // TODO - should this be part of accessor?\n if (props.index !== undefined) {\n if (typeof props.index === 'boolean') {\n this.index = props.index ? 1 : 0;\n } else {\n this.index = props.index;\n }\n }\n\n // DEPRECATED\n // @ts-expect-error\n if (props.instanced !== undefined) {\n // @ts-expect-error\n this.divisor = props.instanced ? 1 : 0;\n }\n // @ts-expect-error\n if (props.isInstanced !== undefined) {\n // @ts-expect-error\n this.divisor = props.isInstanced ? 1 : 0;\n }\n\n if (this.offset === undefined) delete this.offset;\n if (this.stride === undefined) delete this.stride;\n if (this.type === undefined) delete this.type;\n if (this.size === undefined) delete this.size;\n if (this.divisor === undefined) delete this.divisor;\n if (this.normalized === undefined) delete this.normalized;\n if (this.integer === undefined) delete this.integer;\n \n if (this.buffer === undefined) delete this.buffer;\n if (this.index === undefined) delete this.index;\n \n return this;\n }\n}\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