@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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/debug/webgl-developer-tools.ts"],"names":["log","loadScript","GL","WEBGL_DEBUG_CDN_URL","DEFAULT_DEBUG_CONTEXT_PROPS","debug","throwOnError","break","undefined","webgl2","getContextData","gl","luma","loadWebGLDeveloperTools","globalThis","WebGLDebugUtils","global","module","makeDebugContext","props","getDebugContext","getRealContext","data","realContext","warn","debugContext","init","glDebug","onGLError","bind","onValidateGLFunc","key","WebGLDebugContext","Object","setPrototypeOf","getPrototypeOf","create","getFunctionString","functionName","functionArgs","Array","from","map","arg","args","glFunctionArgsToString","slice","length","err","errorMessage","glEnumToString","glName","message","error","Error","functionString","level","isBreakpoint","every","breakOn","indexOf"],"mappings":"AACA,SAAQA,GAAR,EAAaC,UAAb,QAA8B,eAA9B;AACA,OAAOC,EAAP,MAAe,oBAAf;AAEA,MAAMC,mBAAmB,GAAG,8CAA5B;AASA,MAAMC,2BAAwD,GAAG;AAC/DC,EAAAA,KAAK,EAAE,IADwD;AAE/DC,EAAAA,YAAY,EAAE,KAFiD;AAG/DC,EAAAA,KAAK,EAAEC,SAHwD;AAI/DC,EAAAA,MAAM,EAAE;AAJuD,CAAjE;;AAQA,SAASC,cAAT,CAAwBC,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,iBAAiB,CAACC,YAAD,EAAeC,YAAf,CAApD;AACA,UAAMkB,YAAY,GAChBtC,KAAK,CAACZ,KAAN,IAAeY,KAAK,CAACZ,KAAN,CAAYmD,KAAZ,CAAmBC,OAAD,IAAqBJ,cAAc,CAACK,OAAf,CAAuBD,OAAvB,MAAoC,CAAC,CAA5E,CADjB;;AAEA,QAAIF,YAAJ,EAAkB;AAChB;AACD;AACF;;AAED,OAAK,MAAMd,GAAX,IAAkBJ,YAAlB,EAAgC;AAC9B,QAAII,GAAG,KAAKnC,SAAZ,EAAuB;AACrB+C,MAAAA,cAAc,GAAGA,cAAc,IAAIlB,iBAAiB,CAACC,YAAD,EAAeC,YAAf,CAApD;;AACA,UAAIpB,KAAK,CAACb,YAAV,EAAwB;AACtB,cAAM,IAAIgD,KAAJ,+BAAiCC,cAAjC,EAAN;AACD,OAFD,MAEO;AACLvD,QAAAA,GAAG,CAACqD,KAAJ,+BAAiCE,cAAjC;AACA;AACD;AACF;AACF;AACF","sourcesContent":["// luma.gl, MIT license\nimport {log, loadScript} from '@luma.gl/api/';\nimport GL from '@luma.gl/constants';\n\nconst WEBGL_DEBUG_CDN_URL = 'https://unpkg.com/webgl-debug@2.0.1/index.js';\n\ntype DebugContextProps = {\n debug?: boolean;\n throwOnError?: boolean;\n break?: string[];\n webgl2?: boolean;\n};\n\nconst DEFAULT_DEBUG_CONTEXT_PROPS: Required<DebugContextProps> = {\n debug: true,\n throwOnError: false,\n break: undefined,\n webgl2: false,\n}\n\n// Helper to get shared context data\nfunction getContextData(gl: any) {\n gl.luma = gl.luma || {};\n return gl.luma;\n}\n\ndeclare global {\n var WebGLDebugUtils: any;\n}\n\n/**\n * Loads Khronos WebGLDeveloperTools from CDN if not already installed \n * const WebGLDebugUtils = require('webgl-debug');\n * @see https://github.com/KhronosGroup/WebGLDeveloperTools\n * @see https://github.com/vorg/webgl-debug\n */\nexport async function loadWebGLDeveloperTools(): Promise<void> {\n if (!globalThis.WebGLDebugUtils) {\n // @ts-expect-error Developer tools expects global to be set\n globalThis.global = globalThis.global || globalThis;\n // @ts-expect-error Developer tools expects global to be set\n globalThis.global.module = {};\n await loadScript(WEBGL_DEBUG_CDN_URL);\n }\n}\n\n// Returns (a potentially new) context with debug instrumentation turned off or on.\n// Note that this actually returns a new context\nexport function makeDebugContext(gl: WebGLRenderingContext, props: DebugContextProps = {}): WebGLRenderingContext {\n // Return null to ensure we don't try to create a context in this case (TODO what case is that?)\n if (!gl) {\n return null;\n }\n\n return props.debug ? getDebugContext(gl, props) : getRealContext(gl);\n}\n\n// Returns the real context from either of the real/debug contexts\nfunction getRealContext(gl: WebGLRenderingContext): WebGLRenderingContext {\n const data = getContextData(gl);\n // If the context has a realContext member, it is a debug context so return the realContext\n return data.realContext ? data.realContext : gl;\n}\n\n// Returns the debug context from either of the real/debug contexts\nfunction getDebugContext(gl: WebGLRenderingContext, props: DebugContextProps): WebGLRenderingContext {\n if (!globalThis.WebGLDebugUtils) {\n log.warn('webgl-debug not loaded')();\n return gl;\n }\n\n const data = getContextData(gl);\n\n // If this already has a debug context, return it.\n if (data.debugContext) {\n return data.debugContext;\n }\n\n // Create a new debug context\n globalThis.WebGLDebugUtils.init({...GL, ...gl});\n const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(\n gl,\n onGLError.bind(null, props),\n onValidateGLFunc.bind(null, props)\n );\n\n // Make sure we have all WebGL2 and extension constants (todo dynamic import to circumvent minification?)\n for (const key in GL) {\n if (!(key in glDebug) && typeof GL[key] === 'number') {\n glDebug[key] = GL[key];\n }\n }\n \n // Ensure we have a clean prototype on the instrumented object\n // Note: setPrototypeOf does come with perf warnings, but we already take a bigger perf reduction\n // by synchronizing the WebGL errors after each WebGL call.\n class WebGLDebugContext {}\n Object.setPrototypeOf(glDebug, Object.getPrototypeOf(gl));\n Object.setPrototypeOf(WebGLDebugContext, glDebug);\n const debugContext = Object.create(WebGLDebugContext);\n // Store the debug context\n data.realContext = gl;\n data.debugContext = debugContext;\n debugContext.debug = true;\n\n // Return it\n return debugContext;\n}\n\n// DEBUG TRACING\n\nfunction getFunctionString(functionName: string, functionArgs): string {\n // Cover bug in webgl-debug-tools\n functionArgs = Array.from(functionArgs).map(arg => arg === undefined ? 'undefined' : arg);\n let args = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, functionArgs);\n args = `${args.slice(0, 100)}${args.length > 100 ? '...' : ''}`;\n return `gl.${functionName}(${args})`;\n}\n\nfunction onGLError(props: DebugContextProps, err, functionName: string, args: any[]): void {\n // Cover bug in webgl-debug-tools\n args = Array.from(args).map(arg => arg === undefined ? 'undefined' : arg);\n const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);\n const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);\n const glName = props.webgl2 ? 'gl2' : 'gl1';\n const message = `${errorMessage} in ${glName}.${functionName}(${functionArgs})`;\n log.error(message)();\n debugger; // eslint-disable-line\n if (props.throwOnError) {\n throw new Error(message);\n }\n}\n\n// Don't generate function string until it is needed\nfunction onValidateGLFunc(props: DebugContextProps, functionName: string, functionArgs: any[]): void {\n let functionString: string;\n if (log.level >= 1) {\n functionString = getFunctionString(functionName, functionArgs);\n log.log(1, functionString)();\n }\n\n if (props.break) {\n functionString = functionString || getFunctionString(functionName, functionArgs);\n const isBreakpoint =\n props.break && props.break.every((breakOn: string) => functionString.indexOf(breakOn) !== -1);\n if (isBreakpoint) {\n debugger; // eslint-disable-line\n }\n }\n\n for (const arg of functionArgs) {\n if (arg === undefined) {\n functionString = functionString || getFunctionString(functionName, functionArgs);\n if (props.throwOnError) {\n throw new Error(`Undefined argument: ${functionString}`);\n } else {\n log.error(`Undefined argument: ${functionString}`)();\n debugger; // eslint-disable-line\n }\n }\n }\n}\n"],"file":"webgl-developer-tools.js"}
|
|
1
|
+
{"version":3,"file":"webgl-developer-tools.js","names":["log","loadScript","GL","WEBGL_DEBUG_CDN_URL","getContextData","gl","luma","loadWebGLDeveloperTools","globalThis","WebGLDebugUtils","global","module","makeDebugContext","props","arguments","length","undefined","debug","getDebugContext","getRealContext","data","realContext","warn","debugContext","init","glDebug","onGLError","bind","onValidateGLFunc","key","WebGLDebugContext","Object","setPrototypeOf","getPrototypeOf","create","getFunctionString","functionName","functionArgs","Array","from","map","arg","args","glFunctionArgsToString","concat","slice","err","errorMessage","glEnumToString","glName","webgl2","message","error","throwOnError","Error","functionString","level","break","isBreakpoint","every","breakOn","indexOf"],"sources":["../../../src/context/debug/webgl-developer-tools.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {log, loadScript} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\n\nconst WEBGL_DEBUG_CDN_URL = 'https://unpkg.com/webgl-debug@2.0.1/index.js';\n\ntype DebugContextProps = {\n debug?: boolean;\n throwOnError?: boolean;\n break?: string[];\n webgl2?: boolean;\n};\n\n// const DEFAULT_DEBUG_CONTEXT_PROPS: Required<DebugContextProps> = {\n// debug: true,\n// throwOnError: false,\n// break: [],\n// webgl2: false,\n// }\n\n// Helper to get shared context data\nfunction getContextData(gl: any) {\n gl.luma = gl.luma || {};\n return gl.luma;\n}\n\ndeclare global {\n // eslint-disable-next-line no-var\n var WebGLDebugUtils: any;\n}\n\n/**\n * Loads Khronos WebGLDeveloperTools from CDN if not already installed \n * const WebGLDebugUtils = require('webgl-debug');\n * @see https://github.com/KhronosGroup/WebGLDeveloperTools\n * @see https://github.com/vorg/webgl-debug\n */\nexport async function loadWebGLDeveloperTools(): Promise<void> {\n if (!globalThis.WebGLDebugUtils) {\n globalThis.global = globalThis.global || globalThis;\n // @ts-expect-error Developer tools expects global to be set\n globalThis.global.module = {};\n await loadScript(WEBGL_DEBUG_CDN_URL);\n }\n}\n\n// Returns (a potentially new) context with debug instrumentation turned off or on.\n// Note that this actually returns a new context\nexport function makeDebugContext(gl: WebGLRenderingContext, props: DebugContextProps = {}): WebGLRenderingContext | null {\n // Return null to ensure we don't try to create a context in this case (TODO what case is that?)\n if (!gl) {\n return null;\n }\n\n return props.debug ? getDebugContext(gl, props) : getRealContext(gl);\n}\n\n// Returns the real context from either of the real/debug contexts\nfunction getRealContext(gl: WebGLRenderingContext): WebGLRenderingContext {\n const data = getContextData(gl);\n // If the context has a realContext member, it is a debug context so return the realContext\n return data.realContext ? data.realContext : gl;\n}\n\n// Returns the debug context from either of the real/debug contexts\nfunction getDebugContext(gl: WebGLRenderingContext, props: DebugContextProps): WebGLRenderingContext {\n if (!globalThis.WebGLDebugUtils) {\n log.warn('webgl-debug not loaded')();\n return gl;\n }\n\n const data = getContextData(gl);\n\n // If this already has a debug context, return it.\n if (data.debugContext) {\n return data.debugContext;\n }\n\n // Create a new debug context\n globalThis.WebGLDebugUtils.init({...GL, ...gl});\n const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(\n gl,\n onGLError.bind(null, props),\n onValidateGLFunc.bind(null, props)\n );\n\n // Make sure we have all WebGL2 and extension constants (todo dynamic import to circumvent minification?)\n for (const key in GL) {\n if (!(key in glDebug) && typeof GL[key] === 'number') {\n glDebug[key] = GL[key];\n }\n }\n \n // Ensure we have a clean prototype on the instrumented object\n // Note: setPrototypeOf does come with perf warnings, but we already take a bigger perf reduction\n // by synchronizing the WebGL errors after each WebGL call.\n class WebGLDebugContext {}\n Object.setPrototypeOf(glDebug, Object.getPrototypeOf(gl));\n Object.setPrototypeOf(WebGLDebugContext, glDebug);\n const debugContext = Object.create(WebGLDebugContext);\n // Store the debug context\n data.realContext = gl;\n data.debugContext = debugContext;\n debugContext.debug = true;\n\n // Return it\n return debugContext;\n}\n\n// DEBUG TRACING\n\nfunction getFunctionString(functionName: string, functionArgs): string {\n // Cover bug in webgl-debug-tools\n functionArgs = Array.from(functionArgs).map(arg => arg === undefined ? 'undefined' : arg);\n let args = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, functionArgs);\n args = `${args.slice(0, 100)}${args.length > 100 ? '...' : ''}`;\n return `gl.${functionName}(${args})`;\n}\n\nfunction onGLError(props: DebugContextProps, err, functionName: string, args: any[]): void {\n // Cover bug in webgl-debug-tools\n args = Array.from(args).map(arg => arg === undefined ? 'undefined' : arg);\n const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);\n const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);\n const glName = props.webgl2 ? 'gl2' : 'gl1';\n const message = `${errorMessage} in ${glName}.${functionName}(${functionArgs})`;\n log.error(message)();\n debugger; // eslint-disable-line\n if (props.throwOnError) {\n throw new Error(message);\n }\n}\n\n// Don't generate function string until it is needed\nfunction onValidateGLFunc(props: DebugContextProps, functionName: string, functionArgs: any[]): void {\n let functionString: string = '';\n if (log.level >= 1) {\n functionString = getFunctionString(functionName, functionArgs);\n log.log(1, functionString)();\n }\n\n // If array of breakpoint strings supplied, check if any of them is contained in current GL function\n if (props.break && props.break.length > 0) {\n functionString = functionString || getFunctionString(functionName, functionArgs);\n const isBreakpoint = props.break.every((breakOn: string) => functionString.indexOf(breakOn) !== -1);\n if (isBreakpoint) {\n debugger; // eslint-disable-line\n }\n }\n\n for (const arg of functionArgs) {\n if (arg === undefined) {\n functionString = functionString || getFunctionString(functionName, functionArgs);\n if (props.throwOnError) {\n throw new Error(`Undefined argument: ${functionString}`);\n } else {\n log.error(`Undefined argument: ${functionString}`)();\n debugger; // eslint-disable-line\n }\n }\n }\n}\n"],"mappings":"AACA,SAAQA,GAAG,EAAEC,UAAU,QAAO,cAAc;AAC5C,OAAOC,EAAE,MAAM,oBAAoB;AAEnC,MAAMC,mBAAmB,GAAG,8CAA8C;AAiB1E,SAASC,cAAcA,CAACC,EAAO,EAAE;EAC/BA,EAAE,CAACC,IAAI,GAAGD,EAAE,CAACC,IAAI,IAAI,CAAC,CAAC;EACvB,OAAOD,EAAE,CAACC,IAAI;AAChB;AAaA,OAAO,eAAeC,uBAAuBA,CAAA,EAAkB;EAC7D,IAAI,CAACC,UAAU,CAACC,eAAe,EAAE;IAC/BD,UAAU,CAACE,MAAM,GAAGF,UAAU,CAACE,MAAM,IAAIF,UAAU;IAEnDA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nG,IAAIF,YAAY,EAAE;MAChB;IACF;EACF;EAEA,KAAK,MAAMjB,GAAG,IAAIJ,YAAY,EAAE;IAC9B,IAAII,GAAG,KAAKzB,SAAS,EAAE;MACrBuC,cAAc,GAAGA,cAAc,IAAIpB,iBAAiB,CAACC,YAAY,EAAEC,YAAY,CAAC;MAChF,IAAIxB,KAAK,CAACwC,YAAY,EAAE;QACtB,MAAM,IAAIC,KAAK,wBAAAV,MAAA,CAAwBW,cAAc,EAAG;MAC1D,CAAC,MAAM;QACLvD,GAAG,CAACoD,KAAK,wBAAAR,MAAA,CAAwBW,cAAc,EAAG,EAAE;QACpD;MACF;IACF;EACF;AACF"}
|
|
@@ -10,7 +10,10 @@ export type { GLParameters };
|
|
|
10
10
|
export declare function setParameters(device: Device | WebGLRenderingContext, parameters: GLParameters): void;
|
|
11
11
|
/**
|
|
12
12
|
* Reads the entire WebGL state from a context
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
// default to querying all parameters
|
|
15
|
+
|
|
16
|
+
* @returns - a newly created map, with values keyed by GL parameters
|
|
14
17
|
*
|
|
15
18
|
* @note Copies the state from a context (gl.getParameter should not be overriden)
|
|
16
19
|
* Reads the entire WebGL state from a context
|
|
@@ -19,14 +22,12 @@ export declare function setParameters(device: Device | WebGLRenderingContext, pa
|
|
|
19
22
|
* considered a very slow operation, to be used only if/when a context already manipulated
|
|
20
23
|
* by external code needs to be synchronized for the first time
|
|
21
24
|
*/
|
|
22
|
-
export declare function getParameters(
|
|
23
|
-
export declare function getParameters(gl: WebGLRenderingContext, parameters?: (keyof GLParameters)[]): GLParameters;
|
|
24
|
-
export declare function getParameters(gl: WebGLRenderingContext, parameters: keyof GLParameters): GLParameters;
|
|
25
|
+
export declare function getParameters(device: Device | WebGLRenderingContext, parameters?: keyof GLParameters | (keyof GLParameters)[] | GLParameters): GLParameters;
|
|
25
26
|
/**
|
|
26
27
|
* Reset all parameters to a (almost) pure context state
|
|
27
28
|
* @note viewport and scissor will be set to the values in GL_PARAMETER_DEFAULTS,
|
|
28
29
|
* NOT the canvas size dimensions, so they will have to be properly set after
|
|
29
30
|
* calling this function.
|
|
30
31
|
*/
|
|
31
|
-
export declare function resetParameters(
|
|
32
|
+
export declare function resetParameters(device: Device | WebGLRenderingContext): void;
|
|
32
33
|
//# sourceMappingURL=unified-parameter-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-parameter-api.d.ts","sourceRoot":"","sources":["../../../src/context/parameters/unified-parameter-api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"unified-parameter-api.d.ts","sourceRoot":"","sources":["../../../src/context/parameters/unified-parameter-api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAUpD,YAAY,EAAC,YAAY,EAAC,CAAC;AAE3B;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,GAAG,qBAAqB,EACtC,UAAU,EAAE,YAAY,GACvB,IAAI,CAiDN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,GAAG,qBAAqB,EACtC,UAAU,GAAE,MAAM,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,EAAE,GAAG,YAAoC,GAC7F,YAAY,CAqBd;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAE5E"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { GL_PARAMETER_DEFAULTS, GL_PARAMETER_SETTERS, GL_COMPOSITE_PARAMETER_SETTERS, GL_PARAMETER_GETTERS } from
|
|
2
|
-
import WebGLDevice from
|
|
1
|
+
import { GL_PARAMETER_DEFAULTS, GL_PARAMETER_SETTERS, GL_COMPOSITE_PARAMETER_SETTERS, GL_PARAMETER_GETTERS } from "./webgl-parameter-tables.js";
|
|
2
|
+
import { WebGLDevice } from "../../adapter/webgl-device.js";
|
|
3
3
|
export function setParameters(device, parameters) {
|
|
4
4
|
const webglDevice = WebGLDevice.attach(device);
|
|
5
5
|
const gl = webglDevice.gl;
|
|
6
|
-
|
|
7
6
|
if (isObjectEmpty(parameters)) {
|
|
8
7
|
return;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
const compositeSetters = {};
|
|
12
|
-
|
|
13
10
|
for (const key in parameters) {
|
|
14
11
|
const glConstant = Number(key);
|
|
15
12
|
const setter = GL_PARAMETER_SETTERS[key];
|
|
16
|
-
|
|
17
13
|
if (setter) {
|
|
18
14
|
if (typeof setter === 'string') {
|
|
19
15
|
compositeSetters[setter] = true;
|
|
@@ -22,9 +18,7 @@ export function setParameters(device, parameters) {
|
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
const cache = gl.state && gl.state.cache;
|
|
27
|
-
|
|
28
22
|
if (cache) {
|
|
29
23
|
for (const key in compositeSetters) {
|
|
30
24
|
const compositeSetter = GL_COMPOSITE_PARAMETER_SETTERS[key];
|
|
@@ -32,34 +26,30 @@ export function setParameters(device, parameters) {
|
|
|
32
26
|
}
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
|
-
export function getParameters(
|
|
36
|
-
parameters =
|
|
37
|
-
|
|
29
|
+
export function getParameters(device) {
|
|
30
|
+
let parameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GL_PARAMETER_DEFAULTS;
|
|
31
|
+
const webglDevice = WebGLDevice.attach(device);
|
|
32
|
+
const gl = webglDevice.gl;
|
|
38
33
|
if (typeof parameters === 'number') {
|
|
39
34
|
const key = parameters;
|
|
40
35
|
const getter = GL_PARAMETER_GETTERS[key];
|
|
41
36
|
return getter ? getter(gl, key) : gl.getParameter(key);
|
|
42
37
|
}
|
|
43
|
-
|
|
44
38
|
const parameterKeys = Array.isArray(parameters) ? parameters : Object.keys(parameters);
|
|
45
39
|
const state = {};
|
|
46
|
-
|
|
47
40
|
for (const key of parameterKeys) {
|
|
48
41
|
const getter = GL_PARAMETER_GETTERS[key];
|
|
49
42
|
state[key] = getter ? getter(gl, Number(key)) : gl.getParameter(Number(key));
|
|
50
43
|
}
|
|
51
|
-
|
|
52
44
|
return state;
|
|
53
45
|
}
|
|
54
|
-
export function resetParameters(
|
|
55
|
-
setParameters(
|
|
46
|
+
export function resetParameters(device) {
|
|
47
|
+
setParameters(device, GL_PARAMETER_DEFAULTS);
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
function isObjectEmpty(object) {
|
|
59
50
|
for (const key in object) {
|
|
60
51
|
return false;
|
|
61
52
|
}
|
|
62
|
-
|
|
63
53
|
return true;
|
|
64
54
|
}
|
|
65
55
|
//# sourceMappingURL=unified-parameter-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"unified-parameter-api.js","names":["GL_PARAMETER_DEFAULTS","GL_PARAMETER_SETTERS","GL_COMPOSITE_PARAMETER_SETTERS","GL_PARAMETER_GETTERS","WebGLDevice","setParameters","device","parameters","webglDevice","attach","gl","isObjectEmpty","compositeSetters","key","glConstant","Number","setter","cache","state","compositeSetter","getParameters","arguments","length","undefined","getter","getParameter","parameterKeys","Array","isArray","Object","keys","resetParameters","object"],"sources":["../../../src/context/parameters/unified-parameter-api.ts"],"sourcesContent":["// Provides a unified API for getting and setting any WebGL parameter\n// Also knows default values of all parameters, enabling fast cache initialization\n// Provides base functionality for the state caching.\nimport {Device} from '@luma.gl/api';\nimport type {GLParameters} from '../../types/webgl';\nimport {\n GL_PARAMETER_DEFAULTS,\n GL_PARAMETER_SETTERS,\n GL_COMPOSITE_PARAMETER_SETTERS,\n GL_PARAMETER_GETTERS\n} from './webgl-parameter-tables';\n\nimport {WebGLDevice} from '../../adapter/webgl-device';\n\nexport type {GLParameters};\n\n/**\n * Sets any GL parameter regardless of function (gl.blendMode, ...)\n *\n * @note requires a `cache` object to be set on the context (gl.state.cache)\n * This object is used to fill in any missing values for composite setter functions\n */\nexport function setParameters(\n device: Device | WebGLRenderingContext,\n parameters: GLParameters\n): void {\n const webglDevice = WebGLDevice.attach(device);\n const gl = webglDevice.gl;\n\n if (isObjectEmpty(parameters)) {\n return;\n }\n\n const compositeSetters = {};\n\n // HANDLE PRIMITIVE SETTERS (and make note of any composite setters)\n\n for (const key in parameters) {\n const glConstant = Number(key);\n const setter = GL_PARAMETER_SETTERS[key];\n if (setter) {\n // Composite setters should only be called once, so save them\n if (typeof setter === 'string') {\n compositeSetters[setter] = true;\n } else {\n // if (gl[glConstant] !== undefined) {\n // TODO - added above check since this is being called on WebGL2 parameters in WebGL1...\n // TODO - deep equal on values? only call setter if value has changed?\n // NOTE - the setter will automatically update this.state\n setter(gl, parameters[key], glConstant);\n }\n }\n }\n\n // HANDLE COMPOSITE SETTERS\n\n // NOTE: any non-provided values needed by composite setters are filled in from state cache\n // The cache parameter is automatically retrieved from the context\n // This depends on `trackContextState`, which is technically a \"circular\" dependency.\n // But it is too inconvenient to always require a cache parameter here.\n // This is the ONLY external dependency in this module/\n // @ts-expect-error\n const cache = gl.state && gl.state.cache;\n if (cache) {\n for (const key in compositeSetters) {\n // TODO - avoid calling composite setters if values have not changed.\n const compositeSetter = GL_COMPOSITE_PARAMETER_SETTERS[key];\n // Note - if `trackContextState` has been called,\n // the setter will automatically update this.state.cache\n compositeSetter(gl, parameters, cache);\n }\n }\n\n // Add a log for the else case?\n}\n\n/**\n * Reads the entire WebGL state from a context\n\n // default to querying all parameters\n\n * @returns - a newly created map, with values keyed by GL parameters\n *\n * @note Copies the state from a context (gl.getParameter should not be overriden)\n * Reads the entire WebGL state from a context\n *\n * @note This can generates a huge amount of synchronous driver roundtrips and should be\n * considered a very slow operation, to be used only if/when a context already manipulated\n * by external code needs to be synchronized for the first time\n */\nexport function getParameters(\n device: Device | WebGLRenderingContext,\n parameters: keyof GLParameters | (keyof GLParameters)[] | GLParameters = GL_PARAMETER_DEFAULTS\n): GLParameters {\n const webglDevice = WebGLDevice.attach(device);\n const gl = webglDevice.gl;\n\n // support both arrays of parameters and objects (keys represent parameters)\n\n if (typeof parameters === 'number') {\n // single GL enum\n const key = parameters;\n const getter = GL_PARAMETER_GETTERS[key];\n return getter ? getter(gl, key) : gl.getParameter(key);\n }\n\n const parameterKeys = Array.isArray(parameters) ? parameters : Object.keys(parameters);\n\n const state = {};\n for (const key of parameterKeys) {\n const getter = GL_PARAMETER_GETTERS[key];\n state[key] = getter ? getter(gl, Number(key)) : gl.getParameter(Number(key));\n }\n return state;\n}\n\n/**\n * Reset all parameters to a (almost) pure context state\n * @note viewport and scissor will be set to the values in GL_PARAMETER_DEFAULTS,\n * NOT the canvas size dimensions, so they will have to be properly set after\n * calling this function.\n */\nexport function resetParameters(device: Device | WebGLRenderingContext): void {\n setParameters(device, GL_PARAMETER_DEFAULTS);\n}\n\n// Helpers\n\n// Returns true if given object is empty, false otherwise.\nfunction isObjectEmpty(object) {\n // @ts-ignore dummy key variable\n for (const key in object) {\n return false;\n }\n return true;\n}\n"],"mappings":"SAMEA,qBAAqB,EACrBC,oBAAoB,EACpBC,8BAA8B,EAC9BC,oBAAoB;AAAA,SAGdC,WAAW;AAUnB,OAAO,SAASC,aAAaA,CAC3BC,MAAsC,EACtCC,UAAwB,EAClB;EACN,MAAMC,WAAW,GAAGJ,WAAW,CAACK,MAAM,CAACH,MAAM,CAAC;EAC9C,MAAMI,EAAE,GAAGF,WAAW,CAACE,EAAE;EAEzB,IAAIC,aAAa,CAACJ,UAAU,CAAC,EAAE;IAC7B;EACF;EAEA,MAAMK,gBAAgB,GAAG,CAAC,CAAC;EAI3B,KAAK,MAAMC,GAAG,IAAIN,UAAU,EAAE;IAC5B,MAAMO,UAAU,GAAG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F,MAAMW,KAAK,GAAG,CAAC,CAAC;EAChB,KAAK,MAAML,GAAG,IAAIa,aAAa,EAAE;IAC/B,MAAMF,MAAM,GAAGrB,oBAAoB,CAACU,GAAG,CAAC;IACxCK,KAAK,CAACL,GAAG,CAAC,GAAGW,MAAM,GAAGA,MAAM,CAACd,EAAE,EAAEK,MAAM,CAACF,GAAG,CAAC,CAAC,GAAGH,EAAE,CAACe,YAAY,CAACV,MAAM,CAACF,GAAG,CAAC,CAAC;EAC9E;EACA,OAAOK,KAAK;AACd;AAQA,OAAO,SAASa,eAAeA,CAACzB,MAAsC,EAAQ;EAC5ED,aAAa,CAACC,MAAM,EAAEN,qBAAqB,CAAC;AAC9C;AAKA,SAASW,aAAaA,CAACqB,MAAM,EAAE;EAE7B,KAAK,MAAMnB,GAAG,IAAImB,MAAM,EAAE;IACxB,OAAO,KAAK;EACd;EACA,OAAO,IAAI;AACb"}
|
|
@@ -2,53 +2,53 @@ import GL from '@luma.gl/constants';
|
|
|
2
2
|
import type { GLParameters } from '../../types/webgl';
|
|
3
3
|
export declare const GL_PARAMETER_DEFAULTS: GLParameters;
|
|
4
4
|
export declare const GL_PARAMETER_SETTERS: {
|
|
5
|
-
3042: (gl:
|
|
6
|
-
32773: (gl:
|
|
5
|
+
3042: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
6
|
+
32773: (gl: WebGLRenderingContext, value: [number, number, number, number]) => void;
|
|
7
7
|
32777: string;
|
|
8
8
|
34877: string;
|
|
9
9
|
32969: string;
|
|
10
10
|
32968: string;
|
|
11
11
|
32971: string;
|
|
12
12
|
32970: string;
|
|
13
|
-
3106: (gl:
|
|
14
|
-
3107: (gl:
|
|
15
|
-
2884: (gl:
|
|
16
|
-
2885: (gl:
|
|
17
|
-
2929: (gl:
|
|
18
|
-
2931: (gl:
|
|
19
|
-
2932: (gl:
|
|
20
|
-
2928: (gl:
|
|
21
|
-
2930: (gl:
|
|
22
|
-
3024: (gl:
|
|
23
|
-
35723: (gl:
|
|
24
|
-
35725: (gl:
|
|
25
|
-
36007: (gl:
|
|
26
|
-
36389: (gl:
|
|
27
|
-
34229: (gl:
|
|
28
|
-
36006: (gl:
|
|
29
|
-
36010: (gl:
|
|
30
|
-
34964: (gl:
|
|
31
|
-
36662: (gl:
|
|
32
|
-
36663: (gl:
|
|
33
|
-
35053: (gl:
|
|
34
|
-
35055: (gl:
|
|
35
|
-
2886: (gl:
|
|
36
|
-
33170: (gl:
|
|
37
|
-
2849: (gl:
|
|
38
|
-
32823: (gl:
|
|
13
|
+
3106: (gl: WebGLRenderingContext, value: [number, number, number, number]) => void;
|
|
14
|
+
3107: (gl: WebGLRenderingContext, value: [boolean, boolean, boolean, boolean]) => void;
|
|
15
|
+
2884: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
16
|
+
2885: (gl: WebGLRenderingContext, value: any) => void;
|
|
17
|
+
2929: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
18
|
+
2931: (gl: WebGLRenderingContext, value: any) => void;
|
|
19
|
+
2932: (gl: WebGLRenderingContext, value: any) => void;
|
|
20
|
+
2928: (gl: WebGLRenderingContext, value: [number, number]) => void;
|
|
21
|
+
2930: (gl: WebGLRenderingContext, value: any) => void;
|
|
22
|
+
3024: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
23
|
+
35723: (gl: WebGLRenderingContext, value: GL, key: GL) => void;
|
|
24
|
+
35725: (gl: WebGLRenderingContext, value: any) => void;
|
|
25
|
+
36007: (gl: WebGLRenderingContext, value: any) => void;
|
|
26
|
+
36389: (gl: WebGLRenderingContext, value: any) => void;
|
|
27
|
+
34229: (gl: WebGLRenderingContext, value: any) => void;
|
|
28
|
+
36006: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
29
|
+
36010: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
30
|
+
34964: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
31
|
+
36662: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
32
|
+
36663: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
33
|
+
35053: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
34
|
+
35055: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
35
|
+
2886: (gl: WebGLRenderingContext, value: any) => void;
|
|
36
|
+
33170: (gl: WebGLRenderingContext, value: GL, key: GL) => void;
|
|
37
|
+
2849: (gl: WebGLRenderingContext, value: any) => void;
|
|
38
|
+
32823: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
39
39
|
32824: string;
|
|
40
40
|
10752: string;
|
|
41
|
-
35977: (gl:
|
|
42
|
-
32926: (gl:
|
|
43
|
-
32928: (gl:
|
|
41
|
+
35977: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
42
|
+
32926: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
43
|
+
32928: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
44
44
|
32938: string;
|
|
45
45
|
32939: string;
|
|
46
|
-
3089: (gl:
|
|
47
|
-
3088: (gl:
|
|
48
|
-
2960: (gl:
|
|
49
|
-
2961: (gl:
|
|
50
|
-
2968: (gl:
|
|
51
|
-
36005: (gl:
|
|
46
|
+
3089: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
47
|
+
3088: (gl: WebGLRenderingContext, value: [number, number, number, number]) => void;
|
|
48
|
+
2960: (gl: WebGLRenderingContext, value: unknown, key: GL) => void;
|
|
49
|
+
2961: (gl: WebGLRenderingContext, value: any) => void;
|
|
50
|
+
2968: (gl: WebGLRenderingContext, value: any) => void;
|
|
51
|
+
36005: (gl: WebGLRenderingContext, value: any) => void;
|
|
52
52
|
2962: string;
|
|
53
53
|
2967: string;
|
|
54
54
|
2963: string;
|
|
@@ -61,67 +61,67 @@ export declare const GL_PARAMETER_SETTERS: {
|
|
|
61
61
|
34817: string;
|
|
62
62
|
34818: string;
|
|
63
63
|
34819: string;
|
|
64
|
-
2978: (gl:
|
|
65
|
-
3333: (gl:
|
|
66
|
-
3317: (gl:
|
|
67
|
-
37440: (gl:
|
|
68
|
-
37441: (gl:
|
|
69
|
-
37443: (gl:
|
|
70
|
-
3330: (gl:
|
|
71
|
-
3332: (gl:
|
|
72
|
-
3331: (gl:
|
|
73
|
-
3314: (gl:
|
|
74
|
-
32878: (gl:
|
|
75
|
-
3316: (gl:
|
|
76
|
-
3315: (gl:
|
|
77
|
-
32877: (gl:
|
|
78
|
-
framebuffer: (gl:
|
|
79
|
-
blend: (gl:
|
|
80
|
-
blendColor: (gl:
|
|
81
|
-
blendEquation: (gl:
|
|
82
|
-
blendFunc: (gl:
|
|
83
|
-
clearColor: (gl:
|
|
84
|
-
clearDepth: (gl:
|
|
85
|
-
clearStencil: (gl:
|
|
86
|
-
colorMask: (gl:
|
|
87
|
-
cull: (gl:
|
|
88
|
-
cullFace: (gl:
|
|
89
|
-
depthTest: (gl:
|
|
90
|
-
depthFunc: (gl:
|
|
91
|
-
depthMask: (gl:
|
|
92
|
-
depthRange: (gl:
|
|
93
|
-
dither: (gl:
|
|
94
|
-
derivativeHint: (gl:
|
|
95
|
-
frontFace: (gl:
|
|
96
|
-
mipmapHint: (gl:
|
|
97
|
-
lineWidth: (gl:
|
|
98
|
-
polygonOffsetFill: (gl:
|
|
99
|
-
polygonOffset: (gl:
|
|
100
|
-
sampleCoverage: (gl:
|
|
101
|
-
scissorTest: (gl:
|
|
102
|
-
scissor: (gl:
|
|
103
|
-
stencilTest: (gl:
|
|
104
|
-
stencilMask: (gl:
|
|
105
|
-
stencilFunc: (gl:
|
|
106
|
-
stencilOp: (gl:
|
|
107
|
-
viewport: (gl:
|
|
64
|
+
2978: (gl: WebGLRenderingContext, value: [number, number, number, number]) => void;
|
|
65
|
+
3333: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
66
|
+
3317: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
67
|
+
37440: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
68
|
+
37441: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
69
|
+
37443: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
70
|
+
3330: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
71
|
+
3332: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
72
|
+
3331: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
73
|
+
3314: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
74
|
+
32878: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
75
|
+
3316: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
76
|
+
3315: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
77
|
+
32877: (gl: WebGLRenderingContext, value: number | boolean, key: GL) => void;
|
|
78
|
+
framebuffer: (gl: WebGLRenderingContext, framebuffer: any) => void;
|
|
79
|
+
blend: (gl: WebGLRenderingContext, value: any) => void;
|
|
80
|
+
blendColor: (gl: WebGLRenderingContext, value: [number, number, number, number]) => void;
|
|
81
|
+
blendEquation: (gl: WebGLRenderingContext, args: number | [number, number]) => void;
|
|
82
|
+
blendFunc: (gl: WebGLRenderingContext, args: [number, number] | [number, number, number, number]) => void;
|
|
83
|
+
clearColor: (gl: WebGLRenderingContext, value: [number, number, number, number]) => void;
|
|
84
|
+
clearDepth: (gl: WebGLRenderingContext, value: any) => void;
|
|
85
|
+
clearStencil: (gl: WebGLRenderingContext, value: any) => void;
|
|
86
|
+
colorMask: (gl: WebGLRenderingContext, value: [boolean, boolean, boolean, boolean]) => void;
|
|
87
|
+
cull: (gl: WebGLRenderingContext, value: any) => void;
|
|
88
|
+
cullFace: (gl: WebGLRenderingContext, value: any) => void;
|
|
89
|
+
depthTest: (gl: WebGLRenderingContext, value: any) => void;
|
|
90
|
+
depthFunc: (gl: WebGLRenderingContext, value: any) => void;
|
|
91
|
+
depthMask: (gl: WebGLRenderingContext, value: any) => void;
|
|
92
|
+
depthRange: (gl: WebGLRenderingContext, value: [number, number]) => void;
|
|
93
|
+
dither: (gl: WebGLRenderingContext, value: any) => void;
|
|
94
|
+
derivativeHint: (gl: WebGLRenderingContext, value: any) => void;
|
|
95
|
+
frontFace: (gl: WebGLRenderingContext, value: any) => void;
|
|
96
|
+
mipmapHint: (gl: WebGLRenderingContext, value: any) => void;
|
|
97
|
+
lineWidth: (gl: WebGLRenderingContext, value: any) => void;
|
|
98
|
+
polygonOffsetFill: (gl: WebGLRenderingContext, value: any) => void;
|
|
99
|
+
polygonOffset: (gl: WebGLRenderingContext, value: [number, number]) => void;
|
|
100
|
+
sampleCoverage: (gl: WebGLRenderingContext, value: [number, boolean?]) => void;
|
|
101
|
+
scissorTest: (gl: WebGLRenderingContext, value: any) => void;
|
|
102
|
+
scissor: (gl: WebGLRenderingContext, value: [number, number, number, number]) => void;
|
|
103
|
+
stencilTest: (gl: WebGLRenderingContext, value: any) => void;
|
|
104
|
+
stencilMask: (gl: WebGLRenderingContext, value: any) => void;
|
|
105
|
+
stencilFunc: (gl: WebGLRenderingContext, args: any) => void;
|
|
106
|
+
stencilOp: (gl: WebGLRenderingContext, args: any) => void;
|
|
107
|
+
viewport: (gl: WebGLRenderingContext, value: [number, number, number, number]) => void;
|
|
108
108
|
};
|
|
109
109
|
export declare const GL_COMPOSITE_PARAMETER_SETTERS: {
|
|
110
|
-
blendEquation: (gl:
|
|
111
|
-
blendFunc: (gl:
|
|
112
|
-
polygonOffset: (gl:
|
|
113
|
-
sampleCoverage: (gl:
|
|
114
|
-
stencilFuncFront: (gl:
|
|
115
|
-
stencilFuncBack: (gl:
|
|
116
|
-
stencilOpFront: (gl:
|
|
117
|
-
stencilOpBack: (gl:
|
|
110
|
+
blendEquation: (gl: WebGLRenderingContext, values: any, cache: any) => void;
|
|
111
|
+
blendFunc: (gl: WebGLRenderingContext, values: any, cache: any) => void;
|
|
112
|
+
polygonOffset: (gl: WebGLRenderingContext, values: any, cache: any) => void;
|
|
113
|
+
sampleCoverage: (gl: WebGLRenderingContext, values: any, cache: any) => void;
|
|
114
|
+
stencilFuncFront: (gl: WebGLRenderingContext, values: any, cache: any) => void;
|
|
115
|
+
stencilFuncBack: (gl: WebGLRenderingContext, values: any, cache: any) => void;
|
|
116
|
+
stencilOpFront: (gl: WebGLRenderingContext, values: any, cache: any) => void;
|
|
117
|
+
stencilOpBack: (gl: WebGLRenderingContext, values: any, cache: any) => void;
|
|
118
118
|
};
|
|
119
119
|
declare type UpdateFunc = (params: Record<string, any>) => void;
|
|
120
120
|
export declare const GL_HOOKED_SETTERS: {
|
|
121
|
-
enable: (update: UpdateFunc, capability:
|
|
122
|
-
disable: (update: UpdateFunc, capability:
|
|
123
|
-
pixelStorei: (update: UpdateFunc, pname:
|
|
124
|
-
hint: (update: UpdateFunc, pname:
|
|
121
|
+
enable: (update: UpdateFunc, capability: GL) => void;
|
|
122
|
+
disable: (update: UpdateFunc, capability: GL) => void;
|
|
123
|
+
pixelStorei: (update: UpdateFunc, pname: GL, value: any) => void;
|
|
124
|
+
hint: (update: UpdateFunc, pname: GL, hint: GL) => void;
|
|
125
125
|
useProgram: (update: UpdateFunc, value: any) => void;
|
|
126
126
|
bindRenderbuffer: (update: UpdateFunc, target: any, value: any) => void;
|
|
127
127
|
bindTransformFeedback: (update: UpdateFunc, target: any, value: any) => void;
|
|
@@ -157,16 +157,16 @@ export declare const GL_HOOKED_SETTERS: {
|
|
|
157
157
|
viewport: (update: UpdateFunc, x: any, y: any, width: any, height: any) => void;
|
|
158
158
|
};
|
|
159
159
|
export declare const GL_PARAMETER_GETTERS: {
|
|
160
|
-
3042: (gl:
|
|
161
|
-
2884: (gl:
|
|
162
|
-
2929: (gl:
|
|
163
|
-
3024: (gl:
|
|
164
|
-
32823: (gl:
|
|
165
|
-
32926: (gl:
|
|
166
|
-
32928: (gl:
|
|
167
|
-
3089: (gl:
|
|
168
|
-
2960: (gl:
|
|
169
|
-
35977: (gl:
|
|
160
|
+
3042: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
161
|
+
2884: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
162
|
+
2929: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
163
|
+
3024: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
164
|
+
32823: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
165
|
+
32926: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
166
|
+
32928: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
167
|
+
3089: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
168
|
+
2960: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
169
|
+
35977: (gl: WebGLRenderingContext, key: any) => boolean;
|
|
170
170
|
};
|
|
171
171
|
export declare const NON_CACHE_PARAMETERS: Set<GL>;
|
|
172
172
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-parameter-tables.d.ts","sourceRoot":"","sources":["../../../src/context/parameters/webgl-parameter-tables.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAKpD,eAAO,MAAM,qBAAqB,EAAE,YAiFnC,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-parameter-tables.d.ts","sourceRoot":"","sources":["../../../src/context/parameters/webgl-parameter-tables.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAKpD,eAAO,MAAM,qBAAqB,EAAE,YAiFnC,CAAC;AA0CF,eAAO,MAAM,oBAAoB;eAtCb,qBAAqB,SAAS,OAAO,OAAO,EAAE;gBAwCzC,qBAAqB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,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UAAU;yBAQjB,UAAU,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM;yBAKtD,UAAU,SAAS,MAAM;2BAKvB,UAAU,KAAK,MAAM;wBAKxB,UAAU,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM;uBAKvD,UAAU;wBAKT,UAAU;yBAKT,UAAU,SAAS,MAAM,QAAQ,MAAM;wBAKxC,UAAU,QAAQ,MAAM;wBAKxB,UAAU;wBAKV,UAAU;4BAKN,UAAU;6BAMT,UAAU;sBAMjB,UAAU;0BAKN,UAAU;kCAMF,UAAU;0BAKlB,UAAU;kCAUF,UAAU;wBAOpB,UAAU;gCAUF,UAAU;uBAOnB,UAAU;CAI9B,CAAC;AAOF,eAAO,MAAM,oBAAoB;eAHV,qBAAqB;eAArB,qBAAqB;eAArB,qBAAqB;eAArB,qBAAqB;gBAArB,qBAAqB;gBAArB,qBAAqB;gBAArB,qBAAqB;eAArB,qBAAqB;eAArB,qBAAqB;gBAArB,qBAAqB;CAgB3C,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAuC/B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import GL from '@luma.gl/constants';
|
|
2
|
-
import { isWebGL2 } from
|
|
2
|
+
import { isWebGL2 } from "../context/webgl-checks.js";
|
|
3
3
|
export const GL_PARAMETER_DEFAULTS = {
|
|
4
4
|
[GL.BLEND]: false,
|
|
5
5
|
[GL.BLEND_COLOR]: new Float32Array([0, 0, 0, 0]),
|
|
@@ -75,40 +75,32 @@ export const GL_PARAMETER_DEFAULTS = {
|
|
|
75
75
|
[GL.UNPACK_SKIP_ROWS]: 0,
|
|
76
76
|
[GL.UNPACK_SKIP_IMAGES]: 0
|
|
77
77
|
};
|
|
78
|
-
|
|
79
78
|
const enable = (gl, value, key) => value ? gl.enable(key) : gl.disable(key);
|
|
80
|
-
|
|
81
79
|
const hint = (gl, value, key) => gl.hint(key, value);
|
|
82
|
-
|
|
83
80
|
const pixelStorei = (gl, value, key) => gl.pixelStorei(key, value);
|
|
84
|
-
|
|
85
81
|
const bindFramebuffer = (gl, value, key) => {
|
|
86
82
|
let target;
|
|
87
|
-
|
|
88
83
|
if (key === GL.FRAMEBUFFER_BINDING) {
|
|
89
84
|
target = isWebGL2(gl) ? GL.DRAW_FRAMEBUFFER : GL.FRAMEBUFFER;
|
|
90
85
|
} else {
|
|
91
86
|
target = GL.READ_FRAMEBUFFER;
|
|
92
87
|
}
|
|
93
|
-
|
|
94
88
|
return gl.bindFramebuffer(target, value);
|
|
95
89
|
};
|
|
96
|
-
|
|
97
90
|
const bindBuffer = (gl, value, key) => {
|
|
98
|
-
const
|
|
99
|
-
[GL.ARRAY_BUFFER_BINDING]:
|
|
100
|
-
[GL.COPY_READ_BUFFER_BINDING]:
|
|
101
|
-
[GL.COPY_WRITE_BUFFER_BINDING]:
|
|
102
|
-
[GL.PIXEL_PACK_BUFFER_BINDING]:
|
|
103
|
-
[GL.PIXEL_UNPACK_BUFFER_BINDING]:
|
|
104
|
-
}
|
|
91
|
+
const bindingMap = {
|
|
92
|
+
[GL.ARRAY_BUFFER_BINDING]: GL.ARRAY_BUFFER,
|
|
93
|
+
[GL.COPY_READ_BUFFER_BINDING]: GL.COPY_READ_BUFFER,
|
|
94
|
+
[GL.COPY_WRITE_BUFFER_BINDING]: GL.COPY_WRITE_BUFFER,
|
|
95
|
+
[GL.PIXEL_PACK_BUFFER_BINDING]: GL.PIXEL_PACK_BUFFER,
|
|
96
|
+
[GL.PIXEL_UNPACK_BUFFER_BINDING]: GL.PIXEL_UNPACK_BUFFER
|
|
97
|
+
};
|
|
98
|
+
const target = bindingMap[key];
|
|
105
99
|
gl.bindBuffer(target, value);
|
|
106
100
|
};
|
|
107
|
-
|
|
108
101
|
function isArray(array) {
|
|
109
|
-
return Array.isArray(array) || ArrayBuffer.isView(array);
|
|
102
|
+
return Array.isArray(array) || ArrayBuffer.isView(array) && !(array instanceof DataView);
|
|
110
103
|
}
|
|
111
|
-
|
|
112
104
|
export const GL_PARAMETER_SETTERS = {
|
|
113
105
|
[GL.BLEND]: enable,
|
|
114
106
|
[GL.BLEND_COLOR]: (gl, value) => gl.blendColor(...value),
|
|
@@ -132,9 +124,8 @@ export const GL_PARAMETER_SETTERS = {
|
|
|
132
124
|
[GL.CURRENT_PROGRAM]: (gl, value) => gl.useProgram(value),
|
|
133
125
|
[GL.RENDERBUFFER_BINDING]: (gl, value) => gl.bindRenderbuffer(GL.RENDERBUFFER, value),
|
|
134
126
|
[GL.TRANSFORM_FEEDBACK_BINDING]: (gl, value) => {
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
return (_gl$bindTransformFeed = gl.bindTransformFeedback) === null || _gl$bindTransformFeed === void 0 ? void 0 : _gl$bindTransformFeed.call(gl, GL.TRANSFORM_FEEDBACK, value);
|
|
127
|
+
var _bindTransformFeedbac, _ref;
|
|
128
|
+
return (_bindTransformFeedbac = (_ref = gl).bindTransformFeedback) === null || _bindTransformFeedbac === void 0 ? void 0 : _bindTransformFeedbac.call(_ref, GL.TRANSFORM_FEEDBACK, value);
|
|
138
129
|
},
|
|
139
130
|
[GL.VERTEX_ARRAY_BINDING]: (gl, value) => gl.bindVertexArray(value),
|
|
140
131
|
[GL.FRAMEBUFFER_BINDING]: bindFramebuffer,
|
|
@@ -194,12 +185,12 @@ export const GL_PARAMETER_SETTERS = {
|
|
|
194
185
|
blend: (gl, value) => value ? gl.enable(GL.BLEND) : gl.disable(GL.BLEND),
|
|
195
186
|
blendColor: (gl, value) => gl.blendColor(...value),
|
|
196
187
|
blendEquation: (gl, args) => {
|
|
197
|
-
|
|
198
|
-
gl.blendEquationSeparate(...
|
|
188
|
+
const separateModes = typeof args === 'number' ? [args, args] : args;
|
|
189
|
+
gl.blendEquationSeparate(...separateModes);
|
|
199
190
|
},
|
|
200
191
|
blendFunc: (gl, args) => {
|
|
201
|
-
|
|
202
|
-
gl.blendFuncSeparate(...
|
|
192
|
+
const separateFuncs = (args === null || args === void 0 ? void 0 : args.length) === 2 ? [...args, ...args] : args;
|
|
193
|
+
gl.blendFuncSeparate(...separateFuncs);
|
|
203
194
|
},
|
|
204
195
|
clearColor: (gl, value) => gl.clearColor(...value),
|
|
205
196
|
clearDepth: (gl, value) => gl.clearDepth(value),
|
|
@@ -244,11 +235,9 @@ export const GL_PARAMETER_SETTERS = {
|
|
|
244
235
|
},
|
|
245
236
|
viewport: (gl, value) => gl.viewport(...value)
|
|
246
237
|
};
|
|
247
|
-
|
|
248
238
|
function getValue(glEnum, values, cache) {
|
|
249
239
|
return values[glEnum] !== undefined ? values[glEnum] : cache[glEnum];
|
|
250
240
|
}
|
|
251
|
-
|
|
252
241
|
export const GL_COMPOSITE_PARAMETER_SETTERS = {
|
|
253
242
|
blendEquation: (gl, values, cache) => gl.blendEquationSeparate(getValue(GL.BLEND_EQUATION_RGB, values, cache), getValue(GL.BLEND_EQUATION_ALPHA, values, cache)),
|
|
254
243
|
blendFunc: (gl, values, cache) => gl.blendFuncSeparate(getValue(GL.BLEND_SRC_RGB, values, cache), getValue(GL.BLEND_DST_RGB, values, cache), getValue(GL.BLEND_SRC_ALPHA, values, cache), getValue(GL.BLEND_DST_ALPHA, values, cache)),
|
|
@@ -291,17 +280,14 @@ export const GL_HOOKED_SETTERS = {
|
|
|
291
280
|
[GL.DRAW_FRAMEBUFFER_BINDING]: framebuffer,
|
|
292
281
|
[GL.READ_FRAMEBUFFER_BINDING]: framebuffer
|
|
293
282
|
});
|
|
294
|
-
|
|
295
283
|
case GL.DRAW_FRAMEBUFFER:
|
|
296
284
|
return update({
|
|
297
285
|
[GL.DRAW_FRAMEBUFFER_BINDING]: framebuffer
|
|
298
286
|
});
|
|
299
|
-
|
|
300
287
|
case GL.READ_FRAMEBUFFER:
|
|
301
288
|
return update({
|
|
302
289
|
[GL.READ_FRAMEBUFFER_BINDING]: framebuffer
|
|
303
290
|
});
|
|
304
|
-
|
|
305
291
|
default:
|
|
306
292
|
return null;
|
|
307
293
|
}
|
|
@@ -314,13 +300,11 @@ export const GL_HOOKED_SETTERS = {
|
|
|
314
300
|
[GL.PIXEL_PACK_BUFFER]: [GL.PIXEL_PACK_BUFFER_BINDING],
|
|
315
301
|
[GL.PIXEL_UNPACK_BUFFER]: [GL.PIXEL_UNPACK_BUFFER_BINDING]
|
|
316
302
|
}[target];
|
|
317
|
-
|
|
318
303
|
if (pname) {
|
|
319
304
|
return update({
|
|
320
305
|
[pname]: buffer
|
|
321
306
|
});
|
|
322
307
|
}
|
|
323
|
-
|
|
324
308
|
return {
|
|
325
309
|
valueChanged: true
|
|
326
310
|
};
|
|
@@ -426,9 +410,7 @@ export const GL_HOOKED_SETTERS = {
|
|
|
426
410
|
[GL.VIEWPORT]: [x, y, width, height]
|
|
427
411
|
})
|
|
428
412
|
};
|
|
429
|
-
|
|
430
413
|
const isEnabled = (gl, key) => gl.isEnabled(key);
|
|
431
|
-
|
|
432
414
|
export const GL_PARAMETER_GETTERS = {
|
|
433
415
|
[GL.BLEND]: isEnabled,
|
|
434
416
|
[GL.CULL_FACE]: isEnabled,
|