@luma.gl/webgl 9.0.0-alpha.3 → 9.0.0-alpha.30
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/LICENSE +2 -1
- package/dist/adapter/converters/device-parameters.d.ts +14 -4
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +28 -46
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts +5 -5
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +20 -56
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/converters/texture-formats.d.ts +31 -42
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +163 -178
- package/dist/adapter/converters/texture-formats.js.map +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts +2 -2
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +3 -9
- package/dist/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/adapter/device-helpers/device-features.d.ts +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.d.ts +3 -3
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +2 -5
- package/dist/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js +9 -11
- 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.d.ts +4 -4
- package/dist/adapter/helpers/attribute-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/attribute-utils.js +1 -18
- 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 +10 -7
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +101 -84
- 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 +2 -2
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +3 -33
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/helpers/uniforms.d.ts +9 -10
- package/dist/adapter/helpers/uniforms.d.ts.map +1 -1
- package/dist/adapter/helpers/uniforms.js +8 -18
- package/dist/adapter/helpers/uniforms.js.map +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts +1 -3
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +1 -28
- package/dist/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +15 -12
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +35 -41
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts +6 -9
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +19 -75
- package/dist/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +38 -11
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +122 -32
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +18 -10
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +43 -71
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +15 -9
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +169 -41
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.d.ts +7 -6
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +8 -17
- 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 +21 -24
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +41 -149
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts +19 -4
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +88 -9
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +44 -11
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +90 -152
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts +6 -5
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +7 -15
- 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 +9 -22
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts +64 -44
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +98 -213
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/webgl-canvas-context.d.ts +6 -7
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +8 -20
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +64 -41
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +133 -113
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/accessor.d.ts +3 -3
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +14 -38
- package/dist/classic/accessor.js.map +1 -1
- package/dist/classic/{buffer.d.ts → buffer-with-accessor.d.ts} +16 -28
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -0
- package/dist/classic/{buffer.js → buffer-with-accessor.js} +54 -122
- package/dist/classic/buffer-with-accessor.js.map +1 -0
- package/dist/classic/clear.d.ts +22 -0
- package/dist/classic/clear.d.ts.map +1 -0
- package/dist/classic/clear.js +88 -0
- package/dist/classic/clear.js.map +1 -0
- package/dist/classic/copy-and-blit.d.ts +62 -0
- package/dist/classic/copy-and-blit.d.ts.map +1 -0
- package/dist/classic/copy-and-blit.js +202 -0
- package/dist/classic/copy-and-blit.js.map +1 -0
- package/dist/classic/format-utils.d.ts +3 -0
- package/dist/classic/format-utils.d.ts.map +1 -0
- package/dist/classic/format-utils.js +38 -0
- package/dist/classic/format-utils.js.map +1 -0
- package/dist/classic/typed-array-utils.d.ts +15 -17
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +1 -21
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/context/context/create-browser-context.d.ts +40 -0
- package/dist/context/context/create-browser-context.d.ts.map +1 -0
- package/dist/{esm/context/context/create-context.js → context/context/create-browser-context.js} +23 -19
- 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 +1 -4
- package/dist/context/context/webgl-checks.js.map +1 -1
- 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 +8 -20
- package/dist/context/debug/spector.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts +2 -2
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +11 -34
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts +8 -7
- 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 +105 -106
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +18 -36
- 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 +4 -9
- package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/context/polyfill/polyfill-context.js +21 -29
- 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 +10 -32
- 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 +16 -51
- 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 +10158 -0
- package/dist/index.cjs +6604 -0
- package/dist/index.d.ts +25 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -26
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist.min.js +37 -0
- package/package.json +21 -9
- package/src/adapter/converters/device-parameters.ts +88 -35
- package/src/adapter/converters/sampler-parameters.ts +19 -9
- package/src/adapter/converters/texture-formats.ts +261 -178
- package/src/adapter/converters/vertex-formats.ts +3 -2
- package/src/adapter/device-helpers/device-features.ts +10 -3
- package/src/adapter/device-helpers/device-limits.ts +3 -3
- package/src/adapter/device-helpers/get-device-info.ts +14 -10
- package/src/adapter/helpers/attribute-utils.ts +4 -5
- package/src/adapter/helpers/get-shader-info.ts +40 -0
- package/src/adapter/helpers/get-shader-layout.ts +150 -68
- package/src/adapter/helpers/parse-shader-compiler-log.ts +2 -2
- package/src/adapter/helpers/set-uniform.ts +7 -6
- package/src/adapter/helpers/uniforms.ts +23 -13
- package/src/adapter/objects/constants-to-keys.ts +3 -25
- package/src/adapter/objects/webgl-renderbuffer.ts +40 -37
- package/src/adapter/objects/webgl-resource.ts +14 -23
- package/src/adapter/objects/webgl-vertex-array-object.ts +201 -37
- package/src/adapter/resources/webgl-buffer.ts +56 -58
- package/src/adapter/resources/webgl-command-buffer.ts +332 -25
- package/src/adapter/resources/webgl-command-encoder.ts +16 -11
- package/src/adapter/resources/webgl-external-texture.ts +2 -2
- package/src/adapter/resources/webgl-framebuffer.ts +88 -133
- package/src/adapter/resources/webgl-render-pass.ts +155 -4
- package/src/adapter/resources/webgl-render-pipeline.ts +161 -104
- package/src/adapter/resources/webgl-sampler.ts +13 -8
- package/src/adapter/resources/webgl-shader.ts +11 -10
- package/src/adapter/resources/webgl-texture.ts +113 -85
- package/src/adapter/webgl-canvas-context.ts +14 -14
- package/src/adapter/webgl-device.ts +192 -77
- package/src/classic/accessor.ts +4 -17
- package/src/classic/{buffer.ts → buffer-with-accessor.ts} +67 -75
- package/src/classic/clear.ts +110 -0
- package/src/classic/copy-and-blit.ts +308 -0
- package/src/classic/format-utils.ts +43 -0
- package/src/classic/typed-array-utils.ts +18 -27
- package/src/context/context/{create-context.ts → create-browser-context.ts} +48 -31
- package/src/context/context/create-headless-context.ts +48 -0
- package/src/context/context/webgl-checks.ts +1 -1
- package/src/context/debug/spector.ts +7 -6
- package/src/context/debug/webgl-developer-tools.ts +21 -15
- package/src/context/parameters/unified-parameter-api.ts +20 -14
- package/src/context/parameters/webgl-parameter-tables.ts +117 -98
- package/src/context/polyfill/context-data.ts +27 -0
- package/src/context/polyfill/get-parameter-polyfill.ts +8 -7
- package/src/context/polyfill/polyfill-context.ts +7 -9
- package/src/context/polyfill/polyfill-table.ts +18 -16
- package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
- package/src/context/state-tracker/track-context-state.ts +14 -13
- package/src/context/state-tracker/with-parameters.ts +8 -2
- package/src/index.ts +42 -33
- package/dist/adapter/converters/renderbuffer-formats.d.ts +0 -16
- package/dist/adapter/converters/renderbuffer-formats.d.ts.map +0 -1
- package/dist/adapter/converters/renderbuffer-formats.js +0 -185
- package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
- 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/classic/buffer.d.ts.map +0 -1
- package/dist/classic/buffer.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 +0 -41
- package/dist/context/context/create-context.d.ts.map +0 -1
- package/dist/context/context/create-context.js +0 -49
- 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.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/dist/types/webgl.d.ts +0 -144
- package/dist/types/webgl.d.ts.map +0 -1
- package/dist/types/webgl.js +0 -2
- package/dist/types/webgl.js.map +0 -1
- package/src/adapter/converters/renderbuffer-formats.ts +0 -92
- 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
- package/src/types/webgl.ts +0 -283
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-with-accessor.js","names":["assert","checkProps","GL","assertWebGL2Context","Accessor","getGLTypeFromTypedArray","getTypedArrayFromGLType","WebGLDevice","WEBGLBuffer","DEBUG_DATA_LENGTH","DEPRECATED_PROPS","offset","stride","type","size","divisor","normalized","integer","instanced","isInstanced","PROP_CHECKS_INITIALIZE","removedProps","replacedProps","bytes","deprecatedProps","PROP_CHECKS_SET_PROPS","getWEBGLBufferProps","props","ArrayBuffer","isView","data","byteLength","bufferProps","BufferWithAccessor","constructor","device","arguments","length","undefined","attach","_defineProperty","setAccessor","Object","assign","accessor","seal","getElementCount","Math","round","getBytesPerElement","getVertexCount","getBytesPerVertex","initialize","Number","isFinite","glUsage","STATIC_DRAW","debugData","_setData","byteOffset","_setByteLength","setProps","buffer","reallocate","bytesUsed","setData","subData","options","srcOffset","glTarget","gl","webgl2","COPY_WRITE_BUFFER","bindBuffer","handle","bufferSubData","_inferType","copyData","sourceBuffer","readOffset","writeOffset","gl2","COPY_READ_BUFFER","copyBufferSubData","getData","_this$gl","dstData","srcByteOffset","dstOffset","ArrayType","FLOAT","clamped","sourceAvailableElementCount","_getAvailableElementCount","dstElementOffset","dstAvailableElementCount","dstElementCount","min","copyElementCount","getBufferSubData","bind","index","UNIFORM_BUFFER","TRANSFORM_FEEDBACK_BUFFER","_this$gl2","bindBufferRange","_this$gl3","bindBufferBase","unbind","isIndexedBuffer","_this$gl4","getDebugData","changed","invalidateDebugData","trackDeallocatedMemory","target","_getTarget","bufferData","slice","trackAllocatedMemory","Float32Array","sourceElementOffset","BYTES_PER_ELEMENT","getParameter","pname","value","getBufferParameter"],"sources":["../../src/classic/buffer-with-accessor.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, BufferProps, TypedArray} from '@luma.gl/core';\nimport {assert, checkProps} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {assertWebGL2Context} from '../context/context/webgl-checks';\nimport {AccessorObject} from '../types';\nimport {Accessor} from './accessor';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\n\nimport {WebGLDevice} from '../adapter/webgl-device';\nimport {WEBGLBuffer} from '../adapter/resources/webgl-buffer';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n// Shared prop checks for constructor and setProps\nconst DEPRECATED_PROPS = {\n offset: 'accessor.offset',\n stride: 'accessor.stride',\n type: 'accessor.type',\n size: 'accessor.size',\n divisor: 'accessor.divisor',\n normalized: 'accessor.normalized',\n integer: 'accessor.integer',\n instanced: 'accessor.divisor',\n isInstanced: 'accessor.divisor'\n};\n\n// Prop checks for constructor\nconst PROP_CHECKS_INITIALIZE = {\n removedProps: {},\n replacedProps: {\n bytes: 'byteLength'\n },\n // new Buffer() with individual accessor props is still used in apps, emit warnings\n deprecatedProps: DEPRECATED_PROPS\n};\n\n// Prop checks for setProps\nconst PROP_CHECKS_SET_PROPS = {\n // Buffer.setProps() with individual accessor props is rare => emit errors\n removedProps: DEPRECATED_PROPS\n};\n\nfunction getWEBGLBufferProps(props: BufferWithAccessorProps | ArrayBufferView | number): BufferProps {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n return {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n else if (typeof props === 'number') {\n return {byteLength: props };\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n const bufferProps = {...props };\n // if (bufferProps.offset) {\n // bufferProps.byteOffset = bufferProps.offset;\n // }\n return bufferProps;\n}\n\n/** WebGL Buffer interface */\nexport type BufferWithAccessorProps = BufferProps & {\n handle?: WebGLBuffer;\n\n accessor?: AccessorObject;\n\n // target?: number;\n // glUsage?: number;\n // /** @deprecated */\n // index?: number;\n // /** @deprecated */\n // offset?: number;\n // /** @deprecated */\n // size?: number;\n // /** @deprecated */\n // type?: number\n}\n\n/** WebGL Buffer interface */\nexport class BufferWithAccessor extends WEBGLBuffer {\n usage: number;\n accessor: Accessor;\n\n constructor(device: Device | WebGLRenderingContext, props?: BufferWithAccessorProps);\n constructor(device: Device | WebGLRenderingContext, data: ArrayBufferView | number[]);\n constructor(device: Device | WebGLRenderingContext, byteLength: number);\n\n constructor(device: Device | WebGLRenderingContext, props = {}) {\n super(WebGLDevice.attach(device), getWEBGLBufferProps(props));\n\n // Base class initializes\n // this.initialize(props);\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, (props as BufferWithAccessorProps).accessor));\n\n // infer GL type from supplied typed array\n if (this.props.data) {\n const type = getGLTypeFromTypedArray(this.props.data as TypedArray);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n }\n\n Object.seal(this);\n }\n\n // override write(data: TypedArray, byteOffset: number = 0): void {\n // this.subData({data, offset: byteOffset});\n // }\n\n // returns number of elements in the buffer (assuming that the full buffer is used)\n getElementCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerElement(accessor));\n }\n\n // returns number of vertices in the buffer (assuming that the full buffer is used)\n getVertexCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerVertex(accessor));\n }\n\n // Creates and initializes the buffer object's data store.\n // Signature: `new Buffer(gl, {data: new Float32Array(...)})`\n // Signature: `new Buffer(gl, new Float32Array(...))`\n // Signature: `new Buffer(gl, 100)`\n initialize(props: BufferWithAccessorProps = {}): this {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n props = {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n if (Number.isFinite(props)) {\n // @ts-expect-error\n props = {byteLength: props};\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n\n // Initialize member fields\n // @ts-expect-error readonly field\n this.glUsage = props.glUsage || GL.STATIC_DRAW;\n this.debugData = null;\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, props.accessor));\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._setData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._setByteLength(props.byteLength || 0);\n }\n\n return this;\n }\n\n setProps(props: BufferWithAccessorProps): this {\n props = checkProps('Buffer', props, PROP_CHECKS_SET_PROPS);\n\n if ('accessor' in props) {\n this.setAccessor(props.accessor);\n }\n\n return this;\n }\n\n // Optionally stores an accessor with the buffer, makes it easier to use it as an attribute later\n // {type, size = 1, offset = 0, stride = 0, normalized = false, integer = false, divisor = 0}\n setAccessor(accessor: AccessorObject | Accessor): this {\n // NOTE: From luma.gl v7.0, Accessors have an optional `buffer `field\n // (mainly to support \"interleaving\")\n // To avoid confusion, ensure `buffer.accessor` does not have a `buffer.accessor.buffer` field:\n accessor = Object.assign({}, accessor);\n // @ts-expect-error\n delete accessor.buffer;\n\n // This new statement ensures that an \"accessor object\" is re-packaged as an Accessor instance\n this.accessor = new Accessor(accessor);\n return this;\n }\n\n // Allocate a bigger GPU buffer (if the current buffer is not big enough).\n // If a reallocation is triggered it clears the buffer\n // Returns:\n // `true`: buffer was reallocated, data was cleared\n // `false`: buffer was big enough, data is intact\n reallocate(byteLength: number): boolean {\n if (byteLength > this.byteLength) {\n this._setByteLength(byteLength);\n return true;\n }\n this.bytesUsed = byteLength;\n return false;\n }\n\n // Update with new data. Reinitializes the buffer\n setData(props: BufferWithAccessorProps) {\n return this.initialize(props);\n }\n\n // Updates a subset of a buffer object's data store.\n // Data (Typed Array or ArrayBuffer), length is inferred unless provided\n // Offset into buffer\n // WebGL2 only: Offset into srcData\n // WebGL2 only: Number of bytes to be copied\n subData(options: TypedArray | {data: TypedArray, offset?: number; srcOffset?: number; byteLength?: number, length?: number}) {\n // Signature: buffer.subData(new Float32Array([...]))\n if (ArrayBuffer.isView(options)) {\n options = {data: options};\n }\n\n const {data, offset = 0, srcOffset = 0} = options;\n const byteLength = options.byteLength || options.length;\n\n assert(data);\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 // @ts-expect-error\n const glTarget = this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n this.gl.bindBuffer(glTarget, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n assertWebGL2Context(this.gl);\n // @ts-expect-error\n this.gl.bufferSubData(this.glTarget, offset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(glTarget, offset, data);\n }\n this.gl.bindBuffer(glTarget, null);\n\n // TODO - update local `data` if offsets are right\n this.debugData = null;\n\n this._inferType(data);\n\n return this;\n }\n\n /**\n * Copies part of the data of another buffer into this buffer\n * @note WEBGL2 ONLY\n */\n copyData(options: {\n sourceBuffer: any;\n readOffset?: number;\n writeOffset?: number;\n size: any;\n }): this {\n const {sourceBuffer, readOffset = 0, writeOffset = 0, size} = options;\n const {gl, gl2} = this;\n assertWebGL2Context(gl);\n\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl.bindBuffer(GL.COPY_READ_BUFFER, sourceBuffer.handle);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, this.handle);\n gl2?.copyBufferSubData(GL.COPY_READ_BUFFER, GL.COPY_WRITE_BUFFER, readOffset, writeOffset, size);\n gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n this.debugData = null;\n\n return this;\n }\n\n /**\n * Reads data from buffer into an ArrayBufferView or SharedArrayBuffer.\n * @note WEBGL2 ONLY\n */\n override getData(options?: {\n dstData?: any;\n srcByteOffset?: number;\n dstOffset?: number;\n length?: number;\n }): any {\n let {dstData = null, length = 0} = options || {};\n const {srcByteOffset = 0, dstOffset = 0} = options || {};\n assertWebGL2Context(this.gl);\n\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);\n\n const dstElementOffset = dstOffset;\n\n let dstAvailableElementCount;\n let dstElementCount;\n if (dstData) {\n dstElementCount = dstData.length;\n dstAvailableElementCount = dstElementCount - dstElementOffset;\n } else {\n // Allocate ArrayBufferView with enough size to copy all eligible data.\n dstAvailableElementCount = Math.min(\n sourceAvailableElementCount,\n length || sourceAvailableElementCount\n );\n dstElementCount = dstElementOffset + dstAvailableElementCount;\n }\n\n const copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount);\n length = length || copyElementCount;\n assert(length <= copyElementCount);\n dstData = dstData || new ArrayType(dstElementCount);\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, srcByteOffset, dstData, dstOffset, length);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n return dstData;\n }\n\n /**\n * Binds a buffer to a given binding point (target).\n * GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER take an index, and optionally a range.\n * - GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER need an index to affect state\n * - GL.UNIFORM_BUFFER: `offset` must be aligned to GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT.\n * - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA.\n */\n bind(options?: {glTarget?: number; index?: any; offset?: number; size?: any}): this {\n const {\n glTarget = this.glTarget, // target for the bind operation\n index = this.accessor && this.accessor.index, // index = index of target (indexed bind point)\n offset = 0,\n size\n } = options || {};\n // NOTE: While GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER could\n // be used as direct binding points, they will not affect transform feedback or\n // uniform buffer state. Instead indexed bindings need to be made.\n if (glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER) {\n if (size !== undefined) {\n this.gl2?.bindBufferRange(glTarget, index, this.handle, offset, size);\n } else {\n assert(offset === 0); // Make sure offset wasn't supplied\n this.gl2?.bindBufferBase(glTarget, index, this.handle);\n }\n } else {\n this.gl.bindBuffer(glTarget, this.handle);\n }\n\n return this;\n }\n\n unbind(options?: {glTarget?: any; index?: any}): this {\n const {glTarget = this.glTarget, index = this.accessor && this.accessor.index} = options || {};\n const isIndexedBuffer = glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER;\n if (isIndexedBuffer) {\n this.gl2?.bindBufferBase(glTarget, index, null);\n } else {\n this.gl.bindBuffer(glTarget, null);\n }\n return this;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n // Returns a short initial data array\n getDebugData(): {\n data: any;\n changed: boolean;\n } {\n if (!this.debugData) {\n this.debugData = this.getData({length: Math.min(DEBUG_DATA_LENGTH, this.byteLength)});\n return {data: this.debugData, changed: true};\n }\n return {data: this.debugData, changed: false};\n }\n\n invalidateDebugData() {\n this.debugData = null;\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _setData(data, offset: number = 0, byteLength: number = data.byteLength + offset): this {\n assert(ArrayBuffer.isView(data));\n\n this.trackDeallocatedMemory();\n\n const target = this._getTarget();\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.glUsage);\n this.gl.bufferSubData(target, offset, 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 // infer GL type from supplied typed array\n const type = getGLTypeFromTypedArray(data);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _setByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n this.trackDeallocatedMemory();\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 glTarget = this._getTarget();\n this.gl.bindBuffer(glTarget, this.handle);\n this.gl.bufferData(glTarget, data, this.glUsage);\n this.gl.bindBuffer(glTarget, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\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 _getTarget() {\n // @ts-expect-error\n return this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n }\n\n _getAvailableElementCount(srcByteOffset: number) {\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;\n return this.getElementCount() - sourceElementOffset;\n }\n\n // Automatically infers type from typed array passed to setData\n // Note: No longer that useful, since type is now autodeduced from the compiled shaders\n _inferType(data) {\n if (!this.accessor.type) {\n this.setAccessor(new Accessor(this.accessor, {type: getGLTypeFromTypedArray(data)}));\n }\n }\n\n // RESOURCE METHODS\n\n getParameter(pname: GL): any {\n this.gl.bindBuffer(this.glTarget, this.handle);\n const value = this.gl.getBufferParameter(this.glTarget, pname);\n this.gl.bindBuffer(this.glTarget, null);\n return value;\n }\n\n // DEPRECATIONS - v7.0\n /** @deprecated Use Buffer.accessor.type */\n get type() {\n return this.accessor.type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AAQ,EAAE,IAAI,CAACK,MAAM,CAAC;IAC9C,MAAMmD,KAAK,GAAG,IAAI,CAACvD,EAAE,CAACwD,kBAAkB,CAAC,IAAI,CAACzD,QAAQ,EAAEuD,KAAK,CAAC;IAC9D,IAAI,CAACtD,EAAE,CAACG,UAAU,CAAC,IAAI,CAACJ,QAAQ,EAAE,IAAI,CAAC;IACvC,OAAOwD,KAAK;EACd;EAIA,IAAIhH,IAAIA,CAAA,EAAG;IACT,OAAO,IAAI,CAAC+B,QAAQ,CAAC/B,IAAI;EAC3B;AACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Device, Framebuffer } from '@luma.gl/core';
|
|
2
|
+
/**
|
|
3
|
+
* Optionally clears depth, color and stencil buffers
|
|
4
|
+
* @deprecated Set clear color when creating a RenderPass.
|
|
5
|
+
*/
|
|
6
|
+
export declare function clear(gl: Device | WebGLRenderingContext, options?: {
|
|
7
|
+
framebuffer?: Framebuffer;
|
|
8
|
+
color?: any;
|
|
9
|
+
depth?: any;
|
|
10
|
+
stencil?: any;
|
|
11
|
+
}): void;
|
|
12
|
+
/**
|
|
13
|
+
* WebGL2 - clear a specific drawing buffer
|
|
14
|
+
* @deprecated Set clear color when creating a RenderPass
|
|
15
|
+
*/
|
|
16
|
+
export declare function clearBuffer(gl: Device | WebGLRenderingContext, options?: {
|
|
17
|
+
framebuffer?: Framebuffer;
|
|
18
|
+
buffer?: any;
|
|
19
|
+
drawBuffer?: any;
|
|
20
|
+
value?: any;
|
|
21
|
+
}): void;
|
|
22
|
+
//# sourceMappingURL=clear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../src/classic/clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAS,MAAM,eAAe,CAAC;AAiB1D;;;GAGG;AACH,wBAAgB,KAAK,CACnB,EAAE,EAAE,MAAM,GAAG,qBAAqB,EAClC,OAAO,CAAC,EAAE;IAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAA;CAAC,GAC7E,IAAI,CAsCN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,GAAG,qBAAqB,EAClC,OAAO,CAAC,EAAE;IAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAA;CAAC,QAuCnF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { assert } from '@luma.gl/core';
|
|
2
|
+
import { WebGLDevice } from "../adapter/webgl-device.js";
|
|
3
|
+
import { withParameters } from "../context/state-tracker/with-parameters.js";
|
|
4
|
+
const GL_DEPTH_BUFFER_BIT = 0x00000100;
|
|
5
|
+
const GL_STENCIL_BUFFER_BIT = 0x00000400;
|
|
6
|
+
const GL_COLOR_BUFFER_BIT = 0x00004000;
|
|
7
|
+
const GL_COLOR = 0x1800;
|
|
8
|
+
const GL_DEPTH = 0x1801;
|
|
9
|
+
const GL_STENCIL = 0x1802;
|
|
10
|
+
const GL_DEPTH_STENCIL = 0x84f9;
|
|
11
|
+
const ERR_ARGUMENTS = 'clear: bad arguments';
|
|
12
|
+
export function clear(gl, options) {
|
|
13
|
+
const device = WebGLDevice.attach(gl);
|
|
14
|
+
const {
|
|
15
|
+
framebuffer = null,
|
|
16
|
+
color = null,
|
|
17
|
+
depth = null,
|
|
18
|
+
stencil = null
|
|
19
|
+
} = options || {};
|
|
20
|
+
const parameters = {};
|
|
21
|
+
if (framebuffer) {
|
|
22
|
+
parameters.framebuffer = framebuffer;
|
|
23
|
+
}
|
|
24
|
+
let clearFlags = 0;
|
|
25
|
+
if (color) {
|
|
26
|
+
clearFlags |= GL_COLOR_BUFFER_BIT;
|
|
27
|
+
if (color !== true) {
|
|
28
|
+
parameters.clearColor = color;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (depth) {
|
|
32
|
+
clearFlags |= GL_DEPTH_BUFFER_BIT;
|
|
33
|
+
if (depth !== true) {
|
|
34
|
+
parameters.clearDepth = depth;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (stencil) {
|
|
38
|
+
clearFlags |= GL_STENCIL_BUFFER_BIT;
|
|
39
|
+
if (depth !== true) {
|
|
40
|
+
parameters.clearStencil = depth;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
assert(clearFlags !== 0, ERR_ARGUMENTS);
|
|
44
|
+
withParameters(device.gl, parameters, () => {
|
|
45
|
+
device.gl.clear(clearFlags);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function clearBuffer(gl, options) {
|
|
49
|
+
const device = WebGLDevice.attach(gl);
|
|
50
|
+
const {
|
|
51
|
+
framebuffer = null,
|
|
52
|
+
buffer = GL_COLOR,
|
|
53
|
+
drawBuffer = 0,
|
|
54
|
+
value = [0, 0, 0, 0]
|
|
55
|
+
} = options || {};
|
|
56
|
+
withParameters(device.gl2, {
|
|
57
|
+
framebuffer
|
|
58
|
+
}, () => {
|
|
59
|
+
switch (buffer) {
|
|
60
|
+
case GL_COLOR:
|
|
61
|
+
switch (value.constructor) {
|
|
62
|
+
case Int32Array:
|
|
63
|
+
device.gl2.clearBufferiv(buffer, drawBuffer, value);
|
|
64
|
+
break;
|
|
65
|
+
case Uint32Array:
|
|
66
|
+
device.gl2.clearBufferuiv(buffer, drawBuffer, value);
|
|
67
|
+
break;
|
|
68
|
+
case Float32Array:
|
|
69
|
+
default:
|
|
70
|
+
device.gl2.clearBufferfv(buffer, drawBuffer, value);
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
case GL_DEPTH:
|
|
74
|
+
device.gl2.clearBufferfv(GL_DEPTH, 0, [value]);
|
|
75
|
+
break;
|
|
76
|
+
case GL_STENCIL:
|
|
77
|
+
device.gl2.clearBufferiv(GL_STENCIL, 0, [value]);
|
|
78
|
+
break;
|
|
79
|
+
case GL_DEPTH_STENCIL:
|
|
80
|
+
const [depth, stencil] = value;
|
|
81
|
+
device.gl2.clearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
assert(false, ERR_ARGUMENTS);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=clear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear.js","names":["assert","WebGLDevice","withParameters","GL_DEPTH_BUFFER_BIT","GL_STENCIL_BUFFER_BIT","GL_COLOR_BUFFER_BIT","GL_COLOR","GL_DEPTH","GL_STENCIL","GL_DEPTH_STENCIL","ERR_ARGUMENTS","clear","gl","options","device","attach","framebuffer","color","depth","stencil","parameters","clearFlags","clearColor","clearDepth","clearStencil","clearBuffer","buffer","drawBuffer","value","gl2","constructor","Int32Array","clearBufferiv","Uint32Array","clearBufferuiv","Float32Array","clearBufferfv","clearBufferfi"],"sources":["../../src/classic/clear.ts"],"sourcesContent":["import {Device, Framebuffer, assert} from '@luma.gl/core';\nimport {WebGLDevice} from '../adapter/webgl-device';\nimport {withParameters} from '../context/state-tracker/with-parameters';\n\n// Should collapse during minification\nconst GL_DEPTH_BUFFER_BIT = 0x00000100;\nconst GL_STENCIL_BUFFER_BIT = 0x00000400;\nconst GL_COLOR_BUFFER_BIT = 0x00004000;\n\nconst GL_COLOR = 0x1800;\nconst GL_DEPTH = 0x1801;\nconst GL_STENCIL = 0x1802;\nconst GL_DEPTH_STENCIL = 0x84f9;\n\n// Should disappear if asserts are removed\nconst ERR_ARGUMENTS = 'clear: bad arguments';\n\n/** \n * Optionally clears depth, color and stencil buffers \n * @deprecated Set clear color when creating a RenderPass.\n */\nexport function clear(\n gl: Device | WebGLRenderingContext,\n options?: {framebuffer?: Framebuffer; color?: any; depth?: any; stencil?: any}\n): void {\n const device = WebGLDevice.attach(gl);\n const {framebuffer = null, color = null, depth = null, stencil = null} = options || {};\n const parameters: any = {};\n\n if (framebuffer) {\n parameters.framebuffer = framebuffer;\n }\n\n let clearFlags = 0;\n\n if (color) {\n clearFlags |= GL_COLOR_BUFFER_BIT;\n if (color !== true) {\n parameters.clearColor = color;\n }\n }\n\n if (depth) {\n clearFlags |= GL_DEPTH_BUFFER_BIT;\n if (depth !== true) {\n parameters.clearDepth = depth;\n }\n }\n\n if (stencil) {\n clearFlags |= GL_STENCIL_BUFFER_BIT;\n if (depth !== true) {\n parameters.clearStencil = depth;\n }\n }\n\n assert(clearFlags !== 0, ERR_ARGUMENTS);\n\n // Temporarily set any clear \"colors\" and call clear\n withParameters(device.gl, parameters, () => {\n device.gl.clear(clearFlags);\n });\n}\n\n/** \n * WebGL2 - clear a specific drawing buffer \n * @deprecated Set clear color when creating a RenderPass\n */\nexport function clearBuffer(\n gl: Device | WebGLRenderingContext,\n options?: {framebuffer?: Framebuffer; buffer?: any; drawBuffer?: any; value?: any}\n) {\n const device = WebGLDevice.attach(gl);\n\n const {framebuffer = null, buffer = GL_COLOR, drawBuffer = 0, value = [0, 0, 0, 0]} = options || {};\n withParameters(device.gl2, {framebuffer}, () => {\n // Method selection per OpenGL ES 3 docs\n switch (buffer) {\n case GL_COLOR:\n switch (value.constructor) {\n case Int32Array:\n device.gl2.clearBufferiv(buffer, drawBuffer, value);\n break;\n case Uint32Array:\n device.gl2.clearBufferuiv(buffer, drawBuffer, value);\n break;\n case Float32Array:\n default:\n device.gl2.clearBufferfv(buffer, drawBuffer, value);\n }\n break;\n\n case GL_DEPTH:\n device.gl2.clearBufferfv(GL_DEPTH, 0, [value]);\n break;\n\n case GL_STENCIL:\n device.gl2.clearBufferiv(GL_STENCIL, 0, [value]);\n break;\n\n case GL_DEPTH_STENCIL:\n const [depth, stencil] = value;\n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Aa,CAACxB,UAAU,EAAE,CAAC,EAAE,CAACoB,KAAK,CAAC,CAAC;QAChD;MAEF,KAAKnB,gBAAgB;QACnB,MAAM,CAACS,KAAK,EAAEC,OAAO,CAAC,GAAGS,KAAK;QAC9Bd,MAAM,CAACe,GAAG,CAACQ,aAAa,CAAC5B,gBAAgB,EAAE,CAAC,EAAES,KAAK,EAAEC,OAAO,CAAC;QAC7D;MAEF;QACEnB,MAAM,CAAC,KAAK,EAAEU,aAAa,CAAC;IAChC;EACF,CAAC,CAAC;AACJ"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Texture, Framebuffer, FramebufferProps } from '@luma.gl/core';
|
|
2
|
+
import { GL } from '@luma.gl/constants';
|
|
3
|
+
import { BufferWithAccessor as Buffer } from './buffer-with-accessor';
|
|
4
|
+
/**
|
|
5
|
+
* Copies data from a type or a Texture object into ArrayBuffer object.
|
|
6
|
+
* App can provide targetPixelArray or have it auto allocated by this method
|
|
7
|
+
* newly allocated by this method unless provided by app.
|
|
8
|
+
* @deprecated Use CommandEncoder.copyTextureToBuffer and Buffer.read
|
|
9
|
+
* @note Slow requires roundtrip to GPU
|
|
10
|
+
*
|
|
11
|
+
* @param source
|
|
12
|
+
* @param options
|
|
13
|
+
* @returns pixel array,
|
|
14
|
+
*/
|
|
15
|
+
export declare function readPixelsToArray(source: Framebuffer | Texture, options?: {
|
|
16
|
+
sourceX?: number;
|
|
17
|
+
sourceY?: number;
|
|
18
|
+
sourceFormat?: number;
|
|
19
|
+
sourceAttachment?: number;
|
|
20
|
+
target?: Uint8Array | Uint16Array | Float32Array;
|
|
21
|
+
sourceWidth?: number;
|
|
22
|
+
sourceHeight?: number;
|
|
23
|
+
sourceType?: number;
|
|
24
|
+
}): Uint8Array | Uint16Array | Float32Array;
|
|
25
|
+
/**
|
|
26
|
+
* Copies data from a Framebuffer or a Texture object into a Buffer object.
|
|
27
|
+
* NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.
|
|
28
|
+
* @deprecated Use CommandEncoder
|
|
29
|
+
* @param source
|
|
30
|
+
* @param options
|
|
31
|
+
*/
|
|
32
|
+
export declare function readPixelsToBuffer(source: Framebuffer | Texture, options?: {
|
|
33
|
+
sourceX?: number;
|
|
34
|
+
sourceY?: number;
|
|
35
|
+
sourceFormat?: number;
|
|
36
|
+
target?: Buffer;
|
|
37
|
+
targetByteOffset?: number;
|
|
38
|
+
sourceWidth?: number;
|
|
39
|
+
sourceHeight?: number;
|
|
40
|
+
sourceType?: number;
|
|
41
|
+
}): Buffer;
|
|
42
|
+
/**
|
|
43
|
+
* Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)
|
|
44
|
+
* @deprecated Use CommandEncoder
|
|
45
|
+
*/
|
|
46
|
+
export declare function copyToTexture(source: Framebuffer | Texture, target: Texture | GL, options?: {
|
|
47
|
+
sourceX?: number;
|
|
48
|
+
sourceY?: number;
|
|
49
|
+
targetX?: number;
|
|
50
|
+
targetY?: number;
|
|
51
|
+
targetZ?: number;
|
|
52
|
+
targetMipmaplevel?: number;
|
|
53
|
+
targetInternalFormat?: number;
|
|
54
|
+
width?: number;
|
|
55
|
+
height?: number;
|
|
56
|
+
}): Texture;
|
|
57
|
+
/**
|
|
58
|
+
* Wraps a given texture into a framebuffer object, that can be further used
|
|
59
|
+
* to read data from the texture object.
|
|
60
|
+
*/
|
|
61
|
+
export declare function toFramebuffer(texture: Texture, props?: FramebufferProps): Framebuffer;
|
|
62
|
+
//# sourceMappingURL=copy-and-blit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-and-blit.d.ts","sourceRoot":"","sources":["../../src/classic/copy-and-blit.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAC,kBAAkB,IAAI,MAAM,EAAC,MAAM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CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAgGT;AAYD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAarF"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { assert, Texture, Framebuffer } from '@luma.gl/core';
|
|
2
|
+
import { GL } from '@luma.gl/constants';
|
|
3
|
+
import { BufferWithAccessor as Buffer } from "./buffer-with-accessor.js";
|
|
4
|
+
import { withParameters } from "../context/state-tracker/with-parameters.js";
|
|
5
|
+
import { getGLTypeFromTypedArray, getTypedArrayFromGLType } from "./typed-array-utils.js";
|
|
6
|
+
import { glFormatToComponents, glTypeToBytes } from "./format-utils.js";
|
|
7
|
+
export function readPixelsToArray(source, options) {
|
|
8
|
+
const {
|
|
9
|
+
sourceX = 0,
|
|
10
|
+
sourceY = 0,
|
|
11
|
+
sourceFormat = GL.RGBA
|
|
12
|
+
} = options || {};
|
|
13
|
+
let {
|
|
14
|
+
sourceAttachment = GL.COLOR_ATTACHMENT0,
|
|
15
|
+
target = null,
|
|
16
|
+
sourceWidth,
|
|
17
|
+
sourceHeight,
|
|
18
|
+
sourceType
|
|
19
|
+
} = options || {};
|
|
20
|
+
const {
|
|
21
|
+
framebuffer,
|
|
22
|
+
deleteFramebuffer
|
|
23
|
+
} = getFramebuffer(source);
|
|
24
|
+
assert(framebuffer);
|
|
25
|
+
const {
|
|
26
|
+
gl,
|
|
27
|
+
handle
|
|
28
|
+
} = framebuffer;
|
|
29
|
+
sourceWidth = sourceWidth || framebuffer.width;
|
|
30
|
+
sourceHeight = sourceHeight || framebuffer.height;
|
|
31
|
+
if (sourceAttachment === GL.COLOR_ATTACHMENT0 && handle === null) {
|
|
32
|
+
sourceAttachment = GL.FRONT;
|
|
33
|
+
}
|
|
34
|
+
const attachment = sourceAttachment - GL.COLOR_ATTACHMENT0;
|
|
35
|
+
sourceType = sourceType || framebuffer.colorAttachments[attachment].type;
|
|
36
|
+
target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);
|
|
37
|
+
sourceType = sourceType || getGLTypeFromTypedArray(target);
|
|
38
|
+
const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, handle);
|
|
39
|
+
gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);
|
|
40
|
+
gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
41
|
+
if (deleteFramebuffer) {
|
|
42
|
+
framebuffer.destroy();
|
|
43
|
+
}
|
|
44
|
+
return target;
|
|
45
|
+
}
|
|
46
|
+
export function readPixelsToBuffer(source, options) {
|
|
47
|
+
const {
|
|
48
|
+
sourceX = 0,
|
|
49
|
+
sourceY = 0,
|
|
50
|
+
sourceFormat = GL.RGBA,
|
|
51
|
+
targetByteOffset = 0
|
|
52
|
+
} = options || {};
|
|
53
|
+
let {
|
|
54
|
+
target,
|
|
55
|
+
sourceWidth,
|
|
56
|
+
sourceHeight,
|
|
57
|
+
sourceType
|
|
58
|
+
} = options || {};
|
|
59
|
+
const {
|
|
60
|
+
framebuffer,
|
|
61
|
+
deleteFramebuffer
|
|
62
|
+
} = getFramebuffer(source);
|
|
63
|
+
assert(framebuffer);
|
|
64
|
+
sourceWidth = sourceWidth || framebuffer.width;
|
|
65
|
+
sourceHeight = sourceHeight || framebuffer.height;
|
|
66
|
+
const webglFramebuffer = framebuffer;
|
|
67
|
+
const gl2 = webglFramebuffer.device.assertWebGL2();
|
|
68
|
+
sourceType = sourceType || (target ? target.type : GL.UNSIGNED_BYTE);
|
|
69
|
+
if (!target) {
|
|
70
|
+
const components = glFormatToComponents(sourceFormat);
|
|
71
|
+
const byteCount = glTypeToBytes(sourceType);
|
|
72
|
+
const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;
|
|
73
|
+
target = new Buffer(gl2, {
|
|
74
|
+
byteLength,
|
|
75
|
+
accessor: {
|
|
76
|
+
type: sourceType,
|
|
77
|
+
size: components
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
target.bind({
|
|
82
|
+
glTarget: GL.PIXEL_PACK_BUFFER
|
|
83
|
+
});
|
|
84
|
+
withParameters(gl2, {
|
|
85
|
+
framebuffer
|
|
86
|
+
}, () => {
|
|
87
|
+
gl2.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, targetByteOffset);
|
|
88
|
+
});
|
|
89
|
+
target.unbind({
|
|
90
|
+
glTarget: GL.PIXEL_PACK_BUFFER
|
|
91
|
+
});
|
|
92
|
+
if (deleteFramebuffer) {
|
|
93
|
+
framebuffer.destroy();
|
|
94
|
+
}
|
|
95
|
+
return target;
|
|
96
|
+
}
|
|
97
|
+
export function copyToTexture(source, target, options) {
|
|
98
|
+
const {
|
|
99
|
+
sourceX = 0,
|
|
100
|
+
sourceY = 0,
|
|
101
|
+
targetMipmaplevel = 0,
|
|
102
|
+
targetInternalFormat = GL.RGBA
|
|
103
|
+
} = options || {};
|
|
104
|
+
let {
|
|
105
|
+
targetX,
|
|
106
|
+
targetY,
|
|
107
|
+
targetZ,
|
|
108
|
+
width,
|
|
109
|
+
height
|
|
110
|
+
} = options || {};
|
|
111
|
+
const {
|
|
112
|
+
framebuffer,
|
|
113
|
+
deleteFramebuffer
|
|
114
|
+
} = getFramebuffer(source);
|
|
115
|
+
assert(framebuffer);
|
|
116
|
+
const webglFramebuffer = framebuffer;
|
|
117
|
+
const {
|
|
118
|
+
device,
|
|
119
|
+
handle
|
|
120
|
+
} = webglFramebuffer;
|
|
121
|
+
const isSubCopy = typeof targetX !== 'undefined' || typeof targetY !== 'undefined' || typeof targetZ !== 'undefined';
|
|
122
|
+
targetX = targetX || 0;
|
|
123
|
+
targetY = targetY || 0;
|
|
124
|
+
targetZ = targetZ || 0;
|
|
125
|
+
const prevHandle = device.gl.bindFramebuffer(GL.FRAMEBUFFER, handle);
|
|
126
|
+
assert(target);
|
|
127
|
+
let texture = null;
|
|
128
|
+
let textureTarget;
|
|
129
|
+
if (target instanceof Texture) {
|
|
130
|
+
texture = target;
|
|
131
|
+
width = Number.isFinite(width) ? width : texture.width;
|
|
132
|
+
height = Number.isFinite(height) ? height : texture.height;
|
|
133
|
+
texture.bind(0);
|
|
134
|
+
textureTarget = texture.target;
|
|
135
|
+
} else {
|
|
136
|
+
textureTarget = target;
|
|
137
|
+
}
|
|
138
|
+
if (!isSubCopy) {
|
|
139
|
+
device.gl.copyTexImage2D(textureTarget, targetMipmaplevel, targetInternalFormat, sourceX, sourceY, width, height, 0);
|
|
140
|
+
} else {
|
|
141
|
+
switch (textureTarget) {
|
|
142
|
+
case GL.TEXTURE_2D:
|
|
143
|
+
case GL.TEXTURE_CUBE_MAP:
|
|
144
|
+
device.gl.copyTexSubImage2D(textureTarget, targetMipmaplevel, targetX, targetY, sourceX, sourceY, width, height);
|
|
145
|
+
break;
|
|
146
|
+
case GL.TEXTURE_2D_ARRAY:
|
|
147
|
+
case GL.TEXTURE_3D:
|
|
148
|
+
device.assertWebGL2();
|
|
149
|
+
device.gl2.copyTexSubImage3D(textureTarget, targetMipmaplevel, targetX, targetY, targetZ, sourceX, sourceY, width, height);
|
|
150
|
+
break;
|
|
151
|
+
default:
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (texture) {
|
|
155
|
+
texture.unbind();
|
|
156
|
+
}
|
|
157
|
+
gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
158
|
+
if (deleteFramebuffer) {
|
|
159
|
+
framebuffer.destroy();
|
|
160
|
+
}
|
|
161
|
+
return texture;
|
|
162
|
+
}
|
|
163
|
+
function getFramebuffer(source) {
|
|
164
|
+
if (!(source instanceof Framebuffer)) {
|
|
165
|
+
return {
|
|
166
|
+
framebuffer: toFramebuffer(source),
|
|
167
|
+
deleteFramebuffer: true
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
framebuffer: source,
|
|
172
|
+
deleteFramebuffer: false
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
export function toFramebuffer(texture, props) {
|
|
176
|
+
const {
|
|
177
|
+
device,
|
|
178
|
+
width,
|
|
179
|
+
height,
|
|
180
|
+
id
|
|
181
|
+
} = texture;
|
|
182
|
+
const framebuffer = device.createFramebuffer({
|
|
183
|
+
...props,
|
|
184
|
+
id: "framebuffer-for-".concat(id),
|
|
185
|
+
width,
|
|
186
|
+
height,
|
|
187
|
+
colorAttachments: [texture]
|
|
188
|
+
});
|
|
189
|
+
return framebuffer;
|
|
190
|
+
}
|
|
191
|
+
function getPixelArray(pixelArray, type, format, width, height) {
|
|
192
|
+
if (pixelArray) {
|
|
193
|
+
return pixelArray;
|
|
194
|
+
}
|
|
195
|
+
type = type || GL.UNSIGNED_BYTE;
|
|
196
|
+
const ArrayType = getTypedArrayFromGLType(type, {
|
|
197
|
+
clamped: false
|
|
198
|
+
});
|
|
199
|
+
const components = glFormatToComponents(format);
|
|
200
|
+
return new ArrayType(width * height * components);
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=copy-and-blit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-and-blit.js","names":["assert","Texture","Framebuffer","GL","BufferWithAccessor","Buffer","withParameters","getGLTypeFromTypedArray","getTypedArrayFromGLType","glFormatToComponents","glTypeToBytes","readPixelsToArray","source","options","sourceX","sourceY","sourceFormat","RGBA","sourceAttachment","COLOR_ATTACHMENT0","target","sourceWidth","sourceHeight","sourceType","framebuffer","deleteFramebuffer","getFramebuffer","gl","handle","width","height","FRONT","attachment","colorAttachments","type","getPixelArray","prevHandle","bindFramebuffer","FRAMEBUFFER","readPixels","destroy","readPixelsToBuffer","targetByteOffset","webglFramebuffer","gl2","device","assertWebGL2","UNSIGNED_BYTE","components","byteCount","byteLength","accessor","size","bind","glTarget","PIXEL_PACK_BUFFER","unbind","copyToTexture","targetMipmaplevel","targetInternalFormat","targetX","targetY","targetZ","isSubCopy","texture","textureTarget","Number","isFinite","copyTexImage2D","TEXTURE_2D","TEXTURE_CUBE_MAP","copyTexSubImage2D","TEXTURE_2D_ARRAY","TEXTURE_3D","copyTexSubImage3D","toFramebuffer","props","id","createFramebuffer","concat","pixelArray","format","ArrayType","clamped"],"sources":["../../src/classic/copy-and-blit.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {assert, Texture, Framebuffer, FramebufferProps} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\nimport {BufferWithAccessor as Buffer} from './buffer-with-accessor';\nimport {WEBGLTexture} from '../adapter/resources/webgl-texture';\nimport {WEBGLFramebuffer} from '../adapter/resources/webgl-framebuffer';\nimport {withParameters} from '../context/state-tracker/with-parameters';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\nimport {glFormatToComponents, glTypeToBytes} from './format-utils';\n\n/**\n * Copies data from a type or a Texture object into ArrayBuffer object.\n * App can provide targetPixelArray or have it auto allocated by this method\n * newly allocated by this method unless provided by app.\n * @deprecated Use CommandEncoder.copyTextureToBuffer and Buffer.read\n * @note Slow requires roundtrip to GPU\n *\n * @param source\n * @param options\n * @returns pixel array,\n */\nexport function readPixelsToArray(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n sourceAttachment?: number;\n target?: Uint8Array | Uint16Array | Float32Array;\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n): Uint8Array | Uint16Array | Float32Array {\n const {sourceX = 0, sourceY = 0, sourceFormat = GL.RGBA} = options || {};\n let {\n sourceAttachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer\n target = null,\n // following parameters are auto deduced if not provided\n sourceWidth,\n sourceHeight,\n sourceType\n } = options || {};\n\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n const {gl, handle} = framebuffer as WEBGLFramebuffer;\n sourceWidth = sourceWidth || framebuffer.width;\n sourceHeight = sourceHeight || framebuffer.height;\n\n // TODO - Set and unset gl.readBuffer\n if (sourceAttachment === GL.COLOR_ATTACHMENT0 && handle === null) {\n sourceAttachment = GL.FRONT;\n }\n\n const attachment = sourceAttachment - GL.COLOR_ATTACHMENT0;\n // assert(attachments[sourceAttachment]);\n\n // Deduce the type from color attachment if not provided.\n sourceType = sourceType || (framebuffer.colorAttachments[attachment] as WEBGLTexture).type;\n\n // Deduce type and allocated pixelArray if needed\n target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);\n\n // Pixel array available, if necessary, deduce type from it.\n sourceType = sourceType || getGLTypeFromTypedArray(target);\n\n const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, handle);\n gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);\n // @ts-expect-error\n gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n return target;\n}\n\n/**\n * Copies data from a Framebuffer or a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.\n * @deprecated Use CommandEncoder\n * @param source\n * @param options\n */\nexport function readPixelsToBuffer(\n source: Framebuffer | Texture,\n options?: {\n sourceX?: number;\n sourceY?: number;\n sourceFormat?: number;\n target?: Buffer; // A new Buffer object is created when not provided.\n targetByteOffset?: number; // byte offset in buffer object\n // following parameters are auto deduced if not provided\n sourceWidth?: number;\n sourceHeight?: number;\n sourceType?: number;\n }\n): Buffer {\n const {sourceX = 0, sourceY = 0, sourceFormat = GL.RGBA, targetByteOffset = 0} = options || {};\n // following parameters are auto deduced if not provided\n let {target, sourceWidth, sourceHeight, sourceType} = options || {};\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n sourceWidth = sourceWidth || framebuffer.width;\n sourceHeight = sourceHeight || framebuffer.height;\n\n // Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature\n const webglFramebuffer = framebuffer as WEBGLFramebuffer;\n const gl2 = webglFramebuffer.device.assertWebGL2();\n\n // deduce type if not available.\n sourceType = sourceType || (target ? target.type : GL.UNSIGNED_BYTE);\n\n if (!target) {\n // Create new buffer with enough size\n const components = glFormatToComponents(sourceFormat);\n const byteCount = glTypeToBytes(sourceType);\n const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;\n target = new Buffer(gl2, {byteLength, accessor: {type: sourceType, size: components}});\n }\n\n target.bind({glTarget: GL.PIXEL_PACK_BUFFER});\n withParameters(gl2, {framebuffer}, () => {\n gl2.readPixels(\n sourceX,\n sourceY,\n sourceWidth,\n sourceHeight,\n sourceFormat,\n sourceType,\n targetByteOffset\n );\n });\n target.unbind({glTarget: GL.PIXEL_PACK_BUFFER});\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n\n return target;\n}\n\n/**\n * Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)\n * @deprecated Use CommandEncoder\n */\n// eslint-disable-next-line complexity, max-statements\nexport function copyToTexture(\n source: Framebuffer | Texture,\n target: Texture | GL,\n options?: {\n sourceX?: number;\n sourceY?: number;\n\n targetX?: number;\n targetY?: number;\n targetZ?: number;\n targetMipmaplevel?: number;\n targetInternalFormat?: number;\n\n width?: number; // defaults to target width\n height?: number; // defaults to target height\n }\n): Texture {\n const {\n sourceX = 0,\n sourceY = 0,\n // attachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer\n targetMipmaplevel = 0,\n targetInternalFormat = GL.RGBA\n } = options || {};\n let {\n targetX,\n targetY,\n targetZ,\n width, // defaults to target width\n height // defaults to target height\n } = options || {};\n\n const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n assert(framebuffer);\n const webglFramebuffer = framebuffer as WEBGLFramebuffer;\n const {device, handle} = webglFramebuffer;\n const isSubCopy =\n typeof targetX !== 'undefined' ||\n typeof targetY !== 'undefined' ||\n typeof targetZ !== 'undefined';\n targetX = targetX || 0;\n targetY = targetY || 0;\n targetZ = targetZ || 0;\n const prevHandle = device.gl.bindFramebuffer(GL.FRAMEBUFFER, handle);\n // TODO - support gl.readBuffer (WebGL2 only)\n // const prevBuffer = gl.readBuffer(attachment);\n assert(target);\n let texture = null;\n let textureTarget: GL;\n if (target instanceof Texture) {\n texture = target;\n width = Number.isFinite(width) ? width : texture.width;\n height = Number.isFinite(height) ? height : texture.height;\n texture.bind(0);\n textureTarget = texture.target;\n } else {\n textureTarget = target;\n }\n\n if (!isSubCopy) {\n device.gl.copyTexImage2D(\n textureTarget,\n targetMipmaplevel,\n targetInternalFormat,\n sourceX,\n sourceY,\n width,\n height,\n 0 /* border must be 0 */\n );\n } else {\n switch (textureTarget) {\n case GL.TEXTURE_2D:\n case GL.TEXTURE_CUBE_MAP:\n device.gl.copyTexSubImage2D(\n textureTarget,\n targetMipmaplevel,\n targetX,\n targetY,\n sourceX,\n sourceY,\n width,\n height\n );\n break;\n case GL.TEXTURE_2D_ARRAY:\n case GL.TEXTURE_3D:\n device.assertWebGL2();\n device.gl2.copyTexSubImage3D(\n textureTarget,\n targetMipmaplevel,\n targetX,\n targetY,\n targetZ,\n sourceX,\n sourceY,\n width,\n height\n );\n break;\n default:\n }\n }\n if (texture) {\n texture.unbind();\n }\n // @ts-expect-error\n gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (deleteFramebuffer) {\n framebuffer.destroy();\n }\n return texture;\n}\n\nfunction getFramebuffer(source: Texture | Framebuffer): {\n framebuffer: Framebuffer;\n deleteFramebuffer: boolean;\n} {\n if (!(source instanceof Framebuffer)) {\n return {framebuffer: toFramebuffer(source), deleteFramebuffer: true};\n }\n return {framebuffer: source, deleteFramebuffer: false};\n}\n\n/**\n * Wraps a given texture into a framebuffer object, that can be further used\n * to read data from the texture object.\n */\nexport function toFramebuffer(texture: Texture, props?: FramebufferProps): Framebuffer {\n const {device, width, height, id} = texture;\n const framebuffer = device.createFramebuffer({\n ...props,\n id: `framebuffer-for-${id}`,\n width,\n height,\n colorAttachments: [\n texture\n ]\n }\n );\n return framebuffer;\n}\n\nfunction getPixelArray(\n pixelArray,\n type,\n format,\n width: number,\n height: number\n): Uint8Array | Uint16Array | Float32Array {\n if (pixelArray) {\n return pixelArray;\n }\n // Allocate pixel array if not already available, using supplied type\n type = type || GL.UNSIGNED_BYTE;\n const ArrayType = getTypedArrayFromGLType(type, {clamped: false});\n const components = glFormatToComponents(format);\n // TODO - check for composite type (components = 1).\n return new ArrayType(width * height * components) as Uint8Array | Uint16Array | Float32Array;\n}\n"],"mappings":"AACA,SAAQA,MAAM,EAAEC,OAAO,EAAEC,WAAW,QAAyB,eAAe;AAC5E,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,kBAAkB,IAAIC,MAAM;AAAA,SAG5BC,cAAc;AAAA,SACdC,uBAAuB,EAAEC,uBAAuB;AAAA,SAChDC,oBAAoB,EAAEC,aAAa;AAa3C,OAAO,SAASC,iBAAiBA,CAC/BC,MAA6B,EAC7BC,OAUC,EACwC;EACzC,MAAM;IAACC,OAAO,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC,YAAY,GAAGb,EAAE,CAACc;EAAI,CAAC,GAAGJ,OAAO,IAAI,CAAC,CAAC;EACxE,IAAI;IACFK,gBAAgB,GAAGf,EAAE,CAACgB,iBAAiB;IACvCC,MAAM,GAAG,IAAI;IAEbC,WAAW;IACXC,YAAY;IACZC;EACF,CAAC,GAAGV,OAAO,IAAI,CAAC,CAAC;EAEjB,MAAM;IAACW,WAAW;IAAEC;EAAiB,CAAC,GAAGC,cAAc,CAACd,MAAM,CAAC;EAC/DZ,MAAM,CAACwB,WAAW,CAAC;EACnB,MAAM;IAACG,EAAE;IAAEC;EAAM,CAAC,GAAGJ,WAA+B;EACpDH,WAAW,GAAGA,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AoB,CAAC,MAAM,KAAA,qBAoB1C;AAGD,wBAAgB,aAAa,CAAC,IAAI,KAAA,iBAejC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { assert } from '@luma.gl/core';
|
|
2
|
+
import { GL } from '@luma.gl/constants';
|
|
3
|
+
export function glFormatToComponents(format) {
|
|
4
|
+
switch (format) {
|
|
5
|
+
case GL.ALPHA:
|
|
6
|
+
case GL.R32F:
|
|
7
|
+
case GL.RED:
|
|
8
|
+
return 1;
|
|
9
|
+
case GL.RG32F:
|
|
10
|
+
case GL.RG:
|
|
11
|
+
return 2;
|
|
12
|
+
case GL.RGB:
|
|
13
|
+
case GL.RGB32F:
|
|
14
|
+
return 3;
|
|
15
|
+
case GL.RGBA:
|
|
16
|
+
case GL.RGBA32F:
|
|
17
|
+
return 4;
|
|
18
|
+
default:
|
|
19
|
+
assert(false);
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function glTypeToBytes(type) {
|
|
24
|
+
switch (type) {
|
|
25
|
+
case GL.UNSIGNED_BYTE:
|
|
26
|
+
return 1;
|
|
27
|
+
case GL.UNSIGNED_SHORT_5_6_5:
|
|
28
|
+
case GL.UNSIGNED_SHORT_4_4_4_4:
|
|
29
|
+
case GL.UNSIGNED_SHORT_5_5_5_1:
|
|
30
|
+
return 2;
|
|
31
|
+
case GL.FLOAT:
|
|
32
|
+
return 4;
|
|
33
|
+
default:
|
|
34
|
+
assert(false);
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=format-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-utils.js","names":["assert","GL","glFormatToComponents","format","ALPHA","R32F","RED","RG32F","RG","RGB","RGB32F","RGBA","RGBA32F","glTypeToBytes","type","UNSIGNED_BYTE","UNSIGNED_SHORT_5_6_5","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","FLOAT"],"sources":["../../src/classic/format-utils.ts"],"sourcesContent":["import {assert} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\n// Returns number of components in a specific readPixels WebGL format\nexport function glFormatToComponents(format) {\n switch (format) {\n case GL.ALPHA:\n case GL.R32F:\n case GL.RED:\n return 1;\n case GL.RG32F:\n case GL.RG:\n return 2;\n case GL.RGB:\n case GL.RGB32F:\n return 3;\n case GL.RGBA:\n case GL.RGBA32F:\n return 4;\n // TODO: Add support for additional WebGL2 formats\n default:\n assert(false);\n return 0;\n }\n}\n\n// Return byte count for given readPixels WebGL type\nexport function glTypeToBytes(type) {\n switch (type) {\n case GL.UNSIGNED_BYTE:\n return 1;\n case GL.UNSIGNED_SHORT_5_6_5:\n case GL.UNSIGNED_SHORT_4_4_4_4:\n case GL.UNSIGNED_SHORT_5_5_5_1:\n return 2;\n case GL.FLOAT:\n return 4;\n // TODO: Add support for additional WebGL2 types\n default:\n assert(false);\n return 0;\n }\n}\n"],"mappings":"AAAA,SAAQA,MAAM,QAAO,eAAe;AACpC,SAAQC,EAAE,QAAO,oBAAoB;AAGrC,OAAO,SAASC,oBAAoBA,CAACC,MAAM,EAAE;EAC3C,QAAQA,MAAM;IACZ,KAAKF,EAAE,CAACG,KAAK;IACb,KAAKH,EAAE,CAACI,IAAI;IACZ,KAAKJ,EAAE,CAACK,GAAG;MACT,OAAO,CAAC;IACV,KAAKL,EAAE,CAACM,KAAK;IACb,KAAKN,EAAE,CAACO,EAAE;MACR,OAAO,CAAC;IACV,KAAKP,EAAE,CAACQ,GAAG;IACX,KAAKR,EAAE,CAACS,MAAM;MACZ,OAAO,CAAC;IACV,KAAKT,EAAE,CAACU,IAAI;IACZ,KAAKV,EAAE,CAACW,OAAO;MACb,OAAO,CAAC;IAEV;MACEZ,MAAM,CAAC,KAAK,CAAC;MACb,OAAO,CAAC;EACZ;AACF;AAGA,OAAO,SAASa,aAAaA,CAACC,IAAI,EAAE;EAClC,QAAQA,IAAI;IACV,KAAKb,EAAE,CAACc,aAAa;MACnB,OAAO,CAAC;IACV,KAAKd,EAAE,CAACe,oBAAoB;IAC5B,KAAKf,EAAE,CAACgB,sBAAsB;IAC9B,KAAKhB,EAAE,CAACiB,sBAAsB;MAC5B,OAAO,CAAC;IACV,KAAKjB,EAAE,CAACkB,KAAK;MACX,OAAO,CAAC;IAEV;MACEnB,MAAM,CAAC,KAAK,CAAC;MACb,OAAO,CAAC;EACZ;AACF"}
|
|
@@ -1,44 +1,42 @@
|
|
|
1
|
-
import { TypedArray } from '@luma.gl/
|
|
2
|
-
import {
|
|
3
|
-
declare type TypedArrayConstructor = Float32ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
|
|
1
|
+
import { TypedArray, TypedArrayConstructor } from '@luma.gl/core';
|
|
2
|
+
import { GLDataType, GLPixelType } from '@luma.gl/constants';
|
|
4
3
|
/**
|
|
5
4
|
* Converts TYPED ARRAYS to corresponding GL constant
|
|
6
5
|
* Used to auto deduce gl parameter types
|
|
7
|
-
* @param
|
|
6
|
+
* @param arrayOrType
|
|
8
7
|
* @returns
|
|
9
8
|
*/
|
|
10
|
-
export declare function getGLTypeFromTypedArray(arrayOrType: TypedArray):
|
|
9
|
+
export declare function getGLTypeFromTypedArray(arrayOrType: TypedArray): GLDataType;
|
|
11
10
|
/**
|
|
12
11
|
* Converts GL constant to corresponding TYPED ARRAY
|
|
13
12
|
* Used to auto deduce gl parameter types
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
13
|
+
* @param glType
|
|
14
|
+
* @param param1
|
|
16
15
|
* @returns
|
|
17
16
|
*/
|
|
18
|
-
export declare function getTypedArrayFromGLType(glType:
|
|
17
|
+
export declare function getTypedArrayFromGLType(glType: GLDataType | GLPixelType, options?: {
|
|
19
18
|
clamped?: boolean;
|
|
20
19
|
}): TypedArrayConstructor;
|
|
21
20
|
/**
|
|
22
21
|
* Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)
|
|
23
22
|
* https: *stackoverflow.com/questions/41969562/
|
|
24
23
|
* how-can-i-flip-the-result-of-webglrenderingcontext-readpixels
|
|
25
|
-
* @param
|
|
24
|
+
* @param param0
|
|
26
25
|
*/
|
|
27
26
|
export declare function flipRows(options: {
|
|
28
|
-
data:
|
|
29
|
-
width:
|
|
30
|
-
height:
|
|
27
|
+
data: TypedArray;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
31
30
|
bytesPerPixel?: number;
|
|
32
|
-
temp?:
|
|
31
|
+
temp?: Uint8Array;
|
|
33
32
|
}): void;
|
|
34
33
|
export declare function scalePixels(options: {
|
|
35
|
-
data:
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
34
|
+
data: TypedArray;
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
38
37
|
}): {
|
|
39
38
|
data: Uint8Array;
|
|
40
39
|
width: number;
|
|
41
40
|
height: number;
|
|
42
41
|
};
|
|
43
|
-
export {};
|
|
44
42
|
//# sourceMappingURL=typed-array-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-array-utils.d.ts","sourceRoot":"","sources":["../../src/classic/typed-array-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typed-array-utils.d.ts","sourceRoot":"","sources":["../../src/classic/typed-array-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,UAAU,EAAE,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAChE,OAAO,EAAK,UAAU,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAI/D;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAuB3E;AAED;;;;;;GAMG;AAEH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,UAAU,GAAG,WAAW,EAChC,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,qBAAqB,CAwBvB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,GAAG,IAAI,CAgBP;AAGD,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG;IACF,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAaA"}
|