@luma.gl/webgl 9.0.0-alpha.16 → 9.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +117 -200
- package/dist/adapter/converters/device-parameters.js.map +1 -0
- 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 +172 -62
- package/dist/adapter/converters/renderbuffer-formats.js.map +1 -0
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +151 -149
- package/dist/adapter/converters/sampler-parameters.js.map +1 -0
- 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 +847 -438
- package/dist/adapter/converters/texture-formats.js.map +1 -0
- package/dist/adapter/converters/vertex-formats.js +24 -15
- package/dist/adapter/converters/vertex-formats.js.map +1 -0
- package/dist/adapter/device-helpers/device-features.js +84 -120
- package/dist/adapter/device-helpers/device-features.js.map +1 -0
- 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 +83 -88
- package/dist/adapter/device-helpers/device-limits.js.map +1 -0
- package/dist/adapter/device-helpers/get-device-info.js +37 -42
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -0
- package/dist/adapter/device-helpers/is-old-ie.js +8 -10
- package/dist/adapter/device-helpers/is-old-ie.js.map +1 -0
- package/dist/adapter/helpers/attribute-utils.js +57 -50
- package/dist/adapter/helpers/attribute-utils.js.map +1 -0
- package/dist/adapter/helpers/get-shader-info.d.ts +1 -1
- package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-info.js +19 -21
- package/dist/adapter/helpers/get-shader-info.js.map +1 -0
- package/dist/adapter/helpers/get-shader-layout.js +251 -310
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -0
- package/dist/adapter/helpers/parse-shader-compiler-log.js +26 -32
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -0
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +80 -67
- package/dist/adapter/helpers/set-uniform.js.map +1 -0
- package/dist/adapter/helpers/uniforms.js +75 -80
- package/dist/adapter/helpers/uniforms.js.map +1 -0
- package/dist/adapter/objects/constants-to-keys.js +26 -33
- package/dist/adapter/objects/constants-to-keys.js.map +1 -0
- 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 +70 -67
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -0
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +158 -213
- package/dist/adapter/objects/webgl-resource.js.map +1 -0
- 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 +66 -74
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -0
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +118 -150
- package/dist/adapter/resources/webgl-buffer.js.map +1 -0
- 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 +41 -40
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -0
- package/dist/adapter/resources/webgl-command-encoder.js +37 -26
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -0
- package/dist/adapter/resources/webgl-external-texture.js +1 -91
- package/dist/adapter/resources/webgl-external-texture.js.map +1 -0
- 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 +198 -231
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -0
- package/dist/adapter/resources/webgl-render-pass.js +11 -8
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -0
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +289 -316
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -0
- package/dist/adapter/resources/webgl-sampler.js +35 -42
- package/dist/adapter/resources/webgl-sampler.js.map +1 -0
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +53 -57
- package/dist/adapter/resources/webgl-shader.js.map +1 -0
- package/dist/adapter/resources/webgl-texture.d.ts +4 -4
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +697 -661
- package/dist/adapter/resources/webgl-texture.js.map +1 -0
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +35 -55
- package/dist/adapter/webgl-canvas-context.js.map +1 -0
- package/dist/adapter/webgl-device.d.ts +5 -0
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +270 -287
- package/dist/adapter/webgl-device.js.map +1 -0
- package/dist/classic/accessor.js +103 -120
- package/dist/classic/accessor.js.map +1 -0
- package/dist/classic/buffer.d.ts +1 -1
- package/dist/classic/buffer.d.ts.map +1 -1
- package/dist/classic/buffer.js +300 -325
- package/dist/classic/buffer.js.map +1 -0
- 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 +81 -91
- package/dist/classic/typed-array-utils.js.map +1 -0
- package/dist/context/context/create-browser-context.d.ts +3 -1
- package/dist/context/context/create-browser-context.d.ts.map +1 -1
- package/dist/context/context/create-browser-context.js +49 -66
- package/dist/context/context/create-browser-context.js.map +1 -0
- 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 +30 -24
- package/dist/context/context/create-headless-context.js.map +1 -0
- package/dist/context/context/webgl-checks.js +17 -25
- package/dist/context/context/webgl-checks.js.map +1 -0
- package/dist/context/debug/spector.d.ts +3 -1
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +50 -53
- package/dist/context/debug/spector.js.map +1 -0
- 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 +76 -107
- package/dist/context/debug/webgl-developer-tools.js.map +1 -0
- package/dist/context/parameters/unified-parameter-api.js +46 -93
- package/dist/context/parameters/unified-parameter-api.js.map +1 -0
- 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 +404 -462
- package/dist/context/parameters/webgl-parameter-tables.js.map +1 -0
- package/dist/context/polyfill/context-data.js +10 -16
- package/dist/context/polyfill/context-data.js.map +1 -0
- package/dist/context/polyfill/get-parameter-polyfill.js +71 -91
- package/dist/context/polyfill/get-parameter-polyfill.js.map +1 -0
- package/dist/context/polyfill/polyfill-context.js +73 -75
- package/dist/context/polyfill/polyfill-context.js.map +1 -0
- package/dist/context/polyfill/polyfill-table.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-table.js +116 -133
- package/dist/context/polyfill/polyfill-table.js.map +1 -0
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +1 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js +227 -255
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +1 -0
- package/dist/context/state-tracker/deep-array-equal.js +14 -16
- package/dist/context/state-tracker/deep-array-equal.js.map +1 -0
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +127 -183
- package/dist/context/state-tracker/track-context-state.js.map +1 -0
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +29 -43
- package/dist/context/state-tracker/with-parameters.js.map +1 -0
- package/dist/dist.dev.js +9205 -0
- package/dist/index.cjs +5948 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -41
- package/dist/index.js.map +1 -0
- package/dist/types/webgl.d.ts +16 -16
- package/dist/types/webgl.d.ts.map +1 -1
- package/dist/types/webgl.js +1 -0
- package/dist/types/webgl.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist.min.js +36 -0
- package/package.json +18 -9
- package/src/adapter/converters/device-parameters.ts +5 -2
- package/src/adapter/converters/sampler-parameters.ts +4 -2
- package/src/adapter/converters/texture-formats.ts +3 -1
- package/src/adapter/device-helpers/get-device-info.ts +8 -8
- package/src/adapter/helpers/get-shader-info.ts +1 -1
- package/src/adapter/helpers/get-shader-layout.ts +4 -4
- package/src/adapter/helpers/parse-shader-compiler-log.ts +1 -1
- package/src/adapter/helpers/set-uniform.ts +2 -0
- package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
- package/src/adapter/objects/webgl-resource.ts +1 -1
- package/src/adapter/objects/webgl-vertex-array-object.ts +1 -1
- package/src/adapter/resources/webgl-buffer.ts +6 -6
- package/src/adapter/resources/webgl-command-encoder.ts +1 -1
- package/src/adapter/resources/webgl-framebuffer.ts +3 -4
- package/src/adapter/resources/webgl-render-pipeline.ts +19 -20
- package/src/adapter/resources/webgl-shader.ts +1 -1
- package/src/adapter/resources/webgl-texture.ts +8 -9
- package/src/adapter/webgl-canvas-context.ts +2 -2
- package/src/adapter/webgl-device.ts +12 -2
- package/src/classic/accessor.ts +1 -1
- package/src/classic/buffer.ts +3 -3
- package/src/classic/typed-array-utils.ts +1 -1
- package/src/context/context/create-browser-context.ts +4 -2
- package/src/context/context/create-headless-context.ts +2 -2
- package/src/context/debug/spector.ts +5 -4
- package/src/context/debug/webgl-developer-tools.ts +1 -0
- package/src/context/polyfill/polyfill-table.ts +1 -0
- package/src/context/polyfill/polyfill-vertex-array-object.ts +2 -0
- package/src/context/state-tracker/track-context-state.ts +6 -5
- package/src/context/state-tracker/with-parameters.ts +1 -1
- package/src/index.ts +1 -5
- package/src/types/webgl.ts +2 -0
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -4
- package/dist/dist.min.js +0 -1
- package/dist/es5/adapter/converters/device-parameters.js +0 -139
- package/dist/es5/adapter/converters/device-parameters.js.map +0 -1
- package/dist/es5/adapter/converters/renderbuffer-formats.js +0 -151
- package/dist/es5/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/es5/adapter/converters/sampler-parameters.js +0 -182
- package/dist/es5/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/es5/adapter/converters/texture-formats.js +0 -950
- package/dist/es5/adapter/converters/texture-formats.js.map +0 -1
- package/dist/es5/adapter/converters/vertex-formats.js +0 -36
- package/dist/es5/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/es5/adapter/device-helpers/device-features.js +0 -121
- package/dist/es5/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/es5/adapter/device-helpers/device-limits.js +0 -54
- package/dist/es5/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/es5/adapter/device-helpers/get-device-info.js +0 -49
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/es5/adapter/device-helpers/is-old-ie.js +0 -15
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/es5/adapter/helpers/attribute-utils.js +0 -69
- package/dist/es5/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/es5/adapter/helpers/get-shader-info.js +0 -31
- package/dist/es5/adapter/helpers/get-shader-info.js.map +0 -1
- package/dist/es5/adapter/helpers/get-shader-layout.js +0 -311
- package/dist/es5/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js +0 -54
- package/dist/es5/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/es5/adapter/helpers/set-uniform.js +0 -92
- package/dist/es5/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/es5/adapter/helpers/uniforms.js +0 -88
- package/dist/es5/adapter/helpers/uniforms.js.map +0 -1
- package/dist/es5/adapter/objects/constants-to-keys.js +0 -43
- package/dist/es5/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-renderbuffer.js +0 -122
- package/dist/es5/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-resource.js +0 -233
- package/dist/es5/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js +0 -109
- package/dist/es5/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-buffer.js +0 -196
- package/dist/es5/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-command-buffer.js +0 -70
- package/dist/es5/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-command-encoder.js +0 -80
- package/dist/es5/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-external-texture.js +0 -2
- package/dist/es5/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-framebuffer.js +0 -275
- package/dist/es5/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-render-pass.js +0 -45
- package/dist/es5/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-render-pipeline.js +0 -385
- package/dist/es5/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-sampler.js +0 -75
- package/dist/es5/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-shader.js +0 -111
- package/dist/es5/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/es5/adapter/resources/webgl-texture.js +0 -826
- package/dist/es5/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/es5/adapter/webgl-canvas-context.js +0 -72
- package/dist/es5/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/es5/adapter/webgl-device.js +0 -387
- package/dist/es5/adapter/webgl-device.js.map +0 -1
- package/dist/es5/bundle.js +0 -6
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/classic/accessor.js +0 -151
- package/dist/es5/classic/accessor.js.map +0 -1
- package/dist/es5/classic/buffer.js +0 -398
- package/dist/es5/classic/buffer.js.map +0 -1
- package/dist/es5/classic/typed-array-utils.js +0 -99
- package/dist/es5/classic/typed-array-utils.js.map +0 -1
- package/dist/es5/context/context/create-browser-context.js +0 -66
- package/dist/es5/context/context/create-browser-context.js.map +0 -1
- package/dist/es5/context/context/create-headless-context.js +0 -47
- package/dist/es5/context/context/create-headless-context.js.map +0 -1
- package/dist/es5/context/context/webgl-checks.js +0 -44
- package/dist/es5/context/context/webgl-checks.js.map +0 -1
- package/dist/es5/context/debug/spector.js +0 -99
- package/dist/es5/context/debug/spector.js.map +0 -1
- package/dist/es5/context/debug/webgl-developer-tools.js +0 -146
- package/dist/es5/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/es5/context/parameters/unified-parameter-api.js +0 -76
- package/dist/es5/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/es5/context/parameters/webgl-parameter-tables.js +0 -346
- package/dist/es5/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/es5/context/polyfill/context-data.js +0 -18
- package/dist/es5/context/polyfill/context-data.js.map +0 -1
- package/dist/es5/context/polyfill/get-parameter-polyfill.js +0 -69
- package/dist/es5/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-context.js +0 -109
- package/dist/es5/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-table.js +0 -143
- package/dist/es5/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js +0 -271
- package/dist/es5/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/es5/context/state-tracker/deep-array-equal.js +0 -23
- package/dist/es5/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/es5/context/state-tracker/track-context-state.js +0 -167
- package/dist/es5/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/es5/context/state-tracker/with-parameters.js +0 -40
- package/dist/es5/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/es5/index.js +0 -249
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/init.js +0 -7
- package/dist/es5/init.js.map +0 -1
- package/dist/es5/types/webgl.js +0 -5
- package/dist/es5/types/webgl.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/es5/types.js.map +0 -1
- package/dist/esm/adapter/converters/device-parameters.js +0 -137
- package/dist/esm/adapter/converters/device-parameters.js.map +0 -1
- package/dist/esm/adapter/converters/renderbuffer-formats.js +0 -181
- package/dist/esm/adapter/converters/renderbuffer-formats.js.map +0 -1
- package/dist/esm/adapter/converters/sampler-parameters.js +0 -172
- package/dist/esm/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/esm/adapter/converters/texture-formats.js +0 -901
- package/dist/esm/adapter/converters/texture-formats.js.map +0 -1
- package/dist/esm/adapter/converters/vertex-formats.js +0 -29
- package/dist/esm/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/esm/adapter/device-helpers/device-features.js +0 -95
- package/dist/esm/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/esm/adapter/device-helpers/device-limits.js +0 -88
- package/dist/esm/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/esm/adapter/device-helpers/get-device-info.js +0 -42
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/esm/adapter/device-helpers/is-old-ie.js +0 -9
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/esm/adapter/helpers/attribute-utils.js +0 -64
- package/dist/esm/adapter/helpers/attribute-utils.js.map +0 -1
- package/dist/esm/adapter/helpers/get-shader-info.js +0 -25
- package/dist/esm/adapter/helpers/get-shader-info.js.map +0 -1
- package/dist/esm/adapter/helpers/get-shader-layout.js +0 -282
- package/dist/esm/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js +0 -30
- package/dist/esm/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/esm/adapter/helpers/set-uniform.js +0 -85
- package/dist/esm/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/esm/adapter/helpers/uniforms.js +0 -89
- package/dist/esm/adapter/helpers/uniforms.js.map +0 -1
- package/dist/esm/adapter/objects/constants-to-keys.js +0 -35
- package/dist/esm/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-renderbuffer.js +0 -78
- package/dist/esm/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-resource.js +0 -163
- package/dist/esm/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js +0 -74
- package/dist/esm/adapter/objects/webgl-vertex-array-object.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-buffer.js +0 -134
- package/dist/esm/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-command-buffer.js +0 -50
- package/dist/esm/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-command-encoder.js +0 -41
- package/dist/esm/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-external-texture.js +0 -2
- package/dist/esm/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-framebuffer.js +0 -207
- package/dist/esm/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-render-pass.js +0 -14
- package/dist/esm/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-render-pipeline.js +0 -311
- package/dist/esm/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-sampler.js +0 -42
- package/dist/esm/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-shader.js +0 -62
- package/dist/esm/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/esm/adapter/resources/webgl-texture.js +0 -714
- package/dist/esm/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/esm/adapter/webgl-canvas-context.js +0 -41
- package/dist/esm/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/esm/adapter/webgl-device.js +0 -276
- package/dist/esm/adapter/webgl-device.js.map +0 -1
- package/dist/esm/bundle.js +0 -4
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/classic/accessor.js +0 -120
- package/dist/esm/classic/accessor.js.map +0 -1
- package/dist/esm/classic/buffer.js +0 -327
- package/dist/esm/classic/buffer.js.map +0 -1
- package/dist/esm/classic/typed-array-utils.js +0 -92
- package/dist/esm/classic/typed-array-utils.js.map +0 -1
- package/dist/esm/context/context/create-browser-context.js +0 -53
- package/dist/esm/context/context/create-browser-context.js.map +0 -1
- package/dist/esm/context/context/create-headless-context.js +0 -39
- package/dist/esm/context/context/create-headless-context.js.map +0 -1
- package/dist/esm/context/context/webgl-checks.js +0 -31
- package/dist/esm/context/context/webgl-checks.js.map +0 -1
- package/dist/esm/context/debug/spector.js +0 -64
- package/dist/esm/context/debug/spector.js.map +0 -1
- package/dist/esm/context/debug/webgl-developer-tools.js +0 -97
- package/dist/esm/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/esm/context/parameters/unified-parameter-api.js +0 -55
- package/dist/esm/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/esm/context/parameters/webgl-parameter-tables.js +0 -427
- package/dist/esm/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/esm/context/polyfill/context-data.js +0 -12
- package/dist/esm/context/polyfill/context-data.js.map +0 -1
- package/dist/esm/context/polyfill/get-parameter-polyfill.js +0 -86
- package/dist/esm/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-context.js +0 -84
- package/dist/esm/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-table.js +0 -138
- package/dist/esm/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js +0 -265
- package/dist/esm/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/esm/context/state-tracker/deep-array-equal.js +0 -17
- package/dist/esm/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/esm/context/state-tracker/track-context-state.js +0 -148
- package/dist/esm/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/esm/context/state-tracker/with-parameters.js +0 -34
- package/dist/esm/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/esm/index.js +0 -27
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/init.js +0 -4
- package/dist/esm/init.js.map +0 -1
- package/dist/esm/types/webgl.js +0 -2
- package/dist/esm/types/webgl.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/init.d.ts +0 -2
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -3
- package/src/bundle.ts +0 -4
- package/src/init.ts +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-command-buffer.js","names":["GL","cast","value","CommandBuffer","constructor","_defineProperty","submitCommands","device","commands","arguments","length","undefined","command","name","_copyBufferToBuffer","options","_copyBufferToTexture","_copyTextureToBuffer","_copyTextureToTexture","source","destination","gl2","_options$sourceOffset","_options$destinationO","bindBuffer","COPY_READ_BUFFER","handle","COPY_WRITE_BUFFER","copyBufferSubData","sourceOffset","destinationOffset","size","Error"],"sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"sourcesContent":["import type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport WebGLDevice from '../webgl-device';\nimport WEBGLBuffer from './webgl-buffer';\n\nfunction cast<T>(value: unknown): T {\n return value as T;\n}\n\ntype CopyBufferToBufferCommand = {\n name: 'copy-buffer-to-buffer';\n options: CopyBufferToBufferOptions;\n};\n\ntype CopyBufferToTextureCommand = {\n name: 'copy-buffer-to-texture';\n options: CopyBufferToTextureOptions;\n};\n\ntype CopyTextureToBufferCommand = {\n name: 'copy-texture-to-buffer';\n options: CopyTextureToBufferOptions;\n};\n\ntype CopyTextureToTextureCommand = {\n name: 'copy-texture-to-texture';\n options: CopyTextureToTextureOptions;\n};\n\ntype Command =\n | CopyBufferToBufferCommand\n | CopyBufferToTextureCommand\n | CopyTextureToBufferCommand\n | CopyTextureToTextureCommand;\n\nexport default class CommandBuffer {\n commands: Command[] = [];\n}\n\nexport function submitCommands(device: WebGLDevice, commands: Command[] = []) {\n for (const command of commands) {\n switch (command.name) {\n case 'copy-buffer-to-buffer':\n _copyBufferToBuffer(device, command.options);\n break;\n case 'copy-buffer-to-texture':\n _copyBufferToTexture(device, command.options);\n break;\n case 'copy-texture-to-buffer':\n _copyTextureToBuffer(device, command.options);\n break;\n case 'copy-texture-to-texture':\n _copyTextureToTexture(device, command.options);\n break;\n }\n }\n}\n\nfunction _copyBufferToBuffer(device: WebGLDevice, options: CopyBufferToBufferOptions): void {\n const source = cast<WEBGLBuffer>(options.source);\n const destination = cast<WEBGLBuffer>(options.destination);\n\n const {gl2} = device;\n if (gl2) {\n // In WebGL2 we can perform the copy on the GPU\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl2.bindBuffer(GL.COPY_READ_BUFFER, source.handle);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, destination.handle);\n gl2.copyBufferSubData(\n GL.COPY_READ_BUFFER,\n GL.COPY_WRITE_BUFFER,\n options.sourceOffset ?? 0,\n options.destinationOffset ?? 0,\n options.size\n );\n gl2.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n } else {\n // TODO - in WebGL1 we would have to read back to CPU\n // read / write buffer from / to CPU\n throw new Error('copyBufferToBuffer not implemented in WebGL1');\n }\n}\n\nfunction _copyBufferToTexture(device: WebGLDevice, options: CopyBufferToTextureOptions): void {}\n\nfunction _copyTextureToBuffer(device: WebGLDevice, options: CopyTextureToBufferOptions): void {}\n\nfunction _copyTextureToTexture(device: WebGLDevice, options: CopyTextureToTextureOptions): void {}\n"],"mappings":";AAMA,OAAOA,EAAE,MAAM,oBAAoB;AAInC,SAASC,IAAIA,CAAIC,KAAc,EAAK;EAClC,OAAOA,KAAK;AACd;AA4BA,eAAe,MAAMC,aAAa,CAAC;EAAAC,YAAA;IAAAC,eAAA,mBACX,EAAE;EAAA;AAC1B;AAEA,OAAO,SAASC,cAAcA,CAACC,MAAmB,EAA4B;EAAA,IAA1BC,QAAmB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAC1E,KAAK,MAAMG,OAAO,IAAIJ,QAAQ,EAAE;IAC9B,QAAQI,OAAO,CAACC,IAAI;MAClB,KAAK,uBAAuB;QAC1BC,mBAAmB,CAACP,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC5C;MACF,KAAK,wBAAwB;QAC3BC,oBAAoB,CAACT,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC7C;MACF,KAAK,wBAAwB;QAC3BE,oBAAoB,CAACV,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC7C;MACF,KAAK,yBAAyB;QAC5BG,qBAAqB,CAACX,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC9C;IAAM;EAEZ;AACF;AAEA,SAASD,mBAAmBA,CAACP,MAAmB,EAAEQ,OAAkC,EAAQ;EAC1F,MAAMI,MAAM,GAAGlB,IAAI,CAAcc,OAAO,CAACI,MAAM,CAAC;EAChD,MAAMC,WAAW,GAAGnB,IAAI,CAAcc,OAAO,CAACK,WAAW,CAAC;EAE1D,MAAM;IAACC;EAAG,CAAC,GAAGd,MAAM;EACpB,IAAIc,GAAG,EAAE;IAAA,IAAAC,qBAAA,EAAAC,qBAAA;IAGPF,GAAG,CAACG,UAAU,CAACxB,EAAE,CAACyB,gBAAgB,EAAEN,MAAM,CAACO,MAAM,CAAC;IAClDL,GAAG,CAACG,UAAU,CAACxB,EAAE,CAAC2B,iBAAiB,EAAEP,WAAW,CAACM,MAAM,CAAC;IACxDL,GAAG,CAACO,iBAAiB,CACnB5B,EAAE,CAACyB,gBAAgB,EACnBzB,EAAE,CAAC2B,iBAAiB,GAAAL,qBAAA,GACpBP,OAAO,CAACc,YAAY,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,CAAC,GAAAC,qBAAA,GACzBR,OAAO,CAACe,iBAAiB,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,CAAC,EAC9BR,OAAO,CAACgB,IAAI,CACb;IACDV,GAAG,CAACG,UAAU,CAACxB,EAAE,CAACyB,gBAAgB,EAAE,IAAI,CAAC;IACzCJ,GAAG,CAACG,UAAU,CAACxB,EAAE,CAAC2B,iBAAiB,EAAE,IAAI,CAAC;EAC5C,CAAC,MAAM;IAGL,MAAM,IAAIK,KAAK,CAAC,8CAA8C,CAAC;EACjE;AACF;AAEA,SAAShB,oBAAoBA,CAACT,MAAmB,EAAEQ,OAAmC,EAAQ,CAAC;AAE/F,SAASE,oBAAoBA,CAACV,MAAmB,EAAEQ,OAAmC,EAAQ,CAAC;AAE/F,SAASG,qBAAqBA,CAACX,MAAmB,EAAEQ,OAAoC,EAAQ,CAAC"}
|
|
@@ -1,29 +1,40 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import { CommandEncoder } from '@luma.gl/api';
|
|
2
|
-
import CommandBuffer from
|
|
3
|
+
import CommandBuffer from "./webgl-command-buffer.js";
|
|
3
4
|
export default class WEBGLCommandEncoder extends CommandEncoder {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
constructor(device, props) {
|
|
6
|
+
super(props);
|
|
7
|
+
_defineProperty(this, "device", void 0);
|
|
8
|
+
_defineProperty(this, "commandBuffer", new CommandBuffer());
|
|
9
|
+
this.device = device;
|
|
10
|
+
}
|
|
11
|
+
destroy() {}
|
|
12
|
+
copyBufferToBuffer(options) {
|
|
13
|
+
this.commandBuffer.commands.push({
|
|
14
|
+
name: 'copy-buffer-to-buffer',
|
|
15
|
+
options
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
copyBufferToTexture(options) {
|
|
19
|
+
this.commandBuffer.commands.push({
|
|
20
|
+
name: 'copy-buffer-to-texture',
|
|
21
|
+
options
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
copyTextureToBuffer(options) {
|
|
25
|
+
this.commandBuffer.commands.push({
|
|
26
|
+
name: 'copy-texture-to-buffer',
|
|
27
|
+
options
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
copyTextureToTexture(options) {
|
|
31
|
+
this.commandBuffer.commands.push({
|
|
32
|
+
name: 'copy-texture-to-texture',
|
|
33
|
+
options
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
pushDebugGroup(groupLabel) {}
|
|
37
|
+
popDebugGroup() {}
|
|
38
|
+
insertDebugMarker(markerLabel) {}
|
|
28
39
|
}
|
|
29
|
-
|
|
40
|
+
//# sourceMappingURL=webgl-command-encoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-command-encoder.js","names":["CommandEncoder","CommandBuffer","WEBGLCommandEncoder","constructor","device","props","_defineProperty","destroy","copyBufferToBuffer","options","commandBuffer","commands","push","name","copyBufferToTexture","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps} from '@luma.gl/api';\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\n\nimport CommandBuffer from './webgl-command-buffer';\nimport WebGLDevice from '../webgl-device';\n\nexport default class WEBGLCommandEncoder extends CommandEncoder {\n readonly device: WebGLDevice;\n\n readonly commandBuffer = new CommandBuffer();\n\n constructor(device: WebGLDevice, props: CommandEncoderProps) {\n super(props);\n this.device = device;\n }\n\n override destroy(): void {}\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n // finish(options?: {id?: string}): GPUCommandBuffer;\n\n copyBufferToBuffer(options: CopyBufferToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-buffer', options});\n }\n\n copyBufferToTexture(options: CopyBufferToTextureOptions) {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-texture', options});\n }\n\n copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-buffer', options});\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-texture', options});\n }\n\n override pushDebugGroup(groupLabel: string): void {}\n override popDebugGroup() {}\n\n override insertDebugMarker(markerLabel: string): void {}\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}\n"],"mappings":";AAAA,SAAQA,cAAc,QAA4B,cAAc;AAAC,OAQ1DC,aAAa;AAGpB,eAAe,MAAMC,mBAAmB,SAASF,cAAc,CAAC;EAK9DG,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA,wBAHU,IAAIL,aAAa,EAAE;IAI1C,IAAI,CAACG,MAAM,GAAGA,MAAM;EACtB;EAESG,OAAOA,CAAA,EAAS,CAAC;EAM1BC,kBAAkBA,CAACC,OAAkC,EAAQ;IAC3D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,uBAAuB;MAAEJ;IAAO,CAAC,CAAC;EAC5E;EAEAK,mBAAmBA,CAACL,OAAmC,EAAE;IACvD,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,wBAAwB;MAAEJ;IAAO,CAAC,CAAC;EAC7E;EAEAM,mBAAmBA,CAACN,OAAmC,EAAQ;IAC7D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,wBAAwB;MAAEJ;IAAO,CAAC,CAAC;EAC7E;EAEAO,oBAAoBA,CAACP,OAAoC,EAAQ;IAC/D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,yBAAyB;MAAEJ;IAAO,CAAC,CAAC;EAC9E;EAESQ,cAAcA,CAACC,UAAkB,EAAQ,CAAC;EAC1CC,aAAaA,CAAA,EAAG,CAAC;EAEjBC,iBAAiBA,CAACC,WAAmB,EAAQ,CAAC;AAWzD"}
|
|
@@ -1,92 +1,2 @@
|
|
|
1
|
-
/*
|
|
2
|
-
export default class WEBGLExternalTexture extends WEBGLTexture {
|
|
3
|
-
readonly device: WebGLDevice;
|
|
4
|
-
readonly gl: WebGLRenderingContext;
|
|
5
|
-
readonly gl2: WebGL2RenderingContext | null;
|
|
6
|
-
readonly handle: WebGLTexture;
|
|
7
1
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
width: number = undefined;
|
|
11
|
-
height: number = undefined;
|
|
12
|
-
depth: number = undefined;
|
|
13
|
-
|
|
14
|
-
format = undefined;
|
|
15
|
-
type = undefined;
|
|
16
|
-
dataFormat = undefined;
|
|
17
|
-
border = undefined;
|
|
18
|
-
mipmaps: boolean = undefined;
|
|
19
|
-
|
|
20
|
-
textureUnit: number = undefined;
|
|
21
|
-
|
|
22
|
-
sampler: WEBGLSampler;
|
|
23
|
-
|
|
24
|
-
// Program.draw() checks the loaded flag of all textures to avoid
|
|
25
|
-
// Textures that are still loading from promises
|
|
26
|
-
// Set to true as soon as texture has been initialized with valid data
|
|
27
|
-
loaded = false;
|
|
28
|
-
_video;
|
|
29
|
-
|
|
30
|
-
readonly target: GL;
|
|
31
|
-
// target cannot be modified by bind:
|
|
32
|
-
// textures are special because when you first bind them to a target,
|
|
33
|
-
// they get special information. When you first bind a texture as a
|
|
34
|
-
// GL_TEXTURE_2D, you are actually setting special state in the texture.
|
|
35
|
-
// You are saying that this texture is a 2D texture.
|
|
36
|
-
// And it will always be a 2D texture; this state cannot be changed ever.
|
|
37
|
-
// If you have a texture that was first bound as a GL_TEXTURE_2D,
|
|
38
|
-
// you must always bind it as a GL_TEXTURE_2D;
|
|
39
|
-
// attempting to bind it as GL_TEXTURE_3D will give rise to an error
|
|
40
|
-
// (while run-time).
|
|
41
|
-
|
|
42
|
-
static isSupported(device: WebGLDevice, options?: TextureSupportOptions): boolean {
|
|
43
|
-
const {format, linearFiltering} = options;
|
|
44
|
-
let supported = true;
|
|
45
|
-
if (format) {
|
|
46
|
-
supported = supported && isFormatSupported(device.gl, format);
|
|
47
|
-
supported = supported && (!linearFiltering || isTextureFormatFilterable(device.gl, format));
|
|
48
|
-
}
|
|
49
|
-
return supported;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// eslint-disable-next-line max-statements
|
|
53
|
-
constructor(device: Device | WebGLRenderingContext, props: TextureProps) {
|
|
54
|
-
super(WebGLDevice.attach(device), {id: uid('texture'), ...props});
|
|
55
|
-
|
|
56
|
-
this.target = getWebGLTextureTarget(props);
|
|
57
|
-
|
|
58
|
-
this.device = WebGLDevice.attach(device);
|
|
59
|
-
this.gl = this.device.gl;
|
|
60
|
-
this.gl2 = this.device.gl2;
|
|
61
|
-
this.handle = this.props.handle || this.gl.createTexture();
|
|
62
|
-
|
|
63
|
-
let data = props.data;
|
|
64
|
-
|
|
65
|
-
const isVideo = typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement;
|
|
66
|
-
// @ts-expect-error
|
|
67
|
-
if (isVideo && data.readyState < HTMLVideoElement.HAVE_METADATA) {
|
|
68
|
-
this._video = null; // Declare member before the object is sealed
|
|
69
|
-
data.addEventListener('loadeddata', () => this.initialize(props));
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
update(): this {
|
|
74
|
-
if (this._video) {
|
|
75
|
-
const {video, parameters, lastTime} = this._video;
|
|
76
|
-
// @ts-expect-error
|
|
77
|
-
if (lastTime === video.currentTime || video.readyState < HTMLVideoElement.HAVE_CURRENT_DATA) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.setSubImageData({
|
|
81
|
-
data: video,
|
|
82
|
-
parameters
|
|
83
|
-
});
|
|
84
|
-
if (this.mipmaps) {
|
|
85
|
-
this.generateMipmap();
|
|
86
|
-
}
|
|
87
|
-
this._video.lastTime = video.currentTime;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|
|
2
|
+
//# sourceMappingURL=webgl-external-texture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-external-texture.js","names":[],"sources":["../../../src/adapter/resources/webgl-external-texture.ts"],"sourcesContent":["/*\nexport default class WEBGLExternalTexture extends WEBGLTexture {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLTexture;\n\n data;\n\n width: number = undefined;\n height: number = undefined;\n depth: number = undefined;\n\n format = undefined;\n type = undefined;\n dataFormat = undefined;\n border = undefined;\n mipmaps: boolean = undefined;\n\n textureUnit: number = undefined;\n\n sampler: WEBGLSampler;\n\n // Program.draw() checks the loaded flag of all textures to avoid\n // Textures that are still loading from promises\n // Set to true as soon as texture has been initialized with valid data\n loaded = false;\n _video;\n\n readonly target: GL;\n // target cannot be modified by bind:\n // textures are special because when you first bind them to a target,\n // they get special information. When you first bind a texture as a\n // GL_TEXTURE_2D, you are actually setting special state in the texture.\n // You are saying that this texture is a 2D texture.\n // And it will always be a 2D texture; this state cannot be changed ever.\n // If you have a texture that was first bound as a GL_TEXTURE_2D,\n // you must always bind it as a GL_TEXTURE_2D;\n // attempting to bind it as GL_TEXTURE_3D will give rise to an error\n // (while run-time).\n\n static isSupported(device: WebGLDevice, options?: TextureSupportOptions): boolean {\n const {format, linearFiltering} = options;\n let supported = true;\n if (format) {\n supported = supported && isFormatSupported(device.gl, format);\n supported = supported && (!linearFiltering || isTextureFormatFilterable(device.gl, format));\n }\n return supported;\n }\n\n // eslint-disable-next-line max-statements\n constructor(device: Device | WebGLRenderingContext, props: TextureProps) {\n super(WebGLDevice.attach(device), {id: uid('texture'), ...props});\n\n this.target = getWebGLTextureTarget(props);\n\n this.device = WebGLDevice.attach(device);\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n this.handle = this.props.handle || this.gl.createTexture();\n\n let data = props.data;\n\n const isVideo = typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement;\n // @ts-expect-error\n if (isVideo && data.readyState < HTMLVideoElement.HAVE_METADATA) {\n this._video = null; // Declare member before the object is sealed\n data.addEventListener('loadeddata', () => this.initialize(props));\n return this;\n }\n\n update(): this {\n if (this._video) {\n const {video, parameters, lastTime} = this._video;\n // @ts-expect-error\n if (lastTime === video.currentTime || video.readyState < HTMLVideoElement.HAVE_CURRENT_DATA) {\n return;\n }\n this.setSubImageData({\n data: video,\n parameters\n });\n if (this.mipmaps) {\n this.generateMipmap();\n }\n this._video.lastTime = video.currentTime;\n }\n }\n\n\n*/"],"mappings":""}
|
|
@@ -4,8 +4,8 @@ import GL from '@luma.gl/constants';
|
|
|
4
4
|
import WebGLDevice from '../webgl-device';
|
|
5
5
|
import WebGLTexture from './webgl-texture';
|
|
6
6
|
import Renderbuffer from '../objects/webgl-renderbuffer';
|
|
7
|
-
export type TextureAttachment = [Texture, number?, number?];
|
|
8
|
-
export type Attachment = WebGLTexture | Renderbuffer | TextureAttachment;
|
|
7
|
+
export declare type TextureAttachment = [Texture, number?, number?];
|
|
8
|
+
export declare type Attachment = WebGLTexture | Renderbuffer | TextureAttachment;
|
|
9
9
|
/** luma.gl Framebuffer, WebGL implementation */
|
|
10
10
|
export default class WEBGLFramebuffer extends Framebuffer {
|
|
11
11
|
device: WebGLDevice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAc,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAGzD,
|
|
1
|
+
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAc,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAGzD,oBAAY,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC5D,oBAAY,UAAU,GAAG,YAAY,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAEzE,iDAAiD;AACjD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACvD,MAAM,EAAE,WAAW,CAAC;IACpB,EAAE,EAAE,qBAAqB,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IAEzB,IAAI,OAAO,iBAAuC;IAClD,QAAQ,CAAC,gBAAgB,EAAE,YAAY,EAAE,CAAM;IAC/C,QAAQ,CAAC,sBAAsB,EAAE,YAAY,GAAG,IAAI,CAAQ;IAC5D,SAAS,CAAC,aAAa,EAAE,CAAC,YAAY,GAAG,YAAY,CAAC,EAAE,CAAM;gBAElD,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;IAuC/C,OAAO,IAAI,IAAI;IAaxB,uBAAuB;IACvB,SAAS,CAAC,YAAY,IAAI,IAAI;IAW9B,uBAAuB,IAAI,YAAY,EAAE;IAgBzC,gCAAgC;IAChC,SAAS,CAAC,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAgCzG,4DAA4D;IAC5D,SAAS,CAAC,6BAA6B,IAAI,YAAY,GAAG,YAAY;IAyBtE,iEAAiE;IACjE,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA0BjE,4BAA4B;IAC5B,SAAS,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,GAAG,YAAY,GAAG,YAAY;IAe9F,SAAS,CAAC,mBAAmB,CAAC,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,YAAY,GAAG,IAAI;IAS/E;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CA2BpG"}
|
|
@@ -1,240 +1,207 @@
|
|
|
1
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { Framebuffer, Texture, log, assert } from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
|
-
import WebGLTexture from
|
|
5
|
-
import Renderbuffer from
|
|
6
|
-
import { getWebGLTextureFormat, getWebGLDepthStencilAttachment } from
|
|
7
|
-
/** luma.gl Framebuffer, WebGL implementation */
|
|
4
|
+
import WebGLTexture from "./webgl-texture.js";
|
|
5
|
+
import Renderbuffer from "../objects/webgl-renderbuffer.js";
|
|
6
|
+
import { getWebGLTextureFormat, getWebGLDepthStencilAttachment } from "../converters/texture-formats.js";
|
|
8
7
|
export default class WEBGLFramebuffer extends Framebuffer {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
29
|
-
const attachment = this.colorAttachments[i];
|
|
30
|
-
const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
|
|
31
|
-
if (attachment) {
|
|
32
|
-
this._attachOne(attachmentPoint, attachment);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (this.props.depthStencilAttachment) {
|
|
36
|
-
this._attachOne(getWebGLDepthStencilAttachment(this.depthStencilAttachment.format), this.depthStencilAttachment);
|
|
37
|
-
}
|
|
38
|
-
// @ts-expect-error
|
|
39
|
-
this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
40
|
-
// @ts-expect-error
|
|
41
|
-
if (props.check !== false) {
|
|
42
|
-
this._checkStatus();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
destroy() {
|
|
46
|
-
if (this.handle !== null) {
|
|
47
|
-
for (const resource of this._ownResources) {
|
|
48
|
-
resource.destroy();
|
|
49
|
-
}
|
|
50
|
-
this.gl.deleteFramebuffer(this.handle);
|
|
51
|
-
// this.handle = null;
|
|
52
|
-
this.destroyed = true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// PRIVATE
|
|
56
|
-
/** Check the status */
|
|
57
|
-
_checkStatus() {
|
|
58
|
-
const { gl } = this;
|
|
59
|
-
const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
|
|
60
|
-
const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER);
|
|
61
|
-
// @ts-expect-error
|
|
62
|
-
gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
63
|
-
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
64
|
-
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
_createColorAttachments() {
|
|
68
|
-
return this.props.colorAttachments.map(colorAttachment => {
|
|
69
|
-
if (!colorAttachment) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
if (colorAttachment instanceof WebGLTexture) {
|
|
73
|
-
return colorAttachment;
|
|
74
|
-
}
|
|
75
|
-
// if (typeof colorAttachment === 'default') {
|
|
76
|
-
// return this._createColorAttachment('rgba8unorm', this.width, this.height);
|
|
77
|
-
// }
|
|
78
|
-
// @ts-expect-error
|
|
79
|
-
return this._createColorAttachment(colorAttachment, this.width, this.height);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/** Create a color attachment */
|
|
83
|
-
_createColorAttachment(format, width, height) {
|
|
84
|
-
const texture = this.device._createTexture({
|
|
85
|
-
id: `${this.id}-color`,
|
|
86
|
-
data: null,
|
|
87
|
-
format,
|
|
88
|
-
// type: GL.UNSIGNED_BYTE,
|
|
89
|
-
width,
|
|
90
|
-
height,
|
|
91
|
-
// Note: Mipmapping can be disabled by texture resource when we resize the texture
|
|
92
|
-
// to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant
|
|
93
|
-
// behavior we always disable mipmaps.
|
|
94
|
-
mipmaps: false,
|
|
95
|
-
// Set MIN and MAG filtering parameters so mipmaps are not used in sampling.
|
|
96
|
-
// Use LINEAR so subpixel algos like fxaa work.
|
|
97
|
-
// Set WRAP modes that support NPOT textures too.
|
|
98
|
-
sampler: {
|
|
99
|
-
minFilter: 'linear',
|
|
100
|
-
magFilter: 'linear',
|
|
101
|
-
addressModeU: 'clamp-to-edge',
|
|
102
|
-
addressModeV: 'clamp-to-edge'
|
|
103
|
-
},
|
|
104
|
-
// parameters: {
|
|
105
|
-
// [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
|
|
106
|
-
// [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
|
|
107
|
-
// [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
|
|
108
|
-
// [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE
|
|
109
|
-
// }
|
|
110
|
-
});
|
|
111
|
-
this._ownResources.push(texture);
|
|
112
|
-
return texture;
|
|
113
|
-
}
|
|
114
|
-
/** Create a depth stencil attachment GL.DEPTH24_STENCIL8 */
|
|
115
|
-
_createDepthStencilAttachment() {
|
|
116
|
-
if (!this.props.depthStencilAttachment) {
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
if (this.props.depthStencilAttachment instanceof Renderbuffer) {
|
|
120
|
-
return this.props.depthStencilAttachment;
|
|
121
|
-
}
|
|
122
|
-
if (this.props.depthStencilAttachment instanceof Texture) {
|
|
123
|
-
return this.props.depthStencilAttachment;
|
|
124
|
-
}
|
|
125
|
-
const format = this.props.depthStencilAttachment;
|
|
126
|
-
const webglFormat = getWebGLTextureFormat(this.gl, format);
|
|
127
|
-
const texture = new Renderbuffer(this.device, {
|
|
128
|
-
id: `${this.id}-depth-stencil`,
|
|
129
|
-
format: webglFormat,
|
|
130
|
-
// dataFormat: GL.DEPTH_STENCIL,
|
|
131
|
-
// type: GL.UNSIGNED_INT_24_8,
|
|
132
|
-
width: this.width,
|
|
133
|
-
height: this.height
|
|
134
|
-
});
|
|
135
|
-
this._ownResources.push(texture);
|
|
136
|
-
return texture;
|
|
137
|
-
}
|
|
138
|
-
/** Attachment resize is expected to be a noop if size is same */
|
|
139
|
-
_resizeAttachments(width, height) {
|
|
140
|
-
// for default framebuffer, just update the stored size
|
|
141
|
-
if (this.handle === null) {
|
|
142
|
-
// assert(width === undefined && height === undefined);
|
|
143
|
-
this.width = this.gl.drawingBufferWidth;
|
|
144
|
-
this.height = this.gl.drawingBufferHeight;
|
|
145
|
-
return this;
|
|
146
|
-
}
|
|
147
|
-
if (width === undefined) {
|
|
148
|
-
width = this.gl.drawingBufferWidth;
|
|
149
|
-
}
|
|
150
|
-
if (height === undefined) {
|
|
151
|
-
height = this.gl.drawingBufferHeight;
|
|
152
|
-
}
|
|
153
|
-
if (width !== this.width && height !== this.height) {
|
|
154
|
-
log.log(2, `Resizing framebuffer ${this.id} to ${width}x${height}`)();
|
|
155
|
-
}
|
|
156
|
-
for (const colorAttachment of this.colorAttachments) {
|
|
157
|
-
colorAttachment.resize({ width, height });
|
|
158
|
-
}
|
|
159
|
-
this.depthStencilAttachment?.resize({ width, height });
|
|
160
|
-
return this;
|
|
161
|
-
}
|
|
162
|
-
/** Attach one attachment */
|
|
163
|
-
_attachOne(attachmentPoint, attachment) {
|
|
164
|
-
if (attachment instanceof Renderbuffer) {
|
|
165
|
-
this._attachRenderbuffer(attachmentPoint, attachment);
|
|
166
|
-
return attachment;
|
|
167
|
-
}
|
|
168
|
-
else if (Array.isArray(attachment)) {
|
|
169
|
-
const [texture, layer = 0, level = 0] = attachment;
|
|
170
|
-
this._attachTexture(attachmentPoint, texture, layer, level);
|
|
171
|
-
return texture;
|
|
172
|
-
}
|
|
173
|
-
else if (attachment instanceof WebGLTexture) {
|
|
174
|
-
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
175
|
-
return attachment;
|
|
176
|
-
}
|
|
177
|
-
throw new Error('attach');
|
|
178
|
-
}
|
|
179
|
-
_attachRenderbuffer(attachment, renderbuffer) {
|
|
180
|
-
this.gl.framebufferRenderbuffer(GL.FRAMEBUFFER, attachment, GL.RENDERBUFFER, renderbuffer.handle);
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* @param attachment
|
|
184
|
-
* @param texture
|
|
185
|
-
* @param layer = 0 - index into WebGLTextureArray and Texture3D or face for `TextureCubeMap`
|
|
186
|
-
* @param level = 0 - mipmapLevel (must be 0 in WebGL1)
|
|
187
|
-
*/
|
|
188
|
-
_attachTexture(attachment, texture, layer, level) {
|
|
189
|
-
const { gl, gl2 } = this.device;
|
|
190
|
-
gl.bindTexture(texture.target, texture.handle);
|
|
191
|
-
switch (texture.target) {
|
|
192
|
-
case GL.TEXTURE_2D_ARRAY:
|
|
193
|
-
case GL.TEXTURE_3D:
|
|
194
|
-
this.device.assertWebGL2();
|
|
195
|
-
gl2?.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);
|
|
196
|
-
break;
|
|
197
|
-
case GL.TEXTURE_CUBE_MAP:
|
|
198
|
-
// layer must be a cubemap face (or if index, converted to cube map face)
|
|
199
|
-
const face = mapIndexToCubeMapFace(layer);
|
|
200
|
-
gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, face, texture.handle, level);
|
|
201
|
-
break;
|
|
202
|
-
case GL.TEXTURE_2D:
|
|
203
|
-
gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, GL.TEXTURE_2D, texture.handle, level);
|
|
204
|
-
break;
|
|
205
|
-
default:
|
|
206
|
-
assert(false, 'Illegal texture type');
|
|
207
|
-
}
|
|
208
|
-
gl.bindTexture(texture.target, null);
|
|
8
|
+
get texture() {
|
|
9
|
+
return this.colorAttachments[0];
|
|
10
|
+
}
|
|
11
|
+
constructor(device, props) {
|
|
12
|
+
super(device, props);
|
|
13
|
+
_defineProperty(this, "device", void 0);
|
|
14
|
+
_defineProperty(this, "gl", void 0);
|
|
15
|
+
_defineProperty(this, "handle", void 0);
|
|
16
|
+
_defineProperty(this, "colorAttachments", []);
|
|
17
|
+
_defineProperty(this, "depthStencilAttachment", null);
|
|
18
|
+
_defineProperty(this, "_ownResources", []);
|
|
19
|
+
this.device = device;
|
|
20
|
+
this.gl = device.gl;
|
|
21
|
+
this.handle = this.props.handle !== undefined ? this.props.handle : this.gl.createFramebuffer();
|
|
22
|
+
if (this.handle) {
|
|
23
|
+
device.setSpectorMetadata(this.handle, {
|
|
24
|
+
id: this.props.id,
|
|
25
|
+
props: this.props
|
|
26
|
+
});
|
|
209
27
|
}
|
|
28
|
+
this.colorAttachments = this._createColorAttachments();
|
|
29
|
+
this.depthStencilAttachment = this._createDepthStencilAttachment();
|
|
30
|
+
const prevHandle = this.gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
|
|
31
|
+
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
32
|
+
const attachment = this.colorAttachments[i];
|
|
33
|
+
const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
|
|
34
|
+
if (attachment) {
|
|
35
|
+
this._attachOne(attachmentPoint, attachment);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (this.props.depthStencilAttachment) {
|
|
39
|
+
this._attachOne(getWebGLDepthStencilAttachment(this.depthStencilAttachment.format), this.depthStencilAttachment);
|
|
40
|
+
}
|
|
41
|
+
this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
42
|
+
if (props.check !== false) {
|
|
43
|
+
this._checkStatus();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
destroy() {
|
|
47
|
+
if (this.handle !== null) {
|
|
48
|
+
for (const resource of this._ownResources) {
|
|
49
|
+
resource.destroy();
|
|
50
|
+
}
|
|
51
|
+
this.gl.deleteFramebuffer(this.handle);
|
|
52
|
+
this.destroyed = true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
_checkStatus() {
|
|
56
|
+
const {
|
|
57
|
+
gl
|
|
58
|
+
} = this;
|
|
59
|
+
const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
|
|
60
|
+
const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER);
|
|
61
|
+
gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
62
|
+
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
63
|
+
throw new Error("Framebuffer ".concat(_getFrameBufferStatus(status)));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
_createColorAttachments() {
|
|
67
|
+
return this.props.colorAttachments.map(colorAttachment => {
|
|
68
|
+
if (!colorAttachment) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
if (colorAttachment instanceof WebGLTexture) {
|
|
72
|
+
return colorAttachment;
|
|
73
|
+
}
|
|
74
|
+
return this._createColorAttachment(colorAttachment, this.width, this.height);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
_createColorAttachment(format, width, height) {
|
|
78
|
+
const texture = this.device._createTexture({
|
|
79
|
+
id: "".concat(this.id, "-color"),
|
|
80
|
+
data: null,
|
|
81
|
+
format,
|
|
82
|
+
width,
|
|
83
|
+
height,
|
|
84
|
+
mipmaps: false,
|
|
85
|
+
sampler: {
|
|
86
|
+
minFilter: 'linear',
|
|
87
|
+
magFilter: 'linear',
|
|
88
|
+
addressModeU: 'clamp-to-edge',
|
|
89
|
+
addressModeV: 'clamp-to-edge'
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
this._ownResources.push(texture);
|
|
93
|
+
return texture;
|
|
94
|
+
}
|
|
95
|
+
_createDepthStencilAttachment() {
|
|
96
|
+
if (!this.props.depthStencilAttachment) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
if (this.props.depthStencilAttachment instanceof Renderbuffer) {
|
|
100
|
+
return this.props.depthStencilAttachment;
|
|
101
|
+
}
|
|
102
|
+
if (this.props.depthStencilAttachment instanceof Texture) {
|
|
103
|
+
return this.props.depthStencilAttachment;
|
|
104
|
+
}
|
|
105
|
+
const format = this.props.depthStencilAttachment;
|
|
106
|
+
const webglFormat = getWebGLTextureFormat(this.gl, format);
|
|
107
|
+
const texture = new Renderbuffer(this.device, {
|
|
108
|
+
id: "".concat(this.id, "-depth-stencil"),
|
|
109
|
+
format: webglFormat,
|
|
110
|
+
width: this.width,
|
|
111
|
+
height: this.height
|
|
112
|
+
});
|
|
113
|
+
this._ownResources.push(texture);
|
|
114
|
+
return texture;
|
|
115
|
+
}
|
|
116
|
+
_resizeAttachments(width, height) {
|
|
117
|
+
var _this$depthStencilAtt;
|
|
118
|
+
if (this.handle === null) {
|
|
119
|
+
this.width = this.gl.drawingBufferWidth;
|
|
120
|
+
this.height = this.gl.drawingBufferHeight;
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
if (width === undefined) {
|
|
124
|
+
width = this.gl.drawingBufferWidth;
|
|
125
|
+
}
|
|
126
|
+
if (height === undefined) {
|
|
127
|
+
height = this.gl.drawingBufferHeight;
|
|
128
|
+
}
|
|
129
|
+
if (width !== this.width && height !== this.height) {
|
|
130
|
+
log.log(2, "Resizing framebuffer ".concat(this.id, " to ").concat(width, "x").concat(height))();
|
|
131
|
+
}
|
|
132
|
+
for (const colorAttachment of this.colorAttachments) {
|
|
133
|
+
colorAttachment.resize({
|
|
134
|
+
width,
|
|
135
|
+
height
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
(_this$depthStencilAtt = this.depthStencilAttachment) === null || _this$depthStencilAtt === void 0 ? void 0 : _this$depthStencilAtt.resize({
|
|
139
|
+
width,
|
|
140
|
+
height
|
|
141
|
+
});
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
_attachOne(attachmentPoint, attachment) {
|
|
145
|
+
if (attachment instanceof Renderbuffer) {
|
|
146
|
+
this._attachRenderbuffer(attachmentPoint, attachment);
|
|
147
|
+
return attachment;
|
|
148
|
+
} else if (Array.isArray(attachment)) {
|
|
149
|
+
const [texture, layer = 0, level = 0] = attachment;
|
|
150
|
+
this._attachTexture(attachmentPoint, texture, layer, level);
|
|
151
|
+
return texture;
|
|
152
|
+
} else if (attachment instanceof WebGLTexture) {
|
|
153
|
+
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
154
|
+
return attachment;
|
|
155
|
+
}
|
|
156
|
+
throw new Error('attach');
|
|
157
|
+
}
|
|
158
|
+
_attachRenderbuffer(attachment, renderbuffer) {
|
|
159
|
+
this.gl.framebufferRenderbuffer(GL.FRAMEBUFFER, attachment, GL.RENDERBUFFER, renderbuffer.handle);
|
|
160
|
+
}
|
|
161
|
+
_attachTexture(attachment, texture, layer, level) {
|
|
162
|
+
const {
|
|
163
|
+
gl,
|
|
164
|
+
gl2
|
|
165
|
+
} = this.device;
|
|
166
|
+
gl.bindTexture(texture.target, texture.handle);
|
|
167
|
+
switch (texture.target) {
|
|
168
|
+
case GL.TEXTURE_2D_ARRAY:
|
|
169
|
+
case GL.TEXTURE_3D:
|
|
170
|
+
this.device.assertWebGL2();
|
|
171
|
+
gl2 === null || gl2 === void 0 ? void 0 : gl2.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);
|
|
172
|
+
break;
|
|
173
|
+
case GL.TEXTURE_CUBE_MAP:
|
|
174
|
+
const face = mapIndexToCubeMapFace(layer);
|
|
175
|
+
gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, face, texture.handle, level);
|
|
176
|
+
break;
|
|
177
|
+
case GL.TEXTURE_2D:
|
|
178
|
+
gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, GL.TEXTURE_2D, texture.handle, level);
|
|
179
|
+
break;
|
|
180
|
+
default:
|
|
181
|
+
assert(false, 'Illegal texture type');
|
|
182
|
+
}
|
|
183
|
+
gl.bindTexture(texture.target, null);
|
|
184
|
+
}
|
|
210
185
|
}
|
|
211
|
-
// Helper functions
|
|
212
|
-
// Map an index to a cube map face constant
|
|
213
186
|
function mapIndexToCubeMapFace(layer) {
|
|
214
|
-
|
|
215
|
-
// if smaller assume layer is index, otherwise assume it is already a cube map face constant
|
|
216
|
-
return layer < GL.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X : layer;
|
|
187
|
+
return layer < GL.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X : layer;
|
|
217
188
|
}
|
|
218
|
-
// Helper METHODS
|
|
219
|
-
// Get a string describing the framebuffer error if installed
|
|
220
189
|
function _getFrameBufferStatus(status) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
default:
|
|
238
|
-
return `${status}`;
|
|
239
|
-
}
|
|
190
|
+
switch (status) {
|
|
191
|
+
case GL.FRAMEBUFFER_COMPLETE:
|
|
192
|
+
return 'success';
|
|
193
|
+
case GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
|
194
|
+
return 'Mismatched attachments';
|
|
195
|
+
case GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
|
196
|
+
return 'No attachments';
|
|
197
|
+
case GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
|
|
198
|
+
return 'Height/width mismatch';
|
|
199
|
+
case GL.FRAMEBUFFER_UNSUPPORTED:
|
|
200
|
+
return 'Unsupported or split attachments';
|
|
201
|
+
case GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
|
|
202
|
+
return 'Samples mismatch';
|
|
203
|
+
default:
|
|
204
|
+
return "".concat(status);
|
|
205
|
+
}
|
|
240
206
|
}
|
|
207
|
+
//# sourceMappingURL=webgl-framebuffer.js.map
|