@luma.gl/webgl 9.0.0-alpha.3 → 9.0.0-alpha.31
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/shader-formats.d.ts +9 -0
- package/dist/adapter/converters/shader-formats.d.ts.map +1 -0
- package/dist/adapter/converters/shader-formats.js +53 -0
- package/dist/adapter/converters/shader-formats.js.map +1 -0
- package/dist/adapter/converters/texture-formats.d.ts +32 -44
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +165 -201
- package/dist/adapter/converters/texture-formats.js.map +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts +9 -3
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +48 -16
- 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/decode-webgl-types.d.ts +26 -0
- package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -0
- package/dist/adapter/helpers/{uniforms.js → decode-webgl-types.js} +20 -29
- package/dist/adapter/helpers/decode-webgl-types.js.map +1 -0
- 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 -48
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +58 -113
- 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/webgl-topology-utils.d.ts +11 -0
- package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -0
- package/dist/adapter/helpers/{attribute-utils.js → webgl-topology-utils.js} +2 -19
- package/dist/adapter/helpers/webgl-topology-utils.js.map +1 -0
- 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 +39 -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 +9 -18
- 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 +52 -14
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +119 -182
- 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 +10245 -0
- package/dist/index.cjs +6550 -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 +3 -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/shader-formats.ts +41 -0
- package/src/adapter/converters/texture-formats.ts +264 -194
- package/src/adapter/converters/vertex-formats.ts +68 -10
- 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/{uniforms.ts → decode-webgl-types.ts} +36 -21
- package/src/adapter/helpers/get-shader-info.ts +40 -0
- package/src/adapter/helpers/get-shader-layout.ts +120 -146
- package/src/adapter/helpers/parse-shader-compiler-log.ts +2 -2
- package/src/adapter/helpers/set-uniform.ts +7 -6
- package/src/adapter/helpers/{attribute-utils.ts → webgl-topology-utils.ts} +4 -5
- 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 +202 -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 +17 -12
- 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 +232 -131
- 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/src/types.ts +2 -0
- 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/adapter/helpers/attribute-utils.d.ts +0 -11
- package/dist/adapter/helpers/attribute-utils.d.ts.map +0 -1
- package/dist/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/adapter/helpers/uniforms.d.ts +0 -26
- package/dist/adapter/helpers/uniforms.d.ts.map +0 -1
- package/dist/adapter/helpers/uniforms.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":["GL","cast","value","CommandBuffer","submitCommands","device","commands","command","name","_copyBufferToBuffer","options","_copyBufferToTexture","_copyTextureToBuffer","_copyTextureToTexture","source","destination","gl2","bindBuffer","COPY_READ_BUFFER","handle","COPY_WRITE_BUFFER","copyBufferSubData","sourceOffset","destinationOffset","size","Error"],"mappings":";AAMA,OAAOA,EAAP,MAAe,oBAAf;;AAIA,SAASC,IAAT,CAAiBC,KAAjB,EAAoC;AAClC,SAAOA,KAAP;AACD;;AA4BD,eAAe,MAAMC,aAAN,CAAoB;AAAA;AAAA,sCACX,EADW;AAAA;;AAAA;AAInC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ACkB,gBAAlB,EAAoC,IAApC;AACAF,IAAAA,GAAG,CAACC,UAAJ,CAAejB,EAAE,CAACoB,iBAAlB,EAAqC,IAArC;AACD,GAdD,MAcO;AAGL,UAAM,IAAIK,KAAJ,CAAU,8CAAV,CAAN;AACD;AACF;;AAED,SAASd,oBAAT,CAA8BN,MAA9B,EAAmDK,OAAnD,EAA8F,CAAE;;AAEhG,SAASE,oBAAT,CAA8BP,MAA9B,EAAmDK,OAAnD,EAA8F,CAAE;;AAEhG,SAASG,qBAAT,CAA+BR,MAA/B,EAAoDK,OAApD,EAAgG,CAAE","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 default 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"],"file":"webgl-command-buffer.js"}
|
|
1
|
+
{"version":3,"file":"webgl-command-buffer.js","names":["CommandBuffer","Texture","GL","WEBGLTexture","cast","value","WEBGLCommandBuffer","constructor","device","_defineProperty","submitCommands","commands","arguments","length","undefined","command","name","_copyBufferToBuffer","options","_copyBufferToTexture","_copyTextureToBuffer","_copyTextureToTexture","source","destination","gl2","assertWebGL2","_options$sourceOffset","_options$destinationO","bindBuffer","COPY_READ_BUFFER","handle","COPY_WRITE_BUFFER","copyBufferSubData","sourceOffset","destinationOffset","size","Error","mipLevel","aspect","width","height","depthOrArrayLayers","origin","byteOffset","bytesPerRow","rowsPerImage","framebuffer","destroyFramebuffer","getFramebuffer","webglBuffer","sourceWidth","sourceHeight","sourceFormat","RGBA","sourceType","UNSIGNED_BYTE","PIXEL_PACK_BUFFER","bindFramebuffer","FRAMEBUFFER","readPixels","destroy","destinationMipmaplevel","destinationInternalFormat","sourceX","sourceY","isSubCopy","gl","texture","textureTarget","Number","isFinite","bind","copyTexImage2D","unbind","prevHandle","glFormatToComponents","format","ALPHA","R32F","RED","RG32F","RG","RGB","RGB32F","RGBA32F","glTypeToBytes","type","UNSIGNED_SHORT_5_6_5","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","FLOAT","id","createFramebuffer","concat","colorAttachments"],"sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/core';\nimport {\n CommandBuffer,\n Texture,\n // Buffer,\n Framebuffer\n} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\n// import {getTypedArrayFromGLType, getGLTypeFromTypedArray} from '../../classic/typed-array-utils';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLTexture} from './webgl-texture';\nimport {WEBGLFramebuffer} from './webgl-framebuffer';\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 WEBGLCommandBuffer extends CommandBuffer {\n device: WebGLDevice;\n commands: Command[] = [];\n\n constructor(device: WebGLDevice) {\n super({});\n this.device = device;\n }\n\n submitCommands(commands: Command[] = this.commands) {\n for (const command of commands) {\n switch (command.name) {\n case 'copy-buffer-to-buffer':\n _copyBufferToBuffer(this.device, command.options);\n break;\n case 'copy-buffer-to-texture':\n _copyBufferToTexture(this.device, command.options);\n break;\n case 'copy-texture-to-buffer':\n _copyTextureToBuffer(this.device, command.options);\n break;\n case 'copy-texture-to-texture':\n _copyTextureToTexture(this.device, command.options);\n break;\n }\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.assertWebGL2();\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\n/**\n * Copies data from a Buffer object into a Texture object\n * NOTE: doesn't wait for copy to be complete\n */\nfunction _copyBufferToTexture(device: WebGLDevice, options: CopyBufferToTextureOptions): void {\n throw new Error('Not implemented');\n}\n\n/**\n * Copies data from a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete\n */\nfunction _copyTextureToBuffer(device: WebGLDevice, options: CopyTextureToBufferOptions): void {\n const {\n /** Texture to copy to/from. */\n source,\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n mipLevel = 0,\n /** Defines which aspects of the texture to copy to/from. */\n aspect = 'all',\n\n /** Width to copy */\n width = options.source.width,\n /** Height to copy */\n height = options.source.height,\n depthOrArrayLayers = 0,\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */\n origin = [0, 0],\n\n /** Destination buffer */\n destination,\n /** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */\n byteOffset = 0,\n /**\n * The stride, in bytes, between the beginning of each block row and the subsequent block row.\n * Required if there are multiple block rows (i.e. the copy height or depth is more than one block).\n */\n bytesPerRow,\n /**\n * Number of block rows per single image of the texture.\n * rowsPerImage × bytesPerRow is the stride, in bytes, between the beginning of each image of data and the subsequent image.\n * Required if there are multiple images (i.e. the copy depth is more than one).\n */\n rowsPerImage\n } = options;\n\n // TODO - Not possible to read just stencil or depth part in WebGL?\n if (aspect !== 'all') {\n throw new Error('not supported');\n }\n\n // TODO - mipLevels are set when attaching texture to framebuffer\n if (mipLevel !== 0 || depthOrArrayLayers !== undefined || bytesPerRow || rowsPerImage) {\n throw new Error('not implemented');\n }\n\n // Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature\n const gl2 = device.assertWebGL2();\n\n const {framebuffer, destroyFramebuffer} = getFramebuffer(source);\n try {\n const webglBuffer = destination as WEBGLBuffer;\n const sourceWidth = width || framebuffer.width;\n const sourceHeight = height || framebuffer.height;\n\n // TODO - hack - should be deduced\n const sourceFormat = GL.RGBA;\n const sourceType = 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 = byteOffset + sourceWidth * sourceHeight * components * byteCount;\n // target = device.createBuffer({byteLength});\n // }\n\n gl2.bindBuffer(GL.PIXEL_PACK_BUFFER, webglBuffer.handle);\n gl2.bindFramebuffer(GL.FRAMEBUFFER, framebuffer.handle);\n\n gl2.readPixels(\n origin[0],\n origin[1],\n sourceWidth,\n sourceHeight,\n sourceFormat,\n sourceType,\n byteOffset\n );\n } finally {\n gl2.bindBuffer(GL.PIXEL_PACK_BUFFER, null);\n gl2.bindFramebuffer(GL.FRAMEBUFFER, null);\n\n if (destroyFramebuffer) {\n framebuffer.destroy();\n }\n }\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 transfer.\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 */\n\n/**\n * Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)\n */\n// eslint-disable-next-line complexity, max-statements\nfunction _copyTextureToTexture(device: WebGLDevice, options: CopyTextureToTextureOptions): void {\n const {\n /** Texture to copy to/from. */\n source,\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n // mipLevel = 0,\n /** Defines which aspects of the texture to copy to/from. */\n // aspect = 'all',\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */\n origin = [0, 0],\n\n /** Texture to copy to/from. */\n destination,\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n // destinationMipLevel = options.mipLevel,\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */\n // destinationOrigin = [0, 0],\n /** Defines which aspects of the texture to copy to/from. */\n // destinationAspect = options.aspect,\n\n } = options;\n\n let {\n width = options.destination.width,\n height = options.destination.width,\n // depthOrArrayLayers = 0\n } = options;\n\n const destinationMipmaplevel = 0;\n const destinationInternalFormat = GL.RGBA;\n\n const {framebuffer, destroyFramebuffer} = getFramebuffer(source);\n const [sourceX, sourceY] = origin;\n\n const isSubCopy = false;\n // typeof destinationX !== 'undefined' ||\n // typeof destinationY !== 'undefined' ||\n // typeof destinationZ !== 'undefined';\n\n // destinationX = destinationX || 0;\n // destinationY = destinationY || 0;\n // destinationZ = destinationZ || 0;\n device.gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer.handle);\n // TODO - support gl.readBuffer (WebGL2 only)\n // const prevBuffer = gl.readBuffer(attachment);\n\n let texture = null;\n let textureTarget: GL;\n if (destination instanceof WEBGLTexture) {\n texture = destination;\n width = Number.isFinite(width) ? width : texture.width;\n height = Number.isFinite(height) ? height : texture.height;\n texture.bind(0);\n textureTarget = texture.destination;\n } else {\n throw new Error('whoops');\n // textureTarget = destination;\n }\n\n if (!isSubCopy) {\n device.gl.copyTexImage2D(\n textureTarget,\n destinationMipmaplevel,\n destinationInternalFormat,\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 // destinationMipmaplevel,\n // destinationX,\n // destinationY,\n // sourceX,\n // sourceY,\n // width,\n // height\n // );\n // break;\n // case GL.TEXTURE_2D_ARRAY:\n // case GL.TEXTURE_3D:\n // const gl2 = device.assertWebGL2();\n // gl2.copyTexSubImage3D(\n // textureTarget,\n // destinationMipmaplevel,\n // destinationX,\n // destinationY,\n // destinationZ,\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 device.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (destroyFramebuffer) {\n framebuffer.destroy();\n }\n return texture;\n}\n\n// Returns number of components in a specific readPixels WebGL format\nexport function glFormatToComponents(format): 1 | 2 | 3 | 4 {\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 throw new Error('GLFormat');\n }\n}\n\n// Return byte count for given readPixels WebGL type\nexport function glTypeToBytes(type: GL): 1 | 2 | 4 {\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 throw new Error('GLType');\n }\n}\n\n// Helper methods\n\nfunction getFramebuffer(source: Texture | Framebuffer): {\n framebuffer: WEBGLFramebuffer;\n destroyFramebuffer: boolean;\n} {\n if (source instanceof Texture) {\n const {width, height, id} = source;\n const framebuffer = source.device.createFramebuffer({\n id: `framebuffer-for-${id}`,\n width,\n height,\n colorAttachments: [source]\n }) as unknown as WEBGLFramebuffer;\n\n return {framebuffer, destroyFramebuffer: true};\n }\n return {framebuffer: source as unknown as WEBGLFramebuffer, destroyFramebuffer: false};\n}\n"],"mappings":";AAQA,SACEA,aAAa,EACbC,OAAO,QAGF,eAAe;AACtB,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAK9BC,YAAY;AAGpB,SAASC,IAAIA,CAAIC,KAAc,EAAK;EAClC,OAAOA,KAAK;AACd;AA4BA,OAAO,MAAMC,kBAAkB,SAASN,aAAa,CAAC;EAIpDO,WAAWA,CAACC,MAAmB,EAAE;IAC/B,KAAK,CAAC,CAAC,CAAC,CAAC;IAACC,eAAA;IAAAA,eAAA,mBAHU,EAAE;IAItB,IAAI,CAACD,MAAM,GAAGA,MAAM;EACtB;EAEAE,cAAcA,CAAA,EAAsC;IAAA,IAArCC,QAAmB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI,CAACD,QAAQ;IAChD,KAAK,MAAM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B,EAAE;EAAK,CAAC;AACxF"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { CommandEncoder, CommandEncoderProps } from '@luma.gl/
|
|
2
|
-
import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/
|
|
3
|
-
import
|
|
4
|
-
import WebGLDevice from '../webgl-device';
|
|
5
|
-
export
|
|
1
|
+
import { CommandEncoder, CommandEncoderProps } from '@luma.gl/core';
|
|
2
|
+
import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/core';
|
|
3
|
+
import { WEBGLCommandBuffer } from './webgl-command-buffer';
|
|
4
|
+
import { WebGLDevice } from '../webgl-device';
|
|
5
|
+
export declare class WEBGLCommandEncoder extends CommandEncoder {
|
|
6
6
|
readonly device: WebGLDevice;
|
|
7
|
-
readonly commandBuffer:
|
|
7
|
+
readonly commandBuffer: WEBGLCommandBuffer;
|
|
8
8
|
constructor(device: WebGLDevice, props: CommandEncoderProps);
|
|
9
9
|
destroy(): void;
|
|
10
|
+
finish(): void;
|
|
10
11
|
copyBufferToBuffer(options: CopyBufferToBufferOptions): void;
|
|
11
12
|
copyBufferToTexture(options: CopyBufferToTextureOptions): void;
|
|
12
13
|
copyTextureToBuffer(options: CopyTextureToBufferOptions): void;
|
|
@@ -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,
|
|
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,eAAe,CAAC;AAClE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;gBAE/B,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,mBAAmB;IAMlD,OAAO,IAAI,IAAI;IAEf,MAAM,IAAI,IAAI;IAQvB,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,44 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { CommandEncoder } from '@luma.gl/
|
|
3
|
-
import
|
|
4
|
-
export
|
|
2
|
+
import { CommandEncoder } from '@luma.gl/core';
|
|
3
|
+
import { WEBGLCommandBuffer } from "./webgl-command-buffer.js";
|
|
4
|
+
export class WEBGLCommandEncoder extends CommandEncoder {
|
|
5
5
|
constructor(device, props) {
|
|
6
|
-
super(props);
|
|
7
|
-
|
|
6
|
+
super(device, props);
|
|
8
7
|
_defineProperty(this, "device", void 0);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "commandBuffer", new CommandBuffer());
|
|
11
|
-
|
|
8
|
+
_defineProperty(this, "commandBuffer", void 0);
|
|
12
9
|
this.device = device;
|
|
10
|
+
this.commandBuffer = new WEBGLCommandBuffer(device);
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
destroy() {}
|
|
16
|
-
|
|
13
|
+
finish() {
|
|
14
|
+
this.commandBuffer.submitCommands();
|
|
15
|
+
}
|
|
17
16
|
copyBufferToBuffer(options) {
|
|
18
17
|
this.commandBuffer.commands.push({
|
|
19
18
|
name: 'copy-buffer-to-buffer',
|
|
20
19
|
options
|
|
21
20
|
});
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
copyBufferToTexture(options) {
|
|
25
23
|
this.commandBuffer.commands.push({
|
|
26
24
|
name: 'copy-buffer-to-texture',
|
|
27
25
|
options
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
|
-
|
|
31
28
|
copyTextureToBuffer(options) {
|
|
32
29
|
this.commandBuffer.commands.push({
|
|
33
30
|
name: 'copy-texture-to-buffer',
|
|
34
31
|
options
|
|
35
32
|
});
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
copyTextureToTexture(options) {
|
|
39
35
|
this.commandBuffer.commands.push({
|
|
40
36
|
name: 'copy-texture-to-texture',
|
|
41
37
|
options
|
|
42
38
|
});
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
pushDebugGroup(groupLabel) {}
|
|
46
|
-
|
|
47
41
|
popDebugGroup() {}
|
|
48
|
-
|
|
49
42
|
insertDebugMarker(markerLabel) {}
|
|
50
|
-
|
|
51
43
|
}
|
|
52
|
-
;
|
|
53
44
|
//# sourceMappingURL=webgl-command-encoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgl-command-encoder.js","names":["CommandEncoder","WEBGLCommandBuffer","WEBGLCommandEncoder","constructor","device","props","_defineProperty","commandBuffer","destroy","finish","submitCommands","copyBufferToBuffer","options","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/core';\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/core';\n\nimport {WEBGLCommandBuffer} from './webgl-command-buffer';\nimport {WebGLDevice} from '../webgl-device';\n\nexport class WEBGLCommandEncoder extends CommandEncoder {\n readonly device: WebGLDevice;\n\n readonly commandBuffer: WEBGLCommandBuffer;\n\n constructor(device: WebGLDevice, props: CommandEncoderProps) {\n super(device, props);\n this.device = device;\n this.commandBuffer = new WEBGLCommandBuffer(device);\n }\n\n override destroy(): void {}\n\n override finish(): void {\n this.commandBuffer.submitCommands();\n }\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,eAAe;AAAC,SAQ1D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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.glTarget = 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,37 @@
|
|
|
1
|
-
import type { FramebufferProps,
|
|
2
|
-
import { Framebuffer, Texture } from '@luma.gl/
|
|
3
|
-
import GL from '@luma.gl/constants';
|
|
4
|
-
import WebGLDevice from '../webgl-device';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
export
|
|
8
|
-
export
|
|
1
|
+
import type { FramebufferProps, TextureFormat } from '@luma.gl/core';
|
|
2
|
+
import { Framebuffer, Texture } from '@luma.gl/core';
|
|
3
|
+
import { GL } from '@luma.gl/constants';
|
|
4
|
+
import { WebGLDevice } from '../webgl-device';
|
|
5
|
+
import { WEBGLTexture } from './webgl-texture';
|
|
6
|
+
import { WEBGLRenderbuffer } from '../objects/webgl-renderbuffer';
|
|
7
|
+
export type TextureAttachment = [Texture, number?, number?];
|
|
8
|
+
export 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: WebGLTexture[];
|
|
16
|
-
readonly depthStencilAttachment: WebGLTexture | undefined;
|
|
17
|
-
protected _ownResources: (WebGLTexture | Renderbuffer)[];
|
|
14
|
+
get texture(): Texture<import("@luma.gl/core").TextureProps>;
|
|
18
15
|
constructor(device: WebGLDevice, props: FramebufferProps);
|
|
16
|
+
/** destroys any auto created resources etc. */
|
|
19
17
|
destroy(): void;
|
|
20
18
|
/** Check the status */
|
|
21
19
|
protected _checkStatus(): void;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
protected _resizeAttachments(width: number, height: number): this;
|
|
20
|
+
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
21
|
+
protected createDepthStencilTexture(format: TextureFormat): Texture;
|
|
22
|
+
/**
|
|
23
|
+
* Attachment resize is expected to be a noop if size is same
|
|
24
|
+
*/
|
|
25
|
+
protected resizeAttachments(width: number, height: number): this;
|
|
29
26
|
/** Attach one attachment */
|
|
30
|
-
protected _attachOne(attachmentPoint: GL, attachment: Attachment):
|
|
31
|
-
protected
|
|
27
|
+
protected _attachOne(attachmentPoint: GL, attachment: Attachment): WEBGLTexture | WEBGLRenderbuffer;
|
|
28
|
+
protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void;
|
|
32
29
|
/**
|
|
33
30
|
* @param attachment
|
|
34
31
|
* @param texture
|
|
35
|
-
* @param layer = 0 - index into
|
|
32
|
+
* @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`
|
|
36
33
|
* @param level = 0 - mipmapLevel (must be 0 in WebGL1)
|
|
37
34
|
*/
|
|
38
|
-
protected _attachTexture(attachment: GL, texture:
|
|
35
|
+
protected _attachTexture(attachment: GL, texture: WEBGLTexture, layer: number, level: number): void;
|
|
39
36
|
}
|
|
40
37
|
//# 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":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CACtB,UAAU,EAAE,EAAE,EACd,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,IAAI;CA2BR"}
|
|
@@ -1,75 +1,51 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { Framebuffer,
|
|
3
|
-
import GL from '@luma.gl/constants';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
export
|
|
2
|
+
import { Framebuffer, assert } from '@luma.gl/core';
|
|
3
|
+
import { GL } from '@luma.gl/constants';
|
|
4
|
+
import { WEBGLTexture } from "./webgl-texture.js";
|
|
5
|
+
import { WEBGLRenderbuffer } from "../objects/webgl-renderbuffer.js";
|
|
6
|
+
import { getDepthStencilAttachmentWebGL } from "../converters/texture-formats.js";
|
|
7
|
+
export class WEBGLFramebuffer extends Framebuffer {
|
|
8
8
|
get texture() {
|
|
9
9
|
return this.colorAttachments[0];
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
constructor(device, props) {
|
|
13
12
|
super(device, props);
|
|
14
|
-
|
|
15
13
|
_defineProperty(this, "device", void 0);
|
|
16
|
-
|
|
17
14
|
_defineProperty(this, "gl", void 0);
|
|
18
|
-
|
|
19
15
|
_defineProperty(this, "handle", void 0);
|
|
20
|
-
|
|
21
|
-
_defineProperty(this, "colorAttachments", []);
|
|
22
|
-
|
|
23
|
-
_defineProperty(this, "depthStencilAttachment", undefined);
|
|
24
|
-
|
|
25
|
-
_defineProperty(this, "_ownResources", []);
|
|
26
|
-
|
|
16
|
+
const isDefaultFramebuffer = props.handle === null;
|
|
27
17
|
this.device = device;
|
|
28
18
|
this.gl = device.gl;
|
|
29
|
-
this.handle = this.props.handle
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.handle.__SPECTOR_Metadata = {
|
|
19
|
+
this.handle = this.props.handle || isDefaultFramebuffer ? this.props.handle : this.gl.createFramebuffer();
|
|
20
|
+
if (!isDefaultFramebuffer) {
|
|
21
|
+
device.setSpectorMetadata(this.handle, {
|
|
33
22
|
id: this.props.id,
|
|
34
23
|
props: this.props
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
|
|
45
|
-
|
|
46
|
-
if (attachment) {
|
|
47
|
-
this._attachOne(attachmentPoint, attachment);
|
|
24
|
+
});
|
|
25
|
+
this.autoCreateAttachmentTextures();
|
|
26
|
+
this.gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
|
|
27
|
+
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
28
|
+
const attachment = this.colorAttachments[i];
|
|
29
|
+
const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
|
|
30
|
+
if (attachment) {
|
|
31
|
+
this._attachOne(attachmentPoint, attachment);
|
|
32
|
+
}
|
|
48
33
|
}
|
|
34
|
+
if (this.depthStencilAttachment) {
|
|
35
|
+
this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.format), this.depthStencilAttachment);
|
|
36
|
+
}
|
|
37
|
+
this.gl.bindFramebuffer(GL.FRAMEBUFFER, null);
|
|
49
38
|
}
|
|
50
|
-
|
|
51
|
-
if (this.props.depthStencilAttachment) {
|
|
52
|
-
this._attachOne(getWebGLDepthStencilAttachment(this.depthStencilAttachment.format), this.depthStencilAttachment);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
56
|
-
|
|
57
39
|
if (props.check !== false) {
|
|
58
40
|
this._checkStatus();
|
|
59
41
|
}
|
|
60
42
|
}
|
|
61
|
-
|
|
62
43
|
destroy() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
resource.destroy();
|
|
66
|
-
}
|
|
67
|
-
|
|
44
|
+
super.destroy();
|
|
45
|
+
if (!this.destroyed && this.handle !== null) {
|
|
68
46
|
this.gl.deleteFramebuffer(this.handle);
|
|
69
|
-
this.handle = null;
|
|
70
47
|
}
|
|
71
48
|
}
|
|
72
|
-
|
|
73
49
|
_checkStatus() {
|
|
74
50
|
const {
|
|
75
51
|
gl
|
|
@@ -77,187 +53,103 @@ export default class WEBGLFramebuffer extends Framebuffer {
|
|
|
77
53
|
const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
|
|
78
54
|
const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER);
|
|
79
55
|
gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
80
|
-
|
|
81
56
|
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
82
57
|
throw new Error("Framebuffer ".concat(_getFrameBufferStatus(status)));
|
|
83
58
|
}
|
|
84
59
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return this.props.colorAttachments.map(colorAttachment => {
|
|
88
|
-
if (!colorAttachment) {
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (colorAttachment instanceof WebGLTexture) {
|
|
93
|
-
return colorAttachment;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return this._createColorAttachment(colorAttachment, this.width, this.height);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
_createColorAttachment(format, width, height) {
|
|
101
|
-
const texture = this.device._createTexture({
|
|
102
|
-
id: "".concat(this.id, "-color"),
|
|
103
|
-
data: null,
|
|
104
|
-
format,
|
|
105
|
-
width,
|
|
106
|
-
height,
|
|
107
|
-
mipmaps: false,
|
|
108
|
-
sampler: {
|
|
109
|
-
minFilter: 'linear',
|
|
110
|
-
magFilter: 'linear',
|
|
111
|
-
addressModeU: 'clamp-to-edge',
|
|
112
|
-
addressModeV: 'clamp-to-edge'
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
this._ownResources.push(texture);
|
|
117
|
-
|
|
118
|
-
return texture;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
_createDepthStencilAttachment() {
|
|
122
|
-
if (!this.props.depthStencilAttachment) {
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (this.props.depthStencilAttachment instanceof Renderbuffer) {
|
|
127
|
-
return this.props.depthStencilAttachment;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (this.props.depthStencilAttachment instanceof Texture) {
|
|
131
|
-
return this.props.depthStencilAttachment;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const format = this.props.depthStencilAttachment;
|
|
135
|
-
const webglFormat = getWebGLTextureFormat(this.gl, format);
|
|
136
|
-
const texture = new Renderbuffer(this.device, {
|
|
60
|
+
createDepthStencilTexture(format) {
|
|
61
|
+
return new WEBGLRenderbuffer(this.device, {
|
|
137
62
|
id: "".concat(this.id, "-depth-stencil"),
|
|
138
|
-
format
|
|
63
|
+
format,
|
|
139
64
|
width: this.width,
|
|
140
65
|
height: this.height
|
|
141
66
|
});
|
|
142
|
-
|
|
143
|
-
this._ownResources.push(texture);
|
|
144
|
-
|
|
145
|
-
return texture;
|
|
146
67
|
}
|
|
147
|
-
|
|
148
|
-
_resizeAttachments(width, height) {
|
|
149
|
-
var _this$depthStencilAtt;
|
|
150
|
-
|
|
68
|
+
resizeAttachments(width, height) {
|
|
151
69
|
if (this.handle === null) {
|
|
152
70
|
this.width = this.gl.drawingBufferWidth;
|
|
153
71
|
this.height = this.gl.drawingBufferHeight;
|
|
154
72
|
return this;
|
|
155
73
|
}
|
|
156
|
-
|
|
157
74
|
if (width === undefined) {
|
|
158
75
|
width = this.gl.drawingBufferWidth;
|
|
159
76
|
}
|
|
160
|
-
|
|
161
77
|
if (height === undefined) {
|
|
162
78
|
height = this.gl.drawingBufferHeight;
|
|
163
79
|
}
|
|
164
|
-
|
|
165
|
-
if (width !== this.width && height !== this.height) {
|
|
166
|
-
log.log(2, "Resizing framebuffer ".concat(this.id, " to ").concat(width, "x").concat(height))();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
80
|
for (const colorAttachment of this.colorAttachments) {
|
|
170
81
|
colorAttachment.resize({
|
|
171
82
|
width,
|
|
172
83
|
height
|
|
173
84
|
});
|
|
174
85
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
86
|
+
if (this.depthStencilAttachment) {
|
|
87
|
+
this.depthStencilAttachment.resize({
|
|
88
|
+
width,
|
|
89
|
+
height
|
|
90
|
+
});
|
|
91
|
+
}
|
|
180
92
|
return this;
|
|
181
93
|
}
|
|
182
|
-
|
|
183
94
|
_attachOne(attachmentPoint, attachment) {
|
|
184
|
-
if (attachment instanceof
|
|
185
|
-
this.
|
|
186
|
-
|
|
95
|
+
if (attachment instanceof WEBGLRenderbuffer) {
|
|
96
|
+
this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
|
|
187
97
|
return attachment;
|
|
188
98
|
} else if (Array.isArray(attachment)) {
|
|
189
99
|
const [texture, layer = 0, level = 0] = attachment;
|
|
190
|
-
|
|
191
100
|
this._attachTexture(attachmentPoint, texture, layer, level);
|
|
192
|
-
|
|
193
101
|
return texture;
|
|
194
|
-
} else if (attachment instanceof
|
|
102
|
+
} else if (attachment instanceof WEBGLTexture) {
|
|
195
103
|
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
196
|
-
|
|
197
104
|
return attachment;
|
|
198
105
|
}
|
|
106
|
+
throw new Error('attach');
|
|
199
107
|
}
|
|
200
|
-
|
|
201
|
-
_attachRenderbuffer(attachment, renderbuffer) {
|
|
108
|
+
_attachWEBGLRenderbuffer(attachment, renderbuffer) {
|
|
202
109
|
this.gl.framebufferRenderbuffer(GL.FRAMEBUFFER, attachment, GL.RENDERBUFFER, renderbuffer.handle);
|
|
203
110
|
}
|
|
204
|
-
|
|
205
111
|
_attachTexture(attachment, texture, layer, level) {
|
|
206
112
|
const {
|
|
207
113
|
gl,
|
|
208
114
|
gl2
|
|
209
115
|
} = this.device;
|
|
210
116
|
gl.bindTexture(texture.target, texture.handle);
|
|
211
|
-
|
|
212
117
|
switch (texture.target) {
|
|
213
118
|
case GL.TEXTURE_2D_ARRAY:
|
|
214
119
|
case GL.TEXTURE_3D:
|
|
215
120
|
this.device.assertWebGL2();
|
|
216
|
-
gl2.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);
|
|
121
|
+
gl2 === null || gl2 === void 0 ? void 0 : gl2.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);
|
|
217
122
|
break;
|
|
218
|
-
|
|
219
123
|
case GL.TEXTURE_CUBE_MAP:
|
|
220
124
|
const face = mapIndexToCubeMapFace(layer);
|
|
221
125
|
gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, face, texture.handle, level);
|
|
222
126
|
break;
|
|
223
|
-
|
|
224
127
|
case GL.TEXTURE_2D:
|
|
225
128
|
gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, GL.TEXTURE_2D, texture.handle, level);
|
|
226
129
|
break;
|
|
227
|
-
|
|
228
130
|
default:
|
|
229
131
|
assert(false, 'Illegal texture type');
|
|
230
132
|
}
|
|
231
|
-
|
|
232
133
|
gl.bindTexture(texture.target, null);
|
|
233
134
|
}
|
|
234
|
-
|
|
235
135
|
}
|
|
236
|
-
|
|
237
136
|
function mapIndexToCubeMapFace(layer) {
|
|
238
137
|
return layer < GL.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X : layer;
|
|
239
138
|
}
|
|
240
|
-
|
|
241
139
|
function _getFrameBufferStatus(status) {
|
|
242
140
|
switch (status) {
|
|
243
141
|
case GL.FRAMEBUFFER_COMPLETE:
|
|
244
142
|
return 'success';
|
|
245
|
-
|
|
246
143
|
case GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
|
247
144
|
return 'Mismatched attachments';
|
|
248
|
-
|
|
249
145
|
case GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
|
250
146
|
return 'No attachments';
|
|
251
|
-
|
|
252
147
|
case GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
|
|
253
148
|
return 'Height/width mismatch';
|
|
254
|
-
|
|
255
149
|
case GL.FRAMEBUFFER_UNSUPPORTED:
|
|
256
150
|
return 'Unsupported or split attachments';
|
|
257
|
-
|
|
258
151
|
case GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
|
|
259
152
|
return 'Samples mismatch';
|
|
260
|
-
|
|
261
153
|
default:
|
|
262
154
|
return "".concat(status);
|
|
263
155
|
}
|