@luma.gl/webgl 9.0.0-alpha.2 → 9.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/converters/device-parameters.d.ts +11 -1
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +17 -35
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.d.ts +2 -2
- package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.js +2 -7
- package/dist/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/adapter/converters/sampler-parameters.d.ts +4 -4
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +19 -55
- package/dist/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +13 -66
- package/dist/adapter/converters/texture-formats.js.map +1 -1
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +2 -8
- package/dist/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-features.js +13 -20
- package/dist/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +1 -4
- package/dist/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js +8 -10
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/adapter/device-helpers/is-old-ie.js +2 -1
- package/dist/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/adapter/helpers/attribute-utils.js +0 -17
- package/dist/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/adapter/helpers/get-shader-info.d.ts +9 -0
- package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -0
- package/dist/adapter/helpers/get-shader-info.js +25 -0
- package/dist/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/adapter/helpers/get-shader-layout.d.ts +1 -1
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +41 -67
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js +0 -7
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +1 -31
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/helpers/uniforms.d.ts +1 -1
- package/dist/adapter/helpers/uniforms.d.ts.map +1 -1
- package/dist/adapter/helpers/uniforms.js +4 -14
- package/dist/adapter/helpers/uniforms.js.map +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +0 -7
- package/dist/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +3 -3
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +6 -22
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts +3 -5
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +15 -68
- package/dist/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +6 -6
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +7 -17
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +3 -4
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +18 -49
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +3 -18
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.d.ts +3 -3
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +2 -15
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +16 -16
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +17 -75
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts +3 -3
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +3 -8
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +5 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +51 -140
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts +5 -4
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +5 -13
- package/dist/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts +3 -4
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +8 -21
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts +26 -26
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +66 -183
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/webgl-canvas-context.d.ts +3 -3
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +6 -19
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +53 -37
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +108 -109
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/accessor.d.ts +1 -1
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +12 -36
- package/dist/classic/accessor.js.map +1 -1
- package/dist/classic/buffer.d.ts +3 -4
- package/dist/classic/buffer.d.ts.map +1 -1
- package/dist/classic/buffer.js +30 -87
- package/dist/classic/buffer.js.map +1 -1
- package/dist/classic/typed-array-utils.d.ts +1 -1
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +0 -20
- package/dist/classic/typed-array-utils.js.map +1 -1
- package/dist/context/context/{create-context.d.ts → create-browser-context.d.ts} +2 -1
- package/dist/context/context/create-browser-context.d.ts.map +1 -0
- package/dist/context/context/{create-context.js → create-browser-context.js} +19 -15
- package/dist/context/context/create-browser-context.js.map +1 -0
- package/dist/context/context/create-headless-context.d.ts +9 -0
- package/dist/context/context/create-headless-context.d.ts.map +1 -0
- package/dist/context/context/create-headless-context.js +42 -0
- package/dist/context/context/create-headless-context.js.map +1 -0
- package/dist/context/context/webgl-checks.js +0 -3
- package/dist/context/context/webgl-checks.js.map +1 -1
- package/dist/context/debug/spector.d.ts +1 -0
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +7 -19
- package/dist/context/debug/spector.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +8 -32
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts +6 -5
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +8 -18
- package/dist/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts +103 -103
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +16 -34
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/context/polyfill/context-data.d.ts +13 -0
- package/dist/context/polyfill/context-data.d.ts.map +1 -0
- package/dist/context/polyfill/context-data.js +12 -0
- package/dist/context/polyfill/context-data.js.map +1 -0
- package/dist/context/polyfill/get-parameter-polyfill.d.ts +1 -1
- package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -1
- package/dist/context/polyfill/get-parameter-polyfill.js +1 -6
- package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/context/polyfill/polyfill-context.js +20 -28
- package/dist/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/context/polyfill/polyfill-table.d.ts +8 -8
- package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-table.js +8 -30
- package/dist/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.js +0 -4
- package/dist/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +15 -50
- package/dist/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts +2 -1
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +7 -9
- package/dist/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/dist.dev.js +9204 -0
- package/dist/index.cjs +5948 -0
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -26
- package/dist/index.js.map +1 -1
- package/dist/types/webgl.d.ts +8 -7
- package/dist/types/webgl.d.ts.map +1 -1
- package/dist/types/webgl.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist.min.js +36 -0
- package/package.json +18 -9
- package/src/.DS_Store +0 -0
- package/src/adapter/.DS_Store +0 -0
- package/src/adapter/converters/device-parameters.ts +45 -16
- package/src/adapter/converters/renderbuffer-formats.ts +1 -3
- package/src/adapter/converters/sampler-parameters.ts +18 -7
- package/src/adapter/converters/texture-formats.ts +18 -16
- package/src/adapter/converters/vertex-formats.ts +1 -0
- package/src/adapter/device-helpers/device-features.ts +9 -2
- package/src/adapter/device-helpers/device-limits.ts +1 -1
- package/src/adapter/device-helpers/get-device-info.ts +12 -8
- package/src/adapter/helpers/get-shader-info.ts +37 -0
- package/src/adapter/helpers/get-shader-layout.ts +59 -37
- package/src/adapter/helpers/parse-shader-compiler-log.ts +2 -2
- package/src/adapter/helpers/set-uniform.ts +3 -1
- package/src/adapter/helpers/uniforms.ts +21 -10
- package/src/adapter/objects/constants-to-keys.ts +4 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +8 -8
- package/src/adapter/objects/webgl-resource.ts +8 -13
- package/src/adapter/objects/webgl-vertex-array-object.ts +10 -10
- package/src/adapter/resources/webgl-buffer.ts +16 -16
- package/src/adapter/resources/webgl-command-buffer.ts +3 -3
- package/src/adapter/resources/webgl-command-encoder.ts +8 -8
- package/src/adapter/resources/webgl-external-texture.ts +1 -1
- package/src/adapter/resources/webgl-framebuffer.ts +36 -33
- package/src/adapter/resources/webgl-render-pass.ts +4 -3
- package/src/adapter/resources/webgl-render-pipeline.ts +89 -77
- package/src/adapter/resources/webgl-sampler.ts +12 -6
- package/src/adapter/resources/webgl-shader.ts +10 -9
- package/src/adapter/resources/webgl-texture.ts +55 -45
- package/src/adapter/webgl-canvas-context.ts +8 -9
- package/src/adapter/webgl-device.ts +153 -69
- package/src/classic/accessor.ts +2 -15
- package/src/classic/buffer.ts +18 -25
- package/src/classic/typed-array-utils.ts +4 -2
- package/src/context/.DS_Store +0 -0
- package/src/context/context/{create-context.ts → create-browser-context.ts} +17 -7
- package/src/context/context/create-headless-context.ts +48 -0
- package/src/context/debug/spector.ts +6 -5
- package/src/context/debug/webgl-developer-tools.ts +13 -13
- package/src/context/parameters/unified-parameter-api.ts +18 -12
- package/src/context/parameters/webgl-parameter-tables.ts +113 -94
- package/src/context/polyfill/context-data.ts +27 -0
- package/src/context/polyfill/get-parameter-polyfill.ts +7 -6
- package/src/context/polyfill/polyfill-context.ts +6 -8
- package/src/context/polyfill/polyfill-table.ts +16 -14
- package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
- package/src/context/state-tracker/track-context-state.ts +13 -12
- package/src/context/state-tracker/with-parameters.ts +8 -2
- package/src/index.ts +28 -26
- package/src/types/webgl.ts +10 -7
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/dist/context/context/context-state.d.ts +0 -18
- package/dist/context/context/context-state.d.ts.map +0 -1
- package/dist/context/context/context-state.js +0 -26
- package/dist/context/context/context-state.js.map +0 -1
- package/dist/context/context/create-context.d.ts.map +0 -1
- package/dist/context/context/create-context.js.map +0 -1
- package/dist/context/context/device-pixels.d.ts +0 -25
- package/dist/context/context/device-pixels.d.ts.map +0 -1
- package/dist/context/context/device-pixels.js +0 -98
- package/dist/context/context/device-pixels.js.map +0 -1
- package/dist/es5/adapter/converters/device-parameters.js +0 -170
- package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
- package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -163
- package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/es5/adapter/converters/sampler-parameters.js +0 -226
- package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/es5/adapter/converters/texture-formats.js +0 -1031
- package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
- package/dist/es5/adapter/converters/vertex-formats.js +0 -45
- package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/es5/adapter/device-helpers/device-features.js +0 -144
- package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/es5/adapter/device-helpers/device-limits.js +0 -64
- package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/es5/adapter/device-helpers/get-device-info.js +0 -55
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -16
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/es5/adapter/helpers/attribute-utils.js +0 -91
- package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/es5/adapter/helpers/get-shader-layout.js +0 -371
- package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -72
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/es5/adapter/helpers/set-uniform.js +0 -125
- package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/es5/adapter/helpers/uniforms.js +0 -112
- package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
- package/dist/es5/adapter/objects/constants-to-keys.js +0 -54
- package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -150
- package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-resource.js +0 -292
- package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -137
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-buffer.js +0 -243
- package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -96
- package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -98
- package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
- package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -345
- package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-render-pass.js +0 -61
- package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -505
- package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-sampler.js +0 -96
- package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-shader.js +0 -149
- package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-texture.js +0 -986
- package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/es5/adapter/webgl-canvas-context.js +0 -97
- package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/es5/adapter/webgl-device.js +0 -399
- package/dist/es5/adapter/webgl-device.js.map +0 -1
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/classic/accessor.js +0 -181
- package/dist/es5/classic/accessor.js.map +0 -1
- package/dist/es5/classic/buffer.js +0 -470
- package/dist/es5/classic/buffer.js.map +0 -1
- package/dist/es5/classic/typed-array-utils.js +0 -126
- package/dist/es5/classic/typed-array-utils.js.map +0 -1
- package/dist/es5/context/context/context-state.js +0 -31
- package/dist/es5/context/context/context-state.js.map +0 -1
- package/dist/es5/context/context/create-context.js +0 -69
- package/dist/es5/context/context/create-context.js.map +0 -1
- package/dist/es5/context/context/device-pixels.js +0 -115
- package/dist/es5/context/context/device-pixels.js.map +0 -1
- package/dist/es5/context/context/webgl-checks.js +0 -54
- package/dist/es5/context/context/webgl-checks.js.map +0 -1
- package/dist/es5/context/debug/spector.js +0 -133
- package/dist/es5/context/debug/spector.js.map +0 -1
- package/dist/es5/context/debug/webgl-developer-tools.js +0 -198
- package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/es5/context/parameters/unified-parameter-api.js +0 -97
- package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -392
- package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -81
- package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-context.js +0 -135
- package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-table.js +0 -166
- package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -341
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/es5/context/state-tracker/deep-array-equal.js +0 -28
- package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/es5/context/state-tracker/track-context-state.js +0 -211
- package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/es5/context/state-tracker/with-parameters.js +0 -44
- package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/es5/index.js +0 -276
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/init.js +0 -10
- package/dist/es5/init.js.map +0 -1
- package/dist/es5/types/webgl.js +0 -6
- package/dist/es5/types/webgl.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/es5/types.js.map +0 -1
- package/dist/esm/adapter/converters/device-parameters.js +0 -155
- package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
- package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -185
- package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/esm/adapter/converters/sampler-parameters.js +0 -208
- package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/esm/adapter/converters/texture-formats.js +0 -954
- package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
- package/dist/esm/adapter/converters/vertex-formats.js +0 -35
- package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/esm/adapter/device-helpers/device-features.js +0 -102
- package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/esm/adapter/device-helpers/device-limits.js +0 -91
- package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/esm/adapter/device-helpers/get-device-info.js +0 -44
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -8
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/esm/adapter/helpers/attribute-utils.js +0 -81
- package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/esm/adapter/helpers/get-shader-layout.js +0 -306
- package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -37
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/esm/adapter/helpers/set-uniform.js +0 -115
- package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/esm/adapter/helpers/uniforms.js +0 -99
- package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
- package/dist/esm/adapter/objects/constants-to-keys.js +0 -42
- package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -94
- package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-resource.js +0 -216
- package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -84
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-buffer.js +0 -164
- package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -65
- package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -53
- package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
- package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -265
- package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-render-pass.js +0 -19
- package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -400
- package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-sampler.js +0 -50
- package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-shader.js +0 -75
- package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-texture.js +0 -831
- package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/esm/adapter/webgl-canvas-context.js +0 -54
- package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/esm/adapter/webgl-device.js +0 -280
- package/dist/esm/adapter/webgl-device.js.map +0 -1
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/classic/accessor.js +0 -144
- package/dist/esm/classic/accessor.js.map +0 -1
- package/dist/esm/classic/buffer.js +0 -384
- package/dist/esm/classic/buffer.js.map +0 -1
- package/dist/esm/classic/typed-array-utils.js +0 -112
- package/dist/esm/classic/typed-array-utils.js.map +0 -1
- package/dist/esm/context/context/context-state.js +0 -26
- package/dist/esm/context/context/context-state.js.map +0 -1
- package/dist/esm/context/context/create-context.js +0 -49
- package/dist/esm/context/context/create-context.js.map +0 -1
- package/dist/esm/context/context/device-pixels.js +0 -98
- package/dist/esm/context/context/device-pixels.js.map +0 -1
- package/dist/esm/context/context/webgl-checks.js +0 -34
- package/dist/esm/context/context/webgl-checks.js.map +0 -1
- package/dist/esm/context/debug/spector.js +0 -76
- package/dist/esm/context/debug/spector.js.map +0 -1
- package/dist/esm/context/debug/webgl-developer-tools.js +0 -121
- package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/esm/context/parameters/unified-parameter-api.js +0 -65
- package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -445
- package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -91
- package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-context.js +0 -92
- package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-table.js +0 -160
- package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -335
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/esm/context/state-tracker/deep-array-equal.js +0 -21
- package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/esm/context/state-tracker/track-context-state.js +0 -183
- package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/esm/context/state-tracker/with-parameters.js +0 -36
- package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/esm/index.js +0 -27
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/init.js +0 -4
- package/dist/esm/init.js.map +0 -1
- package/dist/esm/types/webgl.js +0 -2
- package/dist/esm/types/webgl.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/init.d.ts +0 -2
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -4
- package/dist/init.js.map +0 -1
- package/src/bundle.ts +0 -4
- package/src/context/context/context-state.ts +0 -41
- package/src/context/context/device-pixels.ts +0 -152
- package/src/init.ts +0 -4
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
// luma.gl, MIT license
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
ShaderLayout,
|
|
3
|
-
BindingLayout,
|
|
5
|
+
// BindingLayout,
|
|
4
6
|
UniformBinding,
|
|
5
7
|
UniformBlockBinding,
|
|
6
8
|
ProgramBindings,
|
|
7
9
|
AttributeBinding,
|
|
8
10
|
VaryingBinding,
|
|
9
|
-
AttributeLayout,
|
|
11
|
+
// AttributeLayout,
|
|
10
12
|
AccessorObject
|
|
11
13
|
} from '@luma.gl/api';
|
|
12
14
|
import GL from '@luma.gl/constants';
|
|
13
15
|
import {isWebGL2} from '../../context/context/webgl-checks';
|
|
14
|
-
import Accessor from '../../classic/accessor'; // TODO - should NOT depend on classic API
|
|
16
|
+
import {Accessor} from '../../classic/accessor'; // TODO - should NOT depend on classic API
|
|
15
17
|
import {decodeUniformType, decodeAttributeType} from './uniforms';
|
|
16
18
|
import {getVertexFormat} from '../converters/vertex-formats';
|
|
17
19
|
import {isSamplerUniform} from './uniforms';
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* Extract metadata describing binding information for a program's shaders
|
|
20
23
|
* Note: `linkProgram()` needs to have been called
|
|
@@ -29,9 +32,11 @@ export function getShaderLayout(gl: WebGLRenderingContext, program: WebGLProgram
|
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
for (const attribute of programBindings.attributes) {
|
|
35
|
+
// TODO - multicolumn attributes like a matrix4 can be up to 16 elts...
|
|
36
|
+
const size = Math.min(attribute.accessor.size, 4);
|
|
32
37
|
const format =
|
|
33
38
|
// attribute.accessor.format ||
|
|
34
|
-
getVertexFormat(attribute.accessor.type || GL.FLOAT,
|
|
39
|
+
getVertexFormat(attribute.accessor.type || GL.FLOAT, size);
|
|
35
40
|
shaderLayout.attributes.push({
|
|
36
41
|
name: attribute.name,
|
|
37
42
|
location: attribute.location,
|
|
@@ -123,7 +128,11 @@ function readAttributeBindings(
|
|
|
123
128
|
const count = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
|
|
124
129
|
|
|
125
130
|
for (let index = 0; index < count; index++) {
|
|
126
|
-
const
|
|
131
|
+
const activeInfo = gl.getActiveAttrib(program, index);
|
|
132
|
+
if (!activeInfo) {
|
|
133
|
+
throw new Error('activeInfo');
|
|
134
|
+
}
|
|
135
|
+
const {name, type: compositeType, size} = activeInfo;
|
|
127
136
|
const location = gl.getAttribLocation(program, name);
|
|
128
137
|
// Add only user provided attributes, for built-in attributes like
|
|
129
138
|
// `gl_InstanceID` locaiton will be < 0
|
|
@@ -158,7 +167,11 @@ function readVaryings(gl: WebGLRenderingContext, program: WebGLProgram): Varying
|
|
|
158
167
|
|
|
159
168
|
const count = gl.getProgramParameter(program, GL.TRANSFORM_FEEDBACK_VARYINGS);
|
|
160
169
|
for (let location = 0; location < count; location++) {
|
|
161
|
-
const
|
|
170
|
+
const activeInfo = gl2.getTransformFeedbackVarying(program, location);
|
|
171
|
+
if (!activeInfo) {
|
|
172
|
+
throw new Error('activeInfo');
|
|
173
|
+
}
|
|
174
|
+
const {name, type: compositeType, size} = activeInfo;
|
|
162
175
|
const {glType, components} = decodeUniformType(compositeType);
|
|
163
176
|
const accessor = new Accessor({type: glType, size: size * components});
|
|
164
177
|
const varying = {location, name, accessor}; // Base values
|
|
@@ -179,7 +192,11 @@ function readUniformBindings(gl: WebGLRenderingContext, program: WebGLProgram):
|
|
|
179
192
|
|
|
180
193
|
const uniformCount = gl.getProgramParameter(program, GL.ACTIVE_UNIFORMS);
|
|
181
194
|
for (let i = 0; i < uniformCount; i++) {
|
|
182
|
-
const
|
|
195
|
+
const activeInfo = gl.getActiveUniform(program, i);
|
|
196
|
+
if (!activeInfo) {
|
|
197
|
+
throw new Error('activeInfo');
|
|
198
|
+
}
|
|
199
|
+
const {name: rawName, size, type} = activeInfo;
|
|
183
200
|
const {name, isArray} = parseUniformName(rawName);
|
|
184
201
|
let webglLocation = gl.getUniformLocation(program, name);
|
|
185
202
|
const uniformInfo = {
|
|
@@ -234,8 +251,8 @@ function readUniformBlocks(
|
|
|
234
251
|
|
|
235
252
|
const blockCount = gl2.getProgramParameter(program, GL.ACTIVE_UNIFORM_BLOCKS);
|
|
236
253
|
for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {
|
|
237
|
-
const blockInfo = {
|
|
238
|
-
name: gl2.getActiveUniformBlockName(program, blockIndex),
|
|
254
|
+
const blockInfo: UniformBlockBinding = {
|
|
255
|
+
name: gl2.getActiveUniformBlockName(program, blockIndex) || '',
|
|
239
256
|
location: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_BINDING),
|
|
240
257
|
byteLength: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_DATA_SIZE),
|
|
241
258
|
vertex: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),
|
|
@@ -244,33 +261,38 @@ function readUniformBlocks(
|
|
|
244
261
|
uniforms: [] as any[]
|
|
245
262
|
};
|
|
246
263
|
|
|
247
|
-
const uniformIndices = getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES);
|
|
264
|
+
const uniformIndices = getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) as number[] || [];
|
|
248
265
|
|
|
249
266
|
const uniformType = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_TYPE); // Array of GLenum indicating the types of the uniforms.
|
|
250
267
|
const uniformArrayLength = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_SIZE); // Array of GLuint indicating the sizes of the uniforms.
|
|
251
|
-
const uniformBlockIndex = gl2.getActiveUniforms(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
); // Array of GLint indicating the block indices of the uniforms.
|
|
268
|
+
// const uniformBlockIndex = gl2.getActiveUniforms(
|
|
269
|
+
// program,
|
|
270
|
+
// uniformIndices,
|
|
271
|
+
// GL.UNIFORM_BLOCK_INDEX
|
|
272
|
+
// ); // Array of GLint indicating the block indices of the uniforms.
|
|
256
273
|
const uniformOffset = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_OFFSET); // Array of GLint indicating the uniform buffer offsets.
|
|
257
274
|
const uniformStride = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_ARRAY_STRIDE); // Array of GLint indicating the strides between the elements.
|
|
258
|
-
const uniformMatrixStride = gl2.getActiveUniforms(
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
); // Array of GLint indicating the strides between columns of a column-major matrix or a row-major matrix.
|
|
263
|
-
const uniformRowMajor = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_IS_ROW_MAJOR);
|
|
275
|
+
// const uniformMatrixStride = gl2.getActiveUniforms(
|
|
276
|
+
// program,
|
|
277
|
+
// uniformIndices,
|
|
278
|
+
// GL.UNIFORM_MATRIX_STRIDE
|
|
279
|
+
// ); // Array of GLint indicating the strides between columns of a column-major matrix or a row-major matrix.
|
|
280
|
+
// const uniformRowMajor = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_IS_ROW_MAJOR);
|
|
264
281
|
for (let i = 0; i < blockInfo.uniformCount; ++i) {
|
|
282
|
+
const activeInfo = gl2.getActiveUniform(program, uniformIndices[i]);
|
|
283
|
+
if (!activeInfo) {
|
|
284
|
+
throw new Error('activeInfo');
|
|
285
|
+
}
|
|
286
|
+
|
|
265
287
|
blockInfo.uniforms.push({
|
|
266
|
-
name:
|
|
288
|
+
name: activeInfo.name,
|
|
267
289
|
format: decodeUniformType(uniformType[i]).format,
|
|
268
290
|
type: uniformType[i],
|
|
269
291
|
arrayLength: uniformArrayLength[i],
|
|
270
292
|
byteOffset: uniformOffset[i],
|
|
271
293
|
byteStride: uniformStride[i],
|
|
272
|
-
matrixStride: uniformStride[i],
|
|
273
|
-
rowMajor: uniformRowMajor[i]
|
|
294
|
+
// matrixStride: uniformStride[i],
|
|
295
|
+
// rowMajor: uniformRowMajor[i]
|
|
274
296
|
});
|
|
275
297
|
}
|
|
276
298
|
|
|
@@ -305,18 +327,18 @@ const SAMPLER_UNIFORMS_GL_TO_GPU: Record<
|
|
|
305
327
|
[GL.UNSIGNED_INT_SAMPLER_2D_ARRAY]: ['2d-array', 'uint']
|
|
306
328
|
};
|
|
307
329
|
|
|
308
|
-
|
|
309
|
-
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (sampler) {
|
|
316
|
-
|
|
317
|
-
return {viewDimension, sampleType};
|
|
330
|
+
type SamplerInfo = | {
|
|
331
|
+
viewDimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';
|
|
332
|
+
sampleType: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint';
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
function getSamplerInfo(type: GL): SamplerInfo {
|
|
336
|
+
const sampler = SAMPLER_UNIFORMS_GL_TO_GPU[type];
|
|
337
|
+
if (!sampler) {
|
|
338
|
+
throw new Error('sampler');
|
|
318
339
|
}
|
|
319
|
-
|
|
340
|
+
const [viewDimension, sampleType] = sampler;
|
|
341
|
+
return {viewDimension, sampleType};
|
|
320
342
|
}
|
|
321
343
|
|
|
322
344
|
// HELPERS
|
|
@@ -333,7 +355,7 @@ function parseUniformName(name: string): {name: string; length: number; isArray:
|
|
|
333
355
|
|
|
334
356
|
// if array name then clean the array brackets
|
|
335
357
|
const UNIFORM_NAME_REGEXP = /([^[]*)(\[[0-9]+\])?/;
|
|
336
|
-
const matches =
|
|
358
|
+
const matches = UNIFORM_NAME_REGEXP.exec(name);
|
|
337
359
|
if (!matches || matches.length < 2) {
|
|
338
360
|
throw new Error(`Failed to parse GLSL uniform name ${name}`);
|
|
339
361
|
}
|
|
@@ -351,7 +373,7 @@ function parseUniformName(name: string): {name: string; length: number; isArray:
|
|
|
351
373
|
* Extract info about all "active" uniform blocks
|
|
352
374
|
* ("Active" just means that unused (inactive) blocks may have been optimized away during linking)
|
|
353
375
|
*
|
|
354
|
-
function getUniformBlockBindings(gl, program): Binding[] {
|
|
376
|
+
function getUniformBlockBindings(gl: WebGLRenderingContext, program): Binding[] {
|
|
355
377
|
if (!isWebGL2(gl)) {
|
|
356
378
|
return;
|
|
357
379
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
|
-
import type {CompilerMessage} from '@luma.gl/
|
|
2
|
+
import type {CompilerMessage} from '@luma.gl/api';
|
|
3
3
|
|
|
4
4
|
const MESSAGE_TYPES = ['warning', 'error', 'info'];
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ export function parseShaderCompilerLog(errLog: string) : readonly CompilerMessag
|
|
|
16
16
|
|
|
17
17
|
for (const line of lines) {
|
|
18
18
|
if (line.length <= 1) {
|
|
19
|
-
continue;
|
|
19
|
+
continue; // eslint-disable-line no-continue
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const segments: string[] = line.split(':');
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
1
3
|
// Uniforms
|
|
2
4
|
import GL from '@luma.gl/constants';
|
|
3
5
|
|
|
@@ -60,7 +62,7 @@ export function setUniform(
|
|
|
60
62
|
case GL.BOOL: return gl.uniform1iv(location, arrayValue);
|
|
61
63
|
case GL.BOOL_VEC2: return gl.uniform2iv(location, arrayValue);
|
|
62
64
|
case GL.BOOL_VEC3: return gl.uniform3iv(location, arrayValue);
|
|
63
|
-
case GL.BOOL_VEC4: gl.uniform4iv(location, arrayValue);
|
|
65
|
+
case GL.BOOL_VEC4: return gl.uniform4iv(location, arrayValue);
|
|
64
66
|
|
|
65
67
|
// WEBGL2 - unsigned integers
|
|
66
68
|
case GL.UNSIGNED_INT: return gl2.uniform1uiv(location, arrayValue, 1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {UniformFormat, VertexFormat} from '@luma.gl/api';
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
|
-
import {GLUniformType, GLSamplerType, GLCompositeType, GLType} from '../../types/webgl'
|
|
3
|
+
import {GLUniformType, GLSamplerType, GLCompositeType, GLType} from '../../types/webgl';
|
|
4
4
|
|
|
5
5
|
/** Check is uniform is of sampler type */
|
|
6
6
|
export function isSamplerUniform(type: GLUniformType): boolean {
|
|
@@ -25,8 +25,11 @@ const SAMPLER_TYPES: GLSamplerType[] = [
|
|
|
25
25
|
GL.UNSIGNED_INT_SAMPLER_2D_ARRAY
|
|
26
26
|
];
|
|
27
27
|
|
|
28
|
-
// Composite types table
|
|
29
|
-
const COMPOSITE_GL_TYPES: Record<
|
|
28
|
+
// Composite types table
|
|
29
|
+
const COMPOSITE_GL_TYPES: Record<
|
|
30
|
+
GLCompositeType,
|
|
31
|
+
[GLType, number, string, UniformFormat, VertexFormat?]
|
|
32
|
+
> = {
|
|
30
33
|
[GL.FLOAT]: [GL.FLOAT, 1, 'float', 'f32', 'float32'],
|
|
31
34
|
[GL.FLOAT_VEC2]: [GL.FLOAT, 2, 'vec2', 'vec2<f32>', 'float32x2'],
|
|
32
35
|
[GL.FLOAT_VEC3]: [GL.FLOAT, 3, 'vec3', 'vec3<f32>', 'float32x3'],
|
|
@@ -61,26 +64,34 @@ const COMPOSITE_GL_TYPES: Record<GLCompositeType, [GLType, number, string, Unifo
|
|
|
61
64
|
};
|
|
62
65
|
|
|
63
66
|
/** Decomposes a composite type GL.VEC3 into a basic type (GL.FLOAT) and components (3) */
|
|
64
|
-
export function decodeUniformType(
|
|
67
|
+
export function decodeUniformType(
|
|
68
|
+
uniformType: GL
|
|
69
|
+
): {format: UniformFormat; components: number; glType: GLType} {
|
|
65
70
|
const typeAndSize = COMPOSITE_GL_TYPES[uniformType];
|
|
66
71
|
if (!typeAndSize) {
|
|
67
|
-
|
|
72
|
+
throw new Error('uniform');
|
|
68
73
|
}
|
|
69
74
|
const [glType, components, , format] = typeAndSize;
|
|
70
75
|
return {format, components, glType};
|
|
71
76
|
}
|
|
72
77
|
|
|
73
|
-
export function decodeAttributeType(
|
|
74
|
-
|
|
78
|
+
export function decodeAttributeType(attributeType: GL): {
|
|
79
|
+
format: VertexFormat;
|
|
80
|
+
components: number;
|
|
81
|
+
glType: GLType;
|
|
82
|
+
} {
|
|
83
|
+
const typeAndSize = COMPOSITE_GL_TYPES[attributeType];
|
|
75
84
|
if (!typeAndSize) {
|
|
76
|
-
|
|
85
|
+
throw new Error('attribute')
|
|
77
86
|
}
|
|
78
87
|
const [glType, components, , , format] = typeAndSize;
|
|
79
88
|
return {format, components, glType};
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
/** Decomposes a composite type GL.VEC3 into a basic type (GL.FLOAT) and components (3) */
|
|
83
|
-
export function decomposeCompositeGLType(
|
|
92
|
+
export function decomposeCompositeGLType(
|
|
93
|
+
compositeGLType: GLCompositeType
|
|
94
|
+
): {type: GLType; components: number} | null {
|
|
84
95
|
const typeAndSize = COMPOSITE_GL_TYPES[compositeGLType];
|
|
85
96
|
if (!typeAndSize) {
|
|
86
97
|
return null;
|
|
@@ -89,7 +100,7 @@ export function decomposeCompositeGLType(compositeGLType: GLCompositeType): {typ
|
|
|
89
100
|
return {type, components};
|
|
90
101
|
}
|
|
91
102
|
|
|
92
|
-
export function getCompositeGLType(type: GL, components): {glType: GLType
|
|
103
|
+
export function getCompositeGLType(type: GL, components): {glType: GLType; name: string} | null {
|
|
93
104
|
switch (type) {
|
|
94
105
|
case GL.BYTE:
|
|
95
106
|
case GL.UNSIGNED_BYTE:
|
|
@@ -16,16 +16,18 @@ export function getKeyValue(gl: WebGLRenderingContext, name: string | GL): GL {
|
|
|
16
16
|
|
|
17
17
|
// Look up string, after removing any 'GL.' or 'gl.' prefix
|
|
18
18
|
name = name.replace(/^.*\./, '');
|
|
19
|
+
// @ts-ignore expect-error depends on settings
|
|
19
20
|
const value = gl[name];
|
|
20
21
|
assert(value !== undefined, `Accessing undefined constant GL.${name}`);
|
|
21
22
|
return value;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export function getKey(gl: WebGLRenderingContext, value: any): string {
|
|
25
|
-
// @ts-expect-error
|
|
26
|
+
// @ts-ignore expect-error depends on settings
|
|
26
27
|
gl = gl.gl || gl;
|
|
27
28
|
value = Number(value);
|
|
28
29
|
for (const key in gl) {
|
|
30
|
+
// @ts-ignore expect-error depends on settings
|
|
29
31
|
if (gl[key] === value) {
|
|
30
32
|
return `GL.${key}`;
|
|
31
33
|
}
|
|
@@ -37,6 +39,7 @@ export function getKeyType(gl: WebGLRenderingContext, value: any): string {
|
|
|
37
39
|
assert(value !== undefined, 'undefined key');
|
|
38
40
|
value = Number(value);
|
|
39
41
|
for (const key in gl) {
|
|
42
|
+
// @ts-ignore expect-error depends on settings
|
|
40
43
|
if (gl[key] === value) {
|
|
41
44
|
return `GL.${key}`;
|
|
42
45
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-inline-comments */
|
|
2
2
|
import {assert, ResourceProps} from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
|
-
import WebGLDevice from '../webgl-device';
|
|
5
|
-
import WebGLResource from './webgl-resource';
|
|
4
|
+
import {WebGLDevice} from '../webgl-device';
|
|
5
|
+
import {WebGLResource} from './webgl-resource';
|
|
6
6
|
import {
|
|
7
7
|
isRenderbufferFormatSupported, getRenderbufferFormatBytesPerPixel
|
|
8
8
|
} from '../converters/renderbuffer-formats';
|
|
@@ -34,8 +34,8 @@ const DEFAULT_RENDERBUFFER_PROPS: Required<RenderbufferProps> = {
|
|
|
34
34
|
* use Textures instead.
|
|
35
35
|
* Renderbuffer objects also natively accommodate Multisampling (MSAA).
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
38
|
-
get [Symbol.toStringTag](): string { return 'Renderbuffer'; }
|
|
37
|
+
export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
|
|
38
|
+
override get [Symbol.toStringTag](): string { return 'Renderbuffer'; }
|
|
39
39
|
|
|
40
40
|
get width(): number { return this.props.width; }
|
|
41
41
|
get height(): number { return this.props.height; }
|
|
@@ -43,7 +43,7 @@ export default class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps>
|
|
|
43
43
|
get samples(): number { return this.props.samples; }
|
|
44
44
|
|
|
45
45
|
static isSupported(gl: WebGLRenderingContext, options?: {format?: number}): boolean {
|
|
46
|
-
return !options
|
|
46
|
+
return !options?.format || isRenderbufferFormatSupported(gl, options.format);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
constructor(device: WebGLDevice, props: RenderbufferProps) {
|
|
@@ -89,16 +89,16 @@ export default class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps>
|
|
|
89
89
|
|
|
90
90
|
// RESOURCE IMPLEMENTATION
|
|
91
91
|
|
|
92
|
-
_createHandle() {
|
|
92
|
+
override _createHandle() {
|
|
93
93
|
return this.gl.createRenderbuffer();
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
_deleteHandle(): void {
|
|
96
|
+
override _deleteHandle(): void {
|
|
97
97
|
this.gl.deleteRenderbuffer(this.handle);
|
|
98
98
|
this.trackDeallocatedMemory();
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
_bindHandle(handle: WEBGLRenderbuffer): void {
|
|
101
|
+
override _bindHandle(handle: WEBGLRenderbuffer): void {
|
|
102
102
|
this.gl.bindRenderbuffer(GL.RENDERBUFFER, handle);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -3,7 +3,7 @@ import {Resource, assert, uid, stubRemovedMethods} from '@luma.gl/api';
|
|
|
3
3
|
import type {Device, ResourceProps} from '@luma.gl/api';
|
|
4
4
|
import GL from '@luma.gl/constants';
|
|
5
5
|
import {isWebGL2, assertWebGLContext} from '../../context/context/webgl-checks';
|
|
6
|
-
import WebGLDevice from '../webgl-device';
|
|
6
|
+
import {WebGLDevice} from '../webgl-device';
|
|
7
7
|
|
|
8
8
|
// Requires full GL enum to be bundled... Make these bindings dependent on dynamic import (debug)?
|
|
9
9
|
import {getKey, getKeyValue} from './constants-to-keys';
|
|
@@ -13,9 +13,7 @@ const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual met
|
|
|
13
13
|
/**
|
|
14
14
|
* Base class for WebGL object wrappers
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
id: string;
|
|
18
|
-
userData: any;
|
|
16
|
+
export abstract class WebGLResource<Props extends ResourceProps> extends Resource<Props> {
|
|
19
17
|
readonly device: WebGLDevice;
|
|
20
18
|
readonly gl: WebGLRenderingContext;
|
|
21
19
|
readonly gl2: WebGL2RenderingContext;
|
|
@@ -34,12 +32,10 @@ const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual met
|
|
|
34
32
|
assertWebGLContext(gl);
|
|
35
33
|
|
|
36
34
|
// extends
|
|
37
|
-
|
|
38
|
-
const {id, userData = {}} = props || {};
|
|
35
|
+
const {id} = props || {};
|
|
39
36
|
this.gl = gl;
|
|
40
37
|
this.gl2 = gl as WebGL2RenderingContext;
|
|
41
38
|
this.id = id || uid(this.constructor.name);
|
|
42
|
-
this.userData = userData;
|
|
43
39
|
|
|
44
40
|
// Set the handle
|
|
45
41
|
// If handle was provided, use it, otherwise create a new handle
|
|
@@ -48,7 +44,6 @@ const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual met
|
|
|
48
44
|
// this.glCount = glGetContextLossCount(this.gl);
|
|
49
45
|
|
|
50
46
|
// Default VertexArray needs to be created with null handle, so compare against undefined
|
|
51
|
-
// @ts-expect-error
|
|
52
47
|
this._handle = props?.handle;
|
|
53
48
|
if (this._handle === undefined) {
|
|
54
49
|
this._handle = this._createHandle();
|
|
@@ -57,7 +52,7 @@ const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual met
|
|
|
57
52
|
this.byteLength = 0;
|
|
58
53
|
}
|
|
59
54
|
|
|
60
|
-
toString(): string {
|
|
55
|
+
override toString(): string {
|
|
61
56
|
return `${this.constructor.name}(${this.id})`;
|
|
62
57
|
}
|
|
63
58
|
|
|
@@ -74,11 +69,11 @@ const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual met
|
|
|
74
69
|
return this._handle;
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
destroy(): void {
|
|
72
|
+
override destroy(): void {
|
|
78
73
|
this.delete();
|
|
79
74
|
}
|
|
80
75
|
|
|
81
|
-
delete({deleteChildren = false} = {}) {
|
|
76
|
+
override delete({deleteChildren = false} = {}) {
|
|
82
77
|
// Delete this object, and get refs to any children
|
|
83
78
|
// @ts-expect-error
|
|
84
79
|
const children = this._handle && this._deleteHandle(this._handle);
|
|
@@ -130,7 +125,7 @@ const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual met
|
|
|
130
125
|
* @param name
|
|
131
126
|
* @return param
|
|
132
127
|
*/
|
|
133
|
-
getParameter(pname: number, props = {}): any {
|
|
128
|
+
getParameter(pname: number, props: any = {}): any {
|
|
134
129
|
pname = getKeyValue(this.gl, pname);
|
|
135
130
|
assert(pname);
|
|
136
131
|
|
|
@@ -163,7 +158,7 @@ const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual met
|
|
|
163
158
|
// Many resources support a getParameter call -
|
|
164
159
|
// getParameters will get all parameters - slow but useful for debugging
|
|
165
160
|
// eslint-disable-next-line complexity
|
|
166
|
-
getParameters(options: {parameters
|
|
161
|
+
getParameters(options: {parameters?: any, keys?: any} = {}) {
|
|
167
162
|
const {parameters, keys} = options;
|
|
168
163
|
|
|
169
164
|
// Get parameter definitions for this Resource
|
|
@@ -2,10 +2,10 @@ import {assert, ResourceProps} from '@luma.gl/api';
|
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
3
|
import {getBrowser} from '@probe.gl/env';
|
|
4
4
|
|
|
5
|
-
import WebGLDevice from '../webgl-device';
|
|
6
|
-
import WebGLResource from './webgl-resource';
|
|
5
|
+
import {WebGLDevice} from '../webgl-device';
|
|
6
|
+
import {WebGLResource} from './webgl-resource';
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import {WEBGLBuffer} from '../resources/webgl-buffer';
|
|
9
9
|
|
|
10
10
|
const ERR_ELEMENTS = 'elements must be GL.ELEMENT_ARRAY_BUFFER';
|
|
11
11
|
|
|
@@ -16,8 +16,8 @@ export type VertexArrayObjectProps = ResourceProps & {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/** VertexArrayObject wrapper */
|
|
19
|
-
export
|
|
20
|
-
get [Symbol.toStringTag](): string {
|
|
19
|
+
export class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObjectProps> {
|
|
20
|
+
override get [Symbol.toStringTag](): string {
|
|
21
21
|
return 'BaseVertexArrayObject';
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -26,24 +26,24 @@ export default class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObj
|
|
|
26
26
|
super(device, props, {});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
_createHandle() {
|
|
29
|
+
override _createHandle() {
|
|
30
30
|
return this.gl2.createVertexArray();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
_deleteHandle(): void {
|
|
33
|
+
override _deleteHandle(): void {
|
|
34
34
|
this.gl2.deleteVertexArray(this.handle);
|
|
35
35
|
// @ts-expect-error
|
|
36
36
|
return [this.elements];
|
|
37
37
|
// return [this.elements, ...this.buffers];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
_bindHandle(handle: WEBGLVertexArrayObject): void {
|
|
40
|
+
override _bindHandle(handle: WEBGLVertexArrayObject): void {
|
|
41
41
|
this.gl2.bindVertexArray(handle);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Set (bind) an elements buffer, for indexed rendering.
|
|
45
45
|
// Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported
|
|
46
|
-
setElementBuffer(elementBuffer:
|
|
46
|
+
setElementBuffer(elementBuffer: WEBGLBuffer | null = null, opts = {}) {
|
|
47
47
|
assert(!elementBuffer || elementBuffer.target === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);
|
|
48
48
|
|
|
49
49
|
// The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject...
|
|
@@ -55,7 +55,7 @@ export default class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObj
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
58
|
-
setBuffer(location: number, buffer:
|
|
58
|
+
setBuffer(location: number, buffer: WEBGLBuffer, accessor: any): this {
|
|
59
59
|
// Check target
|
|
60
60
|
if (buffer.target === GL.ELEMENT_ARRAY_BUFFER) {
|
|
61
61
|
return this.setElementBuffer(buffer, accessor);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type {BufferProps} from '@luma.gl/api';
|
|
2
2
|
import {Buffer, assert} from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
|
-
import WebGLDevice from '../webgl-device';
|
|
4
|
+
import {WebGLDevice} from '../webgl-device';
|
|
5
5
|
|
|
6
6
|
const DEBUG_DATA_LENGTH = 10;
|
|
7
7
|
|
|
8
8
|
/** WebGL Buffer interface */
|
|
9
|
-
export
|
|
9
|
+
export class WEBGLBuffer extends Buffer {
|
|
10
10
|
readonly device: WebGLDevice;
|
|
11
11
|
readonly gl: WebGLRenderingContext;
|
|
12
12
|
readonly gl2: WebGL2RenderingContext | null;
|
|
@@ -15,12 +15,13 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
15
15
|
|
|
16
16
|
byteLength: number;
|
|
17
17
|
bytesUsed: number;
|
|
18
|
-
debugData: ArrayBuffer;
|
|
18
|
+
debugData: ArrayBuffer | null = null;
|
|
19
19
|
|
|
20
20
|
webglUsage: number;
|
|
21
21
|
|
|
22
|
-
accessor: {};
|
|
22
|
+
// accessor: {};
|
|
23
23
|
|
|
24
|
+
|
|
24
25
|
constructor(device: WebGLDevice, props: BufferProps = {}) {
|
|
25
26
|
super(device, props);
|
|
26
27
|
|
|
@@ -28,10 +29,9 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
28
29
|
this.gl = this.device.gl;
|
|
29
30
|
this.gl2 = this.device.gl2;
|
|
30
31
|
|
|
31
|
-
const handle = typeof props === 'object' ? (props
|
|
32
|
+
const handle = typeof props === 'object' ? (props ).handle : undefined;
|
|
32
33
|
this.handle = handle || this.gl.createBuffer();
|
|
33
|
-
|
|
34
|
-
this.handle.__SPECTOR_Metadata = {...this.props, data: typeof this.props.data}; // {name: this.props.id};
|
|
34
|
+
device.setSpectorMetadata(this.handle, {...this.props, data: typeof this.props.data});
|
|
35
35
|
|
|
36
36
|
// In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers
|
|
37
37
|
// otherwise buffer type will lock to generic (non-element) buffer
|
|
@@ -55,7 +55,7 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
55
55
|
// Object.seal(this);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
// PRIVATE METHODS
|
|
59
59
|
|
|
60
60
|
// Allocate a new buffer and initialize to contents of typed array
|
|
61
61
|
_initWithData(data, byteOffset: number = 0, byteLength: number = data.byteLength + byteOffset): this {
|
|
@@ -101,17 +101,17 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
101
101
|
return this;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
destroy(): void {
|
|
105
|
-
if (this.handle) {
|
|
104
|
+
override destroy(): void {
|
|
105
|
+
if (!this.destroyed && this.handle) {
|
|
106
106
|
this.removeStats();
|
|
107
107
|
this.trackDeallocatedMemory();
|
|
108
108
|
this.gl.deleteBuffer(this.handle);
|
|
109
|
-
|
|
110
|
-
this.handle = null;
|
|
109
|
+
this.destroyed = true;
|
|
110
|
+
// this.handle = null;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
write(data: ArrayBufferView, byteOffset: number = 0): void {
|
|
114
|
+
override write(data: ArrayBufferView, byteOffset: number = 0): void {
|
|
115
115
|
const srcOffset = 0;
|
|
116
116
|
const byteLength = data.byteLength;
|
|
117
117
|
|
|
@@ -124,7 +124,7 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
124
124
|
this.device.assertWebGL2();
|
|
125
125
|
|
|
126
126
|
// @ts-expect-error
|
|
127
|
-
this.gl.bufferSubData(this.target,
|
|
127
|
+
this.gl.bufferSubData(this.target, byteOffset, data, srcOffset, byteLength);
|
|
128
128
|
} else {
|
|
129
129
|
this.gl.bufferSubData(target, byteOffset, data);
|
|
130
130
|
}
|
|
@@ -135,7 +135,7 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/** Read data from the buffer */
|
|
138
|
-
async readAsync(
|
|
138
|
+
override async readAsync(
|
|
139
139
|
byteOffset: number = 0,
|
|
140
140
|
byteLength?: number
|
|
141
141
|
): Promise<ArrayBuffer> {
|
|
@@ -168,7 +168,7 @@ export default class WEBGLBuffer extends Buffer {
|
|
|
168
168
|
|
|
169
169
|
_getReadTarget() {
|
|
170
170
|
return this.target;
|
|
171
|
-
return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.target;
|
|
171
|
+
// return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.target;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -5,8 +5,8 @@ import type {
|
|
|
5
5
|
CopyTextureToTextureOptions
|
|
6
6
|
} from '@luma.gl/api';
|
|
7
7
|
import GL from '@luma.gl/constants';
|
|
8
|
-
import WebGLDevice from '../webgl-device';
|
|
9
|
-
import WEBGLBuffer from './webgl-buffer';
|
|
8
|
+
import {WebGLDevice} from '../webgl-device';
|
|
9
|
+
import {WEBGLBuffer} from './webgl-buffer';
|
|
10
10
|
|
|
11
11
|
function cast<T>(value: unknown): T {
|
|
12
12
|
return value as T;
|
|
@@ -38,7 +38,7 @@ type Command =
|
|
|
38
38
|
| CopyTextureToBufferCommand
|
|
39
39
|
| CopyTextureToTextureCommand;
|
|
40
40
|
|
|
41
|
-
export
|
|
41
|
+
export class CommandBuffer {
|
|
42
42
|
commands: Command[] = [];
|
|
43
43
|
}
|
|
44
44
|
|