@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,328 +1,339 @@
|
|
|
1
|
+
// luma.gl, MIT license
|
|
1
2
|
import GL from '@luma.gl/constants';
|
|
2
|
-
import { isWebGL2 } from '../../context/context/webgl-checks';
|
|
3
|
-
import Accessor from '../../classic/accessor';
|
|
4
|
-
import { decodeUniformType, decodeAttributeType } from './uniforms';
|
|
5
|
-
import { getVertexFormat } from '../converters/vertex-formats';
|
|
6
|
-
import { isSamplerUniform } from './uniforms';
|
|
3
|
+
import { isWebGL2 } from '../../context/context/webgl-checks.js';
|
|
4
|
+
import Accessor from '../../classic/accessor.js'; // TODO - should NOT depend on classic API
|
|
5
|
+
import { decodeUniformType, decodeAttributeType } from './uniforms.js';
|
|
6
|
+
import { getVertexFormat } from '../converters/vertex-formats.js';
|
|
7
|
+
import { isSamplerUniform } from './uniforms.js';
|
|
8
|
+
/**
|
|
9
|
+
* Extract metadata describing binding information for a program's shaders
|
|
10
|
+
* Note: `linkProgram()` needs to have been called
|
|
11
|
+
* (although linking does not need to have been successful).
|
|
12
|
+
*/
|
|
7
13
|
export function getShaderLayout(gl, program) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
for (const uniformBlock of programBindings.uniformBlocks) {
|
|
28
|
-
const uniforms = uniformBlock.uniforms.map(uniform => ({
|
|
29
|
-
name: uniform.name,
|
|
30
|
-
format: uniform.format,
|
|
31
|
-
byteOffset: uniform.byteOffset,
|
|
32
|
-
byteStride: uniform.byteStride,
|
|
33
|
-
arrayLength: uniform.arrayLength
|
|
34
|
-
}));
|
|
35
|
-
shaderLayout.bindings.push({
|
|
36
|
-
type: 'uniform',
|
|
37
|
-
name: uniformBlock.name,
|
|
38
|
-
location: uniformBlock.location,
|
|
39
|
-
visibility: (uniformBlock.vertex ? 0x1 : 0) & (uniformBlock.fragment ? 0x2 : 0),
|
|
40
|
-
minBindingSize: uniformBlock.byteLength,
|
|
41
|
-
uniforms
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let textureUnit = 0;
|
|
46
|
-
|
|
47
|
-
for (const uniform of programBindings.uniforms) {
|
|
48
|
-
if (isSamplerUniform(uniform.type)) {
|
|
49
|
-
const {
|
|
50
|
-
viewDimension,
|
|
51
|
-
sampleType
|
|
52
|
-
} = getSamplerInfo(uniform.type);
|
|
53
|
-
shaderLayout.bindings.push({
|
|
54
|
-
type: 'texture',
|
|
55
|
-
name: uniform.name,
|
|
56
|
-
location: textureUnit,
|
|
57
|
-
viewDimension,
|
|
58
|
-
sampleType
|
|
59
|
-
});
|
|
60
|
-
uniform.textureUnit = textureUnit;
|
|
61
|
-
textureUnit += 1;
|
|
14
|
+
const programBindings = getProgramBindings(gl, program);
|
|
15
|
+
const shaderLayout = {
|
|
16
|
+
attributes: [],
|
|
17
|
+
bindings: []
|
|
18
|
+
};
|
|
19
|
+
for (const attribute of programBindings.attributes) {
|
|
20
|
+
// TODO - multicolumn attributes like a matrix4 can be up to 16 elts...
|
|
21
|
+
const size = Math.min(attribute.accessor.size, 4);
|
|
22
|
+
const format =
|
|
23
|
+
// attribute.accessor.format ||
|
|
24
|
+
getVertexFormat(attribute.accessor.type || GL.FLOAT, size);
|
|
25
|
+
shaderLayout.attributes.push({
|
|
26
|
+
name: attribute.name,
|
|
27
|
+
location: attribute.location,
|
|
28
|
+
format,
|
|
29
|
+
stepMode: attribute.accessor.divisor === 1 ? 'instance' : 'vertex'
|
|
30
|
+
});
|
|
62
31
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
32
|
+
// Uniform blocks
|
|
33
|
+
for (const uniformBlock of programBindings.uniformBlocks) {
|
|
34
|
+
const uniforms = uniformBlock.uniforms.map((uniform) => ({
|
|
35
|
+
name: uniform.name,
|
|
36
|
+
format: uniform.format,
|
|
37
|
+
byteOffset: uniform.byteOffset,
|
|
38
|
+
byteStride: uniform.byteStride,
|
|
39
|
+
arrayLength: uniform.arrayLength
|
|
40
|
+
}));
|
|
41
|
+
shaderLayout.bindings.push({
|
|
42
|
+
type: 'uniform',
|
|
43
|
+
name: uniformBlock.name,
|
|
44
|
+
location: uniformBlock.location,
|
|
45
|
+
visibility: (uniformBlock.vertex ? 0x1 : 0) & (uniformBlock.fragment ? 0x2 : 0),
|
|
46
|
+
minBindingSize: uniformBlock.byteLength,
|
|
47
|
+
uniforms
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
let textureUnit = 0;
|
|
51
|
+
for (const uniform of programBindings.uniforms) {
|
|
52
|
+
if (isSamplerUniform(uniform.type)) {
|
|
53
|
+
const { viewDimension, sampleType } = getSamplerInfo(uniform.type);
|
|
54
|
+
shaderLayout.bindings.push({
|
|
55
|
+
type: 'texture',
|
|
56
|
+
name: uniform.name,
|
|
57
|
+
location: textureUnit,
|
|
58
|
+
viewDimension,
|
|
59
|
+
sampleType
|
|
60
|
+
});
|
|
61
|
+
// @ts-expect-error
|
|
62
|
+
uniform.textureUnit = textureUnit;
|
|
63
|
+
textureUnit += 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const uniforms = programBindings.uniforms?.filter((uniform) => uniform.location !== null) || [];
|
|
67
|
+
if (uniforms.length) {
|
|
68
|
+
shaderLayout.uniforms = uniforms;
|
|
69
|
+
}
|
|
70
|
+
if (programBindings.varyings?.length) {
|
|
71
|
+
shaderLayout.varyings = programBindings.varyings;
|
|
72
|
+
}
|
|
73
|
+
return shaderLayout;
|
|
76
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Extract metadata describing binding information for a program's shaders
|
|
77
|
+
* Note: `linkProgram()` needs to have been called
|
|
78
|
+
* (although linking does not need to have been successful).
|
|
79
|
+
*/
|
|
77
80
|
export function getProgramBindings(gl, program) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const config = {
|
|
82
|
+
attributes: readAttributeBindings(gl, program),
|
|
83
|
+
uniforms: readUniformBindings(gl, program),
|
|
84
|
+
uniformBlocks: readUniformBlocks(gl, program),
|
|
85
|
+
varyings: readVaryings(gl, program)
|
|
86
|
+
};
|
|
87
|
+
Object.seal(config);
|
|
88
|
+
return config;
|
|
89
|
+
// generateWebGPUStyleBindings(bindings);
|
|
86
90
|
}
|
|
87
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Extract info about all transform feedback varyings
|
|
93
|
+
*
|
|
94
|
+
* linkProgram needs to have been called, although linking does not need to have been successful
|
|
95
|
+
*/
|
|
88
96
|
function readAttributeBindings(gl, program) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
const attributes = [];
|
|
98
|
+
const count = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
|
|
99
|
+
for (let index = 0; index < count; index++) {
|
|
100
|
+
const activeInfo = gl.getActiveAttrib(program, index);
|
|
101
|
+
if (!activeInfo) {
|
|
102
|
+
throw new Error('activeInfo');
|
|
103
|
+
}
|
|
104
|
+
const { name, type: compositeType, size } = activeInfo;
|
|
105
|
+
const location = gl.getAttribLocation(program, name);
|
|
106
|
+
// Add only user provided attributes, for built-in attributes like
|
|
107
|
+
// `gl_InstanceID` locaiton will be < 0
|
|
108
|
+
if (location >= 0) {
|
|
109
|
+
const { glType, components } = decodeAttributeType(compositeType);
|
|
110
|
+
;
|
|
111
|
+
const accessor = { type: glType, size: size * components };
|
|
112
|
+
// Any attribute name containing the word "instance" will be assumed to be instanced
|
|
113
|
+
if (/instance/i.test(name)) {
|
|
114
|
+
accessor.divisor = 1;
|
|
115
|
+
}
|
|
116
|
+
const attributeInfo = { location, name, accessor: new Accessor(accessor) }; // Base values
|
|
117
|
+
attributes.push(attributeInfo);
|
|
118
|
+
}
|
|
97
119
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
name,
|
|
101
|
-
type: compositeType,
|
|
102
|
-
size
|
|
103
|
-
} = activeInfo;
|
|
104
|
-
const location = gl.getAttribLocation(program, name);
|
|
105
|
-
|
|
106
|
-
if (location >= 0) {
|
|
107
|
-
const {
|
|
108
|
-
glType,
|
|
109
|
-
components
|
|
110
|
-
} = decodeAttributeType(compositeType);
|
|
111
|
-
;
|
|
112
|
-
const accessor = {
|
|
113
|
-
type: glType,
|
|
114
|
-
size: size * components
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
if (/instance/i.test(name)) {
|
|
118
|
-
accessor.divisor = 1;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const attributeInfo = {
|
|
122
|
-
location,
|
|
123
|
-
name,
|
|
124
|
-
accessor: new Accessor(accessor)
|
|
125
|
-
};
|
|
126
|
-
attributes.push(attributeInfo);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
attributes.sort((a, b) => a.location - b.location);
|
|
131
|
-
return attributes;
|
|
120
|
+
attributes.sort((a, b) => a.location - b.location);
|
|
121
|
+
return attributes;
|
|
132
122
|
}
|
|
133
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Extract info about all transform feedback varyings
|
|
125
|
+
*
|
|
126
|
+
* linkProgram needs to have been called, although linking does not need to have been successful
|
|
127
|
+
*/
|
|
134
128
|
function readVaryings(gl, program) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const gl2 = gl;
|
|
140
|
-
const varyings = [];
|
|
141
|
-
const count = gl.getProgramParameter(program, GL.TRANSFORM_FEEDBACK_VARYINGS);
|
|
142
|
-
|
|
143
|
-
for (let location = 0; location < count; location++) {
|
|
144
|
-
const activeInfo = gl2.getTransformFeedbackVarying(program, location);
|
|
145
|
-
|
|
146
|
-
if (!activeInfo) {
|
|
147
|
-
throw new Error('activeInfo');
|
|
129
|
+
if (!isWebGL2(gl)) {
|
|
130
|
+
return [];
|
|
148
131
|
}
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
name,
|
|
167
|
-
accessor
|
|
168
|
-
};
|
|
169
|
-
varyings.push(varying);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
varyings.sort((a, b) => a.location - b.location);
|
|
173
|
-
return varyings;
|
|
132
|
+
const gl2 = gl;
|
|
133
|
+
const varyings = [];
|
|
134
|
+
const count = gl.getProgramParameter(program, GL.TRANSFORM_FEEDBACK_VARYINGS);
|
|
135
|
+
for (let location = 0; location < count; location++) {
|
|
136
|
+
const activeInfo = gl2.getTransformFeedbackVarying(program, location);
|
|
137
|
+
if (!activeInfo) {
|
|
138
|
+
throw new Error('activeInfo');
|
|
139
|
+
}
|
|
140
|
+
const { name, type: compositeType, size } = activeInfo;
|
|
141
|
+
const { glType, components } = decodeUniformType(compositeType);
|
|
142
|
+
;
|
|
143
|
+
const accessor = new Accessor({ type: glType, size: size * components });
|
|
144
|
+
const varying = { location, name, accessor }; // Base values
|
|
145
|
+
varyings.push(varying);
|
|
146
|
+
}
|
|
147
|
+
varyings.sort((a, b) => a.location - b.location);
|
|
148
|
+
return varyings;
|
|
174
149
|
}
|
|
175
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Extract info about all uniforms
|
|
152
|
+
*
|
|
153
|
+
* Query uniform locations and build name to setter map.
|
|
154
|
+
*/
|
|
176
155
|
function readUniformBindings(gl, program) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
isArray
|
|
195
|
-
} = parseUniformName(rawName);
|
|
196
|
-
let webglLocation = gl.getUniformLocation(program, name);
|
|
197
|
-
const uniformInfo = {
|
|
198
|
-
location: webglLocation,
|
|
199
|
-
name,
|
|
200
|
-
size,
|
|
201
|
-
type,
|
|
202
|
-
isArray
|
|
203
|
-
};
|
|
204
|
-
uniforms.push(uniformInfo);
|
|
205
|
-
|
|
206
|
-
if (uniformInfo.size > 1) {
|
|
207
|
-
for (let j = 0; j < uniformInfo.size; j++) {
|
|
208
|
-
const elementName = "".concat(name, "[").concat(j, "]");
|
|
209
|
-
webglLocation = gl.getUniformLocation(program, elementName);
|
|
210
|
-
const arrayElementUniformInfo = { ...uniformInfo,
|
|
211
|
-
name: elementName,
|
|
212
|
-
location: webglLocation
|
|
156
|
+
const uniforms = [];
|
|
157
|
+
const uniformCount = gl.getProgramParameter(program, GL.ACTIVE_UNIFORMS);
|
|
158
|
+
for (let i = 0; i < uniformCount; i++) {
|
|
159
|
+
const activeInfo = gl.getActiveUniform(program, i);
|
|
160
|
+
if (!activeInfo) {
|
|
161
|
+
throw new Error('activeInfo');
|
|
162
|
+
}
|
|
163
|
+
const { name: rawName, size, type } = activeInfo;
|
|
164
|
+
const { name, isArray } = parseUniformName(rawName);
|
|
165
|
+
let webglLocation = gl.getUniformLocation(program, name);
|
|
166
|
+
const uniformInfo = {
|
|
167
|
+
// WebGL locations are uniquely typed but just numbers
|
|
168
|
+
location: webglLocation,
|
|
169
|
+
name,
|
|
170
|
+
size,
|
|
171
|
+
type,
|
|
172
|
+
isArray
|
|
213
173
|
};
|
|
214
|
-
uniforms.push(
|
|
215
|
-
|
|
174
|
+
uniforms.push(uniformInfo);
|
|
175
|
+
// Array (e.g. matrix) uniforms can occupy several 4x4 byte banks
|
|
176
|
+
if (uniformInfo.size > 1) {
|
|
177
|
+
for (let j = 0; j < uniformInfo.size; j++) {
|
|
178
|
+
const elementName = `${name}[${j}]`;
|
|
179
|
+
webglLocation = gl.getUniformLocation(program, elementName);
|
|
180
|
+
const arrayElementUniformInfo = {
|
|
181
|
+
...uniformInfo,
|
|
182
|
+
name: elementName,
|
|
183
|
+
location: webglLocation
|
|
184
|
+
};
|
|
185
|
+
uniforms.push(arrayElementUniformInfo);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
216
188
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return uniforms;
|
|
189
|
+
return uniforms;
|
|
220
190
|
}
|
|
221
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Extract info about all "active" uniform blocks
|
|
193
|
+
*
|
|
194
|
+
* ("Active" just means that unused (aka inactive) blocks may have been
|
|
195
|
+
* optimized away during linking)
|
|
196
|
+
*/
|
|
222
197
|
function readUniformBlocks(gl, program) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
const gl2 = gl;
|
|
228
|
-
|
|
229
|
-
const getBlockParameter = (blockIndex, pname) => gl2.getActiveUniformBlockParameter(program, blockIndex, pname);
|
|
230
|
-
|
|
231
|
-
const uniformBlocks = [];
|
|
232
|
-
const blockCount = gl2.getProgramParameter(program, GL.ACTIVE_UNIFORM_BLOCKS);
|
|
233
|
-
|
|
234
|
-
for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {
|
|
235
|
-
const blockInfo = {
|
|
236
|
-
name: gl2.getActiveUniformBlockName(program, blockIndex) || '',
|
|
237
|
-
location: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_BINDING),
|
|
238
|
-
byteLength: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_DATA_SIZE),
|
|
239
|
-
vertex: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),
|
|
240
|
-
fragment: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),
|
|
241
|
-
uniformCount: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORMS),
|
|
242
|
-
uniforms: []
|
|
243
|
-
};
|
|
244
|
-
const uniformIndices = getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) || [];
|
|
245
|
-
const uniformType = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_TYPE);
|
|
246
|
-
const uniformArrayLength = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_SIZE);
|
|
247
|
-
const uniformOffset = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_OFFSET);
|
|
248
|
-
const uniformStride = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_ARRAY_STRIDE);
|
|
249
|
-
|
|
250
|
-
for (let i = 0; i < blockInfo.uniformCount; ++i) {
|
|
251
|
-
const activeInfo = gl2.getActiveUniform(program, uniformIndices[i]);
|
|
252
|
-
|
|
253
|
-
if (!activeInfo) {
|
|
254
|
-
throw new Error('activeInfo');
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
blockInfo.uniforms.push({
|
|
258
|
-
name: activeInfo.name,
|
|
259
|
-
format: decodeUniformType(uniformType[i]).format,
|
|
260
|
-
type: uniformType[i],
|
|
261
|
-
arrayLength: uniformArrayLength[i],
|
|
262
|
-
byteOffset: uniformOffset[i],
|
|
263
|
-
byteStride: uniformStride[i]
|
|
264
|
-
});
|
|
198
|
+
if (!isWebGL2(gl)) {
|
|
199
|
+
return [];
|
|
265
200
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
201
|
+
const gl2 = gl;
|
|
202
|
+
const getBlockParameter = (blockIndex, pname) => gl2.getActiveUniformBlockParameter(program, blockIndex, pname);
|
|
203
|
+
const uniformBlocks = [];
|
|
204
|
+
const blockCount = gl2.getProgramParameter(program, GL.ACTIVE_UNIFORM_BLOCKS);
|
|
205
|
+
for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {
|
|
206
|
+
const blockInfo = {
|
|
207
|
+
name: gl2.getActiveUniformBlockName(program, blockIndex) || '',
|
|
208
|
+
location: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_BINDING),
|
|
209
|
+
byteLength: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_DATA_SIZE),
|
|
210
|
+
vertex: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),
|
|
211
|
+
fragment: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),
|
|
212
|
+
uniformCount: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORMS),
|
|
213
|
+
uniforms: []
|
|
214
|
+
};
|
|
215
|
+
const uniformIndices = getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) || [];
|
|
216
|
+
const uniformType = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_TYPE); // Array of GLenum indicating the types of the uniforms.
|
|
217
|
+
const uniformArrayLength = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_SIZE); // Array of GLuint indicating the sizes of the uniforms.
|
|
218
|
+
// const uniformBlockIndex = gl2.getActiveUniforms(
|
|
219
|
+
// program,
|
|
220
|
+
// uniformIndices,
|
|
221
|
+
// GL.UNIFORM_BLOCK_INDEX
|
|
222
|
+
// ); // Array of GLint indicating the block indices of the uniforms.
|
|
223
|
+
const uniformOffset = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_OFFSET); // Array of GLint indicating the uniform buffer offsets.
|
|
224
|
+
const uniformStride = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_ARRAY_STRIDE); // Array of GLint indicating the strides between the elements.
|
|
225
|
+
// const uniformMatrixStride = gl2.getActiveUniforms(
|
|
226
|
+
// program,
|
|
227
|
+
// uniformIndices,
|
|
228
|
+
// GL.UNIFORM_MATRIX_STRIDE
|
|
229
|
+
// ); // Array of GLint indicating the strides between columns of a column-major matrix or a row-major matrix.
|
|
230
|
+
// const uniformRowMajor = gl2.getActiveUniforms(program, uniformIndices, GL.UNIFORM_IS_ROW_MAJOR);
|
|
231
|
+
for (let i = 0; i < blockInfo.uniformCount; ++i) {
|
|
232
|
+
const activeInfo = gl2.getActiveUniform(program, uniformIndices[i]);
|
|
233
|
+
if (!activeInfo) {
|
|
234
|
+
throw new Error('activeInfo');
|
|
235
|
+
}
|
|
236
|
+
blockInfo.uniforms.push({
|
|
237
|
+
name: activeInfo.name,
|
|
238
|
+
format: decodeUniformType(uniformType[i]).format,
|
|
239
|
+
type: uniformType[i],
|
|
240
|
+
arrayLength: uniformArrayLength[i],
|
|
241
|
+
byteOffset: uniformOffset[i],
|
|
242
|
+
byteStride: uniformStride[i],
|
|
243
|
+
// matrixStride: uniformStride[i],
|
|
244
|
+
// rowMajor: uniformRowMajor[i]
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
uniformBlocks.push(blockInfo);
|
|
248
|
+
}
|
|
249
|
+
uniformBlocks.sort((a, b) => a.location - b.location);
|
|
250
|
+
return uniformBlocks;
|
|
272
251
|
}
|
|
273
|
-
|
|
274
252
|
const SAMPLER_UNIFORMS_GL_TO_GPU = {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
253
|
+
[GL.SAMPLER_2D]: ['2d', 'float'],
|
|
254
|
+
[GL.SAMPLER_CUBE]: ['cube', 'float'],
|
|
255
|
+
[GL.SAMPLER_3D]: ['3d', 'float'],
|
|
256
|
+
[GL.SAMPLER_2D_SHADOW]: ['3d', 'depth'],
|
|
257
|
+
[GL.SAMPLER_2D_ARRAY]: ['2d-array', 'float'],
|
|
258
|
+
[GL.SAMPLER_2D_ARRAY_SHADOW]: ['2d-array', 'depth'],
|
|
259
|
+
[GL.SAMPLER_CUBE_SHADOW]: ['cube', 'float'],
|
|
260
|
+
[GL.INT_SAMPLER_2D]: ['2d', 'sint'],
|
|
261
|
+
[GL.INT_SAMPLER_3D]: ['3d', 'sint'],
|
|
262
|
+
[GL.INT_SAMPLER_CUBE]: ['cube', 'sint'],
|
|
263
|
+
[GL.INT_SAMPLER_2D_ARRAY]: ['2d-array', 'uint'],
|
|
264
|
+
[GL.UNSIGNED_INT_SAMPLER_2D]: ['2d', 'uint'],
|
|
265
|
+
[GL.UNSIGNED_INT_SAMPLER_3D]: ['3d', 'uint'],
|
|
266
|
+
[GL.UNSIGNED_INT_SAMPLER_CUBE]: ['cube', 'uint'],
|
|
267
|
+
[GL.UNSIGNED_INT_SAMPLER_2D_ARRAY]: ['2d-array', 'uint']
|
|
290
268
|
};
|
|
291
|
-
|
|
292
269
|
function getSamplerInfo(type) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const [viewDimension, sampleType] = sampler;
|
|
300
|
-
return {
|
|
301
|
-
viewDimension,
|
|
302
|
-
sampleType
|
|
303
|
-
};
|
|
270
|
+
let sampler = SAMPLER_UNIFORMS_GL_TO_GPU[type];
|
|
271
|
+
if (!sampler) {
|
|
272
|
+
throw new Error('sampler');
|
|
273
|
+
}
|
|
274
|
+
const [viewDimension, sampleType] = sampler;
|
|
275
|
+
return { viewDimension, sampleType };
|
|
304
276
|
}
|
|
305
|
-
|
|
277
|
+
// HELPERS
|
|
306
278
|
function parseUniformName(name) {
|
|
307
|
-
|
|
279
|
+
// Shortcut to avoid redundant or bad matches
|
|
280
|
+
if (name[name.length - 1] !== ']') {
|
|
281
|
+
return {
|
|
282
|
+
name,
|
|
283
|
+
length: 1,
|
|
284
|
+
isArray: false
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
// if array name then clean the array brackets
|
|
288
|
+
const UNIFORM_NAME_REGEXP = /([^[]*)(\[[0-9]+\])?/;
|
|
289
|
+
const matches = name.match(UNIFORM_NAME_REGEXP);
|
|
290
|
+
if (!matches || matches.length < 2) {
|
|
291
|
+
throw new Error(`Failed to parse GLSL uniform name ${name}`);
|
|
292
|
+
}
|
|
308
293
|
return {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
294
|
+
name: matches[1],
|
|
295
|
+
length: matches[2] ? 1 : 0,
|
|
296
|
+
isArray: Boolean(matches[2])
|
|
312
297
|
};
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* TODO - verify this is a copy of above and delete
|
|
301
|
+
* import type {TextureFormat} from '@luma.gl/api';
|
|
302
|
+
* Extract info about all "active" uniform blocks
|
|
303
|
+
* ("Active" just means that unused (inactive) blocks may have been optimized away during linking)
|
|
304
|
+
*
|
|
305
|
+
function getUniformBlockBindings(gl: WebGLRenderingContext, program): Binding[] {
|
|
306
|
+
if (!isWebGL2(gl)) {
|
|
307
|
+
return;
|
|
313
308
|
}
|
|
309
|
+
const bindings: Binding[] = [];
|
|
310
|
+
const count = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);
|
|
311
|
+
for (let blockIndex = 0; blockIndex < count; blockIndex++) {
|
|
312
|
+
const vertex = gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),
|
|
313
|
+
const fragment = gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),
|
|
314
|
+
const visibility = (vertex) + (fragment);
|
|
315
|
+
const binding: BufferBinding = {
|
|
316
|
+
location: gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_BINDING),
|
|
317
|
+
// name: gl.getActiveUniformBlockName(program, blockIndex),
|
|
318
|
+
type: 'uniform',
|
|
319
|
+
visibility,
|
|
320
|
+
minBindingSize: gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_DATA_SIZE),
|
|
321
|
+
// uniformCount: gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_ACTIVE_UNIFORMS),
|
|
322
|
+
// uniformIndices: gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),
|
|
323
|
+
}
|
|
324
|
+
bindings.push(binding);
|
|
325
|
+
}
|
|
326
|
+
return bindings;
|
|
327
|
+
}
|
|
314
328
|
|
|
315
|
-
|
|
316
|
-
const
|
|
329
|
+
function setBindings(gl2: WebGL2RenderingContext, program: WebGLProgram, bindings: Binding[][]): void {
|
|
330
|
+
for (const bindGroup of bindings) {
|
|
331
|
+
for (const binding of bindGroup) {
|
|
317
332
|
|
|
318
|
-
|
|
319
|
-
throw new Error("Failed to parse GLSL uniform name ".concat(name));
|
|
333
|
+
}
|
|
320
334
|
}
|
|
321
335
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
length: matches[2] ? 1 : 0,
|
|
325
|
-
isArray: Boolean(matches[2])
|
|
326
|
-
};
|
|
336
|
+
// Set up indirection table
|
|
337
|
+
// this.gl2.uniformBlockBinding(this.handle, blockIndex, blockBinding);
|
|
327
338
|
}
|
|
328
|
-
|
|
339
|
+
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompilerMessage } from '@luma.gl/
|
|
1
|
+
import type { CompilerMessage } from '@luma.gl/api';
|
|
2
2
|
/**
|
|
3
3
|
* Parse a WebGL-format GLSL compilation log into an array of WebGPU style message records.
|
|
4
4
|
* This follows documented WebGL conventions for compilation logs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-shader-compiler-log.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/parse-shader-compiler-log.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"parse-shader-compiler-log.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/parse-shader-compiler-log.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAIlD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAI,SAAS,eAAe,EAAE,CAqClF"}
|