@luma.gl/webgl 9.0.0-alpha.2 → 9.0.0-alpha.21
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 +11 -1
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +17 -35
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.d.ts +2 -2
- package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.js +2 -7
- package/dist/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts +4 -4
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +19 -55
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +13 -66
- package/dist/adapter/converters/texture-formats.js.map +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +2 -8
- package/dist/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-features.js +13 -20
- package/dist/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +1 -4
- package/dist/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js +8 -10
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/adapter/device-helpers/is-old-ie.js +2 -1
- package/dist/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/adapter/helpers/attribute-utils.js +0 -17
- package/dist/adapter/helpers/attribute-utils.js.map +1 -1
- 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 +25 -0
- package/dist/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/adapter/helpers/get-shader-layout.d.ts +1 -1
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +41 -67
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js +0 -7
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +1 -31
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/helpers/uniforms.d.ts +1 -1
- package/dist/adapter/helpers/uniforms.d.ts.map +1 -1
- package/dist/adapter/helpers/uniforms.js +4 -14
- package/dist/adapter/helpers/uniforms.js.map +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +0 -7
- package/dist/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +3 -3
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +6 -22
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts +3 -5
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +15 -68
- package/dist/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +6 -6
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +7 -17
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +3 -4
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +18 -49
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +3 -18
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.d.ts +3 -3
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +2 -15
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +16 -16
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +17 -75
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts +3 -3
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +3 -8
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +5 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +51 -140
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts +5 -4
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +5 -13
- package/dist/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts +3 -4
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +8 -21
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts +26 -26
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +66 -183
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/webgl-canvas-context.d.ts +3 -3
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +6 -19
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +53 -37
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +108 -109
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/accessor.d.ts +1 -1
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +12 -36
- package/dist/classic/accessor.js.map +1 -1
- package/dist/classic/buffer.d.ts +3 -4
- package/dist/classic/buffer.d.ts.map +1 -1
- package/dist/classic/buffer.js +30 -87
- package/dist/classic/buffer.js.map +1 -1
- package/dist/classic/typed-array-utils.d.ts +1 -1
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +0 -20
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/context/context/{create-context.d.ts → create-browser-context.d.ts} +2 -1
- package/dist/context/context/create-browser-context.d.ts.map +1 -0
- package/dist/context/context/{create-context.js → create-browser-context.js} +19 -15
- package/dist/context/context/create-browser-context.js.map +1 -0
- package/dist/context/context/create-headless-context.d.ts +9 -0
- package/dist/context/context/create-headless-context.d.ts.map +1 -0
- package/dist/context/context/create-headless-context.js +42 -0
- package/dist/context/context/create-headless-context.js.map +1 -0
- package/dist/context/context/webgl-checks.js +0 -3
- package/dist/context/context/webgl-checks.js.map +1 -1
- package/dist/context/debug/spector.d.ts +1 -0
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +7 -19
- package/dist/context/debug/spector.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +8 -32
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts +6 -5
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +8 -18
- package/dist/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts +103 -103
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +16 -34
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/context/polyfill/context-data.d.ts +13 -0
- package/dist/context/polyfill/context-data.d.ts.map +1 -0
- package/dist/context/polyfill/context-data.js +12 -0
- package/dist/context/polyfill/context-data.js.map +1 -0
- package/dist/context/polyfill/get-parameter-polyfill.d.ts +1 -1
- package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -1
- package/dist/context/polyfill/get-parameter-polyfill.js +1 -6
- package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/context/polyfill/polyfill-context.js +20 -28
- package/dist/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/context/polyfill/polyfill-table.d.ts +8 -8
- package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-table.js +8 -30
- package/dist/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.js +0 -4
- package/dist/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +15 -50
- package/dist/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts +2 -1
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +7 -9
- package/dist/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/dist.dev.js +9204 -0
- package/dist/index.cjs +5948 -0
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -26
- package/dist/index.js.map +1 -1
- package/dist/types/webgl.d.ts +8 -7
- package/dist/types/webgl.d.ts.map +1 -1
- package/dist/types/webgl.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist.min.js +36 -0
- package/package.json +18 -9
- package/src/.DS_Store +0 -0
- package/src/adapter/.DS_Store +0 -0
- package/src/adapter/converters/device-parameters.ts +45 -16
- package/src/adapter/converters/renderbuffer-formats.ts +1 -3
- package/src/adapter/converters/sampler-parameters.ts +18 -7
- package/src/adapter/converters/texture-formats.ts +18 -16
- package/src/adapter/converters/vertex-formats.ts +1 -0
- package/src/adapter/device-helpers/device-features.ts +9 -2
- package/src/adapter/device-helpers/device-limits.ts +1 -1
- package/src/adapter/device-helpers/get-device-info.ts +12 -8
- package/src/adapter/helpers/get-shader-info.ts +37 -0
- package/src/adapter/helpers/get-shader-layout.ts +59 -37
- package/src/adapter/helpers/parse-shader-compiler-log.ts +2 -2
- package/src/adapter/helpers/set-uniform.ts +3 -1
- package/src/adapter/helpers/uniforms.ts +21 -10
- package/src/adapter/objects/constants-to-keys.ts +4 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +8 -8
- package/src/adapter/objects/webgl-resource.ts +8 -13
- package/src/adapter/objects/webgl-vertex-array-object.ts +10 -10
- package/src/adapter/resources/webgl-buffer.ts +16 -16
- package/src/adapter/resources/webgl-command-buffer.ts +3 -3
- package/src/adapter/resources/webgl-command-encoder.ts +8 -8
- package/src/adapter/resources/webgl-external-texture.ts +1 -1
- package/src/adapter/resources/webgl-framebuffer.ts +36 -33
- package/src/adapter/resources/webgl-render-pass.ts +4 -3
- package/src/adapter/resources/webgl-render-pipeline.ts +89 -77
- package/src/adapter/resources/webgl-sampler.ts +12 -6
- package/src/adapter/resources/webgl-shader.ts +10 -9
- package/src/adapter/resources/webgl-texture.ts +55 -45
- package/src/adapter/webgl-canvas-context.ts +8 -9
- package/src/adapter/webgl-device.ts +153 -69
- package/src/classic/accessor.ts +2 -15
- package/src/classic/buffer.ts +18 -25
- package/src/classic/typed-array-utils.ts +4 -2
- package/src/context/.DS_Store +0 -0
- package/src/context/context/{create-context.ts → create-browser-context.ts} +17 -7
- package/src/context/context/create-headless-context.ts +48 -0
- package/src/context/debug/spector.ts +6 -5
- package/src/context/debug/webgl-developer-tools.ts +13 -13
- package/src/context/parameters/unified-parameter-api.ts +18 -12
- package/src/context/parameters/webgl-parameter-tables.ts +113 -94
- package/src/context/polyfill/context-data.ts +27 -0
- package/src/context/polyfill/get-parameter-polyfill.ts +7 -6
- package/src/context/polyfill/polyfill-context.ts +6 -8
- package/src/context/polyfill/polyfill-table.ts +16 -14
- package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
- package/src/context/state-tracker/track-context-state.ts +13 -12
- package/src/context/state-tracker/with-parameters.ts +8 -2
- package/src/index.ts +28 -26
- package/src/types/webgl.ts +10 -7
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/dist/context/context/context-state.d.ts +0 -18
- package/dist/context/context/context-state.d.ts.map +0 -1
- package/dist/context/context/context-state.js +0 -26
- package/dist/context/context/context-state.js.map +0 -1
- package/dist/context/context/create-context.d.ts.map +0 -1
- package/dist/context/context/create-context.js.map +0 -1
- package/dist/context/context/device-pixels.d.ts +0 -25
- package/dist/context/context/device-pixels.d.ts.map +0 -1
- package/dist/context/context/device-pixels.js +0 -98
- package/dist/context/context/device-pixels.js.map +0 -1
- package/dist/es5/adapter/converters/device-parameters.js +0 -170
- package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
- package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -163
- package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/es5/adapter/converters/sampler-parameters.js +0 -226
- package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/es5/adapter/converters/texture-formats.js +0 -1031
- package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
- package/dist/es5/adapter/converters/vertex-formats.js +0 -45
- package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/es5/adapter/device-helpers/device-features.js +0 -144
- package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/es5/adapter/device-helpers/device-limits.js +0 -64
- package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/es5/adapter/device-helpers/get-device-info.js +0 -55
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -16
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/es5/adapter/helpers/attribute-utils.js +0 -91
- package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/es5/adapter/helpers/get-shader-layout.js +0 -371
- package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -72
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/es5/adapter/helpers/set-uniform.js +0 -125
- package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/es5/adapter/helpers/uniforms.js +0 -112
- package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
- package/dist/es5/adapter/objects/constants-to-keys.js +0 -54
- package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -150
- package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-resource.js +0 -292
- package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -137
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-buffer.js +0 -243
- package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -96
- package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -98
- package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
- package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -345
- package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-render-pass.js +0 -61
- package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -505
- package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-sampler.js +0 -96
- package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-shader.js +0 -149
- package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-texture.js +0 -986
- package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/es5/adapter/webgl-canvas-context.js +0 -97
- package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/es5/adapter/webgl-device.js +0 -399
- package/dist/es5/adapter/webgl-device.js.map +0 -1
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/classic/accessor.js +0 -181
- package/dist/es5/classic/accessor.js.map +0 -1
- package/dist/es5/classic/buffer.js +0 -470
- package/dist/es5/classic/buffer.js.map +0 -1
- package/dist/es5/classic/typed-array-utils.js +0 -126
- package/dist/es5/classic/typed-array-utils.js.map +0 -1
- package/dist/es5/context/context/context-state.js +0 -31
- package/dist/es5/context/context/context-state.js.map +0 -1
- package/dist/es5/context/context/create-context.js +0 -69
- package/dist/es5/context/context/create-context.js.map +0 -1
- package/dist/es5/context/context/device-pixels.js +0 -115
- package/dist/es5/context/context/device-pixels.js.map +0 -1
- package/dist/es5/context/context/webgl-checks.js +0 -54
- package/dist/es5/context/context/webgl-checks.js.map +0 -1
- package/dist/es5/context/debug/spector.js +0 -133
- package/dist/es5/context/debug/spector.js.map +0 -1
- package/dist/es5/context/debug/webgl-developer-tools.js +0 -198
- package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/es5/context/parameters/unified-parameter-api.js +0 -97
- package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -392
- package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -81
- package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-context.js +0 -135
- package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-table.js +0 -166
- package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -341
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/es5/context/state-tracker/deep-array-equal.js +0 -28
- package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/es5/context/state-tracker/track-context-state.js +0 -211
- package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/es5/context/state-tracker/with-parameters.js +0 -44
- package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/es5/index.js +0 -276
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/init.js +0 -10
- package/dist/es5/init.js.map +0 -1
- package/dist/es5/types/webgl.js +0 -6
- package/dist/es5/types/webgl.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/es5/types.js.map +0 -1
- package/dist/esm/adapter/converters/device-parameters.js +0 -155
- package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
- package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -185
- package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/esm/adapter/converters/sampler-parameters.js +0 -208
- package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/esm/adapter/converters/texture-formats.js +0 -954
- package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
- package/dist/esm/adapter/converters/vertex-formats.js +0 -35
- package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/esm/adapter/device-helpers/device-features.js +0 -102
- package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/esm/adapter/device-helpers/device-limits.js +0 -91
- package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/esm/adapter/device-helpers/get-device-info.js +0 -44
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -8
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/esm/adapter/helpers/attribute-utils.js +0 -81
- package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/esm/adapter/helpers/get-shader-layout.js +0 -306
- package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -37
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/esm/adapter/helpers/set-uniform.js +0 -115
- package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/esm/adapter/helpers/uniforms.js +0 -99
- package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
- package/dist/esm/adapter/objects/constants-to-keys.js +0 -42
- package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -94
- package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-resource.js +0 -216
- package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -84
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-buffer.js +0 -164
- package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -65
- package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -53
- package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
- package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -265
- package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-render-pass.js +0 -19
- package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -400
- package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-sampler.js +0 -50
- package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-shader.js +0 -75
- package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-texture.js +0 -831
- package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/esm/adapter/webgl-canvas-context.js +0 -54
- package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/esm/adapter/webgl-device.js +0 -280
- package/dist/esm/adapter/webgl-device.js.map +0 -1
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/classic/accessor.js +0 -144
- package/dist/esm/classic/accessor.js.map +0 -1
- package/dist/esm/classic/buffer.js +0 -384
- package/dist/esm/classic/buffer.js.map +0 -1
- package/dist/esm/classic/typed-array-utils.js +0 -112
- package/dist/esm/classic/typed-array-utils.js.map +0 -1
- package/dist/esm/context/context/context-state.js +0 -26
- package/dist/esm/context/context/context-state.js.map +0 -1
- package/dist/esm/context/context/create-context.js +0 -49
- package/dist/esm/context/context/create-context.js.map +0 -1
- package/dist/esm/context/context/device-pixels.js +0 -98
- package/dist/esm/context/context/device-pixels.js.map +0 -1
- package/dist/esm/context/context/webgl-checks.js +0 -34
- package/dist/esm/context/context/webgl-checks.js.map +0 -1
- package/dist/esm/context/debug/spector.js +0 -76
- package/dist/esm/context/debug/spector.js.map +0 -1
- package/dist/esm/context/debug/webgl-developer-tools.js +0 -121
- package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/esm/context/parameters/unified-parameter-api.js +0 -65
- package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -445
- package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -91
- package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-context.js +0 -92
- package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-table.js +0 -160
- package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -335
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/esm/context/state-tracker/deep-array-equal.js +0 -21
- package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/esm/context/state-tracker/track-context-state.js +0 -183
- package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/esm/context/state-tracker/with-parameters.js +0 -36
- package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/esm/index.js +0 -27
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/init.js +0 -4
- package/dist/esm/init.js.map +0 -1
- package/dist/esm/types/webgl.js +0 -2
- package/dist/esm/types/webgl.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/init.d.ts +0 -2
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -4
- package/dist/init.js.map +0 -1
- package/src/bundle.ts +0 -4
- package/src/context/context/context-state.ts +0 -41
- package/src/context/context/device-pixels.ts +0 -152
- package/src/init.ts +0 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BufferProps } from '@luma.gl/api';
|
|
2
2
|
import { Buffer } from '@luma.gl/api';
|
|
3
|
-
import WebGLDevice from '../webgl-device';
|
|
3
|
+
import { WebGLDevice } from '../webgl-device';
|
|
4
4
|
/** WebGL Buffer interface */
|
|
5
|
-
export
|
|
5
|
+
export declare class WEBGLBuffer extends Buffer {
|
|
6
6
|
readonly device: WebGLDevice;
|
|
7
7
|
readonly gl: WebGLRenderingContext;
|
|
8
8
|
readonly gl2: WebGL2RenderingContext | null;
|
|
@@ -10,9 +10,8 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
10
10
|
readonly target: number;
|
|
11
11
|
byteLength: number;
|
|
12
12
|
bytesUsed: number;
|
|
13
|
-
debugData: ArrayBuffer;
|
|
13
|
+
debugData: ArrayBuffer | null;
|
|
14
14
|
webglUsage: number;
|
|
15
|
-
accessor: {};
|
|
16
15
|
constructor(device: WebGLDevice, props?: BufferProps);
|
|
17
16
|
_initWithData(data: any, byteOffset?: number, byteLength?: number): this;
|
|
18
17
|
_initWithByteLength(byteLength: number): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-buffer.d.ts","sourceRoot":"","sources":["../../../src/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GAClB,OAAO,CAAC,WAAW,CAAC;IAmBvB,oBAAoB;IAIpB,eAAe;IAKf,cAAc;CAIf"}
|
|
@@ -2,54 +2,42 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
2
2
|
import { Buffer, assert } from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
4
|
const DEBUG_DATA_LENGTH = 10;
|
|
5
|
-
export
|
|
6
|
-
constructor(device
|
|
5
|
+
export class WEBGLBuffer extends Buffer {
|
|
6
|
+
constructor(device) {
|
|
7
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7
8
|
super(device, props);
|
|
8
|
-
|
|
9
9
|
_defineProperty(this, "device", void 0);
|
|
10
|
-
|
|
11
10
|
_defineProperty(this, "gl", void 0);
|
|
12
|
-
|
|
13
11
|
_defineProperty(this, "gl2", void 0);
|
|
14
|
-
|
|
15
12
|
_defineProperty(this, "handle", void 0);
|
|
16
|
-
|
|
17
13
|
_defineProperty(this, "target", void 0);
|
|
18
|
-
|
|
19
14
|
_defineProperty(this, "byteLength", void 0);
|
|
20
|
-
|
|
21
15
|
_defineProperty(this, "bytesUsed", void 0);
|
|
22
|
-
|
|
23
|
-
_defineProperty(this, "debugData", void 0);
|
|
24
|
-
|
|
16
|
+
_defineProperty(this, "debugData", null);
|
|
25
17
|
_defineProperty(this, "webglUsage", void 0);
|
|
26
|
-
|
|
27
|
-
_defineProperty(this, "accessor", void 0);
|
|
28
|
-
|
|
29
18
|
this.device = device;
|
|
30
19
|
this.gl = this.device.gl;
|
|
31
20
|
this.gl2 = this.device.gl2;
|
|
32
21
|
const handle = typeof props === 'object' ? props.handle : undefined;
|
|
33
22
|
this.handle = handle || this.gl.createBuffer();
|
|
34
|
-
this.handle
|
|
23
|
+
device.setSpectorMetadata(this.handle, {
|
|
24
|
+
...this.props,
|
|
35
25
|
data: typeof this.props.data
|
|
36
|
-
};
|
|
26
|
+
});
|
|
37
27
|
this.target = this.props.target || getWebGLTarget(this.props.usage);
|
|
38
28
|
this.webglUsage = this.props.webglUsage || getWebGLUsage(this.props.usage);
|
|
39
29
|
this.debugData = null;
|
|
40
|
-
|
|
41
30
|
if (props.data) {
|
|
42
31
|
this._initWithData(props.data, props.byteOffset, props.byteLength);
|
|
43
32
|
} else {
|
|
44
33
|
this._initWithByteLength(props.byteLength || 0);
|
|
45
34
|
}
|
|
46
35
|
}
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
_initWithData(data) {
|
|
37
|
+
let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
38
|
+
let byteLength = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : data.byteLength + byteOffset;
|
|
49
39
|
assert(ArrayBuffer.isView(data));
|
|
50
|
-
|
|
51
40
|
const target = this._getWriteTarget();
|
|
52
|
-
|
|
53
41
|
this.gl.bindBuffer(target, this.handle);
|
|
54
42
|
this.gl.bufferData(target, byteLength, this.webglUsage);
|
|
55
43
|
this.gl.bufferSubData(target, byteOffset, data);
|
|
@@ -60,17 +48,13 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
60
48
|
this.trackAllocatedMemory(byteLength);
|
|
61
49
|
return this;
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
_initWithByteLength(byteLength) {
|
|
65
52
|
assert(byteLength >= 0);
|
|
66
53
|
let data = byteLength;
|
|
67
|
-
|
|
68
54
|
if (byteLength === 0) {
|
|
69
55
|
data = new Float32Array(0);
|
|
70
56
|
}
|
|
71
|
-
|
|
72
57
|
const target = this._getWriteTarget();
|
|
73
|
-
|
|
74
58
|
this.gl.bindBuffer(target, this.handle);
|
|
75
59
|
this.gl.bufferData(target, data, this.webglUsage);
|
|
76
60
|
this.gl.bindBuffer(target, null);
|
|
@@ -79,33 +63,31 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
79
63
|
this.byteLength = byteLength;
|
|
80
64
|
return this;
|
|
81
65
|
}
|
|
82
|
-
|
|
83
66
|
destroy() {
|
|
84
|
-
if (this.handle) {
|
|
67
|
+
if (!this.destroyed && this.handle) {
|
|
85
68
|
this.removeStats();
|
|
86
69
|
this.trackDeallocatedMemory();
|
|
87
70
|
this.gl.deleteBuffer(this.handle);
|
|
88
|
-
this.
|
|
71
|
+
this.destroyed = true;
|
|
89
72
|
}
|
|
90
73
|
}
|
|
91
|
-
|
|
92
|
-
|
|
74
|
+
write(data) {
|
|
75
|
+
let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
93
76
|
const srcOffset = 0;
|
|
94
77
|
const byteLength = data.byteLength;
|
|
95
78
|
const target = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;
|
|
96
79
|
this.gl.bindBuffer(target, this.handle);
|
|
97
|
-
|
|
98
80
|
if (srcOffset !== 0 || byteLength !== undefined) {
|
|
99
81
|
this.device.assertWebGL2();
|
|
100
|
-
this.gl.bufferSubData(this.target,
|
|
82
|
+
this.gl.bufferSubData(this.target, byteOffset, data, srcOffset, byteLength);
|
|
101
83
|
} else {
|
|
102
84
|
this.gl.bufferSubData(target, byteOffset, data);
|
|
103
85
|
}
|
|
104
|
-
|
|
105
86
|
this.gl.bindBuffer(target, null);
|
|
106
87
|
}
|
|
107
|
-
|
|
108
|
-
|
|
88
|
+
async readAsync() {
|
|
89
|
+
let byteOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
90
|
+
let byteLength = arguments.length > 1 ? arguments[1] : undefined;
|
|
109
91
|
this.device.assertWebGL2();
|
|
110
92
|
const data = new Uint8Array(byteLength);
|
|
111
93
|
const dstOffset = 0;
|
|
@@ -114,51 +96,38 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
114
96
|
this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);
|
|
115
97
|
return data;
|
|
116
98
|
}
|
|
117
|
-
|
|
118
99
|
_invalidateDebugData() {
|
|
119
100
|
this.debugData = null;
|
|
120
101
|
}
|
|
121
|
-
|
|
122
102
|
_getWriteTarget() {
|
|
123
103
|
return this.target;
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
_getReadTarget() {
|
|
127
106
|
return this.target;
|
|
128
|
-
return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.target;
|
|
129
107
|
}
|
|
130
|
-
|
|
131
108
|
}
|
|
132
|
-
|
|
133
109
|
function getWebGLTarget(usage) {
|
|
134
110
|
if (usage & Buffer.INDEX) {
|
|
135
111
|
return GL.ELEMENT_ARRAY_BUFFER;
|
|
136
112
|
}
|
|
137
|
-
|
|
138
113
|
if (usage & Buffer.VERTEX) {
|
|
139
114
|
return GL.ARRAY_BUFFER;
|
|
140
115
|
}
|
|
141
|
-
|
|
142
116
|
if (usage & Buffer.UNIFORM) {
|
|
143
117
|
return GL.UNIFORM_BUFFER;
|
|
144
118
|
}
|
|
145
|
-
|
|
146
119
|
return GL.ARRAY_BUFFER;
|
|
147
120
|
}
|
|
148
|
-
|
|
149
121
|
function getWebGLUsage(usage) {
|
|
150
122
|
if (usage & Buffer.INDEX) {
|
|
151
123
|
return GL.STATIC_DRAW;
|
|
152
124
|
}
|
|
153
|
-
|
|
154
125
|
if (usage & Buffer.VERTEX) {
|
|
155
126
|
return GL.STATIC_DRAW;
|
|
156
127
|
}
|
|
157
|
-
|
|
158
128
|
if (usage & Buffer.UNIFORM) {
|
|
159
129
|
return GL.DYNAMIC_DRAW;
|
|
160
130
|
}
|
|
161
|
-
|
|
162
131
|
return GL.DYNAMIC_DRAW;
|
|
163
132
|
}
|
|
164
133
|
//# sourceMappingURL=webgl-buffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapter/resources/webgl-buffer.ts"],"names":["Buffer","assert","GL","DEBUG_DATA_LENGTH","WEBGLBuffer","constructor","device","props","gl","gl2","handle","undefined","createBuffer","__SPECTOR_Metadata","data","target","getWebGLTarget","usage","webglUsage","getWebGLUsage","debugData","_initWithData","byteOffset","byteLength","_initWithByteLength","ArrayBuffer","isView","_getWriteTarget","bindBuffer","bufferData","bufferSubData","slice","bytesUsed","trackAllocatedMemory","Float32Array","destroy","removeStats","trackDeallocatedMemory","deleteBuffer","write","srcOffset","isWebGL2","COPY_WRITE_BUFFER","assertWebGL2","offset","readAsync","Uint8Array","dstOffset","COPY_READ_BUFFER","getBufferSubData","_invalidateDebugData","_getReadTarget","INDEX","ELEMENT_ARRAY_BUFFER","VERTEX","ARRAY_BUFFER","UNIFORM","UNIFORM_BUFFER","STATIC_DRAW","DYNAMIC_DRAW"],"mappings":";AACA,SAAQA,MAAR,EAAgBC,MAAhB,QAA6B,cAA7B;AACA,OAAOC,EAAP,MAAe,oBAAf;AAGA,MAAMC,iBAAiB,GAAG,EAA1B;AAGA,eAAe,MAAMC,WAAN,SAA0BJ,MAA1B,CAAiC;AAe9CK,EAAAA,WAAW,CAACC,MAAD,EAAsBC,KAAkB,GAAG,EAA3C,EAA+C;AACxD,UAAMD,MAAN,EAAcC,KAAd;;AADwD;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAGxD,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,EAAL,GAAU,KAAKF,MAAL,CAAYE,EAAtB;AACA,SAAKC,GAAL,GAAW,KAAKH,MAAL,CAAYG,GAAvB;AAEA,UAAMC,MAAM,GAAG,OAAOH,KAAP,KAAiB,QAAjB,GAA6BA,KAAD,CAAuBG,MAAnD,GAA4DC,SAA3E;AACA,SAAKD,MAAL,GAAcA,MAAM,IAAI,KAAKF,EAAL,CAAQI,YAAR,EAAxB;AAEA,SAAKF,MAAL,CAAYG,kBAAZ,GAAiC,EAAC,GAAG,KAAKN,KAAT;AAAgBO,MAAAA,IAAI,EAAE,OAAO,KAAKP,KAAL,CAAWO;AAAxC,KAAjC;AAMA,SAAKC,MAAL,GAAc,KAAKR,KAAL,CAAWQ,MAAX,IAAqBC,cAAc,CAAC,KAAKT,KAAL,CAAWU,KA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ACsD,MAAnB,EAA2B;AACzB,WAAOpD,EAAE,CAACqD,YAAV;AACD;;AACD,MAAItC,KAAK,GAAGjB,MAAM,CAACwD,OAAnB,EAA4B;AAC1B,WAAOtD,EAAE,CAACuD,cAAV;AACD;;AAUD,SAAOvD,EAAE,CAACqD,YAAV;AACD;;AAED,SAASpC,aAAT,CAAuBF,KAAvB,EAA0C;AACxC,MAAIA,KAAK,GAAGjB,MAAM,CAACoD,KAAnB,EAA0B;AACxB,WAAOlD,EAAE,CAACwD,WAAV;AACD;;AACD,MAAIzC,KAAK,GAAGjB,MAAM,CAACsD,MAAnB,EAA2B;AACzB,WAAOpD,EAAE,CAACwD,WAAV;AACD;;AACD,MAAIzC,KAAK,GAAGjB,MAAM,CAACwD,OAAnB,EAA4B;AAC1B,WAAOtD,EAAE,CAACyD,YAAV;AACD;;AACD,SAAOzD,EAAE,CAACyD,YAAV;AACD","sourcesContent":["import type {BufferProps} from '@luma.gl/api';\nimport {Buffer, assert} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport WebGLDevice from '../webgl-device';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n/** WebGL Buffer interface */\nexport default class WEBGLBuffer extends Buffer {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLBuffer;\n readonly target: number;\n\n byteLength: number;\n bytesUsed: number;\n debugData: ArrayBuffer;\n\n webglUsage: number;\n\n accessor: {};\n\n constructor(device: WebGLDevice, props: BufferProps = {}) {\n super(device, props);\n\n this.device = device;\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n\n const handle = typeof props === 'object' ? (props as BufferProps).handle : undefined;\n this.handle = handle || this.gl.createBuffer();\n // @ts-expect-error Add metadata for spector\n this.handle.__SPECTOR_Metadata = {...this.props, data: typeof this.props.data}; // {name: this.props.id};\n\n // In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers\n // otherwise buffer type will lock to generic (non-element) buffer\n // In WebGL2, we can use GL.COPY_READ_BUFFER which avoids locking the type here\n // @ts-expect-error Hack - Checking for subclass prop\n this.target = this.props.target || getWebGLTarget(this.props.usage);\n // @ts-expect-error Hack - Checking for subclass prop\n this.webglUsage = this.props.webglUsage || getWebGLUsage(this.props.usage);\n this.debugData = null;\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._initWithData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._initWithByteLength(props.byteLength || 0);\n }\n\n // Deprecated: Merge main props and accessor\n // this.accessor = {...props.accessor};\n\n // Object.seal(this);\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _initWithData(data, byteOffset: number = 0, byteLength: number = data.byteLength + byteOffset): this {\n assert(ArrayBuffer.isView(data));\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.webglUsage);\n this.gl.bufferSubData(target, byteOffset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _initWithByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, data, this.webglUsage);\n this.gl.bindBuffer(target, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n return this;\n }\n\n destroy(): void {\n if (this.handle) {\n this.removeStats();\n this.trackDeallocatedMemory();\n this.gl.deleteBuffer(this.handle);\n // @ts-expect-error\n this.handle = null;\n }\n }\n\n write(data: ArrayBufferView, byteOffset: number = 0): void {\n const srcOffset = 0;\n const byteLength = data.byteLength;\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n const target = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n this.gl.bindBuffer(target, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n this.device.assertWebGL2();\n\n // @ts-expect-error\n this.gl.bufferSubData(this.target, offset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(target, byteOffset, data);\n }\n this.gl.bindBuffer(target, null);\n\n // TODO - update local `data` if offsets are right\n // this.debugData = data.slice(byteOffset, 40);\n }\n\n /** Read data from the buffer */\n async readAsync(\n byteOffset: number = 0,\n byteLength?: number\n ): Promise<ArrayBuffer> {\n this.device.assertWebGL2();\n\n const data = new Uint8Array(byteLength);\n const dstOffset = 0;\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2.getBufferSubData(GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n // this.debugData = null;\n\n return data;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n _invalidateDebugData() {\n this.debugData = null;\n }\n\n _getWriteTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n }\n\n _getReadTarget() {\n return this.target;\n return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.target;\n }\n}\n\n// static MAP_READ = 0x01;\n// static MAP_WRITE = 0x02;\n// static COPY_SRC = 0x0004;\n// static COPY_DST = 0x0008;\n// static INDEX = 0x0010;\n// static VERTEX = 0x0020;\n// static UNIFORM = 0x0040;\n// static STORAGE = 0x0080;\n// static INDIRECT = 0x0100;\n// static QUERY_RESOLVE = 0x0200;\n\nfunction getWebGLTarget(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.ELEMENT_ARRAY_BUFFER;\n }\n if (usage & Buffer.VERTEX) {\n return GL.ARRAY_BUFFER;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.UNIFORM_BUFFER;\n }\n\n // gl.COPY_READ_BUFFER: Buffer for copying from one buffer object to another.\n // gl.COPY_WRITE_BUFFER: Buffer for copying from one buffer object to another.\n // gl.TRANSFORM_FEEDBACK_BUFFER: Buffer for transform feedback operations.\n // gl.PIXEL_PACK_BUFFER: Buffer used for pixel transfer operations.\n // gl.PIXEL_UNPACK_BUFFER: Buffer used for pixel transfer operations.\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n return GL.ARRAY_BUFFER;\n}\n\nfunction getWebGLUsage(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.VERTEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.DYNAMIC_DRAW;\n }\n return GL.DYNAMIC_DRAW;\n}\n"],"file":"webgl-buffer.js"}
|
|
1
|
+
{"version":3,"file":"webgl-buffer.js","names":["Buffer","assert","GL","DEBUG_DATA_LENGTH","WEBGLBuffer","constructor","device","props","arguments","length","undefined","_defineProperty","gl","gl2","handle","createBuffer","setSpectorMetadata","data","target","getWebGLTarget","usage","webglUsage","getWebGLUsage","debugData","_initWithData","byteOffset","byteLength","_initWithByteLength","ArrayBuffer","isView","_getWriteTarget","bindBuffer","bufferData","bufferSubData","slice","bytesUsed","trackAllocatedMemory","Float32Array","destroy","destroyed","removeStats","trackDeallocatedMemory","deleteBuffer","write","srcOffset","isWebGL2","COPY_WRITE_BUFFER","assertWebGL2","readAsync","Uint8Array","dstOffset","COPY_READ_BUFFER","getBufferSubData","_invalidateDebugData","_getReadTarget","INDEX","ELEMENT_ARRAY_BUFFER","VERTEX","ARRAY_BUFFER","UNIFORM","UNIFORM_BUFFER","STATIC_DRAW","DYNAMIC_DRAW"],"sources":["../../../src/adapter/resources/webgl-buffer.ts"],"sourcesContent":["import type {BufferProps} from '@luma.gl/api';\nimport {Buffer, assert} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n/** WebGL Buffer interface */\nexport class WEBGLBuffer extends Buffer {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLBuffer;\n readonly target: number;\n\n byteLength: number;\n bytesUsed: number;\n debugData: ArrayBuffer | null = null;\n\n webglUsage: number;\n\n // accessor: {};\n\n \n constructor(device: WebGLDevice, props: BufferProps = {}) {\n super(device, props);\n\n this.device = device;\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n\n const handle = typeof props === 'object' ? (props ).handle : undefined;\n this.handle = handle || this.gl.createBuffer();\n device.setSpectorMetadata(this.handle, {...this.props, data: typeof this.props.data});\n\n // In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers\n // otherwise buffer type will lock to generic (non-element) buffer\n // In WebGL2, we can use GL.COPY_READ_BUFFER which avoids locking the type here\n // @ts-expect-error Hack - Checking for subclass prop\n this.target = this.props.target || getWebGLTarget(this.props.usage);\n // @ts-expect-error Hack - Checking for subclass prop\n this.webglUsage = this.props.webglUsage || getWebGLUsage(this.props.usage);\n this.debugData = null;\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._initWithData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._initWithByteLength(props.byteLength || 0);\n }\n\n // Deprecated: Merge main props and accessor\n // this.accessor = {...props.accessor};\n\n // Object.seal(this);\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _initWithData(data, byteOffset: number = 0, byteLength: number = data.byteLength + byteOffset): this {\n assert(ArrayBuffer.isView(data));\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.webglUsage);\n this.gl.bufferSubData(target, byteOffset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _initWithByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, data, this.webglUsage);\n this.gl.bindBuffer(target, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n return this;\n }\n\n override destroy(): void {\n if (!this.destroyed && this.handle) {\n this.removeStats();\n this.trackDeallocatedMemory();\n this.gl.deleteBuffer(this.handle);\n this.destroyed = true;\n // this.handle = null;\n }\n }\n\n override write(data: ArrayBufferView, byteOffset: number = 0): void {\n const srcOffset = 0;\n const byteLength = data.byteLength;\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n const target = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n this.gl.bindBuffer(target, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n this.device.assertWebGL2();\n\n // @ts-expect-error\n this.gl.bufferSubData(this.target, byteOffset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(target, byteOffset, data);\n }\n this.gl.bindBuffer(target, null);\n\n // TODO - update local `data` if offsets are right\n // this.debugData = data.slice(byteOffset, 40);\n }\n\n /** Read data from the buffer */\n override async readAsync(\n byteOffset: number = 0,\n byteLength?: number\n ): Promise<ArrayBuffer> {\n this.device.assertWebGL2();\n\n const data = new Uint8Array(byteLength);\n const dstOffset = 0;\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2.getBufferSubData(GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n // this.debugData = null;\n\n return data;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n _invalidateDebugData() {\n this.debugData = null;\n }\n\n _getWriteTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n }\n\n _getReadTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.target;\n }\n}\n\n// static MAP_READ = 0x01;\n// static MAP_WRITE = 0x02;\n// static COPY_SRC = 0x0004;\n// static COPY_DST = 0x0008;\n// static INDEX = 0x0010;\n// static VERTEX = 0x0020;\n// static UNIFORM = 0x0040;\n// static STORAGE = 0x0080;\n// static INDIRECT = 0x0100;\n// static QUERY_RESOLVE = 0x0200;\n\nfunction getWebGLTarget(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.ELEMENT_ARRAY_BUFFER;\n }\n if (usage & Buffer.VERTEX) {\n return GL.ARRAY_BUFFER;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.UNIFORM_BUFFER;\n }\n\n // gl.COPY_READ_BUFFER: Buffer for copying from one buffer object to another.\n // gl.COPY_WRITE_BUFFER: Buffer for copying from one buffer object to another.\n // gl.TRANSFORM_FEEDBACK_BUFFER: Buffer for transform feedback operations.\n // gl.PIXEL_PACK_BUFFER: Buffer used for pixel transfer operations.\n // gl.PIXEL_UNPACK_BUFFER: Buffer used for pixel transfer operations.\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n return GL.ARRAY_BUFFER;\n}\n\nfunction getWebGLUsage(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.VERTEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.DYNAMIC_DRAW;\n }\n return GL.DYNAMIC_DRAW;\n}\n"],"mappings":";AACA,SAAQA,MAAM,EAAEC,MAAM,QAAO,cAAc;AAC3C,OAAOC,EAAE,MAAM,oBAAoB;AAGnC,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,OAAO,MAAMC,WAAW,SAASJ,MAAM,CAAC;EAgBtCK,WAAWA,CAACC,MAAmB,EAA2B;IAAA,IAAzBC,KAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACtD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,oBARS,IAAI;IAAAA,eAAA;IAUlC,IAAI,CAACL,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACM,EAAE,GAAG,IAAI,CAACN,MAAM,CAACM,EAAE;IACxB,IAAI,CAACC,GAAG,GAAG,IAAI,CAACP,MAAM,CAACO,GAAG;IAE1B,MAAMC,MAAM,GAAG,OAAOP,KAAK,KAAK,QAAQ,GAAIA,KAAK,CAAGO,MAAM,GAAGJ,SAAS;IACtE,IAAI,CAACI,MAAM,GAAGA,MAAM,IAAI,IAAI,CAACF,EAAE,CAACG,YAAY,EAAE;IAC9CT,MAAM,CAACU,kBAAkB,CAAC,IAAI,CAACF,MAAM,EAAE;MAAC,GAAG,IAAI,CAACP,KAAK;MAAEU,IAAI,EAAE,OAAO,IAAI,CAACV,KAAK,CAACU;IAAI,CAAC,CAAC;IAMrF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opyTextureToTextureOptions } from '@luma.gl/api';
|
|
2
|
-
import WebGLDevice from '../webgl-device';
|
|
2
|
+
import { WebGLDevice } from '../webgl-device';
|
|
3
3
|
declare type CopyBufferToBufferCommand = {
|
|
4
4
|
name: 'copy-buffer-to-buffer';
|
|
5
5
|
options: CopyBufferToBufferOptions;
|
|
@@ -17,7 +17,7 @@ declare type CopyTextureToTextureCommand = {
|
|
|
17
17
|
options: CopyTextureToTextureOptions;
|
|
18
18
|
};
|
|
19
19
|
declare type Command = CopyBufferToBufferCommand | CopyBufferToTextureCommand | CopyTextureToBufferCommand | CopyTextureToTextureCommand;
|
|
20
|
-
export
|
|
20
|
+
export declare class CommandBuffer {
|
|
21
21
|
commands: Command[];
|
|
22
22
|
}
|
|
23
23
|
export declare function submitCommands(device: WebGLDevice, commands?: Command[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,WAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAO5C,aAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,yBAAyB,CAAC;CACpC,CAAC;AAEF,aAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,aAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,aAAK,2BAA2B,GAAG;IACjC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,2BAA2B,CAAC;CACtC,CAAC;AAEF,aAAK,OAAO,GACR,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,2BAA2B,CAAC;AAEhC,qBAAa,aAAa;IACxB,QAAQ,EAAE,OAAO,EAAE,CAAM;CAC1B;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAE,OAAO,EAAO,QAiB3E"}
|
|
@@ -1,52 +1,40 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
|
-
|
|
4
3
|
function cast(value) {
|
|
5
4
|
return value;
|
|
6
5
|
}
|
|
7
|
-
|
|
8
|
-
export default class CommandBuffer {
|
|
6
|
+
export class CommandBuffer {
|
|
9
7
|
constructor() {
|
|
10
8
|
_defineProperty(this, "commands", []);
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
}
|
|
14
|
-
export function submitCommands(device
|
|
11
|
+
export function submitCommands(device) {
|
|
12
|
+
let commands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
15
13
|
for (const command of commands) {
|
|
16
14
|
switch (command.name) {
|
|
17
15
|
case 'copy-buffer-to-buffer':
|
|
18
16
|
_copyBufferToBuffer(device, command.options);
|
|
19
|
-
|
|
20
17
|
break;
|
|
21
|
-
|
|
22
18
|
case 'copy-buffer-to-texture':
|
|
23
19
|
_copyBufferToTexture(device, command.options);
|
|
24
|
-
|
|
25
20
|
break;
|
|
26
|
-
|
|
27
21
|
case 'copy-texture-to-buffer':
|
|
28
22
|
_copyTextureToBuffer(device, command.options);
|
|
29
|
-
|
|
30
23
|
break;
|
|
31
|
-
|
|
32
24
|
case 'copy-texture-to-texture':
|
|
33
25
|
_copyTextureToTexture(device, command.options);
|
|
34
|
-
|
|
35
26
|
break;
|
|
36
27
|
}
|
|
37
28
|
}
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
function _copyBufferToBuffer(device, options) {
|
|
41
31
|
const source = cast(options.source);
|
|
42
32
|
const destination = cast(options.destination);
|
|
43
33
|
const {
|
|
44
34
|
gl2
|
|
45
35
|
} = device;
|
|
46
|
-
|
|
47
36
|
if (gl2) {
|
|
48
37
|
var _options$sourceOffset, _options$destinationO;
|
|
49
|
-
|
|
50
38
|
gl2.bindBuffer(GL.COPY_READ_BUFFER, source.handle);
|
|
51
39
|
gl2.bindBuffer(GL.COPY_WRITE_BUFFER, destination.handle);
|
|
52
40
|
gl2.copyBufferSubData(GL.COPY_READ_BUFFER, GL.COPY_WRITE_BUFFER, (_options$sourceOffset = options.sourceOffset) !== null && _options$sourceOffset !== void 0 ? _options$sourceOffset : 0, (_options$destinationO = options.destinationOffset) !== null && _options$destinationO !== void 0 ? _options$destinationO : 0, options.size);
|
|
@@ -56,10 +44,7 @@ function _copyBufferToBuffer(device, options) {
|
|
|
56
44
|
throw new Error('copyBufferToBuffer not implemented in WebGL1');
|
|
57
45
|
}
|
|
58
46
|
}
|
|
59
|
-
|
|
60
47
|
function _copyBufferToTexture(device, options) {}
|
|
61
|
-
|
|
62
48
|
function _copyTextureToBuffer(device, options) {}
|
|
63
|
-
|
|
64
49
|
function _copyTextureToTexture(device, options) {}
|
|
65
50
|
//# sourceMappingURL=webgl-command-buffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgl-command-buffer.js","names":["GL","cast","value","CommandBuffer","constructor","_defineProperty","submitCommands","device","commands","arguments","length","undefined","command","name","_copyBufferToBuffer","options","_copyBufferToTexture","_copyTextureToBuffer","_copyTextureToTexture","source","destination","gl2","_options$sourceOffset","_options$destinationO","bindBuffer","COPY_READ_BUFFER","handle","COPY_WRITE_BUFFER","copyBufferSubData","sourceOffset","destinationOffset","size","Error"],"sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"sourcesContent":["import type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\n\nfunction cast<T>(value: unknown): T {\n return value as T;\n}\n\ntype CopyBufferToBufferCommand = {\n name: 'copy-buffer-to-buffer';\n options: CopyBufferToBufferOptions;\n};\n\ntype CopyBufferToTextureCommand = {\n name: 'copy-buffer-to-texture';\n options: CopyBufferToTextureOptions;\n};\n\ntype CopyTextureToBufferCommand = {\n name: 'copy-texture-to-buffer';\n options: CopyTextureToBufferOptions;\n};\n\ntype CopyTextureToTextureCommand = {\n name: 'copy-texture-to-texture';\n options: CopyTextureToTextureOptions;\n};\n\ntype Command =\n | CopyBufferToBufferCommand\n | CopyBufferToTextureCommand\n | CopyTextureToBufferCommand\n | CopyTextureToTextureCommand;\n\nexport class CommandBuffer {\n commands: Command[] = [];\n}\n\nexport function submitCommands(device: WebGLDevice, commands: Command[] = []) {\n for (const command of commands) {\n switch (command.name) {\n case 'copy-buffer-to-buffer':\n _copyBufferToBuffer(device, command.options);\n break;\n case 'copy-buffer-to-texture':\n _copyBufferToTexture(device, command.options);\n break;\n case 'copy-texture-to-buffer':\n _copyTextureToBuffer(device, command.options);\n break;\n case 'copy-texture-to-texture':\n _copyTextureToTexture(device, command.options);\n break;\n }\n }\n}\n\nfunction _copyBufferToBuffer(device: WebGLDevice, options: CopyBufferToBufferOptions): void {\n const source = cast<WEBGLBuffer>(options.source);\n const destination = cast<WEBGLBuffer>(options.destination);\n\n const {gl2} = device;\n if (gl2) {\n // In WebGL2 we can perform the copy on the GPU\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl2.bindBuffer(GL.COPY_READ_BUFFER, source.handle);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, destination.handle);\n gl2.copyBufferSubData(\n GL.COPY_READ_BUFFER,\n GL.COPY_WRITE_BUFFER,\n options.sourceOffset ?? 0,\n options.destinationOffset ?? 0,\n options.size\n );\n gl2.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n } else {\n // TODO - in WebGL1 we would have to read back to CPU\n // read / write buffer from / to CPU\n throw new Error('copyBufferToBuffer not implemented in WebGL1');\n }\n}\n\nfunction _copyBufferToTexture(device: WebGLDevice, options: CopyBufferToTextureOptions): void {}\n\nfunction _copyTextureToBuffer(device: WebGLDevice, options: CopyTextureToBufferOptions): void {}\n\nfunction _copyTextureToTexture(device: WebGLDevice, options: CopyTextureToTextureOptions): void {}\n"],"mappings":";AAMA,OAAOA,EAAE,MAAM,oBAAoB;AAInC,SAASC,IAAIA,CAAIC,KAAc,EAAK;EAClC,OAAOA,KAAK;AACd;AA4BA,OAAO,MAAMC,aAAa,CAAC;EAAAC,YAAA;IAAAC,eAAA,mBACH,EAAE;EAAA;AAC1B;AAEA,OAAO,SAASC,cAAcA,CAACC,MAAmB,EAA4B;EAAA,IAA1BC,QAAmB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAC1E,KAAK,MAAMG,OAAO,IAAIJ,QAAQ,EAAE;IAC9B,QAAQI,OAAO,CAACC,IAAI;MAClB,KAAK,uBAAuB;QAC1BC,mBAAmB,CAACP,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC5C;MACF,KAAK,wBAAwB;QAC3BC,oBAAoB,CAACT,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC7C;MACF,KAAK,wBAAwB;QAC3BE,oBAAoB,CAACV,MAAM,EAAEK,OAAO,CA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E/F,SAASG,qBAAqBA,CAACX,MAAmB,EAAEQ,OAAoC,EAAQ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CommandEncoder, CommandEncoderProps } from '@luma.gl/api';
|
|
2
2
|
import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/api';
|
|
3
|
-
import CommandBuffer from './webgl-command-buffer';
|
|
4
|
-
import WebGLDevice from '../webgl-device';
|
|
5
|
-
export
|
|
3
|
+
import { CommandBuffer } from './webgl-command-buffer';
|
|
4
|
+
import { WebGLDevice } from '../webgl-device';
|
|
5
|
+
export declare class WEBGLCommandEncoder extends CommandEncoder {
|
|
6
6
|
readonly device: WebGLDevice;
|
|
7
7
|
readonly commandBuffer: CommandBuffer;
|
|
8
8
|
constructor(device: WebGLDevice, props: CommandEncoderProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,aAAa,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,QAAQ,CAAC,aAAa,gBAAuB;gBAEjC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,mBAAmB;IAKlD,OAAO,IAAI,IAAI;IAMxB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAI5D,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;IAIvD,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAI9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAIvD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa;IAEb,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAWtD"}
|
|
@@ -1,53 +1,40 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { CommandEncoder } from '@luma.gl/api';
|
|
3
|
-
import CommandBuffer from
|
|
4
|
-
export
|
|
3
|
+
import { CommandBuffer } from "./webgl-command-buffer.js";
|
|
4
|
+
export class WEBGLCommandEncoder extends CommandEncoder {
|
|
5
5
|
constructor(device, props) {
|
|
6
6
|
super(props);
|
|
7
|
-
|
|
8
7
|
_defineProperty(this, "device", void 0);
|
|
9
|
-
|
|
10
8
|
_defineProperty(this, "commandBuffer", new CommandBuffer());
|
|
11
|
-
|
|
12
9
|
this.device = device;
|
|
13
10
|
}
|
|
14
|
-
|
|
15
11
|
destroy() {}
|
|
16
|
-
|
|
17
12
|
copyBufferToBuffer(options) {
|
|
18
13
|
this.commandBuffer.commands.push({
|
|
19
14
|
name: 'copy-buffer-to-buffer',
|
|
20
15
|
options
|
|
21
16
|
});
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
copyBufferToTexture(options) {
|
|
25
19
|
this.commandBuffer.commands.push({
|
|
26
20
|
name: 'copy-buffer-to-texture',
|
|
27
21
|
options
|
|
28
22
|
});
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
copyTextureToBuffer(options) {
|
|
32
25
|
this.commandBuffer.commands.push({
|
|
33
26
|
name: 'copy-texture-to-buffer',
|
|
34
27
|
options
|
|
35
28
|
});
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
copyTextureToTexture(options) {
|
|
39
31
|
this.commandBuffer.commands.push({
|
|
40
32
|
name: 'copy-texture-to-texture',
|
|
41
33
|
options
|
|
42
34
|
});
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
pushDebugGroup(groupLabel) {}
|
|
46
|
-
|
|
47
37
|
popDebugGroup() {}
|
|
48
|
-
|
|
49
38
|
insertDebugMarker(markerLabel) {}
|
|
50
|
-
|
|
51
39
|
}
|
|
52
|
-
;
|
|
53
40
|
//# sourceMappingURL=webgl-command-encoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgl-command-encoder.js","names":["CommandEncoder","CommandBuffer","WEBGLCommandEncoder","constructor","device","props","_defineProperty","destroy","copyBufferToBuffer","options","commandBuffer","commands","push","name","copyBufferToTexture","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps} from '@luma.gl/api';\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\n\nimport {CommandBuffer} from './webgl-command-buffer';\nimport {WebGLDevice} from '../webgl-device';\n\nexport class WEBGLCommandEncoder extends CommandEncoder {\n readonly device: WebGLDevice;\n\n readonly commandBuffer = new CommandBuffer();\n\n constructor(device: WebGLDevice, props: CommandEncoderProps) {\n super(props);\n this.device = device;\n }\n\n override destroy(): void {}\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n // finish(options?: {id?: string}): GPUCommandBuffer;\n\n copyBufferToBuffer(options: CopyBufferToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-buffer', options});\n }\n\n copyBufferToTexture(options: CopyBufferToTextureOptions) {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-texture', options});\n }\n\n copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-buffer', options});\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-texture', options});\n }\n\n override pushDebugGroup(groupLabel: string): void {}\n override popDebugGroup() {}\n\n override insertDebugMarker(markerLabel: string): void {}\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}\n"],"mappings":";AAAA,SAAQA,cAAc,QAA4B,cAAc;AAAC,SAQzDC,aAAa;AAGrB,OAAO,MAAMC,mBAAmB,SAASF,cAAc,CAAC;EAKtDG,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA,wBAHU,IAAIL,aAAa,EAAE;IAI1C,IAAI,CAACG,MAAM,GAAGA,MAAM;EACtB;EAESG,OAAOA,CAAA,EAAS,CAAC;EAM1BC,kBAAkBA,CAACC,OAAkC,EAAQ;IAC3D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,uBAAuB;MAAEJ;IAAO,CAAC,CAAC;EAC5E;EAEAK,mBAAmBA,CAACL,OAAmC,EAAE;IACvD,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,wBAAwB;MAAEJ;IAAO,CAAC,CAAC;EAC7E;EAEAM,mBAAmBA,CAACN,OAAmC,EAAQ;IAC7D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,wBAAwB;MAAEJ;IAAO,CAAC,CAAC;EAC7E;EAEAO,oBAAoBA,CAACP,OAAoC,EAAQ;IAC/D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,yBAAyB;MAAEJ;IAAO,CAAC,CAAC;EAC9E;EAESQ,cAAcA,CAACC,UAAkB,EAAQ,CAAC;EAC1CC,aAAaA,CAAA,EAAG,CAAC;EAEjBC,iBAAiBA,CAACC,WAAmB,EAAQ,CAAC;AAWzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgl-external-texture.js","names":[],"sources":["../../../src/adapter/resources/webgl-external-texture.ts"],"sourcesContent":["/*\nexport class WEBGLExternalTexture extends WEBGLTexture {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLTexture;\n\n data;\n\n width: number = undefined;\n height: number = undefined;\n depth: number = undefined;\n\n format = undefined;\n type = undefined;\n dataFormat = undefined;\n border = undefined;\n mipmaps: boolean = undefined;\n\n textureUnit: number = undefined;\n\n sampler: WEBGLSampler;\n\n // Program.draw() checks the loaded flag of all textures to avoid\n // Textures that are still loading from promises\n // Set to true as soon as texture has been initialized with valid data\n loaded = false;\n _video;\n\n readonly target: GL;\n // target cannot be modified by bind:\n // textures are special because when you first bind them to a target,\n // they get special information. When you first bind a texture as a\n // GL_TEXTURE_2D, you are actually setting special state in the texture.\n // You are saying that this texture is a 2D texture.\n // And it will always be a 2D texture; this state cannot be changed ever.\n // If you have a texture that was first bound as a GL_TEXTURE_2D,\n // you must always bind it as a GL_TEXTURE_2D;\n // attempting to bind it as GL_TEXTURE_3D will give rise to an error\n // (while run-time).\n\n static isSupported(device: WebGLDevice, options?: TextureSupportOptions): boolean {\n const {format, linearFiltering} = options;\n let supported = true;\n if (format) {\n supported = supported && isFormatSupported(device.gl, format);\n supported = supported && (!linearFiltering || isTextureFormatFilterable(device.gl, format));\n }\n return supported;\n }\n\n // eslint-disable-next-line max-statements\n constructor(device: Device | WebGLRenderingContext, props: TextureProps) {\n super(WebGLDevice.attach(device), {id: uid('texture'), ...props});\n\n this.target = getWebGLTextureTarget(props);\n\n this.device = WebGLDevice.attach(device);\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n this.handle = this.props.handle || this.gl.createTexture();\n\n let data = props.data;\n\n const isVideo = typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement;\n // @ts-expect-error\n if (isVideo && data.readyState < HTMLVideoElement.HAVE_METADATA) {\n this._video = null; // Declare member before the object is sealed\n data.addEventListener('loadeddata', () => this.initialize(props));\n return this;\n }\n\n update(): this {\n if (this._video) {\n const {video, parameters, lastTime} = this._video;\n // @ts-expect-error\n if (lastTime === video.currentTime || video.readyState < HTMLVideoElement.HAVE_CURRENT_DATA) {\n return;\n }\n this.setSubImageData({\n data: video,\n parameters\n });\n if (this.mipmaps) {\n this.generateMipmap();\n }\n this._video.lastTime = video.currentTime;\n }\n }\n\n\n*/"],"mappings":""}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import type { FramebufferProps, ColorTextureFormat } from '@luma.gl/api';
|
|
2
2
|
import { Framebuffer, Texture } from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
|
-
import WebGLDevice from '../webgl-device';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { WebGLDevice } from '../webgl-device';
|
|
5
|
+
import { WEBGLTexture } from './webgl-texture';
|
|
6
|
+
import { WEBGLRenderbuffer } from '../objects/webgl-renderbuffer';
|
|
7
7
|
export declare type TextureAttachment = [Texture, number?, number?];
|
|
8
|
-
export declare type Attachment =
|
|
8
|
+
export declare type Attachment = WEBGLTexture | WEBGLRenderbuffer | TextureAttachment;
|
|
9
9
|
/** luma.gl Framebuffer, WebGL implementation */
|
|
10
|
-
export
|
|
10
|
+
export declare class WEBGLFramebuffer extends Framebuffer {
|
|
11
11
|
device: WebGLDevice;
|
|
12
12
|
gl: WebGLRenderingContext;
|
|
13
13
|
handle: WebGLFramebuffer;
|
|
14
|
-
get texture():
|
|
15
|
-
readonly colorAttachments:
|
|
16
|
-
readonly depthStencilAttachment:
|
|
17
|
-
protected _ownResources: (
|
|
14
|
+
get texture(): WEBGLTexture;
|
|
15
|
+
readonly colorAttachments: WEBGLTexture[];
|
|
16
|
+
readonly depthStencilAttachment: WEBGLTexture | null;
|
|
17
|
+
protected _ownResources: (WEBGLTexture | WEBGLRenderbuffer)[];
|
|
18
18
|
constructor(device: WebGLDevice, props: FramebufferProps);
|
|
19
19
|
destroy(): void;
|
|
20
20
|
/** Check the status */
|
|
21
21
|
protected _checkStatus(): void;
|
|
22
|
-
_createColorAttachments():
|
|
22
|
+
_createColorAttachments(): WEBGLTexture[];
|
|
23
23
|
/** Create a color attachment */
|
|
24
|
-
protected _createColorAttachment(format: ColorTextureFormat, width: number, height: number):
|
|
24
|
+
protected _createColorAttachment(format: ColorTextureFormat, width: number, height: number): WEBGLTexture;
|
|
25
25
|
/** Create a depth stencil attachment GL.DEPTH24_STENCIL8 */
|
|
26
|
-
protected _createDepthStencilAttachment():
|
|
26
|
+
protected _createDepthStencilAttachment(): WEBGLRenderbuffer | WEBGLTexture;
|
|
27
27
|
/** Attachment resize is expected to be a noop if size is same */
|
|
28
28
|
protected _resizeAttachments(width: number, height: number): this;
|
|
29
29
|
/** Attach one attachment */
|
|
30
|
-
protected _attachOne(attachmentPoint: GL, attachment: Attachment):
|
|
31
|
-
protected
|
|
30
|
+
protected _attachOne(attachmentPoint: GL, attachment: Attachment): WEBGLTexture | WEBGLRenderbuffer;
|
|
31
|
+
protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void;
|
|
32
32
|
/**
|
|
33
33
|
* @param attachment
|
|
34
34
|
* @param texture
|
|
35
|
-
* @param layer = 0 - index into
|
|
35
|
+
* @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`
|
|
36
36
|
* @param level = 0 - mipmapLevel (must be 0 in WebGL1)
|
|
37
37
|
*/
|
|
38
|
-
protected _attachTexture(attachment: GL, texture:
|
|
38
|
+
protected _attachTexture(attachment: GL, texture: WEBGLTexture, layer: number, level: number): void;
|
|
39
39
|
}
|
|
40
40
|
//# sourceMappingURL=webgl-framebuffer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAc,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAGhE,oBAAY,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC5D,oBAAY,UAAU,GAAG,YAAY,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAE9E,iDAAiD;AACjD,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,MAAM,EAAE,WAAW,CAAC;IACpB,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