@luma.gl/webgl 9.0.0-alpha.15 → 9.0.0-alpha.16
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.js +199 -136
- package/dist/adapter/converters/renderbuffer-formats.d.ts +1 -1
- package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.js +62 -176
- package/dist/adapter/converters/sampler-parameters.js +149 -206
- package/dist/adapter/converters/texture-formats.d.ts +2 -2
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +437 -890
- package/dist/adapter/converters/vertex-formats.js +15 -33
- package/dist/adapter/device-helpers/device-features.js +119 -100
- package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +88 -86
- package/dist/adapter/device-helpers/get-device-info.js +42 -43
- package/dist/adapter/device-helpers/is-old-ie.js +9 -6
- package/dist/adapter/helpers/attribute-utils.js +50 -74
- 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 +27 -0
- package/dist/adapter/helpers/get-shader-layout.js +307 -296
- 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 +32 -33
- package/dist/adapter/helpers/set-uniform.js +67 -110
- package/dist/adapter/helpers/uniforms.js +80 -85
- package/dist/adapter/objects/constants-to-keys.js +33 -33
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +67 -86
- package/dist/adapter/objects/webgl-resource.js +213 -205
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +74 -76
- package/dist/adapter/resources/webgl-buffer.js +150 -147
- package/dist/adapter/resources/webgl-command-buffer.d.ts +5 -5
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +39 -55
- package/dist/adapter/resources/webgl-command-encoder.js +25 -49
- package/dist/adapter/resources/webgl-external-texture.js +91 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +231 -258
- package/dist/adapter/resources/webgl-render-pass.d.ts +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +8 -18
- package/dist/adapter/resources/webgl-render-pipeline.js +316 -378
- package/dist/adapter/resources/webgl-sampler.js +42 -47
- package/dist/adapter/resources/webgl-shader.d.ts +1 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +58 -68
- package/dist/adapter/resources/webgl-texture.d.ts +5 -5
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +661 -815
- package/dist/adapter/webgl-canvas-context.js +55 -49
- package/dist/adapter/webgl-device.js +288 -338
- package/dist/bundle.js +1 -2
- package/dist/classic/accessor.js +120 -127
- package/dist/classic/buffer.d.ts +1 -1
- package/dist/classic/buffer.d.ts.map +1 -1
- package/dist/classic/buffer.js +325 -356
- 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 +91 -101
- package/dist/context/context/create-browser-context.d.ts +1 -2
- package/dist/context/context/create-browser-context.d.ts.map +1 -1
- package/dist/context/context/create-browser-context.js +61 -52
- package/dist/context/context/create-headless-context.d.ts +1 -1
- package/dist/context/context/create-headless-context.d.ts.map +1 -1
- package/dist/context/context/create-headless-context.js +26 -33
- package/dist/context/context/webgl-checks.js +25 -20
- package/dist/context/debug/spector.d.ts +1 -2
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +53 -62
- 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 +106 -93
- package/dist/context/parameters/unified-parameter-api.js +91 -55
- package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +462 -423
- package/dist/context/polyfill/context-data.js +16 -12
- package/dist/context/polyfill/get-parameter-polyfill.js +91 -76
- package/dist/context/polyfill/polyfill-context.js +75 -80
- package/dist/context/polyfill/polyfill-table.js +133 -139
- package/dist/context/polyfill/polyfill-vertex-array-object.js +255 -297
- package/dist/context/state-tracker/deep-array-equal.js +16 -18
- package/dist/context/state-tracker/track-context-state.js +183 -161
- package/dist/context/state-tracker/with-parameters.js +43 -35
- package/dist/dist.min.js +1 -0
- package/dist/es5/adapter/converters/device-parameters.js +3 -38
- package/dist/es5/adapter/converters/device-parameters.js.map +1 -1
- package/dist/es5/adapter/converters/renderbuffer-formats.js +2 -14
- package/dist/es5/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/es5/adapter/converters/sampler-parameters.js +2 -65
- package/dist/es5/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/es5/adapter/converters/texture-formats.js +9 -81
- package/dist/es5/adapter/converters/texture-formats.js.map +1 -1
- package/dist/es5/adapter/converters/vertex-formats.js +0 -12
- package/dist/es5/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/es5/adapter/device-helpers/device-features.js +6 -40
- package/dist/es5/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/es5/adapter/device-helpers/device-limits.js +0 -10
- package/dist/es5/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/es5/adapter/device-helpers/get-device-info.js +0 -10
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/es5/adapter/helpers/attribute-utils.js +3 -25
- package/dist/es5/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/es5/adapter/helpers/get-shader-info.js +31 -0
- package/dist/es5/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/es5/adapter/helpers/get-shader-layout.js +23 -101
- package/dist/es5/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +6 -24
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/es5/adapter/helpers/set-uniform.js +0 -33
- package/dist/es5/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/es5/adapter/helpers/uniforms.js +13 -37
- package/dist/es5/adapter/helpers/uniforms.js.map +1 -1
- package/dist/es5/adapter/objects/constants-to-keys.js +1 -12
- package/dist/es5/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-renderbuffer.js +5 -33
- package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-resource.js +6 -60
- package/dist/es5/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js +7 -35
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-buffer.js +20 -66
- package/dist/es5/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-command-buffer.js +6 -32
- package/dist/es5/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -18
- package/dist/es5/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-framebuffer.js +10 -82
- package/dist/es5/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-render-pass.js +2 -19
- package/dist/es5/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-render-pipeline.js +24 -133
- package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-sampler.js +2 -28
- package/dist/es5/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-shader.js +13 -52
- package/dist/es5/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/es5/adapter/resources/webgl-texture.js +137 -291
- package/dist/es5/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/es5/adapter/webgl-canvas-context.js +0 -24
- package/dist/es5/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/es5/adapter/webgl-device.js +40 -127
- package/dist/es5/adapter/webgl-device.js.map +1 -1
- package/dist/es5/bundle.js +0 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/classic/accessor.js +1 -31
- package/dist/es5/classic/accessor.js.map +1 -1
- package/dist/es5/classic/buffer.js +32 -102
- package/dist/es5/classic/buffer.js.map +1 -1
- package/dist/es5/classic/typed-array-utils.js +10 -37
- package/dist/es5/classic/typed-array-utils.js.map +1 -1
- package/dist/es5/context/context/create-browser-context.js +4 -21
- package/dist/es5/context/context/create-browser-context.js.map +1 -1
- package/dist/es5/context/context/create-headless-context.js +8 -21
- package/dist/es5/context/context/create-headless-context.js.map +1 -1
- package/dist/es5/context/context/webgl-checks.js +4 -14
- package/dist/es5/context/context/webgl-checks.js.map +1 -1
- package/dist/es5/context/debug/spector.js +20 -54
- package/dist/es5/context/debug/spector.js.map +1 -1
- package/dist/es5/context/debug/webgl-developer-tools.js +19 -65
- package/dist/es5/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/es5/context/parameters/unified-parameter-api.js +3 -28
- package/dist/es5/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/es5/context/parameters/webgl-parameter-tables.js +18 -65
- package/dist/es5/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/es5/context/polyfill/context-data.js +0 -3
- package/dist/es5/context/polyfill/context-data.js.map +1 -1
- package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -12
- package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-context.js +8 -33
- package/dist/es5/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-table.js +3 -27
- package/dist/es5/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/es5/context/state-tracker/deep-array-equal.js +0 -5
- package/dist/es5/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/es5/context/state-tracker/track-context-state.js +10 -53
- package/dist/es5/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/es5/context/state-tracker/with-parameters.js +1 -13
- package/dist/es5/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/es5/index.js +72 -99
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/init.js +0 -3
- package/dist/es5/init.js.map +1 -1
- package/dist/es5/types/webgl.js +0 -1
- package/dist/es5/types/webgl.js.map +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/adapter/converters/device-parameters.js +0 -20
- package/dist/esm/adapter/converters/device-parameters.js.map +1 -1
- package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -4
- package/dist/esm/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/esm/adapter/converters/sampler-parameters.js +2 -57
- package/dist/esm/adapter/converters/sampler-parameters.js.map +1 -1
- package/dist/esm/adapter/converters/texture-formats.js +8 -52
- package/dist/esm/adapter/converters/texture-formats.js.map +1 -1
- package/dist/esm/adapter/converters/vertex-formats.js +0 -9
- package/dist/esm/adapter/converters/vertex-formats.js.map +1 -1
- package/dist/esm/adapter/device-helpers/device-features.js +2 -19
- package/dist/esm/adapter/device-helpers/device-features.js.map +1 -1
- package/dist/esm/adapter/device-helpers/device-limits.js +0 -3
- package/dist/esm/adapter/device-helpers/device-limits.js.map +1 -1
- package/dist/esm/adapter/device-helpers/get-device-info.js +0 -6
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +1 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js +2 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +1 -1
- package/dist/esm/adapter/helpers/attribute-utils.js +0 -17
- package/dist/esm/adapter/helpers/attribute-utils.js.map +1 -1
- package/dist/esm/adapter/helpers/get-shader-info.js +25 -0
- package/dist/esm/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/esm/adapter/helpers/get-shader-layout.js +2 -48
- package/dist/esm/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -7
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +1 -1
- package/dist/esm/adapter/helpers/set-uniform.js +0 -30
- package/dist/esm/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/esm/adapter/helpers/uniforms.js +0 -10
- package/dist/esm/adapter/helpers/uniforms.js.map +1 -1
- package/dist/esm/adapter/objects/constants-to-keys.js +0 -7
- package/dist/esm/adapter/objects/constants-to-keys.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-renderbuffer.js +2 -18
- package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-resource.js +10 -57
- package/dist/esm/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js +5 -15
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-buffer.js +12 -40
- package/dist/esm/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-command-buffer.js +2 -17
- package/dist/esm/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -12
- package/dist/esm/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -60
- package/dist/esm/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-render-pass.js +1 -8
- package/dist/esm/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -89
- package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-sampler.js +0 -12
- package/dist/esm/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-shader.js +2 -16
- package/dist/esm/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/esm/adapter/resources/webgl-texture.js +36 -154
- package/dist/esm/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/esm/adapter/webgl-canvas-context.js +0 -14
- package/dist/esm/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/esm/adapter/webgl-device.js +19 -89
- package/dist/esm/adapter/webgl-device.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/classic/accessor.js +10 -34
- package/dist/esm/classic/accessor.js.map +1 -1
- package/dist/esm/classic/buffer.js +15 -71
- package/dist/esm/classic/buffer.js.map +1 -1
- package/dist/esm/classic/typed-array-utils.js +0 -20
- package/dist/esm/classic/typed-array-utils.js.map +1 -1
- package/dist/esm/context/context/create-browser-context.js +6 -14
- package/dist/esm/context/context/create-browser-context.js.map +1 -1
- package/dist/esm/context/context/create-headless-context.js +2 -6
- package/dist/esm/context/context/create-headless-context.js.map +1 -1
- package/dist/esm/context/context/webgl-checks.js +0 -3
- package/dist/esm/context/context/webgl-checks.js.map +1 -1
- package/dist/esm/context/debug/spector.js +2 -14
- package/dist/esm/context/debug/spector.js.map +1 -1
- package/dist/esm/context/debug/webgl-developer-tools.js +4 -22
- package/dist/esm/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/esm/context/parameters/unified-parameter-api.js +2 -13
- package/dist/esm/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -19
- package/dist/esm/context/parameters/webgl-parameter-tables.js.map +1 -1
- package/dist/esm/context/polyfill/context-data.js +0 -2
- package/dist/esm/context/polyfill/context-data.js.map +1 -1
- package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -5
- package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-context.js +14 -21
- package/dist/esm/context/polyfill/polyfill-context.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-table.js +0 -23
- package/dist/esm/context/polyfill/polyfill-table.js.map +1 -1
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -70
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +1 -1
- package/dist/esm/context/state-tracker/deep-array-equal.js +0 -4
- package/dist/esm/context/state-tracker/deep-array-equal.js.map +1 -1
- package/dist/esm/context/state-tracker/track-context-state.js +11 -45
- package/dist/esm/context/state-tracker/track-context-state.js.map +1 -1
- package/dist/esm/context/state-tracker/with-parameters.js +0 -6
- package/dist/esm/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/types/webgl.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/index.js +39 -25
- package/dist/init.js +1 -2
- package/dist/types/webgl.d.ts +20 -20
- package/dist/types/webgl.d.ts.map +1 -1
- package/dist/types/webgl.js +0 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/package.json +8 -8
- package/src/adapter/helpers/get-shader-info.ts +37 -0
- package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
- package/src/adapter/resources/webgl-render-pass.ts +1 -1
- package/src/adapter/resources/webgl-shader.ts +2 -2
- package/src/adapter/webgl-device.ts +1 -1
- package/src/context/debug/webgl-developer-tools.ts +0 -1
- package/src/types/webgl.ts +4 -4
- package/dist/adapter/converters/device-parameters.js.map +0 -1
- package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/adapter/converters/texture-formats.js.map +0 -1
- package/dist/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/adapter/helpers/uniforms.js.map +0 -1
- package/dist/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/adapter/webgl-device.js.map +0 -1
- package/dist/bundle.js.map +0 -1
- package/dist/classic/accessor.js.map +0 -1
- package/dist/classic/buffer.js.map +0 -1
- package/dist/classic/typed-array-utils.js.map +0 -1
- package/dist/context/context/create-browser-context.js.map +0 -1
- package/dist/context/context/create-headless-context.js.map +0 -1
- package/dist/context/context/webgl-checks.js.map +0 -1
- package/dist/context/debug/spector.js.map +0 -1
- package/dist/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/context/polyfill/context-data.js.map +0 -1
- package/dist/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/types/webgl.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -1,945 +1,492 @@
|
|
|
1
1
|
import { decodeTextureFormat } from '@luma.gl/api';
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
|
-
import { isWebGL2 } from '../../context/context/webgl-checks';
|
|
3
|
+
import { isWebGL2 } from '../../context/context/webgl-checks.js';
|
|
4
|
+
// TEXTURE FEATURES
|
|
5
|
+
// Define local device feature strings to optimize minification
|
|
4
6
|
const texture_compression_bc = 'texture-compression-bc';
|
|
5
7
|
const texture_compression_astc = 'texture-compression-astc';
|
|
6
8
|
const texture_compression_etc2 = 'texture-compression-etc2';
|
|
7
9
|
const texture_compression_etc1_webgl = 'texture-compression-etc1-webgl';
|
|
8
10
|
const texture_compression_pvrtc_webgl = 'texture-compression-pvrtc-webgl';
|
|
9
11
|
const texture_compression_atc_webgl = 'texture-compression-atc-webgl';
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
12
|
+
// Define local webgl extension strings to optimize minification
|
|
13
|
+
const X_S3TC = 'WEBGL_compressed_texture_s3tc'; // BC1, BC2, BC3
|
|
14
|
+
const X_S3TC_SRGB = 'WEBGL_compressed_texture_s3tc_srgb'; // BC1, BC2, BC3
|
|
15
|
+
const X_RGTC = 'EXT_texture_compression_rgtc'; // BC4, BC5
|
|
16
|
+
const X_BPTC = 'EXT_texture_compression_bptc'; // BC6, BC7
|
|
17
|
+
const X_ETC2 = 'WEBGL_compressed_texture_etc'; // Renamed from 'WEBGL_compressed_texture_es3'
|
|
15
18
|
const X_ASTC = 'WEBGL_compressed_texture_astc';
|
|
16
19
|
const X_ETC1 = 'WEBGL_compressed_texture_etc1';
|
|
17
20
|
const X_PVRTC = 'WEBGL_compressed_texture_pvrtc';
|
|
18
21
|
const X_ATC = 'WEBGL_compressed_texture_atc';
|
|
19
|
-
|
|
22
|
+
// Define local webgl extension strings to optimize minification
|
|
23
|
+
const EXT_SRGB = 'EXT_sRGB'; // https://developer.mozilla.org/en-US/docs/Web/API/EXT_sRGB
|
|
20
24
|
const EXT_TEXTURE_NORM16 = 'EXT_texture_norm16';
|
|
21
25
|
const EXT_FLOAT_WEBGL1 = 'WEBGL_color_buffer_float';
|
|
22
26
|
const EXT_FLOAT_RENDER_WEBGL2 = 'EXT_color_buffer_float';
|
|
23
|
-
|
|
27
|
+
// const EXT_HALF_FLOAT_WEBGL1 = 'EXT_color_buffer_half_float';
|
|
28
|
+
// const DEPTH = 'WEBGL_depth_texture';
|
|
24
29
|
const checkExtension = (gl, extension) => gl.getExtension(extension);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
const checkExtensions = (gl, extensions) => extensions.every((extension) => gl.getExtension(extension));
|
|
31
|
+
// prettier-ignore
|
|
28
32
|
const TEXTURE_FEATURE_CHECKS = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
'texture-blend-float-webgl1': (gl) => isWebGL2(gl) ? true : checkExtension(gl, 'EXT_float_blend'),
|
|
34
|
+
'texture-formats-srgb-webgl1': (gl) => (isWebGL2(gl) ? true : checkExtension(gl, EXT_SRGB)),
|
|
35
|
+
'texture-formats-depth-webgl1': (gl) => isWebGL2(gl) ? true : checkExtension(gl, 'WEBGL_depth_texture'),
|
|
36
|
+
'texture-formats-float32-webgl1': (gl) => isWebGL2(gl) ? true : checkExtension(gl, 'OES_texture_float'),
|
|
37
|
+
'texture-formats-float16-webgl1': (gl) => isWebGL2(gl) ? true : checkExtension(gl, 'OES_texture_half_float'),
|
|
38
|
+
'texture-formats-norm16-webgl': (gl) => isWebGL2(gl) ? checkExtension(gl, EXT_TEXTURE_NORM16) : false,
|
|
39
|
+
'texture-filter-linear-float32-webgl': (gl) => checkExtension(gl, 'OES_texture_float_linear'),
|
|
40
|
+
'texture-filter-linear-float16-webgl': (gl) => checkExtension(gl, 'OES_texture_half_float_linear'),
|
|
41
|
+
'texture-filter-anisotropic-webgl': (gl) => checkExtension(gl, 'EXT_texture_filter_anisotropic'),
|
|
42
|
+
'texture-renderable-float32-webgl': (gl) => checkExtension(gl, 'EXT_color_buffer_float'),
|
|
43
|
+
'texture-renderable-float16-webgl': (gl) => checkExtension(gl, 'EXT_color_buffer_half_float'),
|
|
44
|
+
'texture-compression-bc': (gl) => checkExtensions(gl, [X_S3TC, X_S3TC_SRGB, X_RGTC, X_BPTC]),
|
|
45
|
+
'texture-compression-bc5-webgl': (gl) => checkExtensions(gl, [X_RGTC]),
|
|
46
|
+
// 'texture-compression-bc7-webgl': gl => checkExtensions(gl, [X_BPTC]),
|
|
47
|
+
// 'texture-compression-bc3-srgb-webgl': gl => checkExtensions(gl, [X_S3TC_SRGB]),
|
|
48
|
+
// 'texture-compression-bc3-webgl': gl => checkExtensions(gl, [X_S3TC]),
|
|
49
|
+
'texture-compression-etc2': (gl) => checkExtensions(gl, [X_ETC2]),
|
|
50
|
+
'texture-compression-astc': (gl) => checkExtensions(gl, [X_ASTC]),
|
|
51
|
+
'texture-compression-etc1-webgl': (gl) => checkExtensions(gl, [X_ETC1]),
|
|
52
|
+
'texture-compression-pvrtc-webgl': (gl) => checkExtensions(gl, [X_PVRTC]),
|
|
53
|
+
'texture-compression-atc-webgl': (gl) => checkExtensions(gl, [X_ATC])
|
|
47
54
|
};
|
|
48
55
|
export function checkTextureFeature(gl, feature) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return ((_TEXTURE_FEATURE_CHEC = TEXTURE_FEATURE_CHECKS[feature]) === null || _TEXTURE_FEATURE_CHEC === void 0 ? void 0 : _TEXTURE_FEATURE_CHEC.call(TEXTURE_FEATURE_CHECKS, gl)) || false;
|
|
56
|
+
return TEXTURE_FEATURE_CHECKS[feature]?.(gl) || false;
|
|
52
57
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
const checkTextureFeatures = (gl, features) => features.every((feature) => checkTextureFeature(gl, feature));
|
|
59
|
+
/** Return a list of texture feature strings (for Device.features). Mainly compressed texture support */
|
|
56
60
|
export function getTextureFeatures(gl) {
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
const textureFeatures = Object.keys(TEXTURE_FEATURE_CHECKS);
|
|
62
|
+
return textureFeatures.filter((feature) => checkTextureFeature(gl, feature));
|
|
59
63
|
}
|
|
64
|
+
// TABLES
|
|
65
|
+
/** Legal combinations for internalFormat, format and type *
|
|
66
|
+
// [GL.DEPTH_COMPONENT]: {types: [GL.UNSIGNED_SHORT, GL.UNSIGNED_INT, GL.UNSIGNED_INT_24_8], gl1ext: DEPTH},
|
|
67
|
+
// [GL.DEPTH_STENCIL]: {gl1ext: DEPTH},
|
|
68
|
+
// Sized texture format
|
|
69
|
+
// R
|
|
70
|
+
[GL.R8]: {dataFormat: GL.RED, types: [GL.UNSIGNED_BYTE], gl2: true},
|
|
71
|
+
[GL.R16F]: {dataFormat: GL.RED, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true},
|
|
72
|
+
[GL.R8UI]: {dataFormat: GL.RED_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true},
|
|
73
|
+
// // RG
|
|
74
|
+
[GL.RG8]: {dataFormat: GL.RG, types: [GL.UNSIGNED_BYTE], gl2: true},
|
|
75
|
+
[GL.RG16F]: {dataFormat: GL.RG, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true},
|
|
76
|
+
[GL.RG8UI]: {dataFormat: GL.RG_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true},
|
|
77
|
+
// // RGB
|
|
78
|
+
[GL.RGB8]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE], gl2: true},
|
|
79
|
+
[GL.SRGB8]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE], gl2: true, gl1ext: EXT_SRGB},
|
|
80
|
+
[GL.RGB16F]: {dataFormat: GL.RGB, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true, gl1ext: EXT_HALF_FLOAT_WEBGL1},
|
|
81
|
+
[GL.RGB8UI]: {dataFormat: GL.RGB_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true},
|
|
82
|
+
// // RGBA
|
|
83
|
+
|
|
84
|
+
[GL.RGB565]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_5_6_5], gl2: true},
|
|
85
|
+
[GL.R11F_G11F_B10F]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_INT_10F_11F_11F_REV, GL.HALF_FLOAT, GL.FLOAT], gl2: true},
|
|
86
|
+
[GL.RGB9_E5]: {dataFormat: GL.RGB, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true, gl1ext: EXT_HALF_FLOAT_WEBGL1},
|
|
87
|
+
[GL.RGBA8]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE], gl2: true},
|
|
88
|
+
[GL.SRGB8_ALPHA8]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE], gl2: true, gl1ext: EXT_SRGB},
|
|
89
|
+
[GL.RGB5_A1]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_5_5_5_1], gl2: true},
|
|
90
|
+
[GL.RGBA4]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_4_4_4_4], gl2: true},
|
|
91
|
+
[GL.RGBA16F]: {dataFormat: GL.RGBA, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true, gl1ext: EXT_HALF_FLOAT_WEBGL1},
|
|
92
|
+
[GL.RGBA8UI]: {dataFormat: GL.RGBA_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true}
|
|
93
|
+
*/
|
|
94
|
+
/** Texture format data */
|
|
95
|
+
// prettier-ignore
|
|
60
96
|
export const TEXTURE_FORMATS = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
b: 4,
|
|
65
|
-
|
|
66
|
-
bpp: 4,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
gl: GL.
|
|
72
|
-
|
|
73
|
-
b:
|
|
74
|
-
c:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
gl: GL.
|
|
81
|
-
b: 1,
|
|
82
|
-
c: 1
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
b:
|
|
87
|
-
c:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
gl: GL.
|
|
91
|
-
b:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
gl: GL.
|
|
96
|
-
b:
|
|
97
|
-
c:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
b:
|
|
102
|
-
c: 2
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
gl: GL.
|
|
106
|
-
b: 2,
|
|
107
|
-
c:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
b:
|
|
112
|
-
c:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
gl: GL.
|
|
116
|
-
|
|
117
|
-
c:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
gl: GL.
|
|
121
|
-
b: 2,
|
|
122
|
-
c:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
gl: GL.
|
|
126
|
-
b: 2,
|
|
127
|
-
c:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
gl: GL.
|
|
138
|
-
b: 2,
|
|
139
|
-
c: 1,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
gl: GL.
|
|
144
|
-
|
|
145
|
-
c: 1,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
gl: GL.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
gl: GL.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
gl: GL.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
gl: GL.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
gl: GL.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
gl: GL.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
gl: GL.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
gl: GL.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
gl: GL.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
gl: GL.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
b: 4,
|
|
216
|
-
c: 4
|
|
217
|
-
},
|
|
218
|
-
'rg16uint': {
|
|
219
|
-
gl: GL.RG16UI,
|
|
220
|
-
b: 4,
|
|
221
|
-
c: 1,
|
|
222
|
-
bpp: 4
|
|
223
|
-
},
|
|
224
|
-
'rg16sint': {
|
|
225
|
-
gl: GL.RG16I,
|
|
226
|
-
b: 4,
|
|
227
|
-
c: 2,
|
|
228
|
-
bpp: 4
|
|
229
|
-
},
|
|
230
|
-
'rg16float': {
|
|
231
|
-
gl: GL.RG16F,
|
|
232
|
-
bpp: 4,
|
|
233
|
-
b: 4,
|
|
234
|
-
c: 2,
|
|
235
|
-
render: 'texture-renderable-float16-webgl',
|
|
236
|
-
filter: 'texture-filter-linear-float16-webgl'
|
|
237
|
-
},
|
|
238
|
-
'rg16unorm-webgl': {
|
|
239
|
-
gl: GL.RG16_EXT,
|
|
240
|
-
b: 2,
|
|
241
|
-
c: 2,
|
|
242
|
-
f: 'texture-formats-norm16-webgl'
|
|
243
|
-
},
|
|
244
|
-
'rg16snorm-webgl': {
|
|
245
|
-
gl: GL.RG16_SNORM_EXT,
|
|
246
|
-
b: 2,
|
|
247
|
-
c: 2,
|
|
248
|
-
f: 'texture-formats-norm16-webgl'
|
|
249
|
-
},
|
|
250
|
-
'r32uint': {
|
|
251
|
-
gl: GL.R32UI,
|
|
252
|
-
b: 4,
|
|
253
|
-
c: 1,
|
|
254
|
-
bpp: 4
|
|
255
|
-
},
|
|
256
|
-
'r32sint': {
|
|
257
|
-
gl: GL.R32I,
|
|
258
|
-
b: 4,
|
|
259
|
-
c: 1,
|
|
260
|
-
bpp: 4
|
|
261
|
-
},
|
|
262
|
-
'r32float': {
|
|
263
|
-
gl: GL.R32F,
|
|
264
|
-
bpp: 4,
|
|
265
|
-
b: 4,
|
|
266
|
-
c: 1,
|
|
267
|
-
render: 'texture-renderable-float32-webgl',
|
|
268
|
-
filter: 'texture-filter-linear-float32-webgl'
|
|
269
|
-
},
|
|
270
|
-
'rgb9e5ufloat': {
|
|
271
|
-
gl: GL.RGB9_E5,
|
|
272
|
-
b: 4,
|
|
273
|
-
c: 3,
|
|
274
|
-
p: 1,
|
|
275
|
-
render: 'texture-renderable-float16-webgl',
|
|
276
|
-
filter: 'texture-filter-linear-float16-webgl'
|
|
277
|
-
},
|
|
278
|
-
'rg11b10ufloat': {
|
|
279
|
-
gl: GL.R11F_G11F_B10F,
|
|
280
|
-
b: 4,
|
|
281
|
-
c: 3,
|
|
282
|
-
p: 1,
|
|
283
|
-
render: 'texture-renderable-float32-webgl'
|
|
284
|
-
},
|
|
285
|
-
'rgb10a2unorm': {
|
|
286
|
-
gl: GL.RGB10_A2,
|
|
287
|
-
b: 4,
|
|
288
|
-
c: 4,
|
|
289
|
-
p: 1
|
|
290
|
-
},
|
|
291
|
-
'rgb10a2unorm-webgl': {
|
|
292
|
-
b: 4,
|
|
293
|
-
c: 4,
|
|
294
|
-
gl: GL.RGB10_A2UI,
|
|
295
|
-
p: 1,
|
|
296
|
-
wgpu: false,
|
|
297
|
-
bpp: 4
|
|
298
|
-
},
|
|
299
|
-
'rgb16unorm-webgl': {
|
|
300
|
-
gl: GL.RGB16_EXT,
|
|
301
|
-
b: 2,
|
|
302
|
-
c: 3,
|
|
303
|
-
f: 'texture-formats-norm16-webgl'
|
|
304
|
-
},
|
|
305
|
-
'rgb16snorm-webgl': {
|
|
306
|
-
gl: GL.RGB16_SNORM_EXT,
|
|
307
|
-
b: 2,
|
|
308
|
-
c: 3,
|
|
309
|
-
f: 'texture-formats-norm16-webgl'
|
|
310
|
-
},
|
|
311
|
-
'rg32uint': {
|
|
312
|
-
gl: GL.RG32UI,
|
|
313
|
-
b: 8,
|
|
314
|
-
c: 2
|
|
315
|
-
},
|
|
316
|
-
'rg32sint': {
|
|
317
|
-
gl: GL.RG32I,
|
|
318
|
-
b: 8,
|
|
319
|
-
c: 2
|
|
320
|
-
},
|
|
321
|
-
'rg32float': {
|
|
322
|
-
gl: GL.RG32F,
|
|
323
|
-
b: 8,
|
|
324
|
-
c: 2,
|
|
325
|
-
render: 'texture-renderable-float32-webgl',
|
|
326
|
-
filter: 'texture-filter-linear-float32-webgl'
|
|
327
|
-
},
|
|
328
|
-
'rgba16uint': {
|
|
329
|
-
gl: GL.RGBA16UI,
|
|
330
|
-
b: 8,
|
|
331
|
-
c: 4
|
|
332
|
-
},
|
|
333
|
-
'rgba16sint': {
|
|
334
|
-
gl: GL.RGBA16I,
|
|
335
|
-
b: 8,
|
|
336
|
-
c: 4
|
|
337
|
-
},
|
|
338
|
-
'rgba16float': {
|
|
339
|
-
gl: GL.RGBA16F,
|
|
340
|
-
gl1: GL.RGBA,
|
|
341
|
-
b: 8,
|
|
342
|
-
c: 4,
|
|
343
|
-
render: 'texture-renderable-float16-webgl',
|
|
344
|
-
filter: 'texture-filter-linear-float16-webgl'
|
|
345
|
-
},
|
|
346
|
-
'rgba16unorm-webgl': {
|
|
347
|
-
gl: GL.RGBA16_EXT,
|
|
348
|
-
b: 2,
|
|
349
|
-
c: 4,
|
|
350
|
-
f: 'texture-formats-norm16-webgl'
|
|
351
|
-
},
|
|
352
|
-
'rgba16snorm-webgl': {
|
|
353
|
-
gl: GL.RGBA16_SNORM_EXT,
|
|
354
|
-
b: 2,
|
|
355
|
-
c: 4,
|
|
356
|
-
f: 'texture-formats-norm16-webgl'
|
|
357
|
-
},
|
|
358
|
-
'rgb32float-webgl': {
|
|
359
|
-
gl: GL.RGB32F,
|
|
360
|
-
gl1: GL.RGB,
|
|
361
|
-
render: 'texture-renderable-float32-webgl',
|
|
362
|
-
filter: 'texture-filter-linear-float32-webgl',
|
|
363
|
-
gl2ext: EXT_FLOAT_RENDER_WEBGL2,
|
|
364
|
-
gl1ext: EXT_FLOAT_WEBGL1,
|
|
365
|
-
dataFormat: GL.RGB,
|
|
366
|
-
types: [GL.FLOAT]
|
|
367
|
-
},
|
|
368
|
-
'rgba32uint': {
|
|
369
|
-
gl: GL.RGBA32UI,
|
|
370
|
-
b: 16,
|
|
371
|
-
c: 4
|
|
372
|
-
},
|
|
373
|
-
'rgba32sint': {
|
|
374
|
-
gl: GL.RGBA32I,
|
|
375
|
-
b: 16,
|
|
376
|
-
c: 4
|
|
377
|
-
},
|
|
378
|
-
'rgba32float': {
|
|
379
|
-
gl: GL.RGBA32F,
|
|
380
|
-
gl1: GL.RGBA,
|
|
381
|
-
b: 16,
|
|
382
|
-
c: 4,
|
|
383
|
-
render: 'texture-renderable-float32-webgl',
|
|
384
|
-
filter: 'texture-filter-linear-float32-webgl'
|
|
385
|
-
},
|
|
386
|
-
'stencil8': {
|
|
387
|
-
gl: GL.STENCIL_INDEX8,
|
|
388
|
-
b: 1,
|
|
389
|
-
c: 1,
|
|
390
|
-
attachment: GL.STENCIL_ATTACHMENT
|
|
391
|
-
},
|
|
392
|
-
'depth16unorm': {
|
|
393
|
-
gl: GL.DEPTH_COMPONENT16,
|
|
394
|
-
gl1: GL.DEPTH_COMPONENT16,
|
|
395
|
-
b: 2,
|
|
396
|
-
c: 1,
|
|
397
|
-
attachment: GL.DEPTH_ATTACHMENT
|
|
398
|
-
},
|
|
399
|
-
'depth24plus': {
|
|
400
|
-
gl: GL.DEPTH_COMPONENT24,
|
|
401
|
-
b: 3,
|
|
402
|
-
c: 1,
|
|
403
|
-
attachment: GL.DEPTH_ATTACHMENT
|
|
404
|
-
},
|
|
405
|
-
'depth32float': {
|
|
406
|
-
gl: GL.DEPTH_COMPONENT32F,
|
|
407
|
-
b: 4,
|
|
408
|
-
c: 1,
|
|
409
|
-
attachment: GL.DEPTH_ATTACHMENT
|
|
410
|
-
},
|
|
411
|
-
'depth24plus-stencil8': {
|
|
412
|
-
b: 4,
|
|
413
|
-
gl: GL.UNSIGNED_INT_24_8,
|
|
414
|
-
gl1: GL.DEPTH_STENCIL,
|
|
415
|
-
c: 2,
|
|
416
|
-
p: 1,
|
|
417
|
-
attachment: GL.DEPTH_STENCIL_ATTACHMENT
|
|
418
|
-
},
|
|
419
|
-
'depth24unorm-stencil8': {
|
|
420
|
-
gl: GL.DEPTH24_STENCIL8,
|
|
421
|
-
b: 4,
|
|
422
|
-
c: 2,
|
|
423
|
-
p: 1,
|
|
424
|
-
attachment: GL.DEPTH_STENCIL_ATTACHMENT
|
|
425
|
-
},
|
|
426
|
-
"depth32float-stencil8": {
|
|
427
|
-
gl: GL.DEPTH32F_STENCIL8,
|
|
428
|
-
b: 5,
|
|
429
|
-
c: 2,
|
|
430
|
-
p: 1,
|
|
431
|
-
attachment: GL.DEPTH_STENCIL_ATTACHMENT
|
|
432
|
-
},
|
|
433
|
-
'bc1-rgb-unorm-webgl': {
|
|
434
|
-
gl: GL.COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
435
|
-
x: X_S3TC,
|
|
436
|
-
f: texture_compression_bc
|
|
437
|
-
},
|
|
438
|
-
'bc1-rgb-unorm-srgb-webgl': {
|
|
439
|
-
gl: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT,
|
|
440
|
-
x: X_S3TC_SRGB,
|
|
441
|
-
f: texture_compression_bc
|
|
442
|
-
},
|
|
443
|
-
'bc1-rgba-unorm': {
|
|
444
|
-
gl: GL.COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
445
|
-
x: X_S3TC,
|
|
446
|
-
f: texture_compression_bc
|
|
447
|
-
},
|
|
448
|
-
'bc1-rgba-unorm-srgb': {
|
|
449
|
-
gl: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT,
|
|
450
|
-
x: X_S3TC_SRGB,
|
|
451
|
-
f: texture_compression_bc
|
|
452
|
-
},
|
|
453
|
-
'bc2-rgba-unorm': {
|
|
454
|
-
gl: GL.COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
455
|
-
x: X_S3TC,
|
|
456
|
-
f: texture_compression_bc
|
|
457
|
-
},
|
|
458
|
-
'bc2-rgba-unorm-srgb': {
|
|
459
|
-
gl: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
|
|
460
|
-
x: X_S3TC_SRGB,
|
|
461
|
-
f: texture_compression_bc
|
|
462
|
-
},
|
|
463
|
-
'bc3-rgba-unorm': {
|
|
464
|
-
gl: GL.COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
465
|
-
x: X_S3TC,
|
|
466
|
-
f: texture_compression_bc
|
|
467
|
-
},
|
|
468
|
-
'bc3-rgba-unorm-srgb': {
|
|
469
|
-
gl: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
|
|
470
|
-
x: X_S3TC_SRGB,
|
|
471
|
-
f: texture_compression_bc
|
|
472
|
-
},
|
|
473
|
-
'bc4-r-unorm': {
|
|
474
|
-
gl: GL.COMPRESSED_RED_RGTC1_EXT,
|
|
475
|
-
x: X_RGTC,
|
|
476
|
-
f: texture_compression_bc
|
|
477
|
-
},
|
|
478
|
-
'bc4-r-snorm': {
|
|
479
|
-
gl: GL.COMPRESSED_SIGNED_RED_RGTC1_EXT,
|
|
480
|
-
x: X_RGTC,
|
|
481
|
-
f: texture_compression_bc
|
|
482
|
-
},
|
|
483
|
-
'bc5-rg-unorm': {
|
|
484
|
-
gl: GL.COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
485
|
-
x: X_RGTC,
|
|
486
|
-
f: texture_compression_bc
|
|
487
|
-
},
|
|
488
|
-
'bc5-rg-snorm': {
|
|
489
|
-
gl: GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
|
|
490
|
-
x: X_RGTC,
|
|
491
|
-
f: texture_compression_bc
|
|
492
|
-
},
|
|
493
|
-
'bc6h-rgb-ufloat': {
|
|
494
|
-
gl: GL.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
|
|
495
|
-
x: X_BPTC,
|
|
496
|
-
f: texture_compression_bc
|
|
497
|
-
},
|
|
498
|
-
'bc6h-rgb-float': {
|
|
499
|
-
gl: GL.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
|
|
500
|
-
x: X_BPTC,
|
|
501
|
-
f: texture_compression_bc
|
|
502
|
-
},
|
|
503
|
-
'bc7-rgba-unorm': {
|
|
504
|
-
gl: GL.COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
505
|
-
x: X_BPTC,
|
|
506
|
-
f: texture_compression_bc
|
|
507
|
-
},
|
|
508
|
-
'bc7-rgba-unorm-srgb': {
|
|
509
|
-
gl: GL.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
|
|
510
|
-
x: X_BPTC,
|
|
511
|
-
f: texture_compression_bc
|
|
512
|
-
},
|
|
513
|
-
'etc2-rgb8unorm': {
|
|
514
|
-
gl: GL.COMPRESSED_RGB8_ETC2,
|
|
515
|
-
f: texture_compression_etc2
|
|
516
|
-
},
|
|
517
|
-
'etc2-rgb8unorm-srgb': {
|
|
518
|
-
gl: GL.COMPRESSED_SRGB8_ETC2,
|
|
519
|
-
f: texture_compression_etc2
|
|
520
|
-
},
|
|
521
|
-
'etc2-rgb8a1unorm': {
|
|
522
|
-
gl: GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
523
|
-
f: texture_compression_etc2
|
|
524
|
-
},
|
|
525
|
-
'etc2-rgb8a1unorm-srgb': {
|
|
526
|
-
gl: GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
527
|
-
f: texture_compression_etc2
|
|
528
|
-
},
|
|
529
|
-
'etc2-rgba8unorm': {
|
|
530
|
-
gl: GL.COMPRESSED_RGBA8_ETC2_EAC,
|
|
531
|
-
f: texture_compression_etc2
|
|
532
|
-
},
|
|
533
|
-
'etc2-rgba8unorm-srgb': {
|
|
534
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
|
|
535
|
-
f: texture_compression_etc2
|
|
536
|
-
},
|
|
537
|
-
'eac-r11unorm': {
|
|
538
|
-
gl: GL.COMPRESSED_R11_EAC,
|
|
539
|
-
f: texture_compression_etc2
|
|
540
|
-
},
|
|
541
|
-
'eac-r11snorm': {
|
|
542
|
-
gl: GL.COMPRESSED_SIGNED_R11_EAC,
|
|
543
|
-
f: texture_compression_etc2
|
|
544
|
-
},
|
|
545
|
-
'eac-rg11unorm': {
|
|
546
|
-
gl: GL.COMPRESSED_RG11_EAC,
|
|
547
|
-
f: texture_compression_etc2
|
|
548
|
-
},
|
|
549
|
-
'eac-rg11snorm': {
|
|
550
|
-
gl: GL.COMPRESSED_SIGNED_RG11_EAC,
|
|
551
|
-
f: texture_compression_etc2
|
|
552
|
-
},
|
|
553
|
-
'astc-4x4-unorm': {
|
|
554
|
-
gl: GL.COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
555
|
-
f: texture_compression_astc
|
|
556
|
-
},
|
|
557
|
-
'astc-4x4-unorm-srgb': {
|
|
558
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
559
|
-
f: texture_compression_astc
|
|
560
|
-
},
|
|
561
|
-
'astc-5x4-unorm': {
|
|
562
|
-
gl: GL.COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
563
|
-
f: texture_compression_astc
|
|
564
|
-
},
|
|
565
|
-
'astc-5x4-unorm-srgb': {
|
|
566
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
567
|
-
f: texture_compression_astc
|
|
568
|
-
},
|
|
569
|
-
'astc-5x5-unorm': {
|
|
570
|
-
gl: GL.COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
571
|
-
f: texture_compression_astc
|
|
572
|
-
},
|
|
573
|
-
'astc-5x5-unorm-srgb': {
|
|
574
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
575
|
-
f: texture_compression_astc
|
|
576
|
-
},
|
|
577
|
-
'astc-6x5-unorm': {
|
|
578
|
-
gl: GL.COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
579
|
-
f: texture_compression_astc
|
|
580
|
-
},
|
|
581
|
-
'astc-6x5-unorm-srgb': {
|
|
582
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
583
|
-
f: texture_compression_astc
|
|
584
|
-
},
|
|
585
|
-
'astc-6x6-unorm': {
|
|
586
|
-
gl: GL.COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
587
|
-
f: texture_compression_astc
|
|
588
|
-
},
|
|
589
|
-
'astc-6x6-unorm-srgb': {
|
|
590
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
591
|
-
f: texture_compression_astc
|
|
592
|
-
},
|
|
593
|
-
'astc-8x5-unorm': {
|
|
594
|
-
gl: GL.COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
595
|
-
f: texture_compression_astc
|
|
596
|
-
},
|
|
597
|
-
'astc-8x5-unorm-srgb': {
|
|
598
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
599
|
-
f: texture_compression_astc
|
|
600
|
-
},
|
|
601
|
-
'astc-8x6-unorm': {
|
|
602
|
-
gl: GL.COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
603
|
-
f: texture_compression_astc
|
|
604
|
-
},
|
|
605
|
-
'astc-8x6-unorm-srgb': {
|
|
606
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
607
|
-
f: texture_compression_astc
|
|
608
|
-
},
|
|
609
|
-
'astc-8x8-unorm': {
|
|
610
|
-
gl: GL.COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
611
|
-
f: texture_compression_astc
|
|
612
|
-
},
|
|
613
|
-
'astc-8x8-unorm-srgb': {
|
|
614
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
615
|
-
f: texture_compression_astc
|
|
616
|
-
},
|
|
617
|
-
'astc-10x5-unorm': {
|
|
618
|
-
gl: GL.COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
619
|
-
f: texture_compression_astc
|
|
620
|
-
},
|
|
621
|
-
'astc-10x5-unorm-srgb': {
|
|
622
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
623
|
-
f: texture_compression_astc
|
|
624
|
-
},
|
|
625
|
-
'astc-10x6-unorm': {
|
|
626
|
-
gl: GL.COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
627
|
-
f: texture_compression_astc
|
|
628
|
-
},
|
|
629
|
-
'astc-10x6-unorm-srgb': {
|
|
630
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
631
|
-
f: texture_compression_astc
|
|
632
|
-
},
|
|
633
|
-
'astc-10x8-unorm': {
|
|
634
|
-
gl: GL.COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
635
|
-
f: texture_compression_astc
|
|
636
|
-
},
|
|
637
|
-
'astc-10x8-unorm-srgb': {
|
|
638
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
639
|
-
f: texture_compression_astc
|
|
640
|
-
},
|
|
641
|
-
'astc-10x10-unorm': {
|
|
642
|
-
gl: GL.COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
643
|
-
f: texture_compression_astc
|
|
644
|
-
},
|
|
645
|
-
'astc-10x10-unorm-srgb': {
|
|
646
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
647
|
-
f: texture_compression_astc
|
|
648
|
-
},
|
|
649
|
-
'astc-12x10-unorm': {
|
|
650
|
-
gl: GL.COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
651
|
-
f: texture_compression_astc
|
|
652
|
-
},
|
|
653
|
-
'astc-12x10-unorm-srgb': {
|
|
654
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
655
|
-
f: texture_compression_astc
|
|
656
|
-
},
|
|
657
|
-
'astc-12x12-unorm': {
|
|
658
|
-
gl: GL.COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
659
|
-
f: texture_compression_astc
|
|
660
|
-
},
|
|
661
|
-
'astc-12x12-unorm-srgb': {
|
|
662
|
-
gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
663
|
-
f: texture_compression_astc
|
|
664
|
-
},
|
|
665
|
-
'pvrtc-rgb4unorm-webgl': {
|
|
666
|
-
gl: GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
|
667
|
-
f: texture_compression_pvrtc_webgl
|
|
668
|
-
},
|
|
669
|
-
'pvrtc-rgba4unorm-webgl': {
|
|
670
|
-
gl: GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
671
|
-
f: texture_compression_pvrtc_webgl
|
|
672
|
-
},
|
|
673
|
-
'pvrtc-rbg2unorm-webgl': {
|
|
674
|
-
gl: GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
|
|
675
|
-
f: texture_compression_pvrtc_webgl
|
|
676
|
-
},
|
|
677
|
-
'pvrtc-rgba2unorm-webgl': {
|
|
678
|
-
gl: GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
679
|
-
f: texture_compression_pvrtc_webgl
|
|
680
|
-
},
|
|
681
|
-
'etc1-rbg-unorm-webgl': {
|
|
682
|
-
gl: GL.COMPRESSED_RGB_ETC1_WEBGL,
|
|
683
|
-
f: texture_compression_etc1_webgl
|
|
684
|
-
},
|
|
685
|
-
'atc-rgb-unorm-webgl': {
|
|
686
|
-
gl: GL.COMPRESSED_RGB_ATC_WEBGL,
|
|
687
|
-
f: texture_compression_atc_webgl
|
|
688
|
-
},
|
|
689
|
-
'atc-rgba-unorm-webgl': {
|
|
690
|
-
gl: GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
|
|
691
|
-
f: texture_compression_atc_webgl
|
|
692
|
-
},
|
|
693
|
-
'atc-rgbai-unorm-webgl': {
|
|
694
|
-
gl: GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
|
|
695
|
-
f: texture_compression_atc_webgl
|
|
696
|
-
}
|
|
97
|
+
// Unsized formats that leave the precision up to the driver.
|
|
98
|
+
// TODO - Fix bpp constants
|
|
99
|
+
// 'r8unorm-unsized': {gl: GL.LUMINANCE, b: 4, c: 2, bpp: 4},
|
|
100
|
+
'rgb8unorm-unsized': { gl: GL.RGB, gl1: GL.RGB, b: 4, c: 2, bpp: 4,
|
|
101
|
+
dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_5_6_5] },
|
|
102
|
+
'rgba8unorm-unsized': { gl: GL.RGBA, gl1: GL.RGBA, b: 4, c: 2, bpp: 4,
|
|
103
|
+
dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_4_4_4_4, GL.UNSIGNED_SHORT_5_5_5_1] },
|
|
104
|
+
// 'rgb8unorm-srgb-unsized': {gl: GL.SRGB_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
105
|
+
// 'rgba8unorm-srgb-unsized': {gl: GL.SRGB_ALPHA_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
106
|
+
// 8-bit formats
|
|
107
|
+
'r8unorm': { gl: GL.R8, b: 1, c: 1 },
|
|
108
|
+
'r8snorm': { gl: GL.R8_SNORM, b: 1, c: 1 },
|
|
109
|
+
'r8uint': { gl: GL.R8UI, b: 1, c: 1 },
|
|
110
|
+
'r8sint': { gl: GL.R8I, b: 1, c: 1 },
|
|
111
|
+
// 16-bit formats
|
|
112
|
+
'rg8unorm': { gl: GL.RG8, b: 2, c: 2 },
|
|
113
|
+
'rg8snorm': { gl: GL.RG8_SNORM, b: 2, c: 2 },
|
|
114
|
+
'rg8uint': { gl: GL.RG8UI, b: 2, c: 2 },
|
|
115
|
+
'rg8sint': { gl: GL.RG8I, b: 2, c: 2 },
|
|
116
|
+
'r16uint': { gl: GL.R16UI, b: 2, c: 1 },
|
|
117
|
+
'r16sint': { gl: GL.R16I, b: 2, c: 1 },
|
|
118
|
+
'r16float': { gl: GL.R16F, b: 2, c: 1, render: 'texture-renderable-float16-webgl', filter: 'texture-filter-linear-float16-webgl' },
|
|
119
|
+
'r16unorm-webgl': { gl: GL.R16_EXT, b: 2, c: 1, f: 'texture-formats-norm16-webgl' },
|
|
120
|
+
'r16snorm-webgl': { gl: GL.R16_SNORM_EXT, b: 2, c: 1, f: 'texture-formats-norm16-webgl' },
|
|
121
|
+
// Packed 16-bit formats
|
|
122
|
+
'rgba4unorm-webgl': { gl: GL.RGBA4, b: 2, c: 4, wgpu: false },
|
|
123
|
+
'rgb565unorm-webgl': { gl: GL.RGB565, b: 2, c: 4, wgpu: false },
|
|
124
|
+
'rgb5a1unorm-webgl': { gl: GL.RGB5_A1, b: 2, c: 4, wgpu: false },
|
|
125
|
+
// 24-bit formats
|
|
126
|
+
'rbg8unorm-webgl': { gl: GL.RGB8, b: 3, c: 3, wgpu: false },
|
|
127
|
+
'rbg8snorm-webgl': { gl: GL.RGB8_SNORM, b: 3, c: 3, wgpu: false },
|
|
128
|
+
// 32-bit formats
|
|
129
|
+
'rgba8unorm': { gl: GL.RGBA8, gl1: GL.RGBA, b: 4, c: 2, bpp: 4 },
|
|
130
|
+
'rgba8unorm-srgb': { gl: GL.SRGB8_ALPHA8, gl1: GL.SRGB_ALPHA_EXT, b: 4, c: 4, gl1ext: EXT_SRGB, bpp: 4 },
|
|
131
|
+
'rgba8snorm': { gl: GL.RGBA8_SNORM, b: 4, c: 4 },
|
|
132
|
+
'rgba8uint': { gl: GL.RGBA8UI, b: 4, c: 4, bpp: 4 },
|
|
133
|
+
'rgba8sint': { gl: GL.RGBA8I, b: 4, c: 4, bpp: 4 },
|
|
134
|
+
// reverse colors, webgpu only
|
|
135
|
+
'bgra8unorm': { b: 4, c: 4 },
|
|
136
|
+
'bgra8unorm-srgb': { b: 4, c: 4 },
|
|
137
|
+
'rg16uint': { gl: GL.RG16UI, b: 4, c: 1, bpp: 4 },
|
|
138
|
+
'rg16sint': { gl: GL.RG16I, b: 4, c: 2, bpp: 4 },
|
|
139
|
+
// When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
|
|
140
|
+
'rg16float': { gl: GL.RG16F, bpp: 4, b: 4, c: 2, render: 'texture-renderable-float16-webgl', filter: 'texture-filter-linear-float16-webgl' },
|
|
141
|
+
'rg16unorm-webgl': { gl: GL.RG16_EXT, b: 2, c: 2, f: 'texture-formats-norm16-webgl' },
|
|
142
|
+
'rg16snorm-webgl': { gl: GL.RG16_SNORM_EXT, b: 2, c: 2, f: 'texture-formats-norm16-webgl' },
|
|
143
|
+
'r32uint': { gl: GL.R32UI, b: 4, c: 1, bpp: 4 },
|
|
144
|
+
'r32sint': { gl: GL.R32I, b: 4, c: 1, bpp: 4 },
|
|
145
|
+
'r32float': { gl: GL.R32F, bpp: 4, b: 4, c: 1, render: 'texture-renderable-float32-webgl', filter: 'texture-filter-linear-float32-webgl' },
|
|
146
|
+
// Packed 32-bit formats
|
|
147
|
+
'rgb9e5ufloat': { gl: GL.RGB9_E5, b: 4, c: 3, p: 1, render: 'texture-renderable-float16-webgl', filter: 'texture-filter-linear-float16-webgl' },
|
|
148
|
+
'rg11b10ufloat': { gl: GL.R11F_G11F_B10F, b: 4, c: 3, p: 1, render: 'texture-renderable-float32-webgl' },
|
|
149
|
+
'rgb10a2unorm': { gl: GL.RGB10_A2, b: 4, c: 4, p: 1 },
|
|
150
|
+
// webgl2 only
|
|
151
|
+
'rgb10a2unorm-webgl': { b: 4, c: 4, gl: GL.RGB10_A2UI, p: 1, wgpu: false, bpp: 4 },
|
|
152
|
+
// 48-bit formats
|
|
153
|
+
'rgb16unorm-webgl': { gl: GL.RGB16_EXT, b: 2, c: 3, f: 'texture-formats-norm16-webgl' },
|
|
154
|
+
'rgb16snorm-webgl': { gl: GL.RGB16_SNORM_EXT, b: 2, c: 3, f: 'texture-formats-norm16-webgl' },
|
|
155
|
+
// 64-bit formats
|
|
156
|
+
'rg32uint': { gl: GL.RG32UI, b: 8, c: 2 },
|
|
157
|
+
'rg32sint': { gl: GL.RG32I, b: 8, c: 2 },
|
|
158
|
+
'rg32float': { gl: GL.RG32F, b: 8, c: 2, render: 'texture-renderable-float32-webgl', filter: 'texture-filter-linear-float32-webgl' },
|
|
159
|
+
'rgba16uint': { gl: GL.RGBA16UI, b: 8, c: 4 },
|
|
160
|
+
'rgba16sint': { gl: GL.RGBA16I, b: 8, c: 4 },
|
|
161
|
+
'rgba16float': { gl: GL.RGBA16F, gl1: GL.RGBA, b: 8, c: 4, render: 'texture-renderable-float16-webgl', filter: 'texture-filter-linear-float16-webgl' },
|
|
162
|
+
'rgba16unorm-webgl': { gl: GL.RGBA16_EXT, b: 2, c: 4, f: 'texture-formats-norm16-webgl' },
|
|
163
|
+
'rgba16snorm-webgl': { gl: GL.RGBA16_SNORM_EXT, b: 2, c: 4, f: 'texture-formats-norm16-webgl' },
|
|
164
|
+
// 96-bit formats (deprecated!)
|
|
165
|
+
'rgb32float-webgl': { gl: GL.RGB32F, gl1: GL.RGB, render: 'texture-renderable-float32-webgl', filter: 'texture-filter-linear-float32-webgl',
|
|
166
|
+
gl2ext: EXT_FLOAT_RENDER_WEBGL2, gl1ext: EXT_FLOAT_WEBGL1,
|
|
167
|
+
dataFormat: GL.RGB, types: [GL.FLOAT] },
|
|
168
|
+
// 128-bit formats
|
|
169
|
+
'rgba32uint': { gl: GL.RGBA32UI, b: 16, c: 4 },
|
|
170
|
+
'rgba32sint': { gl: GL.RGBA32I, b: 16, c: 4 },
|
|
171
|
+
'rgba32float': { gl: GL.RGBA32F, gl1: GL.RGBA, b: 16, c: 4, render: 'texture-renderable-float32-webgl', filter: 'texture-filter-linear-float32-webgl' },
|
|
172
|
+
// Depth and stencil formats
|
|
173
|
+
'stencil8': { gl: GL.STENCIL_INDEX8, b: 1, c: 1, attachment: GL.STENCIL_ATTACHMENT },
|
|
174
|
+
'depth16unorm': { gl: GL.DEPTH_COMPONENT16, gl1: GL.DEPTH_COMPONENT16, b: 2, c: 1, attachment: GL.DEPTH_ATTACHMENT },
|
|
175
|
+
'depth24plus': { gl: GL.DEPTH_COMPONENT24, b: 3, c: 1, attachment: GL.DEPTH_ATTACHMENT },
|
|
176
|
+
'depth32float': { gl: GL.DEPTH_COMPONENT32F, b: 4, c: 1, attachment: GL.DEPTH_ATTACHMENT },
|
|
177
|
+
'depth24plus-stencil8': { b: 4, gl: GL.UNSIGNED_INT_24_8, gl1: GL.DEPTH_STENCIL, c: 2, p: 1, attachment: GL.DEPTH_STENCIL_ATTACHMENT },
|
|
178
|
+
// "depth24unorm-stencil8" feature
|
|
179
|
+
'depth24unorm-stencil8': { gl: GL.DEPTH24_STENCIL8, b: 4, c: 2, p: 1, attachment: GL.DEPTH_STENCIL_ATTACHMENT },
|
|
180
|
+
// "depth32float-stencil8" feature
|
|
181
|
+
"depth32float-stencil8": { gl: GL.DEPTH32F_STENCIL8, b: 5, c: 2, p: 1, attachment: GL.DEPTH_STENCIL_ATTACHMENT },
|
|
182
|
+
// BC compressed formats: check device.features.has("texture-compression-bc");
|
|
183
|
+
'bc1-rgb-unorm-webgl': { gl: GL.COMPRESSED_RGB_S3TC_DXT1_EXT, x: X_S3TC, f: texture_compression_bc },
|
|
184
|
+
'bc1-rgb-unorm-srgb-webgl': { gl: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
185
|
+
'bc1-rgba-unorm': { gl: GL.COMPRESSED_RGBA_S3TC_DXT1_EXT, x: X_S3TC, f: texture_compression_bc },
|
|
186
|
+
'bc1-rgba-unorm-srgb': { gl: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
187
|
+
'bc2-rgba-unorm': { gl: GL.COMPRESSED_RGBA_S3TC_DXT3_EXT, x: X_S3TC, f: texture_compression_bc },
|
|
188
|
+
'bc2-rgba-unorm-srgb': { gl: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
189
|
+
'bc3-rgba-unorm': { gl: GL.COMPRESSED_RGBA_S3TC_DXT5_EXT, x: X_S3TC, f: texture_compression_bc },
|
|
190
|
+
'bc3-rgba-unorm-srgb': { gl: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
|
|
191
|
+
'bc4-r-unorm': { gl: GL.COMPRESSED_RED_RGTC1_EXT, x: X_RGTC, f: texture_compression_bc },
|
|
192
|
+
'bc4-r-snorm': { gl: GL.COMPRESSED_SIGNED_RED_RGTC1_EXT, x: X_RGTC, f: texture_compression_bc },
|
|
193
|
+
'bc5-rg-unorm': { gl: GL.COMPRESSED_RED_GREEN_RGTC2_EXT, x: X_RGTC, f: texture_compression_bc },
|
|
194
|
+
'bc5-rg-snorm': { gl: GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, x: X_RGTC, f: texture_compression_bc },
|
|
195
|
+
'bc6h-rgb-ufloat': { gl: GL.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, x: X_BPTC, f: texture_compression_bc },
|
|
196
|
+
'bc6h-rgb-float': { gl: GL.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, x: X_BPTC, f: texture_compression_bc },
|
|
197
|
+
'bc7-rgba-unorm': { gl: GL.COMPRESSED_RGBA_BPTC_UNORM_EXT, x: X_BPTC, f: texture_compression_bc },
|
|
198
|
+
'bc7-rgba-unorm-srgb': { gl: GL.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, x: X_BPTC, f: texture_compression_bc },
|
|
199
|
+
// WEBGL_compressed_texture_etc: device.features.has("texture-compression-etc2")
|
|
200
|
+
// Note: Supposedly guaranteed availability compressed formats in WebGL2, but through CPU decompression
|
|
201
|
+
'etc2-rgb8unorm': { gl: GL.COMPRESSED_RGB8_ETC2, f: texture_compression_etc2 },
|
|
202
|
+
'etc2-rgb8unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ETC2, f: texture_compression_etc2 },
|
|
203
|
+
'etc2-rgb8a1unorm': { gl: GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, f: texture_compression_etc2 },
|
|
204
|
+
'etc2-rgb8a1unorm-srgb': { gl: GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, f: texture_compression_etc2 },
|
|
205
|
+
'etc2-rgba8unorm': { gl: GL.COMPRESSED_RGBA8_ETC2_EAC, f: texture_compression_etc2 },
|
|
206
|
+
'etc2-rgba8unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, f: texture_compression_etc2 },
|
|
207
|
+
'eac-r11unorm': { gl: GL.COMPRESSED_R11_EAC, f: texture_compression_etc2 },
|
|
208
|
+
'eac-r11snorm': { gl: GL.COMPRESSED_SIGNED_R11_EAC, f: texture_compression_etc2 },
|
|
209
|
+
'eac-rg11unorm': { gl: GL.COMPRESSED_RG11_EAC, f: texture_compression_etc2 },
|
|
210
|
+
'eac-rg11snorm': { gl: GL.COMPRESSED_SIGNED_RG11_EAC, f: texture_compression_etc2 },
|
|
211
|
+
// X_ASTC compressed formats: device.features.has("texture-compression-astc")
|
|
212
|
+
'astc-4x4-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_4x4_KHR, f: texture_compression_astc },
|
|
213
|
+
'astc-4x4-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, f: texture_compression_astc },
|
|
214
|
+
'astc-5x4-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_5x4_KHR, f: texture_compression_astc },
|
|
215
|
+
'astc-5x4-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, f: texture_compression_astc },
|
|
216
|
+
'astc-5x5-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_5x5_KHR, f: texture_compression_astc },
|
|
217
|
+
'astc-5x5-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, f: texture_compression_astc },
|
|
218
|
+
'astc-6x5-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_6x5_KHR, f: texture_compression_astc },
|
|
219
|
+
'astc-6x5-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, f: texture_compression_astc },
|
|
220
|
+
'astc-6x6-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_6x6_KHR, f: texture_compression_astc },
|
|
221
|
+
'astc-6x6-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, f: texture_compression_astc },
|
|
222
|
+
'astc-8x5-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_8x5_KHR, f: texture_compression_astc },
|
|
223
|
+
'astc-8x5-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, f: texture_compression_astc },
|
|
224
|
+
'astc-8x6-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_8x6_KHR, f: texture_compression_astc },
|
|
225
|
+
'astc-8x6-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, f: texture_compression_astc },
|
|
226
|
+
'astc-8x8-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_8x8_KHR, f: texture_compression_astc },
|
|
227
|
+
'astc-8x8-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, f: texture_compression_astc },
|
|
228
|
+
'astc-10x5-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_10x10_KHR, f: texture_compression_astc },
|
|
229
|
+
'astc-10x5-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, f: texture_compression_astc },
|
|
230
|
+
'astc-10x6-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_10x6_KHR, f: texture_compression_astc },
|
|
231
|
+
'astc-10x6-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, f: texture_compression_astc },
|
|
232
|
+
'astc-10x8-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_10x8_KHR, f: texture_compression_astc },
|
|
233
|
+
'astc-10x8-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, f: texture_compression_astc },
|
|
234
|
+
'astc-10x10-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_10x10_KHR, f: texture_compression_astc },
|
|
235
|
+
'astc-10x10-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, f: texture_compression_astc },
|
|
236
|
+
'astc-12x10-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_12x10_KHR, f: texture_compression_astc },
|
|
237
|
+
'astc-12x10-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, f: texture_compression_astc },
|
|
238
|
+
'astc-12x12-unorm': { gl: GL.COMPRESSED_RGBA_ASTC_12x12_KHR, f: texture_compression_astc },
|
|
239
|
+
'astc-12x12-unorm-srgb': { gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, f: texture_compression_astc },
|
|
240
|
+
// WEBGL_compressed_texture_pvrtc
|
|
241
|
+
'pvrtc-rgb4unorm-webgl': { gl: GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG, f: texture_compression_pvrtc_webgl },
|
|
242
|
+
'pvrtc-rgba4unorm-webgl': { gl: GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, f: texture_compression_pvrtc_webgl },
|
|
243
|
+
'pvrtc-rbg2unorm-webgl': { gl: GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG, f: texture_compression_pvrtc_webgl },
|
|
244
|
+
'pvrtc-rgba2unorm-webgl': { gl: GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, f: texture_compression_pvrtc_webgl },
|
|
245
|
+
// WEBGL_compressed_texture_etc1
|
|
246
|
+
'etc1-rbg-unorm-webgl': { gl: GL.COMPRESSED_RGB_ETC1_WEBGL, f: texture_compression_etc1_webgl },
|
|
247
|
+
// WEBGL_compressed_texture_atc
|
|
248
|
+
'atc-rgb-unorm-webgl': { gl: GL.COMPRESSED_RGB_ATC_WEBGL, f: texture_compression_atc_webgl },
|
|
249
|
+
'atc-rgba-unorm-webgl': { gl: GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL, f: texture_compression_atc_webgl },
|
|
250
|
+
'atc-rgbai-unorm-webgl': { gl: GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL, f: texture_compression_atc_webgl }
|
|
697
251
|
};
|
|
698
|
-
|
|
252
|
+
// FUNCTIONS
|
|
699
253
|
function getTextureFormat(format) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
return entry[0];
|
|
254
|
+
if (typeof format === 'string') {
|
|
255
|
+
return format;
|
|
256
|
+
}
|
|
257
|
+
const entry = Object.entries(TEXTURE_FORMATS).find(([, entry]) => (entry.gl === format || entry.gl1 === format));
|
|
258
|
+
if (!entry) {
|
|
259
|
+
throw new Error(`Unknown texture format ${format}`);
|
|
260
|
+
}
|
|
261
|
+
return entry[0];
|
|
711
262
|
}
|
|
712
|
-
|
|
263
|
+
/** Checks if a texture format is supported */
|
|
713
264
|
export function isTextureFormatSupported(gl, formatOrGL) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
265
|
+
const format = getTextureFormat(formatOrGL);
|
|
266
|
+
const info = TEXTURE_FORMATS[format];
|
|
267
|
+
if (!info) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
// Check that we have a GL constant
|
|
271
|
+
if (isWebGL2(gl) ? info.gl === undefined : info.gl1 === undefined) {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
// Check extensions
|
|
275
|
+
const extension = info.x || (isWebGL2(gl) ? info.gl2ext || info.gl1ext : info.gl1ext);
|
|
276
|
+
if (extension) {
|
|
277
|
+
return Boolean(gl.getExtension(extension));
|
|
278
|
+
}
|
|
279
|
+
// if (info.gl1 === undefined && info.gl2 === undefined) {
|
|
280
|
+
// // No info - always supported
|
|
281
|
+
// }
|
|
282
|
+
return true;
|
|
732
283
|
}
|
|
284
|
+
/** Checks if a texture format is supported */
|
|
733
285
|
export function getTextureFormatSupport(gl, formatOrGL) {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
286
|
+
const format = getTextureFormat(formatOrGL);
|
|
287
|
+
const info = TEXTURE_FORMATS[format];
|
|
288
|
+
if (!info) {
|
|
289
|
+
return { supported: false };
|
|
290
|
+
}
|
|
291
|
+
// let decoded;
|
|
292
|
+
// try {
|
|
293
|
+
// decoded = decodeTextureFormat(format);
|
|
294
|
+
// } catch {}
|
|
295
|
+
// Support Check that we have a GL constant
|
|
296
|
+
let supported = isWebGL2(gl) ? info.gl === undefined : info.gl1 === undefined;
|
|
297
|
+
supported = supported && checkTextureFeatures(gl, [info.f]);
|
|
298
|
+
// Filtering
|
|
299
|
+
// const filterable = info.filter
|
|
300
|
+
// ? checkTextureFeatures(gl, [info.filter])
|
|
301
|
+
// : decoded && !decoded.signed;
|
|
302
|
+
// const renderable = info.filter
|
|
303
|
+
// ? checkTextureFeatures(gl, [info.render])
|
|
304
|
+
// : decoded && !decoded.signed;
|
|
738
305
|
return {
|
|
739
|
-
|
|
306
|
+
supported,
|
|
307
|
+
renderable: supported && checkTextureFeatures(gl, [info.render]),
|
|
308
|
+
filterable: supported && checkTextureFeatures(gl, [info.filter]),
|
|
309
|
+
blendable: false,
|
|
310
|
+
storable: false
|
|
740
311
|
};
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
let supported = isWebGL2(gl) ? info.gl === undefined : info.gl1 === undefined;
|
|
744
|
-
supported = supported && checkTextureFeatures(gl, [info.f]);
|
|
745
|
-
return {
|
|
746
|
-
supported,
|
|
747
|
-
renderable: supported && checkTextureFeatures(gl, [info.render]),
|
|
748
|
-
filterable: supported && checkTextureFeatures(gl, [info.filter]),
|
|
749
|
-
blendable: false,
|
|
750
|
-
storable: false
|
|
751
|
-
};
|
|
752
312
|
}
|
|
313
|
+
/** Checks whether linear filtering (interpolated sampling) is available for floating point textures */
|
|
753
314
|
export function isTextureFormatFilterable(gl, formatOrGL) {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
return false;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
try {
|
|
761
|
-
const decoded = decodeTextureFormat(format);
|
|
762
|
-
|
|
763
|
-
if (decoded.signed) {
|
|
764
|
-
return false;
|
|
315
|
+
const format = getTextureFormat(formatOrGL);
|
|
316
|
+
if (!isTextureFormatSupported(gl, format)) {
|
|
317
|
+
return false;
|
|
765
318
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
319
|
+
try {
|
|
320
|
+
const decoded = decodeTextureFormat(format);
|
|
321
|
+
if (decoded.signed) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
if (format.endsWith('32float')) {
|
|
329
|
+
return Boolean(gl.getExtension('OES_texture_float_linear'));
|
|
330
|
+
}
|
|
331
|
+
if (format.endsWith('16float')) {
|
|
332
|
+
return Boolean(gl.getExtension('OES_texture_half_float_linear'));
|
|
333
|
+
}
|
|
334
|
+
// if (typeof format === 'string') {
|
|
335
|
+
// if (format === 'rgba32float') {
|
|
336
|
+
// return gl.device.features.has('texture-renderable-rgba32float-webgl');
|
|
337
|
+
// }
|
|
338
|
+
// if (format.endsWith('32float')) {
|
|
339
|
+
// return gl.device.features.has('texture-renderable-float32-webgl');
|
|
340
|
+
// }
|
|
341
|
+
// if (format.endsWith('16float')) {
|
|
342
|
+
// return gl.device.features.has('texture-renderable-float16-webgl');
|
|
343
|
+
// }
|
|
344
|
+
// }
|
|
345
|
+
return true;
|
|
779
346
|
}
|
|
780
347
|
export function isTextureFormatRenderable(gl, formatOrGL) {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
return true;
|
|
348
|
+
const format = getTextureFormat(formatOrGL);
|
|
349
|
+
if (!isTextureFormatSupported(gl, format)) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
if (typeof format === 'number') {
|
|
353
|
+
return false; // isTextureFormatFilterableWebGL(gl, format);
|
|
354
|
+
}
|
|
355
|
+
// TODO depends on device...
|
|
356
|
+
return true;
|
|
792
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Converts WebGPU string style texture formats to GL constants
|
|
360
|
+
* Pass through GL constants
|
|
361
|
+
*/
|
|
793
362
|
export function getWebGLTextureFormat(gl, formatOrGL) {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
return webglFormat;
|
|
363
|
+
const format = getTextureFormat(formatOrGL);
|
|
364
|
+
const formatInfo = TEXTURE_FORMATS[format];
|
|
365
|
+
const webglFormat = isWebGL2(gl) ? formatInfo?.gl : formatInfo?.gl1;
|
|
366
|
+
// Remap or pass through
|
|
367
|
+
if (typeof format === 'number') {
|
|
368
|
+
return webglFormat || format;
|
|
369
|
+
}
|
|
370
|
+
if (webglFormat === undefined) {
|
|
371
|
+
throw new Error(`Unsupported texture format ${format}`);
|
|
372
|
+
}
|
|
373
|
+
return webglFormat;
|
|
807
374
|
}
|
|
808
375
|
export function getWebGLTextureParameters(gl, formatOrGL) {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
376
|
+
const format = getTextureFormat(formatOrGL);
|
|
377
|
+
const webglFormat = getWebGLTextureFormat(gl, format);
|
|
378
|
+
const decoded = decodeTextureFormat(format);
|
|
379
|
+
return {
|
|
380
|
+
format: webglFormat,
|
|
381
|
+
dataFormat: getWebGLPixelDataFormat(decoded.format, decoded.integer, decoded.normalized, webglFormat),
|
|
382
|
+
type: getWebGLDataType(decoded.dataType),
|
|
383
|
+
// @ts-expect-error
|
|
384
|
+
compressed: decoded.compressed
|
|
385
|
+
};
|
|
818
386
|
}
|
|
819
387
|
export function getWebGLDepthStencilAttachment(formatOrGL) {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
return attachment;
|
|
388
|
+
const format = getTextureFormat(formatOrGL);
|
|
389
|
+
if (typeof format === 'number') {
|
|
390
|
+
// TODO
|
|
391
|
+
throw new Error('unsupported depth stencil format');
|
|
392
|
+
}
|
|
393
|
+
const info = TEXTURE_FORMATS[format];
|
|
394
|
+
const attachment = info.attachment;
|
|
395
|
+
if (!attachment) {
|
|
396
|
+
throw new Error('not a depth stencil format');
|
|
397
|
+
}
|
|
398
|
+
return attachment;
|
|
834
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* function to test if Float 32 bit format texture can be bound as color attachment
|
|
402
|
+
* @todo Generalize to check arbitrary formats?
|
|
403
|
+
*/
|
|
835
404
|
export function _checkFloat32ColorAttachment(gl, internalFormat = gl.RGBA, srcFormat = GL.RGBA, srcType = GL.UNSIGNED_BYTE) {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
405
|
+
let texture = null;
|
|
406
|
+
let framebuffer = null;
|
|
407
|
+
try {
|
|
408
|
+
texture = gl.createTexture();
|
|
409
|
+
gl.bindTexture(GL.TEXTURE_2D, texture);
|
|
410
|
+
const level = 0;
|
|
411
|
+
const width = 1;
|
|
412
|
+
const height = 1;
|
|
413
|
+
const border = 0;
|
|
414
|
+
const pixel = new Uint8Array([0, 0, 255, 255]); // opaque blue
|
|
415
|
+
gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, width, height, border, srcFormat, srcType, pixel);
|
|
416
|
+
framebuffer = gl.createFramebuffer();
|
|
417
|
+
gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer);
|
|
418
|
+
gl.framebufferTexture2D(GL.FRAMEBUFFER, GL.COLOR_ATTACHMENT0, GL.TEXTURE_2D, texture, 0);
|
|
419
|
+
const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER) === GL.FRAMEBUFFER_COMPLETE;
|
|
420
|
+
gl.bindTexture(GL.TEXTURE_2D, null);
|
|
421
|
+
return status;
|
|
422
|
+
}
|
|
423
|
+
finally {
|
|
424
|
+
gl.deleteTexture(texture);
|
|
425
|
+
gl.deleteFramebuffer(framebuffer);
|
|
426
|
+
}
|
|
858
427
|
}
|
|
428
|
+
/** @deprecated should be removed */
|
|
859
429
|
const DATA_FORMAT_CHANNELS = {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
430
|
+
[GL.RED]: 1,
|
|
431
|
+
[GL.RED_INTEGER]: 1,
|
|
432
|
+
[GL.RG]: 2,
|
|
433
|
+
[GL.RG_INTEGER]: 2,
|
|
434
|
+
[GL.RGB]: 3,
|
|
435
|
+
[GL.RGB_INTEGER]: 3,
|
|
436
|
+
[GL.RGBA]: 4,
|
|
437
|
+
[GL.RGBA_INTEGER]: 4,
|
|
438
|
+
[GL.DEPTH_COMPONENT]: 1,
|
|
439
|
+
[GL.DEPTH_STENCIL]: 1,
|
|
440
|
+
[GL.ALPHA]: 1,
|
|
441
|
+
[GL.LUMINANCE]: 1,
|
|
442
|
+
[GL.LUMINANCE_ALPHA]: 2
|
|
873
443
|
};
|
|
444
|
+
/** @deprecated should be removed */
|
|
874
445
|
const TYPE_SIZES = {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
446
|
+
[GL.FLOAT]: 4,
|
|
447
|
+
[GL.UNSIGNED_INT]: 4,
|
|
448
|
+
[GL.INT]: 4,
|
|
449
|
+
[GL.UNSIGNED_SHORT]: 2,
|
|
450
|
+
[GL.SHORT]: 2,
|
|
451
|
+
[GL.HALF_FLOAT]: 2,
|
|
452
|
+
[GL.BYTE]: 1,
|
|
453
|
+
[GL.UNSIGNED_BYTE]: 1
|
|
883
454
|
};
|
|
455
|
+
/** TODO - VERY roundabout legacy way of calculating bytes per pixel */
|
|
884
456
|
export function getTextureFormatBytesPerPixel(gl, formatOrGL) {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
457
|
+
const format = getTextureFormat(formatOrGL);
|
|
458
|
+
const params = getWebGLTextureParameters(gl, format);
|
|
459
|
+
// NOTE(Tarek): Default to RGBA bytes
|
|
460
|
+
const channels = DATA_FORMAT_CHANNELS[params.dataFormat] || 4;
|
|
461
|
+
const channelSize = TYPE_SIZES[params.type] || 1;
|
|
462
|
+
return channels * channelSize;
|
|
890
463
|
}
|
|
891
|
-
|
|
464
|
+
// DATA TYPE HELPERS
|
|
892
465
|
function getWebGLPixelDataFormat(dataFormat, integer, normalized, format) {
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
return integer && !normalized ? GL.RGB_INTEGER : GL.RGB;
|
|
906
|
-
|
|
907
|
-
case 'rgba':
|
|
908
|
-
return integer && !normalized ? GL.RGBA_INTEGER : GL.RGBA;
|
|
909
|
-
|
|
910
|
-
default:
|
|
911
|
-
return GL.RGBA;
|
|
912
|
-
}
|
|
466
|
+
// WebGL1 formats use same internalFormat
|
|
467
|
+
if (format === GL.RGBA || format === GL.RGB) {
|
|
468
|
+
return format;
|
|
469
|
+
}
|
|
470
|
+
// prettier-ignore
|
|
471
|
+
switch (dataFormat) {
|
|
472
|
+
case 'r': return integer && !normalized ? GL.RED_INTEGER : GL.RED;
|
|
473
|
+
case 'rg': return integer && !normalized ? GL.RG_INTEGER : GL.RG;
|
|
474
|
+
case 'rgb': return integer && !normalized ? GL.RGB_INTEGER : GL.RGB;
|
|
475
|
+
case 'rgba': return integer && !normalized ? GL.RGBA_INTEGER : GL.RGBA;
|
|
476
|
+
default: return GL.RGBA;
|
|
477
|
+
}
|
|
913
478
|
}
|
|
914
|
-
|
|
915
479
|
export function getWebGLDataType(dataType) {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
case 'uint32':
|
|
930
|
-
return GL.UNSIGNED_INT;
|
|
931
|
-
|
|
932
|
-
case 'sint32':
|
|
933
|
-
return GL.INT;
|
|
934
|
-
|
|
935
|
-
case 'float16':
|
|
936
|
-
return GL.HALF_FLOAT;
|
|
937
|
-
|
|
938
|
-
case 'float32':
|
|
939
|
-
return GL.FLOAT;
|
|
940
|
-
|
|
941
|
-
default:
|
|
942
|
-
return GL.UNSIGNED_BYTE;
|
|
943
|
-
}
|
|
480
|
+
// prettier-ignore
|
|
481
|
+
switch (dataType) {
|
|
482
|
+
case 'uint8': return GL.UNSIGNED_BYTE;
|
|
483
|
+
case 'sint8': return GL.BYTE;
|
|
484
|
+
case 'uint16': return GL.UNSIGNED_SHORT;
|
|
485
|
+
case 'sint16': return GL.SHORT;
|
|
486
|
+
case 'uint32': return GL.UNSIGNED_INT;
|
|
487
|
+
case 'sint32': return GL.INT;
|
|
488
|
+
case 'float16': return GL.HALF_FLOAT;
|
|
489
|
+
case 'float32': return GL.FLOAT;
|
|
490
|
+
default: return GL.UNSIGNED_BYTE;
|
|
491
|
+
}
|
|
944
492
|
}
|
|
945
|
-
//# sourceMappingURL=texture-formats.js.map
|