@deck.gl/aggregation-layers 9.0.34 → 9.1.0-beta.1
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/common/aggregation-layer.d.ts +30 -0
- package/dist/common/aggregation-layer.d.ts.map +1 -0
- package/dist/common/aggregation-layer.js +69 -0
- package/dist/common/aggregator/aggregator.d.ts +76 -0
- package/dist/common/aggregator/aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/aggregator.js +4 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.js +66 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +139 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.js +43 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +55 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +20 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +17 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/utils.js +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +215 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +201 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +223 -0
- package/dist/common/aggregator/index.d.ts +6 -0
- package/dist/common/aggregator/index.d.ts.map +1 -0
- package/dist/common/aggregator/index.js +5 -0
- package/dist/common/types.d.ts +11 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +4 -0
- package/dist/common/utils/bounds-utils.d.ts +10 -0
- package/dist/common/utils/bounds-utils.d.ts.map +1 -0
- package/dist/common/utils/bounds-utils.js +20 -0
- package/dist/common/utils/color-utils.d.ts +10 -0
- package/dist/common/utils/color-utils.d.ts.map +1 -0
- package/dist/common/utils/color-utils.js +65 -0
- package/dist/common/utils/prop-utils.d.ts.map +1 -0
- package/dist/common/utils/prop-utils.js +12 -0
- package/dist/common/utils/scale-utils.d.ts +46 -0
- package/dist/common/utils/scale-utils.d.ts.map +1 -0
- package/dist/common/utils/scale-utils.js +180 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/contour-layer/bin-options-uniforms.js +17 -0
- package/dist/contour-layer/contour-layer.d.ts +42 -50
- package/dist/contour-layer/contour-layer.d.ts.map +1 -1
- package/dist/contour-layer/contour-layer.js +232 -192
- package/dist/contour-layer/contour-utils.d.ts +36 -15
- package/dist/contour-layer/contour-utils.d.ts.map +1 -1
- package/dist/contour-layer/contour-utils.js +24 -29
- package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares-codes.js +3 -0
- package/dist/contour-layer/marching-squares.d.ts +22 -6
- package/dist/contour-layer/marching-squares.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares.js +71 -68
- package/dist/contour-layer/value-reader.d.ts +10 -0
- package/dist/contour-layer/value-reader.d.ts.map +1 -0
- package/dist/contour-layer/value-reader.js +46 -0
- package/dist/dist.dev.js +4842 -4081
- package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/bin-options-uniforms.js +17 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
- package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
- package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer.js +93 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/grid-layer-uniforms.js +23 -0
- package/dist/grid-layer/grid-layer.d.ts +175 -13
- package/dist/grid-layer/grid-layer.d.ts.map +1 -1
- package/dist/grid-layer/grid-layer.js +342 -46
- package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
- package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
- package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +6 -21
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.js +32 -0
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.js +3 -0
- package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +43 -33
- package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-fs.glsl.js +3 -0
- package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-vs.glsl.js +6 -4
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +5 -23
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.js +22 -0
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +10 -30
- package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
- package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer.js +17 -30
- package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-fs.glsl.js +3 -0
- package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.js +6 -7
- package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
- package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/bin-options-uniforms.js +17 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.js +94 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.js +21 -0
- package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer.js +307 -123
- package/dist/hexagon-layer/hexbin.d.ts +17 -0
- package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
- package/dist/hexagon-layer/hexbin.js +69 -0
- package/dist/index.cjs +3025 -2946
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +7 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -27
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/bin-options-uniforms.js +15 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +52 -134
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +4 -24
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +19 -0
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +21 -62
- package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +157 -174
- package/dist.min.js +401 -382
- package/package.json +10 -9
- package/src/common/aggregation-layer.ts +107 -0
- package/src/common/aggregator/aggregator.ts +88 -0
- package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
- package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
- package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
- package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
- package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
- package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
- package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
- package/src/common/aggregator/index.ts +10 -0
- package/src/{types.ts → common/types.ts} +10 -4
- package/src/common/utils/bounds-utils.ts +34 -0
- package/src/common/utils/color-utils.ts +86 -0
- package/src/common/utils/prop-utils.ts +13 -0
- package/src/common/utils/scale-utils.ts +236 -0
- package/src/contour-layer/bin-options-uniforms.ts +26 -0
- package/src/contour-layer/contour-layer.ts +300 -265
- package/src/contour-layer/contour-utils.ts +68 -39
- package/src/contour-layer/marching-squares-codes.ts +4 -0
- package/src/contour-layer/marching-squares.ts +93 -82
- package/src/contour-layer/value-reader.ts +65 -0
- package/src/grid-layer/bin-options-uniforms.ts +26 -0
- package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
- package/src/grid-layer/grid-cell-layer.ts +141 -0
- package/src/grid-layer/grid-layer-uniforms.ts +37 -0
- package/src/grid-layer/grid-layer.ts +614 -73
- package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
- package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
- package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
- package/src/heatmap-layer/heatmap-layer.ts +59 -36
- package/src/heatmap-layer/max-fs.glsl.ts +4 -0
- package/src/heatmap-layer/max-vs.glsl.ts +7 -4
- package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
- package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
- package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
- package/src/heatmap-layer/triangle-layer.ts +26 -31
- package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
- package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
- package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
- package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
- package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
- package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
- package/src/hexagon-layer/hexagon-layer.ts +454 -186
- package/src/hexagon-layer/hexbin.ts +79 -0
- package/src/index.ts +21 -34
- package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
- package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
- package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
- package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
- package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
- package/dist/aggregation-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
- package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
- package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
- package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
- package/dist/grid-aggregation-layer.d.ts +0 -67
- package/dist/grid-aggregation-layer.d.ts.map +0 -1
- package/dist/grid-aggregation-layer.js +0 -173
- package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
- package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
- package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
- package/dist/types.d.ts +0 -12
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/aggregation-operation-utils.d.ts +0 -19
- package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
- package/dist/utils/aggregation-operation-utils.js +0 -94
- package/dist/utils/bin-sorter.d.ts +0 -52
- package/dist/utils/bin-sorter.d.ts.map +0 -1
- package/dist/utils/bin-sorter.js +0 -167
- package/dist/utils/color-utils.d.ts +0 -3
- package/dist/utils/color-utils.d.ts.map +0 -1
- package/dist/utils/color-utils.js +0 -53
- package/dist/utils/cpu-aggregator.d.ts +0 -169
- package/dist/utils/cpu-aggregator.d.ts.map +0 -1
- package/dist/utils/cpu-aggregator.js +0 -421
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
- package/dist/utils/grid-aggregation-utils.d.ts +0 -30
- package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
- package/dist/utils/grid-aggregation-utils.js +0 -114
- package/dist/utils/prop-utils.d.ts.map +0 -1
- package/dist/utils/prop-utils.js +0 -28
- package/dist/utils/resource-utils.d.ts +0 -14
- package/dist/utils/resource-utils.d.ts.map +0 -1
- package/dist/utils/resource-utils.js +0 -38
- package/dist/utils/scale-utils.d.ts +0 -15
- package/dist/utils/scale-utils.d.ts.map +0 -1
- package/dist/utils/scale-utils.js +0 -184
- package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
- package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
- package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
- package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
- package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
- package/src/grid-aggregation-layer.ts +0 -243
- package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
- package/src/utils/aggregation-operation-utils.ts +0 -118
- package/src/utils/bin-sorter.ts +0 -218
- package/src/utils/color-utils.ts +0 -57
- package/src/utils/cpu-aggregator.ts +0 -503
- package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
- package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
- package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
- package/src/utils/grid-aggregation-utils.ts +0 -147
- package/src/utils/prop-utils.ts +0 -29
- package/src/utils/resource-utils.ts +0 -53
- package/src/utils/scale-utils.js +0 -219
- /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NumberArray3, NumberArray4 } from '@math.gl/core';
|
|
2
|
+
import { Texture } from '@luma.gl/core';
|
|
3
|
+
export type AggregatorTransformProps = {
|
|
4
|
+
binIdRange: NumberArray4;
|
|
5
|
+
isCount: NumberArray3;
|
|
6
|
+
isMean: NumberArray3;
|
|
7
|
+
bins: Texture;
|
|
8
|
+
};
|
|
9
|
+
export declare const aggregatorTransformUniforms: {
|
|
10
|
+
readonly name: "aggregatorTransform";
|
|
11
|
+
readonly vs: "uniform aggregatorTransformUniforms {\n ivec4 binIdRange;\n bvec3 isCount;\n bvec3 isMean;\n float naN;\n} aggregatorTransform;\n";
|
|
12
|
+
readonly uniformTypes: {
|
|
13
|
+
readonly binIdRange: "vec4<i32>";
|
|
14
|
+
readonly isCount: "vec3<f32>";
|
|
15
|
+
readonly isMean: "vec3<f32>";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=aggregation-transform-uniforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregation-transform-uniforms.d.ts","sourceRoot":"","sources":["../../../../src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAWtC,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,YAAY,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;CAQmB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
const uniformBlock = /* glsl */ `\
|
|
5
|
+
uniform aggregatorTransformUniforms {
|
|
6
|
+
ivec4 binIdRange;
|
|
7
|
+
bvec3 isCount;
|
|
8
|
+
bvec3 isMean;
|
|
9
|
+
float naN;
|
|
10
|
+
} aggregatorTransform;
|
|
11
|
+
`;
|
|
12
|
+
export const aggregatorTransformUniforms = {
|
|
13
|
+
name: 'aggregatorTransform',
|
|
14
|
+
vs: uniformBlock,
|
|
15
|
+
uniformTypes: {
|
|
16
|
+
binIdRange: 'vec4<i32>',
|
|
17
|
+
isCount: 'vec3<f32>',
|
|
18
|
+
isMean: 'vec3<f32>'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NumberArray2, NumberArray4 } from '@math.gl/core';
|
|
2
|
+
export type BinSorterProps = {
|
|
3
|
+
binIdRange: NumberArray4;
|
|
4
|
+
targetSize: NumberArray2;
|
|
5
|
+
};
|
|
6
|
+
export declare const binSorterUniforms: {
|
|
7
|
+
readonly name: "binSorter";
|
|
8
|
+
readonly vs: "uniform binSorterUniforms {\n ivec4 binIdRange;\n ivec2 targetSize;\n} binSorter;\n";
|
|
9
|
+
readonly uniformTypes: {
|
|
10
|
+
readonly binIdRange: "vec4<i32>";
|
|
11
|
+
readonly targetSize: "vec2<i32>";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=bin-sorter-uniforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin-sorter-uniforms.d.ts","sourceRoot":"","sources":["../../../../src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAUzD,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,YAAY,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;CAOmB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
const uniformBlock = /* glsl */ `\
|
|
5
|
+
uniform binSorterUniforms {
|
|
6
|
+
ivec4 binIdRange;
|
|
7
|
+
ivec2 targetSize;
|
|
8
|
+
} binSorter;
|
|
9
|
+
`;
|
|
10
|
+
export const binSorterUniforms = {
|
|
11
|
+
name: 'binSorter',
|
|
12
|
+
vs: uniformBlock,
|
|
13
|
+
uniformTypes: {
|
|
14
|
+
binIdRange: 'vec4<i32>',
|
|
15
|
+
targetSize: 'vec2<i32>'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/common/aggregator/gpu-aggregator/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAEvD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAiB7F"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
/**
|
|
5
|
+
* Create a float texture to store aggregation result
|
|
6
|
+
*/
|
|
7
|
+
export function createRenderTarget(device, width, height) {
|
|
8
|
+
return device.createFramebuffer({
|
|
9
|
+
width,
|
|
10
|
+
height,
|
|
11
|
+
colorAttachments: [
|
|
12
|
+
device.createTexture({
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
format: 'rgba32float',
|
|
16
|
+
mipmaps: false,
|
|
17
|
+
sampler: {
|
|
18
|
+
minFilter: 'nearest',
|
|
19
|
+
magFilter: 'nearest'
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Device, Buffer, Texture } from '@luma.gl/core';
|
|
2
|
+
import type { WebGLAggregatorProps } from "./webgl-aggregator.js";
|
|
3
|
+
import type { AggregationOperation } from "../aggregator.js";
|
|
4
|
+
export declare class WebGLAggregationTransform {
|
|
5
|
+
device: Device;
|
|
6
|
+
channelCount: number;
|
|
7
|
+
/** Packed from bin ids */
|
|
8
|
+
binBuffer: Buffer | null;
|
|
9
|
+
/** Packed values from each channel of each bin
|
|
10
|
+
* Stride is number of channels * 4 bytes (float32)
|
|
11
|
+
*/
|
|
12
|
+
valueBuffer: Buffer | null;
|
|
13
|
+
private transform;
|
|
14
|
+
/** Render target for calculating domain */
|
|
15
|
+
private domainFBO;
|
|
16
|
+
/** Aggregated [min, max] for each channel */
|
|
17
|
+
private _domains;
|
|
18
|
+
constructor(device: Device, props: WebGLAggregatorProps);
|
|
19
|
+
destroy(): void;
|
|
20
|
+
get domains(): [min: number, max: number][];
|
|
21
|
+
setDimensions(binCount: number, binIdRange: [number, number][]): void;
|
|
22
|
+
update(bins: Texture | null, operations: AggregationOperation[]): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=webgl-aggregation-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-aggregation-transform.d.ts","sourceRoot":"","sources":["../../../../src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,MAAM,EAAe,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAC,oBAAoB,EAAC,8BAA2B;AAC7D,OAAO,KAAK,EAAC,oBAAoB,EAAC,yBAAsB;AAWxD,qBAAa,yBAAyB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IAErB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAChC;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAElC,OAAO,CAAC,SAAS,CAAkB;IACnC,2CAA2C;IAC3C,OAAO,CAAC,SAAS,CAAc;IAC/B,6CAA6C;IAC7C,OAAO,CAAC,QAAQ,CAA6C;gBAEjD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;IAOvD,OAAO;IAQP,IAAI,OAAO,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,CAY1C;IAED,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;IA6B9D,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE;CA8BhE"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { BufferTransform } from '@luma.gl/engine';
|
|
5
|
+
import { createRenderTarget } from "./utils.js";
|
|
6
|
+
import { TEXTURE_WIDTH } from "./webgl-bin-sorter.js";
|
|
7
|
+
import { aggregatorTransformUniforms } from "./aggregation-transform-uniforms.js";
|
|
8
|
+
const MAX_FLOAT32 = 3e38;
|
|
9
|
+
export class WebGLAggregationTransform {
|
|
10
|
+
constructor(device, props) {
|
|
11
|
+
/** Packed from bin ids */
|
|
12
|
+
this.binBuffer = null;
|
|
13
|
+
/** Packed values from each channel of each bin
|
|
14
|
+
* Stride is number of channels * 4 bytes (float32)
|
|
15
|
+
*/
|
|
16
|
+
this.valueBuffer = null;
|
|
17
|
+
/** Aggregated [min, max] for each channel */
|
|
18
|
+
this._domains = null;
|
|
19
|
+
this.device = device;
|
|
20
|
+
this.channelCount = props.channelCount;
|
|
21
|
+
this.transform = createTransform(device, props);
|
|
22
|
+
this.domainFBO = createRenderTarget(device, 2, 1);
|
|
23
|
+
}
|
|
24
|
+
destroy() {
|
|
25
|
+
this.transform.destroy();
|
|
26
|
+
this.binBuffer?.destroy();
|
|
27
|
+
this.valueBuffer?.destroy();
|
|
28
|
+
this.domainFBO.colorAttachments[0].texture.destroy();
|
|
29
|
+
this.domainFBO.destroy();
|
|
30
|
+
}
|
|
31
|
+
get domains() {
|
|
32
|
+
if (!this._domains) {
|
|
33
|
+
// Domain model has run, but result has not been read to CPU
|
|
34
|
+
const buffer = this.device.readPixelsToArrayWebGL(this.domainFBO).buffer;
|
|
35
|
+
const domain = new Float32Array(buffer);
|
|
36
|
+
this._domains = [
|
|
37
|
+
[-domain[4], domain[0]],
|
|
38
|
+
[-domain[5], domain[1]],
|
|
39
|
+
[-domain[6], domain[2]]
|
|
40
|
+
].slice(0, this.channelCount);
|
|
41
|
+
}
|
|
42
|
+
return this._domains;
|
|
43
|
+
}
|
|
44
|
+
setDimensions(binCount, binIdRange) {
|
|
45
|
+
const { model, transformFeedback } = this.transform;
|
|
46
|
+
model.setVertexCount(binCount);
|
|
47
|
+
const aggregatorTransformProps = {
|
|
48
|
+
binIdRange: [
|
|
49
|
+
binIdRange[0][0],
|
|
50
|
+
binIdRange[0][1],
|
|
51
|
+
binIdRange[1]?.[0] || 0,
|
|
52
|
+
binIdRange[1]?.[1] || 0
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
model.shaderInputs.setProps({ aggregatorTransform: aggregatorTransformProps });
|
|
56
|
+
// Only destroy existing buffer if it is not large enough
|
|
57
|
+
const binBufferByteLength = binCount * binIdRange.length * 4;
|
|
58
|
+
if (!this.binBuffer || this.binBuffer.byteLength < binBufferByteLength) {
|
|
59
|
+
this.binBuffer?.destroy();
|
|
60
|
+
this.binBuffer = this.device.createBuffer({ byteLength: binBufferByteLength });
|
|
61
|
+
transformFeedback.setBuffer('binIds', this.binBuffer);
|
|
62
|
+
}
|
|
63
|
+
const valueBufferByteLength = binCount * this.channelCount * 4;
|
|
64
|
+
if (!this.valueBuffer || this.valueBuffer.byteLength < valueBufferByteLength) {
|
|
65
|
+
this.valueBuffer?.destroy();
|
|
66
|
+
this.valueBuffer = this.device.createBuffer({ byteLength: valueBufferByteLength });
|
|
67
|
+
transformFeedback.setBuffer('values', this.valueBuffer);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
update(bins, operations) {
|
|
71
|
+
if (!bins) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const transform = this.transform;
|
|
75
|
+
const target = this.domainFBO;
|
|
76
|
+
const isCount = [0, 1, 2].map(i => (operations[i] === 'COUNT' ? 1 : 0));
|
|
77
|
+
const isMean = [0, 1, 2].map(i => (operations[i] === 'MEAN' ? 1 : 0));
|
|
78
|
+
const aggregatorTransformProps = {
|
|
79
|
+
isCount: isCount,
|
|
80
|
+
isMean: isMean,
|
|
81
|
+
bins
|
|
82
|
+
};
|
|
83
|
+
transform.model.shaderInputs.setProps({ aggregatorTransform: aggregatorTransformProps });
|
|
84
|
+
transform.run({
|
|
85
|
+
id: 'gpu-aggregation-domain',
|
|
86
|
+
framebuffer: target,
|
|
87
|
+
parameters: {
|
|
88
|
+
viewport: [0, 0, 2, 1]
|
|
89
|
+
},
|
|
90
|
+
clearColor: [-MAX_FLOAT32, -MAX_FLOAT32, -MAX_FLOAT32, 0],
|
|
91
|
+
clearDepth: false,
|
|
92
|
+
clearStencil: false
|
|
93
|
+
});
|
|
94
|
+
// Clear the last read results. This will be lazy-populated if used.
|
|
95
|
+
this._domains = null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function createTransform(device, props) {
|
|
99
|
+
const vs = /* glsl */ `\
|
|
100
|
+
#version 300 es
|
|
101
|
+
#define SHADER_NAME gpu-aggregation-domain-vertex
|
|
102
|
+
|
|
103
|
+
uniform sampler2D bins;
|
|
104
|
+
|
|
105
|
+
#if NUM_DIMS == 1
|
|
106
|
+
out float binIds;
|
|
107
|
+
#else
|
|
108
|
+
out vec2 binIds;
|
|
109
|
+
#endif
|
|
110
|
+
|
|
111
|
+
#if NUM_CHANNELS == 1
|
|
112
|
+
flat out float values;
|
|
113
|
+
#elif NUM_CHANNELS == 2
|
|
114
|
+
flat out vec2 values;
|
|
115
|
+
#else
|
|
116
|
+
flat out vec3 values;
|
|
117
|
+
#endif
|
|
118
|
+
|
|
119
|
+
const float NAN = intBitsToFloat(-1);
|
|
120
|
+
|
|
121
|
+
void main() {
|
|
122
|
+
int row = gl_VertexID / SAMPLER_WIDTH;
|
|
123
|
+
int col = gl_VertexID - row * SAMPLER_WIDTH;
|
|
124
|
+
vec4 weights = texelFetch(bins, ivec2(col, row), 0);
|
|
125
|
+
vec3 value3 = mix(
|
|
126
|
+
mix(weights.rgb, vec3(weights.a), aggregatorTransform.isCount),
|
|
127
|
+
weights.rgb / max(weights.a, 1.0),
|
|
128
|
+
aggregatorTransform.isMean
|
|
129
|
+
);
|
|
130
|
+
if (weights.a == 0.0) {
|
|
131
|
+
value3 = vec3(NAN);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
#if NUM_DIMS == 1
|
|
135
|
+
binIds = float(gl_VertexID + aggregatorTransform.binIdRange.x);
|
|
136
|
+
#else
|
|
137
|
+
int y = gl_VertexID / (aggregatorTransform.binIdRange.y - aggregatorTransform.binIdRange.x);
|
|
138
|
+
int x = gl_VertexID - y * (aggregatorTransform.binIdRange.y - aggregatorTransform.binIdRange.x);
|
|
139
|
+
binIds.y = float(y + aggregatorTransform.binIdRange.z);
|
|
140
|
+
binIds.x = float(x + aggregatorTransform.binIdRange.x);
|
|
141
|
+
#endif
|
|
142
|
+
|
|
143
|
+
#if NUM_CHANNELS == 3
|
|
144
|
+
values = value3;
|
|
145
|
+
#elif NUM_CHANNELS == 2
|
|
146
|
+
values = value3.xy;
|
|
147
|
+
#else
|
|
148
|
+
values = value3.x;
|
|
149
|
+
#endif
|
|
150
|
+
|
|
151
|
+
gl_Position = vec4(0., 0., 0., 1.);
|
|
152
|
+
// This model renders into a 2x1 texture to obtain min and max simultaneously.
|
|
153
|
+
// See comments in fragment shader
|
|
154
|
+
gl_PointSize = 2.0;
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
const fs = /* glsl */ `\
|
|
158
|
+
#version 300 es
|
|
159
|
+
#define SHADER_NAME gpu-aggregation-domain-fragment
|
|
160
|
+
|
|
161
|
+
precision highp float;
|
|
162
|
+
|
|
163
|
+
#if NUM_CHANNELS == 1
|
|
164
|
+
flat in float values;
|
|
165
|
+
#elif NUM_CHANNELS == 2
|
|
166
|
+
flat in vec2 values;
|
|
167
|
+
#else
|
|
168
|
+
flat in vec3 values;
|
|
169
|
+
#endif
|
|
170
|
+
|
|
171
|
+
out vec4 fragColor;
|
|
172
|
+
|
|
173
|
+
void main() {
|
|
174
|
+
vec3 value3;
|
|
175
|
+
#if NUM_CHANNELS == 3
|
|
176
|
+
value3 = values;
|
|
177
|
+
#elif NUM_CHANNELS == 2
|
|
178
|
+
value3.xy = values;
|
|
179
|
+
#else
|
|
180
|
+
value3.x = values;
|
|
181
|
+
#endif
|
|
182
|
+
if (isnan(value3.x)) discard;
|
|
183
|
+
// This shader renders into a 2x1 texture with blending=max
|
|
184
|
+
// The left pixel yields the max value of each channel
|
|
185
|
+
// The right pixel yields the min value of each channel
|
|
186
|
+
if (gl_FragCoord.x < 1.0) {
|
|
187
|
+
fragColor = vec4(value3, 1.0);
|
|
188
|
+
} else {
|
|
189
|
+
fragColor = vec4(-value3, 1.0);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
return new BufferTransform(device, {
|
|
194
|
+
vs,
|
|
195
|
+
fs,
|
|
196
|
+
topology: 'point-list',
|
|
197
|
+
modules: [aggregatorTransformUniforms],
|
|
198
|
+
parameters: {
|
|
199
|
+
blend: true,
|
|
200
|
+
blendColorSrcFactor: 'one',
|
|
201
|
+
blendColorDstFactor: 'one',
|
|
202
|
+
blendColorOperation: 'max',
|
|
203
|
+
blendAlphaSrcFactor: 'one',
|
|
204
|
+
blendAlphaDstFactor: 'one',
|
|
205
|
+
blendAlphaOperation: 'max'
|
|
206
|
+
},
|
|
207
|
+
defines: {
|
|
208
|
+
NUM_DIMS: props.dimensions,
|
|
209
|
+
NUM_CHANNELS: props.channelCount,
|
|
210
|
+
SAMPLER_WIDTH: TEXTURE_WIDTH
|
|
211
|
+
},
|
|
212
|
+
varyings: ['binIds', 'values'],
|
|
213
|
+
disableWarnings: true
|
|
214
|
+
});
|
|
215
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { WebGLBinSorter } from "./webgl-bin-sorter.js";
|
|
2
|
+
import { WebGLAggregationTransform } from "./webgl-aggregation-transform.js";
|
|
3
|
+
import { BinaryAttribute } from '@deck.gl/core';
|
|
4
|
+
import type { Aggregator, AggregationProps, AggregatedBin } from "../aggregator.js";
|
|
5
|
+
import type { Device, BufferLayout } from '@luma.gl/core';
|
|
6
|
+
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
7
|
+
/** Options used to construct a new WebGLAggregator */
|
|
8
|
+
export type WebGLAggregatorProps = {
|
|
9
|
+
/** Size of bin IDs */
|
|
10
|
+
dimensions: 1 | 2;
|
|
11
|
+
/** How many properties to perform aggregation on */
|
|
12
|
+
channelCount: 1 | 2 | 3;
|
|
13
|
+
/** Buffer layout for input attributes */
|
|
14
|
+
bufferLayout?: BufferLayout[];
|
|
15
|
+
/** Define a shader function with one of the signatures
|
|
16
|
+
* `void getBin(out int binId)`: if dimensions=1
|
|
17
|
+
* `void getBin(out ivec2 binId)`: if dimensions=2
|
|
18
|
+
* And a shader function with one of the signatures
|
|
19
|
+
* `void getValue(out float value)`: if channelCount=1
|
|
20
|
+
* `void getValue(out vec2 value)`: if channelCount=2
|
|
21
|
+
* `void getValue(out vec3 value)`: if channelCount=3
|
|
22
|
+
*/
|
|
23
|
+
vs: string;
|
|
24
|
+
/** Shader modules
|
|
25
|
+
* Required to support certain layer extensions (e.g. data filter)
|
|
26
|
+
*/
|
|
27
|
+
modules?: ShaderModule[];
|
|
28
|
+
/** Shadertool module defines */
|
|
29
|
+
defines?: Record<string, string | number | boolean>;
|
|
30
|
+
} & Partial<WebGLAggregationProps>;
|
|
31
|
+
/** Props used to run GPU aggregation, can be changed at any time */
|
|
32
|
+
type WebGLAggregationProps = AggregationProps & {
|
|
33
|
+
/** Limits of binId defined for each dimension. Ids outside of the [start, end) are ignored.
|
|
34
|
+
*/
|
|
35
|
+
binIdRange: [start: number, end: number][];
|
|
36
|
+
/** Context props passed to the shader modules */
|
|
37
|
+
shaderModuleProps?: Record<string, any>;
|
|
38
|
+
};
|
|
39
|
+
/** An Aggregator implementation that calculates aggregation on the GPU */
|
|
40
|
+
export declare class WebGLAggregator implements Aggregator {
|
|
41
|
+
/** Checks if the current device supports GPU aggregation */
|
|
42
|
+
static isSupported(device: Device): boolean;
|
|
43
|
+
readonly dimensions: 1 | 2;
|
|
44
|
+
readonly channelCount: 1 | 2 | 3;
|
|
45
|
+
binCount: number;
|
|
46
|
+
readonly device: Device;
|
|
47
|
+
props: WebGLAggregatorProps & WebGLAggregationProps;
|
|
48
|
+
/** Dirty flag per channel */
|
|
49
|
+
protected needsUpdate: boolean[];
|
|
50
|
+
/** Step 1. sort data points into bins, blended using an aggregation opera†ion */
|
|
51
|
+
protected binSorter: WebGLBinSorter;
|
|
52
|
+
/** Step 2. (optional) calculate the min/max across all bins */
|
|
53
|
+
protected aggregationTransform: WebGLAggregationTransform;
|
|
54
|
+
/** Cached outputs */
|
|
55
|
+
protected binIds: BinaryAttribute | null;
|
|
56
|
+
protected results: BinaryAttribute[];
|
|
57
|
+
constructor(device: Device, props: WebGLAggregatorProps);
|
|
58
|
+
getBins(): BinaryAttribute | null;
|
|
59
|
+
/** Returns an accessor to the output for a given channel. */
|
|
60
|
+
getResult(channel: 0 | 1 | 2): BinaryAttribute | null;
|
|
61
|
+
/** Returns the [min, max] of aggregated values for a given channel. */
|
|
62
|
+
getResultDomain(channel: 0 | 1 | 2): [min: number, max: number];
|
|
63
|
+
/** Returns the information for a given bin. */
|
|
64
|
+
getBin(index: number): AggregatedBin | null;
|
|
65
|
+
/** Release GPU resources */
|
|
66
|
+
destroy(): void;
|
|
67
|
+
/** Update aggregation props. Normalize prop values and set change flags. */
|
|
68
|
+
setProps(props: Partial<WebGLAggregationProps>): void;
|
|
69
|
+
/** Flags a channel to need update.
|
|
70
|
+
* This is called internally by setProps() if certain props change
|
|
71
|
+
* Users of this class still need to manually set the dirty flag sometimes, because even if no props changed
|
|
72
|
+
* the underlying buffers could have been updated and require rerunning the aggregation
|
|
73
|
+
* @param {number} channel - mark the given channel as dirty. If not provided, all channels will be updated.
|
|
74
|
+
*/
|
|
75
|
+
setNeedsUpdate(channel?: number): void;
|
|
76
|
+
update(): void;
|
|
77
|
+
/** Run aggregation */
|
|
78
|
+
preDraw(): void;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=webgl-aggregator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/common/aggregator/gpu-aggregator/webgl-aggregator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,cAAc,EAAC,8BAA2B;AAClD,OAAO,EAAC,yBAAyB,EAAC,yCAAsC;AACxE,OAAO,EAA+B,eAAe,EAAC,MAAM,eAAe,CAAC;AAE5E,OAAO,KAAK,EAAC,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAC,yBAAsB;AAC/E,OAAO,KAAK,EAAC,MAAM,EAAU,YAAY,EAAa,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvD,sDAAsD;AACtD,MAAM,MAAM,oBAAoB,GAAG;IACjC,sBAAsB;IACtB,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC;IAClB,oDAAoD;IACpD,YAAY,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,yCAAyC;IACzC,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B;;;;;;;OAOG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACrD,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEnC,oEAAoE;AACpE,KAAK,qBAAqB,GAAG,gBAAgB,GAAG;IAC9C;OACG;IACH,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC;IAC3C,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC,CAAC;AAEF,0EAA0E;AAC1E,qBAAa,eAAgB,YAAW,UAAU;IAChD,4DAA4D;IAC5D,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAO3C,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAK;IAErB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,oBAAoB,GAAG,qBAAqB,CAAC;IAEpD,6BAA6B;IAC7B,SAAS,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC;IACjC,iFAAiF;IACjF,SAAS,CAAC,SAAS,EAAE,cAAc,CAAC;IACpC,+DAA+D;IAC/D,SAAS,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;IAE1D,qBAAqB;IACrB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAQ;IAChD,SAAS,CAAC,OAAO,EAAE,eAAe,EAAE,CAAM;gBAE9B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;IAkBvD,OAAO,IAAI,eAAe,GAAG,IAAI;IAajC,6DAA6D;IAC7D,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,eAAe,GAAG,IAAI;IAiBrD,uEAAuE;IACvE,eAAe,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC;IAI/D,+CAA+C;IAC/C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAkC3C,4BAA4B;IAC5B,OAAO;IAKP,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC;IA2D9C;;;;;OAKG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM;IAQ/B,MAAM;IAEN,sBAAsB;IACtB,OAAO;CA0BR"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { WebGLBinSorter } from "./webgl-bin-sorter.js";
|
|
5
|
+
import { WebGLAggregationTransform } from "./webgl-aggregation-transform.js";
|
|
6
|
+
import { _deepEqual as deepEqual, log } from '@deck.gl/core';
|
|
7
|
+
/** An Aggregator implementation that calculates aggregation on the GPU */
|
|
8
|
+
export class WebGLAggregator {
|
|
9
|
+
/** Checks if the current device supports GPU aggregation */
|
|
10
|
+
static isSupported(device) {
|
|
11
|
+
return (device.features.has('float32-renderable-webgl') &&
|
|
12
|
+
device.features.has('texture-blend-float-webgl'));
|
|
13
|
+
}
|
|
14
|
+
constructor(device, props) {
|
|
15
|
+
this.binCount = 0;
|
|
16
|
+
/** Cached outputs */
|
|
17
|
+
this.binIds = null;
|
|
18
|
+
this.results = [];
|
|
19
|
+
this.device = device;
|
|
20
|
+
this.dimensions = props.dimensions;
|
|
21
|
+
this.channelCount = props.channelCount;
|
|
22
|
+
this.props = {
|
|
23
|
+
...props,
|
|
24
|
+
pointCount: 0,
|
|
25
|
+
binIdRange: [[0, 0]],
|
|
26
|
+
operations: [],
|
|
27
|
+
attributes: {},
|
|
28
|
+
binOptions: {}
|
|
29
|
+
};
|
|
30
|
+
this.needsUpdate = new Array(this.channelCount).fill(true);
|
|
31
|
+
this.binSorter = new WebGLBinSorter(device, props);
|
|
32
|
+
this.aggregationTransform = new WebGLAggregationTransform(device, props);
|
|
33
|
+
this.setProps(props);
|
|
34
|
+
}
|
|
35
|
+
getBins() {
|
|
36
|
+
const buffer = this.aggregationTransform.binBuffer;
|
|
37
|
+
if (!buffer) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
if (this.binIds?.buffer !== buffer) {
|
|
41
|
+
// deck.gl Attribute.setBinaryValue uses shallow comparison to determine if attribute value has changed
|
|
42
|
+
// For performance, only create a new binary attribute descriptor when Buffer changes
|
|
43
|
+
this.binIds = { buffer, type: 'float32', size: this.dimensions };
|
|
44
|
+
}
|
|
45
|
+
return this.binIds;
|
|
46
|
+
}
|
|
47
|
+
/** Returns an accessor to the output for a given channel. */
|
|
48
|
+
getResult(channel) {
|
|
49
|
+
const buffer = this.aggregationTransform.valueBuffer;
|
|
50
|
+
if (!buffer || channel >= this.channelCount) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
if (this.results[channel]?.buffer !== buffer) {
|
|
54
|
+
this.results[channel] = {
|
|
55
|
+
buffer,
|
|
56
|
+
type: 'float32',
|
|
57
|
+
size: 1,
|
|
58
|
+
stride: this.channelCount * 4,
|
|
59
|
+
offset: channel * 4
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return this.results[channel];
|
|
63
|
+
}
|
|
64
|
+
/** Returns the [min, max] of aggregated values for a given channel. */
|
|
65
|
+
getResultDomain(channel) {
|
|
66
|
+
return this.aggregationTransform.domains[channel];
|
|
67
|
+
}
|
|
68
|
+
/** Returns the information for a given bin. */
|
|
69
|
+
getBin(index) {
|
|
70
|
+
if (index < 0 || index >= this.binCount) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const { binIdRange } = this.props;
|
|
74
|
+
let id;
|
|
75
|
+
if (this.dimensions === 1) {
|
|
76
|
+
id = [index + binIdRange[0][0]];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const [[x0, x1], [y0]] = binIdRange;
|
|
80
|
+
const width = x1 - x0;
|
|
81
|
+
id = [(index % width) + x0, Math.floor(index / width) + y0];
|
|
82
|
+
}
|
|
83
|
+
const pixel = this.binSorter.getBinValues(index);
|
|
84
|
+
if (!pixel) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const count = pixel[3];
|
|
88
|
+
const value = [];
|
|
89
|
+
for (let channel = 0; channel < this.channelCount; channel++) {
|
|
90
|
+
const operation = this.props.operations[channel];
|
|
91
|
+
if (operation === 'COUNT') {
|
|
92
|
+
value[channel] = count;
|
|
93
|
+
}
|
|
94
|
+
else if (count === 0) {
|
|
95
|
+
value[channel] = NaN;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
value[channel] = operation === 'MEAN' ? pixel[channel] / count : pixel[channel];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return { id, value, count };
|
|
102
|
+
}
|
|
103
|
+
/** Release GPU resources */
|
|
104
|
+
destroy() {
|
|
105
|
+
this.binSorter.destroy();
|
|
106
|
+
this.aggregationTransform.destroy();
|
|
107
|
+
}
|
|
108
|
+
/** Update aggregation props. Normalize prop values and set change flags. */
|
|
109
|
+
setProps(props) {
|
|
110
|
+
const oldProps = this.props;
|
|
111
|
+
// Update local settings. These will set the flag this._needsUpdate
|
|
112
|
+
if ('binIdRange' in props && !deepEqual(props.binIdRange, oldProps.binIdRange, 2)) {
|
|
113
|
+
const binIdRange = props.binIdRange;
|
|
114
|
+
log.assert(binIdRange.length === this.dimensions);
|
|
115
|
+
if (this.dimensions === 1) {
|
|
116
|
+
const [[x0, x1]] = binIdRange;
|
|
117
|
+
this.binCount = x1 - x0;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const [[x0, x1], [y0, y1]] = binIdRange;
|
|
121
|
+
this.binCount = (x1 - x0) * (y1 - y0);
|
|
122
|
+
}
|
|
123
|
+
this.binSorter.setDimensions(this.binCount, binIdRange);
|
|
124
|
+
this.aggregationTransform.setDimensions(this.binCount, binIdRange);
|
|
125
|
+
this.setNeedsUpdate();
|
|
126
|
+
}
|
|
127
|
+
if (props.operations) {
|
|
128
|
+
for (let channel = 0; channel < this.channelCount; channel++) {
|
|
129
|
+
if (props.operations[channel] !== oldProps.operations[channel]) {
|
|
130
|
+
this.setNeedsUpdate(channel);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (props.pointCount !== undefined && props.pointCount !== oldProps.pointCount) {
|
|
135
|
+
this.binSorter.setModelProps({ vertexCount: props.pointCount });
|
|
136
|
+
this.setNeedsUpdate();
|
|
137
|
+
}
|
|
138
|
+
if (props.binOptions) {
|
|
139
|
+
if (!deepEqual(props.binOptions, oldProps.binOptions, 2)) {
|
|
140
|
+
this.setNeedsUpdate();
|
|
141
|
+
}
|
|
142
|
+
this.binSorter.model.shaderInputs.setProps({ binOptions: props.binOptions });
|
|
143
|
+
}
|
|
144
|
+
if (props.attributes) {
|
|
145
|
+
const attributeBuffers = {};
|
|
146
|
+
const constantAttributes = {};
|
|
147
|
+
for (const attribute of Object.values(props.attributes)) {
|
|
148
|
+
for (const [attributeName, value] of Object.entries(attribute.getValue())) {
|
|
149
|
+
if (ArrayBuffer.isView(value)) {
|
|
150
|
+
constantAttributes[attributeName] = value;
|
|
151
|
+
}
|
|
152
|
+
else if (value) {
|
|
153
|
+
attributeBuffers[attributeName] = value;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
this.binSorter.setModelProps({ attributes: attributeBuffers, constantAttributes });
|
|
158
|
+
}
|
|
159
|
+
if (props.shaderModuleProps) {
|
|
160
|
+
this.binSorter.setModelProps({ shaderModuleProps: props.shaderModuleProps });
|
|
161
|
+
}
|
|
162
|
+
Object.assign(this.props, props);
|
|
163
|
+
}
|
|
164
|
+
/** Flags a channel to need update.
|
|
165
|
+
* This is called internally by setProps() if certain props change
|
|
166
|
+
* Users of this class still need to manually set the dirty flag sometimes, because even if no props changed
|
|
167
|
+
* the underlying buffers could have been updated and require rerunning the aggregation
|
|
168
|
+
* @param {number} channel - mark the given channel as dirty. If not provided, all channels will be updated.
|
|
169
|
+
*/
|
|
170
|
+
setNeedsUpdate(channel) {
|
|
171
|
+
if (channel === undefined) {
|
|
172
|
+
this.needsUpdate.fill(true);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
this.needsUpdate[channel] = true;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
update() { }
|
|
179
|
+
/** Run aggregation */
|
|
180
|
+
preDraw() {
|
|
181
|
+
if (!this.needsUpdate.some(Boolean)) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const { operations } = this.props;
|
|
185
|
+
const operationsToUpdate = this.needsUpdate.map((needsUpdate, i) => needsUpdate ? operations[i] : null);
|
|
186
|
+
// Render data to bins
|
|
187
|
+
this.binSorter.update(operationsToUpdate);
|
|
188
|
+
// Read to buffer and calculate domain
|
|
189
|
+
this.aggregationTransform.update(this.binSorter.texture, operations);
|
|
190
|
+
for (let i = 0; i < this.channelCount; i++) {
|
|
191
|
+
if (this.needsUpdate[i]) {
|
|
192
|
+
this.needsUpdate[i] = false;
|
|
193
|
+
this.props.onUpdate?.({ channel: i });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// Uncomment to debug
|
|
197
|
+
// console.log('binsFBO', new Float32Array(this.device.readPixelsToArrayWebGL(this.binSorter.texture!).buffer));
|
|
198
|
+
// console.log('binsBuffer', new Float32Array(this.aggregationTransform.binBuffer?.readSyncWebGL().buffer!));
|
|
199
|
+
// console.log('resultBuffer', new Float32Array(this.aggregationTransform.valueBuffer?.readSyncWebGL().buffer!));
|
|
200
|
+
}
|
|
201
|
+
}
|