@luma.gl/webgl 8.6.0-alpha.1 → 8.6.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -1
- package/dist/_deprecated/context-api.d.ts +85 -0
- package/dist/_deprecated/context-api.d.ts.map +1 -0
- package/dist/_deprecated/context-api.js +76 -0
- package/dist/_deprecated/context-api.js.map +1 -0
- package/dist/{features/webgl-features-table.d.ts → _deprecated/features.d.ts} +4 -7
- package/dist/_deprecated/features.d.ts.map +1 -0
- package/dist/_deprecated/features.js +111 -0
- package/dist/_deprecated/features.js.map +1 -0
- package/dist/adapter/converters/set-device-parameters.d.ts +5 -0
- package/dist/adapter/converters/set-device-parameters.d.ts.map +1 -0
- package/dist/adapter/converters/set-device-parameters.js +124 -0
- package/dist/adapter/converters/set-device-parameters.js.map +1 -0
- package/dist/adapter/converters/webgpu-texture-formats.d.ts +281 -0
- package/dist/adapter/converters/webgpu-texture-formats.d.ts.map +1 -0
- package/dist/adapter/converters/webgpu-texture-formats.js +285 -0
- package/dist/adapter/converters/webgpu-texture-formats.js.map +1 -0
- package/dist/adapter/device-helpers/device-features.d.ts +12 -0
- package/dist/adapter/device-helpers/device-features.d.ts.map +1 -0
- package/dist/adapter/device-helpers/device-features.js +123 -0
- package/dist/adapter/device-helpers/device-features.js.map +1 -0
- package/dist/adapter/device-helpers/device-limits.d.ts +51 -0
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -0
- package/dist/adapter/device-helpers/device-limits.js +90 -0
- package/dist/adapter/device-helpers/device-limits.js.map +1 -0
- package/dist/adapter/device-helpers/get-device-info.d.ts +4 -0
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -0
- package/dist/adapter/device-helpers/get-device-info.js +44 -0
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -0
- package/dist/adapter/device-helpers/is-old-ie.d.ts +2 -0
- package/dist/adapter/device-helpers/is-old-ie.d.ts.map +1 -0
- package/dist/{esm/features/check-old-ie.js → adapter/device-helpers/is-old-ie.js} +3 -3
- package/dist/adapter/device-helpers/is-old-ie.js.map +1 -0
- package/dist/adapter/webgl-device.d.ts +110 -0
- package/dist/adapter/webgl-device.d.ts.map +1 -0
- package/dist/adapter/webgl-device.js +207 -0
- package/dist/adapter/webgl-device.js.map +1 -0
- package/dist/adapter/webgl-shader.d.ts +18 -0
- package/dist/adapter/webgl-shader.d.ts.map +1 -0
- package/dist/adapter/webgl-shader.js +82 -0
- package/dist/adapter/webgl-shader.js.map +1 -0
- package/dist/classes/accessor.js +2 -2
- package/dist/classes/accessor.js.map +1 -1
- package/dist/classes/accessor.ts.disabled +1 -1
- package/dist/classes/clear.d.ts +3 -2
- package/dist/classes/clear.d.ts.map +1 -1
- package/dist/classes/clear.js +7 -4
- package/dist/classes/clear.js.map +1 -1
- package/dist/classes/copy-and-blit.d.ts +18 -1
- package/dist/classes/copy-and-blit.d.ts.map +1 -1
- package/dist/classes/copy-and-blit.js +30 -25
- package/dist/classes/copy-and-blit.js.map +1 -1
- package/dist/classes/framebuffer.d.ts +10 -1
- package/dist/classes/framebuffer.d.ts.map +1 -1
- package/dist/classes/framebuffer.js +15 -15
- package/dist/classes/framebuffer.js.map +1 -1
- package/dist/classes/program-configuration.d.ts +14 -17
- package/dist/classes/program-configuration.d.ts.map +1 -1
- package/dist/classes/program-configuration.js +10 -97
- package/dist/classes/program-configuration.js.map +1 -1
- package/dist/classes/program.d.ts +25 -20
- package/dist/classes/program.d.ts.map +1 -1
- package/dist/classes/program.js +39 -28
- package/dist/classes/program.js.map +1 -1
- package/dist/classes/query.d.ts.map +1 -1
- package/dist/classes/query.js +6 -5
- package/dist/classes/query.js.map +1 -1
- package/dist/classes/renderbuffer-formats.js +1 -1
- package/dist/classes/renderbuffer-formats.js.map +1 -1
- package/dist/classes/renderbuffer.d.ts.map +1 -1
- package/dist/classes/renderbuffer.js +4 -3
- package/dist/classes/renderbuffer.js.map +1 -1
- package/dist/classes/{webgl-shader.d.ts → shader.d.ts} +4 -13
- package/dist/classes/shader.d.ts.map +1 -0
- package/dist/classes/{webgl-shader.js → shader.js} +7 -79
- package/dist/classes/shader.js.map +1 -0
- package/dist/classes/texture-2d.d.ts +4 -3
- package/dist/classes/texture-2d.d.ts.map +1 -1
- package/dist/classes/texture-2d.js +5 -8
- package/dist/classes/texture-2d.js.map +1 -1
- package/dist/classes/texture-3d.d.ts +3 -2
- package/dist/classes/texture-3d.d.ts.map +1 -1
- package/dist/classes/texture-3d.js +15 -6
- package/dist/classes/texture-3d.js.map +1 -1
- package/dist/classes/texture-cube.d.ts +2 -1
- package/dist/classes/texture-cube.d.ts.map +1 -1
- package/dist/classes/texture-cube.js +3 -4
- package/dist/classes/texture-cube.js.map +1 -1
- package/dist/classes/texture-formats.js +1 -1
- package/dist/classes/texture-formats.js.map +1 -1
- package/dist/classes/texture.d.ts +14 -9
- package/dist/classes/texture.d.ts.map +1 -1
- package/dist/classes/texture.js +19 -18
- package/dist/classes/texture.js.map +1 -1
- package/dist/classes/transform-feedback.d.ts.map +1 -1
- package/dist/classes/transform-feedback.js +5 -4
- package/dist/classes/transform-feedback.js.map +1 -1
- package/dist/classes/uniform-buffer-layout.js +1 -1
- package/dist/classes/uniform-buffer-layout.js.map +1 -1
- package/dist/classes/uniforms.d.ts +0 -1
- package/dist/classes/uniforms.d.ts.map +1 -1
- package/dist/classes/uniforms.js +1 -2
- package/dist/classes/uniforms.js.map +1 -1
- package/dist/classes/vertex-array-object.d.ts +7 -6
- package/dist/classes/vertex-array-object.d.ts.map +1 -1
- package/dist/classes/vertex-array-object.js +11 -12
- package/dist/classes/vertex-array-object.js.map +1 -1
- package/dist/classes/vertex-array.d.ts +14 -14
- package/dist/classes/vertex-array.d.ts.map +1 -1
- package/dist/classes/vertex-array.js +3 -4
- package/dist/classes/vertex-array.js.map +1 -1
- package/dist/classes/webgl-buffer.d.ts +2 -0
- package/dist/classes/webgl-buffer.d.ts.map +1 -1
- package/dist/classes/webgl-buffer.js +8 -5
- package/dist/classes/webgl-buffer.js.map +1 -1
- package/dist/classes/webgl-resource.d.ts +6 -4
- package/dist/classes/webgl-resource.d.ts.map +1 -1
- package/dist/classes/webgl-resource.js +12 -8
- package/dist/classes/webgl-resource.js.map +1 -1
- package/dist/context/context/context-state.d.ts +18 -0
- package/dist/context/context/context-state.d.ts.map +1 -0
- package/dist/context/context/context-state.js +26 -0
- package/dist/context/context/context-state.js.map +1 -0
- package/dist/context/context/create-context.d.ts +40 -0
- package/dist/context/context/create-context.d.ts.map +1 -0
- package/dist/context/context/create-context.js +37 -0
- package/dist/context/context/create-context.js.map +1 -0
- package/dist/context/context/device-pixels.d.ts +25 -0
- package/dist/context/context/device-pixels.d.ts.map +1 -0
- package/dist/context/context/device-pixels.js +98 -0
- package/dist/context/context/device-pixels.js.map +1 -0
- package/dist/context/context/get-canvas.d.ts +13 -0
- package/dist/context/context/get-canvas.d.ts.map +1 -0
- package/dist/context/context/get-canvas.js +31 -0
- package/dist/context/context/get-canvas.js.map +1 -0
- package/dist/context/context/resize-context.d.ts +20 -0
- package/dist/context/context/resize-context.d.ts.map +1 -0
- package/dist/context/context/resize-context.js +15 -0
- package/dist/context/context/resize-context.js.map +1 -0
- package/dist/context/context/webgl-checks.d.ts +13 -0
- package/dist/context/context/webgl-checks.d.ts.map +1 -0
- package/dist/context/context/webgl-checks.js +34 -0
- package/dist/context/context/webgl-checks.js.map +1 -0
- package/dist/context/parameters/unified-parameter-api.d.ts +31 -0
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -0
- package/dist/context/parameters/unified-parameter-api.js +65 -0
- package/dist/context/parameters/unified-parameter-api.js.map +1 -0
- package/dist/context/parameters/webgl-parameter-tables.d.ts +169 -0
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -0
- package/dist/context/parameters/webgl-parameter-tables.js +445 -0
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -0
- package/dist/context/parameters/webgl-parameters.d.ts +144 -0
- package/dist/context/parameters/webgl-parameters.d.ts.map +1 -0
- package/dist/context/parameters/webgl-parameters.js +2 -0
- package/dist/context/parameters/webgl-parameters.js.map +1 -0
- package/dist/context/polyfill/get-parameter-polyfill.d.ts +2 -0
- package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +1 -0
- package/dist/context/polyfill/get-parameter-polyfill.js +91 -0
- package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -0
- package/dist/context/polyfill/polyfill-context.d.ts +5 -0
- package/dist/context/polyfill/polyfill-context.d.ts.map +1 -0
- package/dist/context/polyfill/polyfill-context.js +91 -0
- package/dist/context/polyfill/polyfill-context.js.map +1 -0
- package/dist/context/polyfill/polyfill-table.d.ts +48 -0
- package/dist/context/polyfill/polyfill-table.d.ts.map +1 -0
- package/dist/context/polyfill/polyfill-table.js +160 -0
- package/dist/context/polyfill/polyfill-table.js.map +1 -0
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts +2 -0
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -0
- package/dist/context/polyfill/polyfill-vertex-array-object.js +335 -0
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
- package/dist/context/state-tracker/deep-array-equal.d.ts +3 -0
- package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -0
- package/dist/context/state-tracker/deep-array-equal.js +21 -0
- package/dist/context/state-tracker/deep-array-equal.js.map +1 -0
- package/dist/context/state-tracker/track-context-state.d.ts +22 -0
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -0
- package/dist/context/state-tracker/track-context-state.js +169 -0
- package/dist/context/state-tracker/track-context-state.js.map +1 -0
- package/dist/context/state-tracker/with-parameters.d.ts +13 -0
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -0
- package/dist/context/state-tracker/with-parameters.js +36 -0
- package/dist/context/state-tracker/with-parameters.js.map +1 -0
- package/dist/debug/debug-uniforms.js +1 -1
- package/dist/debug/debug-uniforms.js.map +1 -1
- package/dist/debug/debug-vertex-array.js +2 -2
- package/dist/debug/debug-vertex-array.js.map +1 -1
- package/dist/es5/_deprecated/context-api.js +116 -0
- package/dist/es5/_deprecated/context-api.js.map +1 -0
- package/dist/es5/_deprecated/features.js +118 -0
- package/dist/es5/_deprecated/features.js.map +1 -0
- package/dist/es5/adapter/converters/set-device-parameters.js +138 -0
- package/dist/es5/adapter/converters/set-device-parameters.js.map +1 -0
- package/dist/es5/adapter/converters/webgpu-texture-formats.js +296 -0
- package/dist/es5/adapter/converters/webgpu-texture-formats.js.map +1 -0
- package/dist/es5/adapter/device-helpers/device-features.js +152 -0
- package/dist/es5/adapter/device-helpers/device-features.js.map +1 -0
- package/dist/es5/adapter/device-helpers/device-limits.js +64 -0
- package/dist/es5/adapter/device-helpers/device-limits.js.map +1 -0
- package/dist/es5/adapter/device-helpers/get-device-info.js +55 -0
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +1 -0
- package/dist/es5/adapter/device-helpers/is-old-ie.js +16 -0
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +1 -0
- package/dist/es5/adapter/webgl-device.js +279 -0
- package/dist/es5/adapter/webgl-device.js.map +1 -0
- package/dist/es5/adapter/webgl-shader.js +155 -0
- package/dist/es5/adapter/webgl-shader.js.map +1 -0
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/classes/accessor.js +104 -74
- package/dist/es5/classes/accessor.js.map +1 -1
- package/dist/es5/classes/accessor.ts.disabled +1 -1
- package/dist/es5/classes/clear.js +55 -34
- package/dist/es5/classes/clear.js.map +1 -1
- package/dist/es5/classes/copy-and-blit.js +175 -156
- package/dist/es5/classes/copy-and-blit.js.map +1 -1
- package/dist/es5/classes/framebuffer.js +647 -518
- package/dist/es5/classes/framebuffer.js.map +1 -1
- package/dist/es5/classes/program-configuration.js +78 -128
- package/dist/es5/classes/program-configuration.js.map +1 -1
- package/dist/es5/classes/program.js +379 -292
- package/dist/es5/classes/program.js.map +1 -1
- package/dist/es5/classes/query.js +172 -107
- package/dist/es5/classes/query.js.map +1 -1
- package/dist/es5/classes/renderbuffer-formats.js +126 -164
- package/dist/es5/classes/renderbuffer-formats.js.map +1 -1
- package/dist/es5/classes/renderbuffer.js +151 -98
- package/dist/es5/classes/renderbuffer.js.map +1 -1
- package/dist/es5/classes/shader.js +195 -0
- package/dist/es5/classes/shader.js.map +1 -0
- package/dist/es5/classes/texture-2d.js +44 -17
- package/dist/es5/classes/texture-2d.js.map +1 -1
- package/dist/es5/classes/texture-3d.js +107 -48
- package/dist/es5/classes/texture-3d.js.map +1 -1
- package/dist/es5/classes/texture-cube.js +169 -110
- package/dist/es5/classes/texture-cube.js.map +1 -1
- package/dist/es5/classes/texture-formats.js +42 -71
- package/dist/es5/classes/texture-formats.js.map +1 -1
- package/dist/es5/classes/texture.js +780 -665
- package/dist/es5/classes/texture.js.map +1 -1
- package/dist/es5/classes/transform-feedback.js +206 -150
- package/dist/es5/classes/transform-feedback.js.map +1 -1
- package/dist/es5/classes/uniform-buffer-layout.js +103 -89
- package/dist/es5/classes/uniform-buffer-layout.js.map +1 -1
- package/dist/es5/classes/uniforms.js +39 -80
- package/dist/es5/classes/uniforms.js.map +1 -1
- package/dist/es5/classes/vertex-array-object.js +268 -209
- package/dist/es5/classes/vertex-array-object.js.map +1 -1
- package/dist/es5/classes/vertex-array.js +348 -303
- package/dist/es5/classes/vertex-array.js.map +1 -1
- package/dist/es5/classes/webgl-buffer.js +374 -303
- package/dist/es5/classes/webgl-buffer.js.map +1 -1
- package/dist/es5/classes/webgl-resource.js +231 -161
- package/dist/es5/classes/webgl-resource.js.map +1 -1
- package/dist/es5/context/context/context-state.js +31 -0
- package/dist/es5/context/context/context-state.js.map +1 -0
- package/dist/es5/context/context/create-context.js +57 -0
- package/dist/es5/context/context/create-context.js.map +1 -0
- package/dist/es5/context/context/device-pixels.js +115 -0
- package/dist/es5/context/context/device-pixels.js.map +1 -0
- package/dist/es5/context/context/get-canvas.js +40 -0
- package/dist/es5/context/context/get-canvas.js.map +1 -0
- package/dist/es5/context/context/resize-context.js +23 -0
- package/dist/es5/context/context/resize-context.js.map +1 -0
- package/dist/es5/context/context/webgl-checks.js +54 -0
- package/dist/es5/context/context/webgl-checks.js.map +1 -0
- package/dist/es5/context/parameters/unified-parameter-api.js +95 -0
- package/dist/es5/context/parameters/unified-parameter-api.js.map +1 -0
- package/dist/es5/context/parameters/webgl-parameter-tables.js +392 -0
- package/dist/es5/context/parameters/webgl-parameter-tables.js.map +1 -0
- package/dist/es5/context/parameters/webgl-parameters.js +6 -0
- package/dist/es5/context/parameters/webgl-parameters.js.map +1 -0
- package/dist/es5/context/polyfill/get-parameter-polyfill.js +81 -0
- package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +1 -0
- package/dist/es5/context/polyfill/polyfill-context.js +134 -0
- package/dist/es5/context/polyfill/polyfill-context.js.map +1 -0
- package/dist/es5/context/polyfill/polyfill-table.js +166 -0
- package/dist/es5/context/polyfill/polyfill-table.js.map +1 -0
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +341 -0
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
- package/dist/es5/context/state-tracker/deep-array-equal.js +28 -0
- package/dist/es5/context/state-tracker/deep-array-equal.js.map +1 -0
- package/dist/es5/context/state-tracker/track-context-state.js +196 -0
- package/dist/es5/context/state-tracker/track-context-state.js.map +1 -0
- package/dist/es5/context/state-tracker/with-parameters.js +44 -0
- package/dist/es5/context/state-tracker/with-parameters.js.map +1 -0
- package/dist/es5/debug/debug-program-configuration.js +48 -20
- package/dist/es5/debug/debug-program-configuration.js.map +1 -1
- package/dist/es5/debug/debug-uniforms.js +110 -70
- package/dist/es5/debug/debug-uniforms.js.map +1 -1
- package/dist/es5/debug/debug-vertex-array.js +49 -54
- package/dist/es5/debug/debug-vertex-array.js.map +1 -1
- package/dist/es5/helpers/get-program-bindings.js +274 -0
- package/dist/es5/helpers/get-program-bindings.js.map +1 -0
- package/dist/es5/helpers/program-bindings.js +2 -0
- package/dist/es5/helpers/program-bindings.js.map +1 -0
- package/dist/es5/index.js +268 -192
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/init.js +18 -14
- package/dist/es5/init.js.map +1 -1
- package/dist/es5/types/accessor.d.ts +29 -0
- package/dist/es5/webgl-utils/attribute-utils.js +74 -87
- package/dist/es5/webgl-utils/attribute-utils.js.map +1 -1
- package/dist/es5/webgl-utils/constants-to-keys.js +7 -7
- package/dist/es5/webgl-utils/constants-to-keys.js.map +1 -1
- package/dist/es5/webgl-utils/format-utils.js +4 -4
- package/dist/es5/webgl-utils/format-utils.js.map +1 -1
- package/dist/es5/webgl-utils/get-error.js +18 -18
- package/dist/es5/webgl-utils/get-error.js.map +1 -1
- package/dist/es5/webgl-utils/index.js +10 -10
- package/dist/es5/webgl-utils/parse-shader-compiler-log.js +53 -25
- package/dist/es5/webgl-utils/parse-shader-compiler-log.js.map +1 -1
- package/dist/es5/webgl-utils/texture-utils.js +32 -36
- package/dist/es5/webgl-utils/texture-utils.js.map +1 -1
- package/dist/es5/webgl-utils/typed-array-utils.js +33 -32
- package/dist/es5/webgl-utils/typed-array-utils.js.map +1 -1
- package/dist/esm/_deprecated/context-api.js +76 -0
- package/dist/esm/_deprecated/context-api.js.map +1 -0
- package/dist/esm/_deprecated/features.js +111 -0
- package/dist/esm/_deprecated/features.js.map +1 -0
- package/dist/esm/adapter/converters/set-device-parameters.js +124 -0
- package/dist/esm/adapter/converters/set-device-parameters.js.map +1 -0
- package/dist/esm/adapter/converters/webgpu-texture-formats.js +285 -0
- package/dist/esm/adapter/converters/webgpu-texture-formats.js.map +1 -0
- package/dist/esm/adapter/device-helpers/device-features.js +123 -0
- package/dist/esm/adapter/device-helpers/device-features.js.map +1 -0
- package/dist/esm/adapter/device-helpers/device-limits.js +90 -0
- package/dist/esm/adapter/device-helpers/device-limits.js.map +1 -0
- package/dist/esm/adapter/device-helpers/get-device-info.js +44 -0
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +1 -0
- package/dist/{features/check-old-ie.js → esm/adapter/device-helpers/is-old-ie.js} +3 -3
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +1 -0
- package/dist/esm/adapter/webgl-device.js +207 -0
- package/dist/esm/adapter/webgl-device.js.map +1 -0
- package/dist/esm/adapter/webgl-shader.js +82 -0
- package/dist/esm/adapter/webgl-shader.js.map +1 -0
- package/dist/esm/classes/accessor.js +2 -2
- package/dist/esm/classes/accessor.js.map +1 -1
- package/dist/esm/classes/accessor.ts.disabled +1 -1
- package/dist/esm/classes/clear.js +7 -4
- package/dist/esm/classes/clear.js.map +1 -1
- package/dist/esm/classes/copy-and-blit.js +30 -25
- package/dist/esm/classes/copy-and-blit.js.map +1 -1
- package/dist/esm/classes/framebuffer.js +15 -15
- package/dist/esm/classes/framebuffer.js.map +1 -1
- package/dist/esm/classes/program-configuration.js +10 -97
- package/dist/esm/classes/program-configuration.js.map +1 -1
- package/dist/esm/classes/program.js +39 -28
- package/dist/esm/classes/program.js.map +1 -1
- package/dist/esm/classes/query.js +6 -5
- package/dist/esm/classes/query.js.map +1 -1
- package/dist/esm/classes/renderbuffer-formats.js +1 -1
- package/dist/esm/classes/renderbuffer-formats.js.map +1 -1
- package/dist/esm/classes/renderbuffer.js +4 -3
- package/dist/esm/classes/renderbuffer.js.map +1 -1
- package/dist/esm/classes/{webgl-shader.js → shader.js} +7 -79
- package/dist/esm/classes/shader.js.map +1 -0
- package/dist/esm/classes/texture-2d.js +5 -8
- package/dist/esm/classes/texture-2d.js.map +1 -1
- package/dist/esm/classes/texture-3d.js +15 -6
- package/dist/esm/classes/texture-3d.js.map +1 -1
- package/dist/esm/classes/texture-cube.js +3 -4
- package/dist/esm/classes/texture-cube.js.map +1 -1
- package/dist/esm/classes/texture-formats.js +1 -1
- package/dist/esm/classes/texture-formats.js.map +1 -1
- package/dist/esm/classes/texture.js +19 -18
- package/dist/esm/classes/texture.js.map +1 -1
- package/dist/esm/classes/transform-feedback.js +5 -4
- package/dist/esm/classes/transform-feedback.js.map +1 -1
- package/dist/esm/classes/uniform-buffer-layout.js +1 -1
- package/dist/esm/classes/uniform-buffer-layout.js.map +1 -1
- package/dist/esm/classes/uniforms.js +1 -2
- package/dist/esm/classes/uniforms.js.map +1 -1
- package/dist/esm/classes/vertex-array-object.js +11 -12
- package/dist/esm/classes/vertex-array-object.js.map +1 -1
- package/dist/esm/classes/vertex-array.js +3 -4
- package/dist/esm/classes/vertex-array.js.map +1 -1
- package/dist/esm/classes/webgl-buffer.js +8 -5
- package/dist/esm/classes/webgl-buffer.js.map +1 -1
- package/dist/esm/classes/webgl-resource.js +12 -8
- package/dist/esm/classes/webgl-resource.js.map +1 -1
- package/dist/esm/context/context/context-state.js +26 -0
- package/dist/esm/context/context/context-state.js.map +1 -0
- package/dist/esm/context/context/create-context.js +37 -0
- package/dist/esm/context/context/create-context.js.map +1 -0
- package/dist/esm/context/context/device-pixels.js +98 -0
- package/dist/esm/context/context/device-pixels.js.map +1 -0
- package/dist/esm/context/context/get-canvas.js +31 -0
- package/dist/esm/context/context/get-canvas.js.map +1 -0
- package/dist/esm/context/context/resize-context.js +15 -0
- package/dist/esm/context/context/resize-context.js.map +1 -0
- package/dist/esm/context/context/webgl-checks.js +34 -0
- package/dist/esm/context/context/webgl-checks.js.map +1 -0
- package/dist/esm/context/parameters/unified-parameter-api.js +65 -0
- package/dist/esm/context/parameters/unified-parameter-api.js.map +1 -0
- package/dist/esm/context/parameters/webgl-parameter-tables.js +445 -0
- package/dist/esm/context/parameters/webgl-parameter-tables.js.map +1 -0
- package/dist/esm/context/parameters/webgl-parameters.js +2 -0
- package/dist/esm/context/parameters/webgl-parameters.js.map +1 -0
- package/dist/esm/context/polyfill/get-parameter-polyfill.js +91 -0
- package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +1 -0
- package/dist/esm/context/polyfill/polyfill-context.js +91 -0
- package/dist/esm/context/polyfill/polyfill-context.js.map +1 -0
- package/dist/esm/context/polyfill/polyfill-table.js +160 -0
- package/dist/esm/context/polyfill/polyfill-table.js.map +1 -0
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +335 -0
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
- package/dist/esm/context/state-tracker/deep-array-equal.js +21 -0
- package/dist/esm/context/state-tracker/deep-array-equal.js.map +1 -0
- package/dist/esm/context/state-tracker/track-context-state.js +169 -0
- package/dist/esm/context/state-tracker/track-context-state.js.map +1 -0
- package/dist/esm/context/state-tracker/with-parameters.js +36 -0
- package/dist/esm/context/state-tracker/with-parameters.js.map +1 -0
- package/dist/esm/debug/debug-uniforms.js +1 -1
- package/dist/esm/debug/debug-uniforms.js.map +1 -1
- package/dist/esm/debug/debug-vertex-array.js +2 -2
- package/dist/esm/debug/debug-vertex-array.js.map +1 -1
- package/dist/esm/helpers/get-program-bindings.js +228 -0
- package/dist/esm/helpers/get-program-bindings.js.map +1 -0
- package/dist/esm/helpers/program-bindings.js +2 -0
- package/dist/esm/helpers/program-bindings.js.map +1 -0
- package/dist/esm/index.js +26 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/init.js +11 -8
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/types/accessor.d.ts +29 -0
- package/dist/esm/webgl-utils/attribute-utils.js +1 -1
- package/dist/esm/webgl-utils/attribute-utils.js.map +1 -1
- package/dist/esm/webgl-utils/constants-to-keys.js +1 -1
- package/dist/esm/webgl-utils/constants-to-keys.js.map +1 -1
- package/dist/esm/webgl-utils/format-utils.js +1 -1
- package/dist/esm/webgl-utils/format-utils.js.map +1 -1
- package/dist/esm/webgl-utils/texture-utils.js +2 -2
- package/dist/esm/webgl-utils/texture-utils.js.map +1 -1
- package/dist/esm/webgl-utils/typed-array-utils.js +22 -18
- package/dist/esm/webgl-utils/typed-array-utils.js.map +1 -1
- package/dist/helpers/get-program-bindings.d.ts +8 -0
- package/dist/helpers/get-program-bindings.d.ts.map +1 -0
- package/dist/helpers/get-program-bindings.js +228 -0
- package/dist/helpers/get-program-bindings.js.map +1 -0
- package/dist/helpers/program-bindings.d.ts +41 -0
- package/dist/helpers/program-bindings.d.ts.map +1 -0
- package/dist/helpers/program-bindings.js +2 -0
- package/dist/helpers/program-bindings.js.map +1 -0
- package/dist/index.d.ts +41 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -20
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +11 -8
- package/dist/init.js.map +1 -1
- package/dist/types/accessor.d.ts +29 -0
- package/dist/webgl-utils/attribute-utils.d.ts +1 -1
- package/dist/webgl-utils/attribute-utils.js +1 -1
- package/dist/webgl-utils/attribute-utils.js.map +1 -1
- package/dist/webgl-utils/constants-to-keys.js +1 -1
- package/dist/webgl-utils/constants-to-keys.js.map +1 -1
- package/dist/webgl-utils/format-utils.d.ts +2 -2
- package/dist/webgl-utils/format-utils.js +1 -1
- package/dist/webgl-utils/format-utils.js.map +1 -1
- package/dist/webgl-utils/texture-utils.d.ts +12 -8
- package/dist/webgl-utils/texture-utils.d.ts.map +1 -1
- package/dist/webgl-utils/texture-utils.js +2 -2
- package/dist/webgl-utils/texture-utils.js.map +1 -1
- package/dist/webgl-utils/typed-array-utils.d.ts +39 -32
- package/dist/webgl-utils/typed-array-utils.d.ts.map +1 -1
- package/dist/webgl-utils/typed-array-utils.js +22 -18
- package/dist/webgl-utils/typed-array-utils.js.map +1 -1
- package/package.json +5 -6
- package/src/.DS_Store +0 -0
- package/src/_deprecated/context-api.ts +146 -0
- package/src/_deprecated/features.ts +159 -0
- package/src/adapter/converters/set-device-parameters.ts +182 -0
- package/src/adapter/converters/webgpu-texture-formats.ts +167 -0
- package/src/adapter/device-helpers/device-features.ts +227 -0
- package/src/adapter/device-helpers/device-limits.ts +150 -0
- package/src/adapter/device-helpers/get-device-info.ts +49 -0
- package/src/{features/check-old-ie.ts → adapter/device-helpers/is-old-ie.ts} +3 -3
- package/src/adapter/webgl-device.ts +399 -0
- package/src/adapter/webgl-shader.ts +84 -0
- package/src/classes/accessor.js +2 -2
- package/src/classes/accessor.ts.disabled +1 -1
- package/src/classes/clear.ts +9 -4
- package/src/classes/copy-and-blit.ts +49 -52
- package/src/classes/framebuffer.ts +38 -35
- package/src/classes/program-configuration.ts +28 -81
- package/src/classes/program.ts +89 -75
- package/src/classes/query.ts +6 -6
- package/src/classes/renderbuffer-formats.ts +1 -1
- package/src/classes/renderbuffer.ts +5 -4
- package/src/classes/{webgl-shader.ts → shader.ts} +7 -78
- package/src/classes/texture-2d.ts +6 -11
- package/src/classes/texture-3d.ts +16 -11
- package/src/classes/texture-cube.ts +7 -7
- package/src/classes/texture-formats.ts +1 -1
- package/src/classes/texture.ts +39 -40
- package/src/classes/transform-feedback.ts +14 -13
- package/src/classes/uniform-buffer-layout.ts +1 -1
- package/src/classes/uniforms.ts +4 -10
- package/src/classes/vertex-array-object.ts +17 -20
- package/src/classes/vertex-array.ts +16 -11
- package/src/classes/webgl-buffer.ts +7 -5
- package/src/classes/webgl-resource.ts +20 -18
- package/src/context/context/context-state.ts +39 -0
- package/src/context/context/create-context.ts +83 -0
- package/src/context/context/device-pixels.ts +147 -0
- package/src/context/context/get-canvas.ts +37 -0
- package/src/context/context/resize-context.ts +37 -0
- package/src/context/context/webgl-checks.ts +49 -0
- package/src/context/parameters/unified-parameter-api.ts +128 -0
- package/src/context/parameters/webgl-parameter-tables.ts +625 -0
- package/src/context/parameters/webgl-parameters.ts +197 -0
- package/src/context/polyfill/get-parameter-polyfill.ts +118 -0
- package/src/context/polyfill/polyfill-context.ts +98 -0
- package/src/context/polyfill/polyfill-table.ts +162 -0
- package/src/context/polyfill/polyfill-vertex-array-object.ts +360 -0
- package/src/context/state-tracker/deep-array-equal.ts +20 -0
- package/src/context/state-tracker/track-context-state.ts +250 -0
- package/src/context/state-tracker/with-parameters.ts +50 -0
- package/src/debug/debug-uniforms.ts +1 -1
- package/src/debug/debug-vertex-array.ts +2 -4
- package/src/helpers/get-program-bindings.ts +244 -0
- package/src/helpers/program-bindings.ts +46 -0
- package/src/index.ts +94 -23
- package/src/init.ts +12 -9
- package/src/types/accessor.d.ts +29 -0
- package/src/types.ts +1 -1
- package/src/webgl-utils/attribute-utils.ts +1 -1
- package/src/webgl-utils/constants-to-keys.ts +1 -1
- package/src/webgl-utils/format-utils.ts +1 -1
- package/src/webgl-utils/{texture-utils.js → texture-utils.ts} +13 -10
- package/src/webgl-utils/{typed-array-utils.js → typed-array-utils.ts} +59 -16
- package/dist/classes/webgl-shader.d.ts.map +0 -1
- package/dist/classes/webgl-shader.js.map +0 -1
- package/dist/context/gl-context.d.ts +0 -15
- package/dist/context/gl-context.d.ts.map +0 -1
- package/dist/context/gl-context.js +0 -32
- package/dist/context/gl-context.js.map +0 -1
- package/dist/context/luma-context-data.d.ts +0 -31
- package/dist/context/luma-context-data.d.ts.map +0 -1
- package/dist/context/luma-context-data.js +0 -5
- package/dist/context/luma-context-data.js.map +0 -1
- package/dist/es5/classes/webgl-shader.js +0 -213
- package/dist/es5/classes/webgl-shader.js.map +0 -1
- package/dist/es5/context/gl-context.js +0 -46
- package/dist/es5/context/gl-context.js.map +0 -1
- package/dist/es5/context/luma-context-data.js +0 -12
- package/dist/es5/context/luma-context-data.js.map +0 -1
- package/dist/es5/features/check-glsl-extension.js +0 -40
- package/dist/es5/features/check-glsl-extension.js.map +0 -1
- package/dist/es5/features/check-old-ie.js +0 -15
- package/dist/es5/features/check-old-ie.js.map +0 -1
- package/dist/es5/features/features.js +0 -85
- package/dist/es5/features/features.js.map +0 -1
- package/dist/es5/features/index.js +0 -64
- package/dist/es5/features/index.js.map +0 -1
- package/dist/es5/features/limits.js +0 -72
- package/dist/es5/features/limits.js.map +0 -1
- package/dist/es5/features/webgl-features-table.js +0 -84
- package/dist/es5/features/webgl-features-table.js.map +0 -1
- package/dist/es5/features/webgl-limits-table.js +0 -172
- package/dist/es5/features/webgl-limits-table.js.map +0 -1
- package/dist/es5/utils/array-utils-flat.js +0 -50
- package/dist/es5/utils/array-utils-flat.js.map +0 -1
- package/dist/es5/utils/assert.js +0 -13
- package/dist/es5/utils/assert.js.map +0 -1
- package/dist/es5/utils/check-props.js +0 -50
- package/dist/es5/utils/check-props.js.map +0 -1
- package/dist/es5/utils/format-value.js +0 -57
- package/dist/es5/utils/format-value.js.map +0 -1
- package/dist/es5/utils/index.js +0 -68
- package/dist/es5/utils/index.js.map +0 -1
- package/dist/es5/utils/is-old-ie.js +0 -13
- package/dist/es5/utils/is-old-ie.js.map +0 -1
- package/dist/es5/utils/load-file.js +0 -43
- package/dist/es5/utils/load-file.js.map +0 -1
- package/dist/es5/utils/stub-methods.js +0 -25
- package/dist/es5/utils/stub-methods.js.map +0 -1
- package/dist/es5/utils/utils.js +0 -31
- package/dist/es5/utils/utils.js.map +0 -1
- package/dist/es5/webgl-utils/texture-utils.d.ts +0 -11
- package/dist/es5/webgl-utils/typed-array-utils.d.ts +0 -36
- package/dist/esm/classes/webgl-shader.js.map +0 -1
- package/dist/esm/context/gl-context.js +0 -32
- package/dist/esm/context/gl-context.js.map +0 -1
- package/dist/esm/context/luma-context-data.js +0 -5
- package/dist/esm/context/luma-context-data.js.map +0 -1
- package/dist/esm/features/check-glsl-extension.js +0 -27
- package/dist/esm/features/check-glsl-extension.js.map +0 -1
- package/dist/esm/features/check-old-ie.js.map +0 -1
- package/dist/esm/features/features.js +0 -67
- package/dist/esm/features/features.js.map +0 -1
- package/dist/esm/features/index.js +0 -5
- package/dist/esm/features/index.js.map +0 -1
- package/dist/esm/features/limits.js +0 -55
- package/dist/esm/features/limits.js.map +0 -1
- package/dist/esm/features/webgl-features-table.js +0 -71
- package/dist/esm/features/webgl-features-table.js.map +0 -1
- package/dist/esm/features/webgl-limits-table.js +0 -161
- package/dist/esm/features/webgl-limits-table.js.map +0 -1
- package/dist/esm/utils/array-utils-flat.js +0 -39
- package/dist/esm/utils/array-utils-flat.js.map +0 -1
- package/dist/esm/utils/assert.js +0 -6
- package/dist/esm/utils/assert.js.map +0 -1
- package/dist/esm/utils/check-props.js +0 -38
- package/dist/esm/utils/check-props.js.map +0 -1
- package/dist/esm/utils/format-value.js +0 -50
- package/dist/esm/utils/format-value.js.map +0 -1
- package/dist/esm/utils/index.js +0 -7
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/is-old-ie.js +0 -5
- package/dist/esm/utils/is-old-ie.js.map +0 -1
- package/dist/esm/utils/load-file.js +0 -30
- package/dist/esm/utils/load-file.js.map +0 -1
- package/dist/esm/utils/stub-methods.js +0 -16
- package/dist/esm/utils/stub-methods.js.map +0 -1
- package/dist/esm/utils/utils.js +0 -20
- package/dist/esm/utils/utils.js.map +0 -1
- package/dist/esm/webgl-utils/texture-utils.d.ts +0 -11
- package/dist/esm/webgl-utils/typed-array-utils.d.ts +0 -36
- package/dist/features/check-glsl-extension.d.ts +0 -2
- package/dist/features/check-glsl-extension.d.ts.map +0 -1
- package/dist/features/check-glsl-extension.js +0 -27
- package/dist/features/check-glsl-extension.js.map +0 -1
- package/dist/features/check-old-ie.d.ts +0 -2
- package/dist/features/check-old-ie.d.ts.map +0 -1
- package/dist/features/check-old-ie.js.map +0 -1
- package/dist/features/features.d.ts +0 -6
- package/dist/features/features.d.ts.map +0 -1
- package/dist/features/features.js +0 -67
- package/dist/features/features.js.map +0 -1
- package/dist/features/index.d.ts +0 -5
- package/dist/features/index.d.ts.map +0 -1
- package/dist/features/index.js +0 -5
- package/dist/features/index.js.map +0 -1
- package/dist/features/limits.d.ts +0 -28
- package/dist/features/limits.d.ts.map +0 -1
- package/dist/features/limits.js +0 -55
- package/dist/features/limits.js.map +0 -1
- package/dist/features/webgl-features-table.d.ts.map +0 -1
- package/dist/features/webgl-features-table.js +0 -71
- package/dist/features/webgl-features-table.js.map +0 -1
- package/dist/features/webgl-limits-table.d.ts +0 -161
- package/dist/features/webgl-limits-table.d.ts.map +0 -1
- package/dist/features/webgl-limits-table.js +0 -161
- package/dist/features/webgl-limits-table.js.map +0 -1
- package/dist/utils/array-utils-flat.d.ts +0 -9
- package/dist/utils/array-utils-flat.d.ts.map +0 -1
- package/dist/utils/array-utils-flat.js +0 -39
- package/dist/utils/array-utils-flat.js.map +0 -1
- package/dist/utils/assert.d.ts +0 -2
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/assert.js +0 -6
- package/dist/utils/assert.js.map +0 -1
- package/dist/utils/check-props.d.ts +0 -2
- package/dist/utils/check-props.d.ts.map +0 -1
- package/dist/utils/check-props.js +0 -38
- package/dist/utils/check-props.js.map +0 -1
- package/dist/utils/format-value.d.ts +0 -5
- package/dist/utils/format-value.d.ts.map +0 -1
- package/dist/utils/format-value.js +0 -50
- package/dist/utils/format-value.js.map +0 -1
- package/dist/utils/index.d.ts +0 -7
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -7
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/is-old-ie.d.ts +0 -4
- package/dist/utils/is-old-ie.d.ts.map +0 -1
- package/dist/utils/is-old-ie.js +0 -5
- package/dist/utils/is-old-ie.js.map +0 -1
- package/dist/utils/load-file.d.ts +0 -4
- package/dist/utils/load-file.d.ts.map +0 -1
- package/dist/utils/load-file.js +0 -30
- package/dist/utils/load-file.js.map +0 -1
- package/dist/utils/stub-methods.d.ts +0 -2
- package/dist/utils/stub-methods.d.ts.map +0 -1
- package/dist/utils/stub-methods.js +0 -16
- package/dist/utils/stub-methods.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -15
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js +0 -20
- package/dist/utils/utils.js.map +0 -1
- package/src/context/gl-context.ts +0 -31
- package/src/context/luma-context-data.ts +0 -27
- package/src/features/check-glsl-extension.ts +0 -34
- package/src/features/features.ts +0 -80
- package/src/features/index.ts +0 -5
- package/src/features/limits.ts +0 -66
- package/src/features/webgl-features-table.ts +0 -104
- package/src/features/webgl-limits-table.ts +0 -51
- package/src/utils/array-utils-flat.ts +0 -56
- package/src/utils/assert.ts +0 -7
- package/src/utils/check-props.ts +0 -68
- package/src/utils/format-value.ts +0 -37
- package/src/utils/index.ts +0 -6
- package/src/utils/is-old-ie.ts +0 -6
- package/src/utils/load-file.ts +0 -40
- package/src/utils/stub-methods.ts +0 -20
- package/src/utils/utils.ts +0 -35
- package/src/webgl-utils/texture-utils.d.ts +0 -11
- package/src/webgl-utils/typed-array-utils.d.ts +0 -36
|
@@ -5,61 +5,61 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "requestAnimationFrame", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function () {
|
|
8
|
+
get: function get() {
|
|
9
9
|
return _requestAnimationFrame.requestAnimationFrame;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "cancelAnimationFrame", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () {
|
|
14
|
+
get: function get() {
|
|
15
15
|
return _requestAnimationFrame.cancelAnimationFrame;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "getGLTypeFromTypedArray", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () {
|
|
20
|
+
get: function get() {
|
|
21
21
|
return _typedArrayUtils.getGLTypeFromTypedArray;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "getTypedArrayFromGLType", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () {
|
|
26
|
+
get: function get() {
|
|
27
27
|
return _typedArrayUtils.getTypedArrayFromGLType;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "flipRows", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () {
|
|
32
|
+
get: function get() {
|
|
33
33
|
return _typedArrayUtils.flipRows;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "scalePixels", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () {
|
|
38
|
+
get: function get() {
|
|
39
39
|
return _typedArrayUtils.scalePixels;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "getKeyValue", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () {
|
|
44
|
+
get: function get() {
|
|
45
45
|
return _constantsToKeys.getKeyValue;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "getKey", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () {
|
|
50
|
+
get: function get() {
|
|
51
51
|
return _constantsToKeys.getKey;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "getKeyType", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () {
|
|
56
|
+
get: function get() {
|
|
57
57
|
return _constantsToKeys.getKeyType;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "cloneTextureFrom", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () {
|
|
62
|
+
get: function get() {
|
|
63
63
|
return _textureUtils.cloneTextureFrom;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
@@ -1,42 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.parseShaderCompilerLog = parseShaderCompilerLog;
|
|
7
|
-
|
|
9
|
+
|
|
10
|
+
var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
|
|
11
|
+
|
|
12
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
+
|
|
18
|
+
var MESSAGE_TYPES = ['warning', 'error', 'info'];
|
|
8
19
|
|
|
9
20
|
function parseShaderCompilerLog(errLog) {
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
var lines = errLog.split(/\r?\n/);
|
|
22
|
+
var messages = [];
|
|
12
23
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
24
|
+
var _iterator = _createForOfIteratorHelper(lines),
|
|
25
|
+
_step;
|
|
17
26
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
try {
|
|
28
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
29
|
+
var line = _step.value;
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
if (line.length <= 1) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
var segments = line.split(':');
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
var _segments = (0, _toArray2.default)(segments),
|
|
38
|
+
messageType = _segments[0],
|
|
39
|
+
linePosition = _segments[1],
|
|
40
|
+
lineNumber = _segments[2],
|
|
41
|
+
rest = _segments.slice(3);
|
|
42
|
+
|
|
43
|
+
var lineNum = parseInt(lineNumber, 10);
|
|
44
|
+
|
|
45
|
+
if (isNaN(lineNum)) {
|
|
46
|
+
lineNum = 0;
|
|
47
|
+
}
|
|
31
48
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
var linePos = parseInt(linePosition, 10);
|
|
50
|
+
|
|
51
|
+
if (isNaN(linePos)) {
|
|
52
|
+
linePos = 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var lowerCaseType = messageType.toLowerCase();
|
|
56
|
+
var type = MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info';
|
|
57
|
+
messages.push({
|
|
58
|
+
message: rest.join(':').trim(),
|
|
59
|
+
type: type,
|
|
60
|
+
lineNum: lineNum,
|
|
61
|
+
linePos: linePos
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
} catch (err) {
|
|
65
|
+
_iterator.e(err);
|
|
66
|
+
} finally {
|
|
67
|
+
_iterator.f();
|
|
40
68
|
}
|
|
41
69
|
|
|
42
70
|
return messages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/webgl-utils/parse-shader-compiler-log.ts"],"names":["MESSAGE_TYPES","parseShaderCompilerLog","errLog","lines","split","messages","line","length","segments","messageType","linePosition","lineNumber","rest","lineNum","parseInt","isNaN","linePos","lowerCaseType","toLowerCase","type","includes","push","message","join","trim"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/webgl-utils/parse-shader-compiler-log.ts"],"names":["MESSAGE_TYPES","parseShaderCompilerLog","errLog","lines","split","messages","line","length","segments","messageType","linePosition","lineNumber","rest","lineNum","parseInt","isNaN","linePos","lowerCaseType","toLowerCase","type","includes","push","message","join","trim"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAMA,aAAa,GAAG,CAAC,SAAD,EAAY,OAAZ,EAAqB,MAArB,CAAtB;;AAOO,SAASC,sBAAT,CAAgCC,MAAhC,EAA6E;AAElF,MAAMC,KAAK,GAAGD,MAAM,CAACE,KAAP,CAAa,OAAb,CAAd;AAEA,MAAMC,QAA2B,GAAG,EAApC;;AAJkF,6CAM/DF,KAN+D;AAAA;;AAAA;AAMlF,wDAA0B;AAAA,UAAfG,IAAe;;AACxB,UAAIA,IAAI,CAACC,MAAL,IAAe,CAAnB,EAAsB;AACpB;AACD;;AAED,UAAMC,QAAkB,GAAGF,IAAI,CAACF,KAAL,CAAW,GAAX,CAA3B;;AACA,6CAAyDI,QAAzD;AAAA,UAAOC,WAAP;AAAA,UAAoBC,YAApB;AAAA,UAAkCC,UAAlC;AAAA,UAAiDC,IAAjD;;AAEA,UAAIC,OAAO,GAAGC,QAAQ,CAACH,UAAD,EAAa,EAAb,CAAtB;;AACA,UAAII,KAAK,CAACF,OAAD,CAAT,EAAoB;AAClBA,QAAAA,OAAO,GAAG,CAAV;AACD;;AAED,UAAIG,OAAO,GAAGF,QAAQ,CAACJ,YAAD,EAAe,EAAf,CAAtB;;AACA,UAAIK,KAAK,CAACC,OAAD,CAAT,EAAoB;AAClBA,QAAAA,OAAO,GAAG,CAAV;AACD;;AAGD,UAAMC,aAAa,GAAGR,WAAW,CAACS,WAAZ,EAAtB;AACA,UAAMC,IAAI,GAAInB,aAAa,CAACoB,QAAd,CAAuBH,aAAvB,IAAwCA,aAAxC,GAAwD,MAAtE;AAEAZ,MAAAA,QAAQ,CAACgB,IAAT,CAAc;AACZC,QAAAA,OAAO,EAAEV,IAAI,CAACW,IAAL,CAAU,GAAV,EAAeC,IAAf,EADG;AAEZL,QAAAA,IAAI,EAAJA,IAFY;AAGZN,QAAAA,OAAO,EAAPA,OAHY;AAIZG,QAAAA,OAAO,EAAPA;AAJY,OAAd;AAMD;AAlCiF;AAAA;AAAA;AAAA;AAAA;;AAoClF,SAAOX,QAAP;AACD","sourcesContent":["// luma.gl, MIT license\nimport type {CompilerMessage} from '@luma.gl/shadertools';\n\nconst MESSAGE_TYPES = ['warning', 'error', 'info'];\n\n/**\n * Parse a WebGL-format GLSL compilation log into an array of WebGPU style message records.\n * This follows documented WebGL conventions for compilation logs.\n * Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain)\n */\nexport function parseShaderCompilerLog(errLog: string) : readonly CompilerMessage[] {\n // Parse the error - note: browser and driver dependent\n const lines = errLog.split(/\\r?\\n/);\n\n const messages: CompilerMessage[] = [];\n\n for (const line of lines) {\n if (line.length <= 1) {\n continue;\n }\n\n const segments: string[] = line.split(':');\n const [messageType, linePosition, lineNumber, ...rest] = segments;\n\n let lineNum = parseInt(lineNumber, 10);\n if (isNaN(lineNum)) {\n lineNum = 0;\n }\n\n let linePos = parseInt(linePosition, 10);\n if (isNaN(linePos)) {\n linePos = 0;\n }\n\n // Ensure supported type\n const lowerCaseType = messageType.toLowerCase();\n const type = (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info') as 'warning' | 'error' | 'info';\n\n messages.push({\n message: rest.join(':').trim(),\n type,\n lineNum,\n linePos // TODO\n })\n }\n\n return messages;\n}\n"],"file":"parse-shader-compiler-log.js"}
|
|
@@ -8,6 +8,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.cloneTextureFrom = cloneTextureFrom;
|
|
9
9
|
exports.toFramebuffer = toFramebuffer;
|
|
10
10
|
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
var _api = require("@luma.gl/api");
|
|
14
|
+
|
|
15
|
+
var _constants = _interopRequireDefault(require("@luma.gl/constants"));
|
|
16
|
+
|
|
11
17
|
var _texture2d = _interopRequireDefault(require("../classes/texture-2d"));
|
|
12
18
|
|
|
13
19
|
var _textureCube = _interopRequireDefault(require("../classes/texture-cube"));
|
|
@@ -16,49 +22,39 @@ var _texture3d = _interopRequireDefault(require("../classes/texture-3d"));
|
|
|
16
22
|
|
|
17
23
|
var _framebuffer = _interopRequireDefault(require("../classes/framebuffer"));
|
|
18
24
|
|
|
19
|
-
var _constants = _interopRequireDefault(require("@luma.gl/constants"));
|
|
20
|
-
|
|
21
|
-
var _utils = require("../utils");
|
|
22
|
-
|
|
23
25
|
function cloneTextureFrom(refTexture, overrides) {
|
|
24
|
-
(0,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
border,
|
|
43
|
-
mipmaps
|
|
26
|
+
(0, _api.assert)(refTexture instanceof _texture2d.default || refTexture instanceof _textureCube.default || refTexture instanceof _texture3d.default);
|
|
27
|
+
var TextureType = refTexture.constructor;
|
|
28
|
+
var gl = refTexture.gl,
|
|
29
|
+
width = refTexture.width,
|
|
30
|
+
height = refTexture.height,
|
|
31
|
+
format = refTexture.format,
|
|
32
|
+
type = refTexture.type,
|
|
33
|
+
dataFormat = refTexture.dataFormat,
|
|
34
|
+
border = refTexture.border,
|
|
35
|
+
mipmaps = refTexture.mipmaps;
|
|
36
|
+
var textureOptions = Object.assign({
|
|
37
|
+
width: width,
|
|
38
|
+
height: height,
|
|
39
|
+
format: format,
|
|
40
|
+
type: type,
|
|
41
|
+
dataFormat: dataFormat,
|
|
42
|
+
border: border,
|
|
43
|
+
mipmaps: mipmaps
|
|
44
44
|
}, overrides);
|
|
45
45
|
return new TextureType(gl, textureOptions);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function toFramebuffer(texture, opts) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} = texture;
|
|
55
|
-
const framebuffer = new _framebuffer.default(gl, Object.assign({}, opts, {
|
|
49
|
+
var gl = texture.gl,
|
|
50
|
+
width = texture.width,
|
|
51
|
+
height = texture.height,
|
|
52
|
+
id = texture.id;
|
|
53
|
+
var framebuffer = new _framebuffer.default(gl, Object.assign({}, opts, {
|
|
56
54
|
id: "framebuffer-for-".concat(id),
|
|
57
|
-
width,
|
|
58
|
-
height,
|
|
59
|
-
attachments: {
|
|
60
|
-
[_constants.default.COLOR_ATTACHMENT0]: texture
|
|
61
|
-
}
|
|
55
|
+
width: width,
|
|
56
|
+
height: height,
|
|
57
|
+
attachments: (0, _defineProperty2.default)({}, _constants.default.COLOR_ATTACHMENT0, texture)
|
|
62
58
|
}));
|
|
63
59
|
return framebuffer;
|
|
64
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/webgl-utils/texture-utils.
|
|
1
|
+
{"version":3,"sources":["../../../src/webgl-utils/texture-utils.ts"],"names":["cloneTextureFrom","refTexture","overrides","Texture2D","TextureCube","Texture3D","TextureType","constructor","gl","width","height","format","type","dataFormat","border","mipmaps","textureOptions","Object","assign","toFramebuffer","texture","opts","id","framebuffer","Framebuffer","attachments","GL","COLOR_ATTACHMENT0"],"mappings":";;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAKO,SAASA,gBAAT,CAAiDC,UAAjD,EAAgEC,SAAhE,EAAoF;AACzF,mBACED,UAAU,YAAYE,kBAAtB,IACEF,UAAU,YAAYG,oBADxB,IAEEH,UAAU,YAAYI,kBAH1B;AAMA,MAAMC,WAAW,GAAGL,UAAU,CAACM,WAA/B;AAEA,MAAOC,EAAP,GAAuEP,UAAvE,CAAOO,EAAP;AAAA,MAAWC,KAAX,GAAuER,UAAvE,CAAWQ,KAAX;AAAA,MAAkBC,MAAlB,GAAuET,UAAvE,CAAkBS,MAAlB;AAAA,MAA0BC,MAA1B,GAAuEV,UAAvE,CAA0BU,MAA1B;AAAA,MAAkCC,IAAlC,GAAuEX,UAAvE,CAAkCW,IAAlC;AAAA,MAAwCC,UAAxC,GAAuEZ,UAAvE,CAAwCY,UAAxC;AAAA,MAAoDC,MAApD,GAAuEb,UAAvE,CAAoDa,MAApD;AAAA,MAA4DC,OAA5D,GAAuEd,UAAvE,CAA4Dc,OAA5D;AAEA,MAAMC,cAAc,GAAGC,MAAM,CAACC,MAAP,CACrB;AACET,IAAAA,KAAK,EAALA,KADF;AAEEC,IAAAA,MAAM,EAANA,MAFF;AAGEC,IAAAA,MAAM,EAANA,MAHF;AAIEC,IAAAA,IAAI,EAAJA,IAJF;AAKEC,IAAAA,UAAU,EAAVA,UALF;AAMEC,IAAAA,MAAM,EAANA,MANF;AAOEC,IAAAA,OAAO,EAAPA;AAPF,GADqB,EAUrBb,SAVqB,CAAvB;AAeA,SAAO,IAAII,WAAJ,CAAgBE,EAAhB,EAAoBQ,cAApB,CAAP;AACD;;AAMM,SAASG,aAAT,CAAuBC,OAAvB,EAAyCC,IAAzC,EAA+E;AACpF,MAAOb,EAAP,GAAgCY,OAAhC,CAAOZ,EAAP;AAAA,MAAWC,KAAX,GAAgCW,OAAhC,CAAWX,KAAX;AAAA,MAAkBC,MAAlB,GAAgCU,OAAhC,CAAkBV,MAAlB;AAAA,MAA0BY,EAA1B,GAAgCF,OAAhC,CAA0BE,EAA1B;AACA,MAAMC,WAAW,GAAG,IAAIC,oBAAJ,CAClBhB,EADkB,EAElBS,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBG,IAAlB,EAAwB;AACtBC,IAAAA,EAAE,4BAAqBA,EAArB,CADoB;AAEtBb,IAAAA,KAAK,EAALA,KAFsB;AAGtBC,IAAAA,MAAM,EAANA,MAHsB;AAItBe,IAAAA,WAAW,oCACRC,mBAAGC,iBADK,EACeP,OADf;AAJW,GAAxB,CAFkB,CAApB;AAWA,SAAOG,WAAP;AACD","sourcesContent":["// TODO: Two subdirectories must not depend on each other (classes vs utils)!\nimport {assert} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport Texture from '../classes/texture';\nimport Texture2D from '../classes/texture-2d';\nimport TextureCube from '../classes/texture-cube';\nimport Texture3D from '../classes/texture-3d';\nimport Framebuffer, {FramebufferProps} from '../classes/framebuffer';\n\ntype TextureType = Texture2D | TextureCube | Texture3D;\n\n/** Clone a new texture object from a reference texture object. */\nexport function cloneTextureFrom<T extends TextureType>(refTexture: T, overrides?: any): T {\n assert(\n refTexture instanceof Texture2D ||\n refTexture instanceof TextureCube ||\n refTexture instanceof Texture3D\n );\n\n const TextureType = refTexture.constructor;\n\n const {gl, width, height, format, type, dataFormat, border, mipmaps} = refTexture;\n\n const textureOptions = Object.assign(\n {\n width,\n height,\n format,\n type,\n dataFormat,\n border,\n mipmaps\n },\n overrides\n );\n\n // TODO: move this to `Texture` class as instance method and use this.constructor\n // @ts-expect-error\n return new TextureType(gl, textureOptions);\n}\n\n/**\n * Wraps a given texture into a framebuffer object, that can be further used\n * to read data from the texture object.\n */ \nexport function toFramebuffer(texture: Texture, opts?: FramebufferProps): Framebuffer {\n const {gl, width, height, id} = texture;\n const framebuffer = new Framebuffer(\n gl,\n Object.assign({}, opts, {\n id: `framebuffer-for-${id}`,\n width,\n height,\n attachments: {\n [GL.COLOR_ATTACHMENT0]: texture\n }\n })\n );\n return framebuffer;\n}\n"],"file":"texture-utils.js"}
|
|
@@ -12,10 +12,10 @@ exports.scalePixels = scalePixels;
|
|
|
12
12
|
|
|
13
13
|
var _constants = _interopRequireDefault(require("@luma.gl/constants"));
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
var ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';
|
|
16
16
|
|
|
17
17
|
function getGLTypeFromTypedArray(arrayOrType) {
|
|
18
|
-
|
|
18
|
+
var type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
|
|
19
19
|
|
|
20
20
|
switch (type) {
|
|
21
21
|
case Float32Array:
|
|
@@ -47,9 +47,11 @@ function getGLTypeFromTypedArray(arrayOrType) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function getTypedArrayFromGLType(glType, {
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
function getTypedArrayFromGLType(glType, options) {
|
|
51
|
+
var _ref = options || {},
|
|
52
|
+
_ref$clamped = _ref.clamped,
|
|
53
|
+
clamped = _ref$clamped === void 0 ? true : _ref$clamped;
|
|
54
|
+
|
|
53
55
|
switch (glType) {
|
|
54
56
|
case _constants.default.FLOAT:
|
|
55
57
|
return Float32Array;
|
|
@@ -80,37 +82,36 @@ function getTypedArrayFromGLType(glType, {
|
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
function flipRows({
|
|
84
|
-
data,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
for (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
function flipRows(options) {
|
|
86
|
+
var data = options.data,
|
|
87
|
+
width = options.width,
|
|
88
|
+
height = options.height,
|
|
89
|
+
_options$bytesPerPixe = options.bytesPerPixel,
|
|
90
|
+
bytesPerPixel = _options$bytesPerPixe === void 0 ? 4 : _options$bytesPerPixe,
|
|
91
|
+
temp = options.temp;
|
|
92
|
+
var bytesPerRow = width * bytesPerPixel;
|
|
93
|
+
var tempBuffer = temp || new Uint8Array(bytesPerRow);
|
|
94
|
+
|
|
95
|
+
for (var y = 0; y < height / 2; ++y) {
|
|
96
|
+
var topOffset = y * bytesPerRow;
|
|
97
|
+
var bottomOffset = (height - y - 1) * bytesPerRow;
|
|
98
|
+
tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));
|
|
97
99
|
data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);
|
|
98
|
-
data.set(
|
|
100
|
+
data.set(tempBuffer, bottomOffset);
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
function scalePixels({
|
|
103
|
-
data,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
for (let c = 0; c < 4; c++) {
|
|
104
|
+
function scalePixels(options) {
|
|
105
|
+
var data = options.data,
|
|
106
|
+
width = options.width,
|
|
107
|
+
height = options.height;
|
|
108
|
+
var newWidth = Math.round(width / 2);
|
|
109
|
+
var newHeight = Math.round(height / 2);
|
|
110
|
+
var newData = new Uint8Array(newWidth * newHeight * 4);
|
|
111
|
+
|
|
112
|
+
for (var y = 0; y < newHeight; y++) {
|
|
113
|
+
for (var x = 0; x < newWidth; x++) {
|
|
114
|
+
for (var c = 0; c < 4; c++) {
|
|
114
115
|
newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];
|
|
115
116
|
}
|
|
116
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/webgl-utils/typed-array-utils.
|
|
1
|
+
{"version":3,"sources":["../../../src/webgl-utils/typed-array-utils.ts"],"names":["ERR_TYPE_DEDUCTION","getGLTypeFromTypedArray","arrayOrType","type","ArrayBuffer","isView","constructor","Float32Array","GL","FLOAT","Uint16Array","UNSIGNED_SHORT","Uint32Array","UNSIGNED_INT","Uint8Array","UNSIGNED_BYTE","Uint8ClampedArray","Int8Array","BYTE","Int16Array","SHORT","Int32Array","INT","Error","getTypedArrayFromGLType","glType","options","clamped","UNSIGNED_SHORT_5_6_5","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","flipRows","data","width","height","bytesPerPixel","temp","bytesPerRow","tempBuffer","y","topOffset","bottomOffset","set","subarray","copyWithin","scalePixels","newWidth","Math","round","newHeight","newData","x","c"],"mappings":"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","sourcesContent":["import GL from '@luma.gl/constants';\n\nconst ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array';\n\ntype TypedArrayConstructor =\n | Float32ArrayConstructor\n | Uint16ArrayConstructor\n | Uint32ArrayConstructor\n | Uint8ArrayConstructor\n | Uint8ClampedArrayConstructor\n | Int8ArrayConstructor\n | Int16ArrayConstructor\n | Int32ArrayConstructor;\n\n/**\n * Converts TYPED ARRAYS to corresponding GL constant\n * Used to auto deduce gl parameter types\n * @param {*} arrayOrType\n * @returns\n */\nexport function getGLTypeFromTypedArray(arrayOrType) {\n // If typed array, look up constructor\n const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;\n switch (type) {\n case Float32Array:\n return GL.FLOAT;\n case Uint16Array:\n return GL.UNSIGNED_SHORT;\n case Uint32Array:\n return GL.UNSIGNED_INT;\n case Uint8Array:\n return GL.UNSIGNED_BYTE;\n case Uint8ClampedArray:\n return GL.UNSIGNED_BYTE;\n case Int8Array:\n return GL.BYTE;\n case Int16Array:\n return GL.SHORT;\n case Int32Array:\n return GL.INT;\n default:\n throw new Error(ERR_TYPE_DEDUCTION);\n }\n}\n\n/**\n * Converts GL constant to corresponding TYPED ARRAY\n * Used to auto deduce gl parameter types\n * @param {*} glType\n * @param {*} param1\n * @returns\n */\n// eslint-disable-next-line complexity\nexport function getTypedArrayFromGLType(\n glType: any,\n options?: {\n clamped?: boolean;\n }\n): TypedArrayConstructor {\n const {clamped = true} = options || {};\n // Sorted in some order of likelihood to reduce amount of comparisons\n switch (glType) {\n case GL.FLOAT:\n return Float32Array;\n case GL.UNSIGNED_SHORT:\n case GL.UNSIGNED_SHORT_5_6_5:\n case GL.UNSIGNED_SHORT_4_4_4_4:\n case GL.UNSIGNED_SHORT_5_5_5_1:\n return Uint16Array;\n case GL.UNSIGNED_INT:\n return Uint32Array;\n case GL.UNSIGNED_BYTE:\n return clamped ? Uint8ClampedArray : Uint8Array;\n case GL.BYTE:\n return Int8Array;\n case GL.SHORT:\n return Int16Array;\n case GL.INT:\n return Int32Array;\n default:\n throw new Error('Failed to deduce typed array type from GL constant');\n }\n}\n\n/**\n * Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)\n * https: *stackoverflow.com/questions/41969562/\n * how-can-i-flip-the-result-of-webglrenderingcontext-readpixels\n * @param {*} param0\n */\n export function flipRows(options: {\n data: any;\n width: any;\n height: any;\n bytesPerPixel?: number;\n temp?: any;\n}): void {\n const {data, width, height, bytesPerPixel = 4, temp} = options;\n const bytesPerRow = width * bytesPerPixel;\n\n // make a temp buffer to hold one row\n const tempBuffer = temp || new Uint8Array(bytesPerRow);\n for (let y = 0; y < height / 2; ++y) {\n const topOffset = y * bytesPerRow;\n const bottomOffset = (height - y - 1) * bytesPerRow;\n // make copy of a row on the top half\n tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));\n // copy a row from the bottom half to the top\n data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);\n // copy the copy of the top half row to the bottom half\n data.set(tempBuffer, bottomOffset);\n }\n}\n\n\nexport function scalePixels(options: {\n data: any;\n width: any;\n height: any;\n}): {\n data: Uint8Array;\n width: number;\n height: number;\n} {\n const {data, width, height} = options;\n const newWidth = Math.round(width / 2);\n const newHeight = Math.round(height / 2);\n const newData = new Uint8Array(newWidth * newHeight * 4);\n for (let y = 0; y < newHeight; y++) {\n for (let x = 0; x < newWidth; x++) {\n for (let c = 0; c < 4; c++) {\n newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];\n }\n }\n }\n return {data: newData, width: newWidth, height: newHeight};\n}\n"],"file":"typed-array-utils.js"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import GL from '@luma.gl/constants';
|
|
2
|
+
import { WebGLDevice } from '@luma.gl/webgl';
|
|
3
|
+
import { DEPRECATED_FEATURES } from './features';
|
|
4
|
+
export function createGLContext(options) {
|
|
5
|
+
const webglDevice = new WebGLDevice(options);
|
|
6
|
+
return webglDevice.gl;
|
|
7
|
+
}
|
|
8
|
+
export function instrumentGLContext(gl, options) {
|
|
9
|
+
const webglDevice = WebGLDevice.attach(gl, options);
|
|
10
|
+
return webglDevice.gl;
|
|
11
|
+
}
|
|
12
|
+
export function resizeGLContext(gl, options) {
|
|
13
|
+
const webglDevice = WebGLDevice.attach(gl);
|
|
14
|
+
webglDevice.resize(options);
|
|
15
|
+
}
|
|
16
|
+
export function hasFeatures(gl, features) {
|
|
17
|
+
const webglDevice = WebGLDevice.attach(gl);
|
|
18
|
+
const normalizedFeatures = Array.isArray(features) ? features : [features];
|
|
19
|
+
const deviceFeatures = normalizedFeatures.map(feature => classicToDeviceFeature(feature));
|
|
20
|
+
return deviceFeatures.every(feature => webglDevice.features.has(feature));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function classicToDeviceFeature(feature) {
|
|
24
|
+
const deviceFeature = feature.toLowerCase().replace(/\_/g, '-');
|
|
25
|
+
|
|
26
|
+
if (deviceFeature.startsWith('webgl2') || deviceFeature.startsWith('glsl-')) {
|
|
27
|
+
return deviceFeature;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return "webgl-".concat(deviceFeature);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function hasFeature(gl, feature) {
|
|
34
|
+
return hasFeatures(gl, feature);
|
|
35
|
+
}
|
|
36
|
+
export function getFeatures(gl) {
|
|
37
|
+
const webglDevice = WebGLDevice.attach(gl);
|
|
38
|
+
const featureMap = {};
|
|
39
|
+
|
|
40
|
+
for (const feature in DEPRECATED_FEATURES) {
|
|
41
|
+
featureMap[feature] = webglDevice.features.has(classicToDeviceFeature(feature));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return featureMap;
|
|
45
|
+
}
|
|
46
|
+
export function getContextDebugInfo(gl) {
|
|
47
|
+
const webglDevice = WebGLDevice.attach(gl);
|
|
48
|
+
const info = webglDevice.info;
|
|
49
|
+
return { ...webglDevice.info,
|
|
50
|
+
vendorMasked: webglDevice.info.vendor,
|
|
51
|
+
rendererMasked: webglDevice.info.renderer
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function getGLContextInfo(gl) {
|
|
55
|
+
const info = getContextDebugInfo(gl);
|
|
56
|
+
return {
|
|
57
|
+
[GL.UNMASKED_VENDOR_WEBGL]: info.vendor,
|
|
58
|
+
[GL.UNMASKED_RENDERER_WEBGL]: info.renderer,
|
|
59
|
+
[GL.VENDOR]: info.vendorMasked,
|
|
60
|
+
[GL.RENDERER]: info.rendererMasked,
|
|
61
|
+
[GL.VERSION]: info.version
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function getContextInfo(gl) {
|
|
65
|
+
return { ...getContextDebugInfo(gl),
|
|
66
|
+
...getContextLimits(gl),
|
|
67
|
+
info: getGLContextInfo(gl)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function getContextLimits(gl) {
|
|
71
|
+
const webglDevice = WebGLDevice.attach(gl);
|
|
72
|
+
return {
|
|
73
|
+
limits: webglDevice.webglLimits
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=context-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/_deprecated/context-api.ts"],"names":["GL","WebGLDevice","DEPRECATED_FEATURES","createGLContext","options","webglDevice","gl","instrumentGLContext","attach","resizeGLContext","resize","hasFeatures","features","normalizedFeatures","Array","isArray","deviceFeatures","map","feature","classicToDeviceFeature","every","has","deviceFeature","toLowerCase","replace","startsWith","hasFeature","getFeatures","featureMap","getContextDebugInfo","info","vendorMasked","vendor","rendererMasked","renderer","getGLContextInfo","UNMASKED_VENDOR_WEBGL","UNMASKED_RENDERER_WEBGL","VENDOR","RENDERER","VERSION","version","getContextInfo","getContextLimits","limits","webglLimits"],"mappings":"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","sourcesContent":["// luma.gl, MIT license\n// LEGACY luma.gl v8 API for WebGLRendering context\n// DEPRECATED API - may be removed in luma.gl v9 or v10.\n\n/* eslint-disable quotes */\nimport GL from '@luma.gl/constants';\nimport {WebGLDevice, WebGLDeviceProps} from '@luma.gl/webgl';\nimport {DEPRECATED_FEATURES} from './features';\n\nexport type GLContextOptions = WebGLDeviceProps & {\n throwOnError?: boolean; // If set to false, return `null` if context creation fails.\n};\n\n/** @deprecated Use `new WebGLDevice()` or `luma.createDevice()` */\nexport function createGLContext(options?: GLContextOptions): WebGLRenderingContext | null {\n const webglDevice = new WebGLDevice(options);\n // Note: OK to return the context, it holds on to the device\n return webglDevice.gl;\n}\n\n/** @deprecated Use `WebGLDevice.attach()` */\nexport function instrumentGLContext(\n gl: WebGLRenderingContext | WebGL2RenderingContext,\n options?: GLContextOptions\n): WebGLRenderingContext {\n const webglDevice = WebGLDevice.attach(gl, options);\n return webglDevice.gl;\n}\n\n/**\n * Resize the canvas' drawing buffer.\n *\n * Can match the canvas CSS size, and optionally also consider devicePixelRatio\n * Can be called every frame\n *\n * Regardless of size, the drawing buffer will always be scaled to the viewport, but\n * for best visual results, usually set to either:\n * canvas CSS width x canvas CSS height\n * canvas CSS width * devicePixelRatio x canvas CSS height * devicePixelRatio\n * See http://webgl2fundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html\n *\n * resizeGLContext(gl, {width, height, useDevicePixels})\n * @deprecated Use WebGLDevice.resize()\n */\nexport function resizeGLContext(\n gl: WebGLRenderingContext,\n options?: {\n width?: number;\n height?: number;\n useDevicePixels?: boolean | number;\n }\n) {\n const webglDevice = WebGLDevice.attach(gl);\n webglDevice.resize(options);\n}\n\n/** \n * Check one or more features\n * @deprecated Use `WebGLDevice.features.has()`\n*/\nexport function hasFeatures(gl: WebGLRenderingContext, features: string | string[]): boolean {\n const webglDevice = WebGLDevice.attach(gl);\n const normalizedFeatures = Array.isArray(features) ? features : [features];\n const deviceFeatures = normalizedFeatures.map(feature => classicToDeviceFeature(feature));\n // @ts-expect-error Feature is a string enum\n return deviceFeatures.every((feature) => webglDevice.features.has(feature));\n}\n\nfunction classicToDeviceFeature(feature: string): string {\n const deviceFeature = feature.toLowerCase().replace(/\\_/g, '-');\n if (deviceFeature.startsWith('webgl2') || deviceFeature.startsWith('glsl-')) {\n return deviceFeature;\n }\n return `webgl-${deviceFeature}`;\n}\n\n/**\n * Check one feature\n * @deprecated Use `WebGLDevice.features`\n */\nexport function hasFeature(gl: WebGLRenderingContext, feature: string): boolean {\n return hasFeatures(gl, feature);\n}\n\n/**\n * Return a map of supported features\n * @deprecated Use `WebGLDevice.features`\n */\nexport function getFeatures(gl: WebGLRenderingContext): Record<string, boolean> {\n const webglDevice = WebGLDevice.attach(gl);\n const featureMap: Record<string, boolean> = {};\n for (const feature in DEPRECATED_FEATURES) {\n // @ts-expect-error Feature is a string enum\n featureMap[feature] = webglDevice.features.has(classicToDeviceFeature(feature));\n }\n return featureMap;\n}\n\n/**\n * Provides strings identifying the GPU vendor and driver.\n * https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/\n *\n * @deprecated Use `WebGLDevice.info`\n */\nexport function getContextDebugInfo(gl: WebGLRenderingContext): {\n vendor: string;\n renderer: string;\n vendorMasked: string;\n rendererMasked: string;\n version: string;\n} {\n const webglDevice = WebGLDevice.attach(gl);\n const info = webglDevice.info;\n return {\n ...webglDevice.info,\n vendorMasked: webglDevice.info.vendor,\n rendererMasked: webglDevice.info.renderer\n };\n}\n\n/** @deprecated Use `WebGLDevice.info` */\nexport function getGLContextInfo(gl) {\n const info = getContextDebugInfo(gl);\n return {\n [GL.UNMASKED_VENDOR_WEBGL]: info.vendor,\n [GL.UNMASKED_RENDERER_WEBGL]: info.renderer,\n [GL.VENDOR]: info.vendorMasked,\n [GL.RENDERER]: info.rendererMasked,\n [GL.VERSION]: info.version,\n };\n}\n\n/** @deprecated Use `WebGLDevice.info` and `WebGLDevice.limits` */\nexport function getContextInfo(gl) {\n return {\n ...getContextDebugInfo(gl),\n ...getContextLimits(gl),\n info: getGLContextInfo(gl),\n };\n}\n\n/** @deprecated Use `WebGLDevice.limits` */\nexport function getContextLimits(gl) {\n const webglDevice = WebGLDevice.attach(gl);\n return {limits: webglDevice.webglLimits};\n}\n"],"file":"context-api.js"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import GL from '@luma.gl/constants';
|
|
2
|
+
import { isWebGL2 } from '@luma.gl/webgl';
|
|
3
|
+
import { assert } from '@luma.gl/api';
|
|
4
|
+
export const DEPRECATED_FEATURES = {
|
|
5
|
+
WEBGL2: 'WEBGL2',
|
|
6
|
+
VERTEX_ARRAY_OBJECT: 'VERTEX_ARRAY_OBJECT',
|
|
7
|
+
TIMER_QUERY: 'TIMER_QUERY',
|
|
8
|
+
INSTANCED_RENDERING: 'INSTANCED_RENDERING',
|
|
9
|
+
MULTIPLE_RENDER_TARGETS: 'MULTIPLE_RENDER_TARGETS',
|
|
10
|
+
ELEMENT_INDEX_UINT32: 'ELEMENT_INDEX_UINT32',
|
|
11
|
+
BLEND_EQUATION_MINMAX: 'BLEND_EQUATION_MINMAX',
|
|
12
|
+
FLOAT_BLEND: 'FLOAT_BLEND',
|
|
13
|
+
COLOR_ENCODING_SRGB: 'COLOR_ENCODING_SRGB',
|
|
14
|
+
TEXTURE_DEPTH: 'TEXTURE_DEPTH',
|
|
15
|
+
TEXTURE_FLOAT: 'TEXTURE_FLOAT',
|
|
16
|
+
TEXTURE_HALF_FLOAT: 'TEXTURE_HALF_FLOAT',
|
|
17
|
+
TEXTURE_FILTER_LINEAR_FLOAT: 'TEXTURE_FILTER_LINEAR_FLOAT',
|
|
18
|
+
TEXTURE_FILTER_LINEAR_HALF_FLOAT: 'TEXTURE_FILTER_LINEAR_HALF_FLOAT',
|
|
19
|
+
TEXTURE_FILTER_ANISOTROPIC: 'TEXTURE_FILTER_ANISOTROPIC',
|
|
20
|
+
COLOR_ATTACHMENT_RGBA32F: 'COLOR_ATTACHMENT_RGBA32F',
|
|
21
|
+
COLOR_ATTACHMENT_FLOAT: 'COLOR_ATTACHMENT_FLOAT',
|
|
22
|
+
COLOR_ATTACHMENT_HALF_FLOAT: 'COLOR_ATTACHMENT_HALF_FLOAT',
|
|
23
|
+
GLSL_FRAG_DATA: 'GLSL_FRAG_DATA',
|
|
24
|
+
GLSL_FRAG_DEPTH: 'GLSL_FRAG_DEPTH',
|
|
25
|
+
GLSL_DERIVATIVES: 'GLSL_DERIVATIVES',
|
|
26
|
+
GLSL_TEXTURE_LOD: 'GLSL_TEXTURE_LOD'
|
|
27
|
+
};
|
|
28
|
+
export function getWebGLFeatures(gl) {
|
|
29
|
+
gl.getExtension('EXT_color_buffer_float');
|
|
30
|
+
gl.getExtension('WEBGL_color_buffer_float');
|
|
31
|
+
gl.getExtension('EXT_float_blend');
|
|
32
|
+
const features = new Set();
|
|
33
|
+
|
|
34
|
+
for (const feature in WEBGL_FEATURES) {
|
|
35
|
+
if (isFeatureSupported(gl, feature)) {
|
|
36
|
+
features.add(feature);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return features;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function isFeatureSupported(gl, cap) {
|
|
44
|
+
const feature = WEBGL_FEATURES[cap];
|
|
45
|
+
assert(feature, cap);
|
|
46
|
+
const [webgl1Feature, webgl2Feature] = feature;
|
|
47
|
+
const featureDefinition = isWebGL2(gl) ? webgl2Feature : webgl1Feature;
|
|
48
|
+
|
|
49
|
+
if (cap === DEPRECATED_FEATURES.COLOR_ATTACHMENT_RGBA32F && !isWebGL2(gl)) {
|
|
50
|
+
return checkFloat32ColorAttachment(gl);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (typeof featureDefinition === 'string') {
|
|
54
|
+
return Boolean(gl.getExtension(featureDefinition));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return featureDefinition;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function checkFloat32ColorAttachment(gl) {
|
|
61
|
+
let texture;
|
|
62
|
+
let framebuffer;
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const texture = gl.createTexture();
|
|
66
|
+
gl.bindTexture(GL.TEXTURE_2D, texture);
|
|
67
|
+
const level = 0;
|
|
68
|
+
const internalFormat = gl.RGBA;
|
|
69
|
+
const width = 1;
|
|
70
|
+
const height = 1;
|
|
71
|
+
const border = 0;
|
|
72
|
+
const srcFormat = gl.RGBA;
|
|
73
|
+
const srcType = gl.UNSIGNED_BYTE;
|
|
74
|
+
const pixel = new Uint8Array([0, 0, 255, 255]);
|
|
75
|
+
gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, width, height, border, srcFormat, srcType, pixel);
|
|
76
|
+
const framebuffer = gl.createFramebuffer();
|
|
77
|
+
gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer);
|
|
78
|
+
gl.framebufferTexture2D(GL.FRAMEBUFFER, GL.COLOR_ATTACHMENT0, GL.TEXTURE_2D, texture, 0);
|
|
79
|
+
const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER) === GL.FRAMEBUFFER_COMPLETE;
|
|
80
|
+
return status;
|
|
81
|
+
} finally {
|
|
82
|
+
gl.deleteTexture(texture);
|
|
83
|
+
gl.deleteFramebuffer(framebuffer);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const WEBGL_FEATURES = {
|
|
88
|
+
[DEPRECATED_FEATURES.WEBGL2]: [false, true],
|
|
89
|
+
[DEPRECATED_FEATURES.VERTEX_ARRAY_OBJECT]: ['OES_vertex_array_object', true],
|
|
90
|
+
[DEPRECATED_FEATURES.TIMER_QUERY]: ['EXT_disjoint_timer_query', 'EXT_disjoint_timer_query_webgl2'],
|
|
91
|
+
[DEPRECATED_FEATURES.INSTANCED_RENDERING]: ['ANGLE_instanced_arrays', true],
|
|
92
|
+
[DEPRECATED_FEATURES.MULTIPLE_RENDER_TARGETS]: ['WEBGL_draw_buffers', true],
|
|
93
|
+
[DEPRECATED_FEATURES.ELEMENT_INDEX_UINT32]: ['OES_element_index_uint', true],
|
|
94
|
+
[DEPRECATED_FEATURES.BLEND_EQUATION_MINMAX]: ['EXT_blend_minmax', true],
|
|
95
|
+
[DEPRECATED_FEATURES.FLOAT_BLEND]: ['EXT_float_blend', 'EXT_float_blend'],
|
|
96
|
+
[DEPRECATED_FEATURES.COLOR_ENCODING_SRGB]: ['EXT_sRGB', true],
|
|
97
|
+
[DEPRECATED_FEATURES.TEXTURE_DEPTH]: ['WEBGL_depth_texture', true],
|
|
98
|
+
[DEPRECATED_FEATURES.TEXTURE_FLOAT]: ['OES_texture_float', true],
|
|
99
|
+
[DEPRECATED_FEATURES.TEXTURE_HALF_FLOAT]: ['OES_texture_half_float', true],
|
|
100
|
+
[DEPRECATED_FEATURES.TEXTURE_FILTER_LINEAR_FLOAT]: ['OES_texture_float_linear', 'OES_texture_float_linear'],
|
|
101
|
+
[DEPRECATED_FEATURES.TEXTURE_FILTER_LINEAR_HALF_FLOAT]: ['OES_texture_half_float_linear', 'OES_texture_half_float_linear'],
|
|
102
|
+
[DEPRECATED_FEATURES.TEXTURE_FILTER_ANISOTROPIC]: ['EXT_texture_filter_anisotropic', 'EXT_texture_filter_anisotropic'],
|
|
103
|
+
[DEPRECATED_FEATURES.COLOR_ATTACHMENT_RGBA32F]: [false, 'EXT_color_buffer_float'],
|
|
104
|
+
[DEPRECATED_FEATURES.COLOR_ATTACHMENT_FLOAT]: [false, 'EXT_color_buffer_float'],
|
|
105
|
+
[DEPRECATED_FEATURES.COLOR_ATTACHMENT_HALF_FLOAT]: ['EXT_color_buffer_half_float', 'EXT_color_buffer_half_float'],
|
|
106
|
+
[DEPRECATED_FEATURES.GLSL_FRAG_DATA]: ['WEBGL_draw_buffers', true],
|
|
107
|
+
[DEPRECATED_FEATURES.GLSL_FRAG_DEPTH]: ['EXT_frag_depth', true],
|
|
108
|
+
[DEPRECATED_FEATURES.GLSL_DERIVATIVES]: ['OES_standard_derivatives', true],
|
|
109
|
+
[DEPRECATED_FEATURES.GLSL_TEXTURE_LOD]: ['EXT_shader_texture_lod', true]
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=features.js.map
|