@deck.gl/aggregation-layers 9.0.0-beta.5 → 9.0.0-beta.7

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.
Files changed (53) hide show
  1. package/dist/contour-layer/contour-layer.d.ts.map +1 -1
  2. package/dist/contour-layer/contour-layer.js +2 -3
  3. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
  4. package/dist/cpu-grid-layer/cpu-grid-layer.js +1 -2
  5. package/dist/dist.dev.js +228 -314
  6. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +2 -6
  7. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +50 -79
  8. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +4 -4
  9. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +1 -1
  10. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
  11. package/dist/gpu-grid-layer/gpu-grid-layer.js +4 -4
  12. package/dist/grid-aggregation-layer.js +1 -1
  13. package/dist/heatmap-layer/heatmap-layer.d.ts +0 -1
  14. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  15. package/dist/heatmap-layer/heatmap-layer.js +4 -20
  16. package/dist/heatmap-layer/max-fs.glsl.js +2 -2
  17. package/dist/heatmap-layer/max-vs.glsl.js +6 -10
  18. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +15 -25
  19. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +11 -16
  20. package/dist/heatmap-layer/weights-fs.glsl.js +7 -11
  21. package/dist/heatmap-layer/weights-vs.glsl.js +7 -12
  22. package/dist/hexagon-layer/hexagon-layer.d.ts +1 -1
  23. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
  24. package/dist/hexagon-layer/hexagon-layer.js +1 -2
  25. package/dist/index.cjs +223 -390
  26. package/dist/index.cjs.map +3 -3
  27. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -2
  28. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  29. package/dist/screen-grid-layer/screen-grid-cell-layer.js +0 -3
  30. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +5 -10
  31. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +30 -42
  32. package/dist/screen-grid-layer/screen-grid-layer.d.ts +0 -3
  33. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
  34. package/dist/screen-grid-layer/screen-grid-layer.js +1 -8
  35. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +6 -9
  36. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +14 -25
  37. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +2 -6
  38. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +25 -42
  39. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +8 -8
  40. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  41. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +13 -24
  42. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +4 -9
  43. package/dist.min.js +298 -450
  44. package/package.json +8 -10
  45. package/src/contour-layer/contour-layer.ts +2 -3
  46. package/src/cpu-grid-layer/cpu-grid-layer.ts +1 -2
  47. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +1 -1
  48. package/src/gpu-grid-layer/gpu-grid-layer.ts +2 -2
  49. package/src/heatmap-layer/heatmap-layer.ts +5 -23
  50. package/src/hexagon-layer/hexagon-layer.ts +2 -3
  51. package/src/screen-grid-layer/screen-grid-cell-layer.ts +0 -4
  52. package/src/screen-grid-layer/screen-grid-layer.ts +1 -11
  53. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +4 -15
@@ -1,4 +1,4 @@
1
- import { Device, Texture } from '@luma.gl/core';
1
+ import { Texture } from '@luma.gl/core';
2
2
  import { Model } from '@luma.gl/engine';
3
3
  import { Layer, LayerProps, UpdateParameters, DefaultProps } from '@deck.gl/core';
4
4
  import type { _ScreenGridLayerProps } from "./screen-grid-layer.js";
@@ -12,7 +12,6 @@ export type _ScreenGridCellLayerProps<DataT> = _ScreenGridLayerProps<DataT> & {
12
12
  export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {}> extends Layer<ExtraPropsT & Required<_ScreenGridCellLayerProps<DataT>>> {
13
13
  static layerName: string;
14
14
  static defaultProps: DefaultProps<ScreenGridCellLayerProps<unknown>>;
15
- static isSupported(device: Device): boolean;
16
15
  state: {
17
16
  model?: Model;
18
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"screen-grid-cell-layer.d.ts","sourceRoot":"","sources":["../../src/screen-grid-layer/screen-grid-cell-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAW,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,KAAK,EAAE,UAAU,EAAgB,gBAAgB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAI9F,OAAO,KAAK,EAAC,qBAAqB,EAAC,+BAA4B;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAclD,uDAAuD;AACvD,MAAM,MAAM,wBAAwB,CAAC,KAAK,GAAG,OAAO,IAAI,yBAAyB,CAAC,KAAK,CAAC,GACtF,UAAU,CAAC;AAEb,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI,qBAAqB,CAAC,KAAK,CAAC,GAAG;IAC5E,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBAAmB,CAAC,KAAK,GAAG,GAAG,EAAE,WAAW,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,KAAK,CAC9F,WAAW,GAAG,QAAQ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CAA8C;AAC9C,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI,qBAAqB,CAAC,KAAK,CAAC,GAAG;IAC5E,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBAAmB,CAAC,KAAK,GAAG,GAAG,EAAE,WAAW,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,KAAK,CAC9F,WAAW,GAAG,QAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CACzD;IACC,MAAM,CAAC,SAAS,SAAyB;IACzC,MAAM,CAAC,YAAY,kDAAgB;IAEnC,KAAK,EAAG;QACN,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IAEF,UAAU,IAAI;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,YAAY,EAAE,CAAA;KAAC;IAI/D,eAAe;IAYf,iBAAiB,CAAC,EAAC,WAAW,EAAC;;KAAA;IAK/B,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAe1C,IAAI,CAAC,EAAC,QAAQ,EAAC;;KAAA;IA2Bf,0BAA0B,CAAC,SAAS,KAAA,EAAE,EAAC,YAAY,EAAC;;KAAA;IAkBpD,SAAS,IAAI,KAAK;IAsBlB,gBAAgB,IAAI,OAAO;IAe3B,eAAe,CAAC,QAAQ,KAAA,EAAE,KAAK,KAAA,EAAE,WAAW,KAAA,GAAG,IAAI;CA2BpD"}
@@ -34,9 +34,6 @@ const defaultProps = {
34
34
  export default class ScreenGridCellLayer extends Layer {
35
35
  static { this.layerName = 'ScreenGridCellLayer'; }
36
36
  static { this.defaultProps = defaultProps; }
37
- static isSupported(device) {
38
- return device.features.has('texture-formats-float32-webgl1');
39
- }
40
37
  getShaders() {
41
38
  return { vs, fs, modules: [picking] };
42
39
  }
@@ -21,20 +21,15 @@
21
21
  export default `\
22
22
  #version 300 es
23
23
  #define SHADER_NAME screen-grid-layer-fragment-shader
24
-
25
24
  precision highp float;
26
-
27
25
  in vec4 vColor;
28
26
  in float vSampleCount;
29
-
30
27
  out vec4 fragColor;
31
-
32
28
  void main(void) {
33
- if (vSampleCount <= 0.0) {
34
- discard;
35
- }
36
- fragColor = vColor;
37
-
38
- DECKGL_FILTER_COLOR(fragColor, geometry);
29
+ if (vSampleCount <= 0.0) {
30
+ discard;
31
+ }
32
+ fragColor = vColor;
33
+ DECKGL_FILTER_COLOR(fragColor, geometry);
39
34
  }
40
35
  `;
@@ -21,12 +21,10 @@ export default `\
21
21
  #version 300 es
22
22
  #define SHADER_NAME screen-grid-layer-vertex-shader
23
23
  #define RANGE_COUNT 6
24
-
25
24
  in vec3 positions;
26
25
  in vec3 instancePositions;
27
26
  in vec4 instanceCounts;
28
27
  in vec3 instancePickingColors;
29
-
30
28
  uniform float opacity;
31
29
  uniform vec3 cellScale;
32
30
  uniform vec4 minColor;
@@ -35,50 +33,40 @@ uniform vec4 colorRange[RANGE_COUNT];
35
33
  uniform vec2 colorDomain;
36
34
  uniform bool shouldUseMinMax;
37
35
  uniform sampler2D maxTexture;
38
-
39
36
  out vec4 vColor;
40
37
  out float vSampleCount;
41
-
42
38
  vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
43
- vec4 outColor = vec4(0., 0., 0., 0.);
44
- if (value >= domain.x && value <= domain.y) {
45
- float domainRange = domain.y - domain.x;
46
- if (domainRange <= 0.) {
47
- outColor = colorRange[0];
48
- } else {
49
- float rangeCount = float(RANGE_COUNT);
50
- float rangeStep = domainRange / rangeCount;
51
- float idx = floor((value - domain.x) / rangeStep);
52
- idx = clamp(idx, 0., rangeCount - 1.);
53
- int intIdx = int(idx);
54
- outColor = colorRange[intIdx];
55
- }
56
- }
57
- outColor = outColor / 255.;
58
- return outColor;
39
+ vec4 outColor = vec4(0., 0., 0., 0.);
40
+ if (value >= domain.x && value <= domain.y) {
41
+ float domainRange = domain.y - domain.x;
42
+ if (domainRange <= 0.) {
43
+ outColor = colorRange[0];
44
+ } else {
45
+ float rangeCount = float(RANGE_COUNT);
46
+ float rangeStep = domainRange / rangeCount;
47
+ float idx = floor((value - domain.x) / rangeStep);
48
+ idx = clamp(idx, 0., rangeCount - 1.);
49
+ int intIdx = int(idx);
50
+ outColor = colorRange[intIdx];
51
+ }
52
+ }
53
+ outColor = outColor / 255.;
54
+ return outColor;
59
55
  }
60
-
61
56
  void main(void) {
62
- vSampleCount = instanceCounts.a;
63
-
64
- float weight = instanceCounts.r;
65
- float maxWeight = texture(maxTexture, vec2(0.5)).r;
66
-
67
- float step = weight / maxWeight;
68
- vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
69
-
70
- vec2 domain = colorDomain;
71
- float domainMaxValid = float(colorDomain.y != 0.);
72
- domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
73
- vec4 rangeColor = quantizeScale(domain, colorRange, weight);
74
-
75
- float rangeMinMax = float(shouldUseMinMax);
76
- vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
77
- vColor = vec4(color.rgb, color.a * opacity);
78
-
79
- // Set color to be rendered to picking fbo (also used to check for selection highlight).
80
- picking_setPickingColor(instancePickingColors);
81
-
82
- gl_Position = vec4(instancePositions + positions * cellScale, 1.);
57
+ vSampleCount = instanceCounts.a;
58
+ float weight = instanceCounts.r;
59
+ float maxWeight = texture(maxTexture, vec2(0.5)).r;
60
+ float step = weight / maxWeight;
61
+ vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
62
+ vec2 domain = colorDomain;
63
+ float domainMaxValid = float(colorDomain.y != 0.);
64
+ domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
65
+ vec4 rangeColor = quantizeScale(domain, colorRange, weight);
66
+ float rangeMinMax = float(shouldUseMinMax);
67
+ vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
68
+ vColor = vec4(color.rgb, color.a * opacity);
69
+ picking_setPickingColor(instancePickingColors);
70
+ gl_Position = vec4(instancePositions + positions * cellScale, 1.);
83
71
  }
84
72
  `;
@@ -53,9 +53,6 @@ export type _ScreenGridLayerProps<DataT> = {
53
53
  /**
54
54
  * Perform aggregation is performed on GPU.
55
55
  *
56
- * NOTE: GPU Aggregation requires WebGL2 support by the browser.
57
- * When `gpuAggregation` is set to true and browser doesn't support WebGL2, aggregation falls back to CPU.
58
- *
59
56
  * @default true
60
57
  */
61
58
  gpuAggregation?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"screen-grid-layer.d.ts","sourceRoot":"","sources":["../../src/screen-grid-layer/screen-grid-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,oBAAoB,EACpB,KAAK,EACL,YAAY,EACZ,UAAU,EAEV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAKnD,OAAO,oBAAoB,EAAE,EAAC,yBAAyB,EAAC,qCAAkC;AAuB1F,mDAAmD;AACnD,MAAM,MAAM,oBAAoB,CAAC,KAAK,GAAG,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,GAC9E,yBAAyB,CAAC,KAAK,CAAC,CAAC;AAEnC,2CAA2C;AAC3C,MAAM,MAAM,qBAAqB,CAAC,KAAK,IAAI;IACzC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAExB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAEtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC;IAErB;;;;OAIG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,6 @@
18
18
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  // THE SOFTWARE.
20
20
  import { log } from '@deck.gl/core';
21
- import { GL } from '@luma.gl/constants';
22
21
  import GPUGridAggregator from "../utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
23
22
  import { AGGREGATION_OPERATION, getValueFunc } from "../utils/aggregation-operation-utils.js";
24
23
  import ScreenGridCellLayer from "./screen-grid-cell-layer.js";
@@ -46,12 +45,6 @@ export default class ScreenGridLayer extends GridAggregationLayer {
46
45
  static { this.layerName = 'ScreenGridLayer'; }
47
46
  static { this.defaultProps = defaultProps; }
48
47
  initializeState() {
49
- if (!ScreenGridCellLayer.isSupported(this.context.device)) {
50
- // max aggregated value is sampled from a float texture
51
- this.setState({ supported: false });
52
- log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();
53
- return;
54
- }
55
48
  super.initializeAggregationLayer({
56
49
  dimensions: DIMENSIONS,
57
50
  // @ts-expect-error
@@ -80,7 +73,7 @@ export default class ScreenGridLayer extends GridAggregationLayer {
80
73
  [POSITION_ATTRIBUTE_NAME]: {
81
74
  size: 3,
82
75
  accessor: 'getPosition',
83
- type: GL.DOUBLE,
76
+ type: 'float64',
84
77
  fp64: this.use64bitPositions()
85
78
  },
86
79
  // this attribute is used in gpu aggregation path only
@@ -20,20 +20,17 @@
20
20
  export default `\
21
21
  #version 300 es
22
22
  #define SHADER_NAME gpu-aggregation-all-fs
23
-
24
23
  precision highp float;
25
-
26
24
  in vec2 vTextureCoord;
27
25
  uniform sampler2D uSampler;
28
26
  uniform bool combineMaxMin;
29
27
  out vec4 fragColor;
30
28
  void main(void) {
31
- vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
32
- if (textureColor.a == 0.) {
33
- discard;
34
- }
35
- fragColor.rgb = textureColor.rgb;
36
- // if combineMinMax is true, use Alpha channel for first weights min value.
37
- fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
29
+ vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
30
+ if (textureColor.a == 0.) {
31
+ discard;
32
+ }
33
+ fragColor.rgb = textureColor.rgb;
34
+ fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
38
35
  }
39
36
  `;
@@ -20,34 +20,23 @@
20
20
  export default `\
21
21
  #version 300 es
22
22
  #define SHADER_NAME gpu-aggregation-all-vs-64
23
-
24
23
  in vec2 position;
25
24
  uniform ivec2 gridSize;
26
25
  out vec2 vTextureCoord;
27
-
28
26
  void main(void) {
29
- // Map each position to single pixel
30
- vec2 pos = vec2(-1.0, -1.0);
31
-
32
- // Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
33
- vec2 offset = 1.0 / vec2(gridSize);
34
- pos = pos + offset;
35
-
36
- gl_Position = vec4(pos, 0.0, 1.0);
37
-
38
- int yIndex = gl_InstanceID / gridSize[0];
39
- int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
40
-
41
- vec2 yIndexFP64 = vec2(float(yIndex), 0.);
42
- vec2 xIndexFP64 = vec2(float(xIndex), 0.);
43
- vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
44
- vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
45
-
46
- vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
47
- vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
48
-
49
- vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
50
- // Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
51
- gl_PointSize = 1.0;
27
+ vec2 pos = vec2(-1.0, -1.0);
28
+ vec2 offset = 1.0 / vec2(gridSize);
29
+ pos = pos + offset;
30
+ gl_Position = vec4(pos, 0.0, 1.0);
31
+ int yIndex = gl_InstanceID / gridSize[0];
32
+ int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
33
+ vec2 yIndexFP64 = vec2(float(yIndex), 0.);
34
+ vec2 xIndexFP64 = vec2(float(xIndex), 0.);
35
+ vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
36
+ vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
37
+ vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
38
+ vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
39
+ vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
40
+ gl_PointSize = 1.0;
52
41
  }
53
42
  `;
@@ -20,15 +20,11 @@
20
20
  export default `\
21
21
  #version 300 es
22
22
  #define SHADER_NAME gpu-aggregation-to-grid-fs
23
-
24
23
  precision highp float;
25
-
26
24
  in vec3 vWeights;
27
-
28
25
  out vec4 fragColor;
29
-
30
26
  void main(void) {
31
- fragColor = vec4(vWeights, 1.0);
32
- DECKGL_FILTER_COLOR(fragColor, geometry);
27
+ fragColor = vec4(vWeights, 1.0);
28
+ DECKGL_FILTER_COLOR(fragColor, geometry);
33
29
  }
34
30
  `;
@@ -20,7 +20,6 @@
20
20
  export default `\
21
21
  #version 300 es
22
22
  #define SHADER_NAME gpu-aggregation-to-grid-vs
23
-
24
23
  in vec3 positions;
25
24
  in vec3 positions64Low;
26
25
  in vec3 weights;
@@ -29,50 +28,34 @@ uniform vec2 gridSize;
29
28
  uniform bool projectPoints;
30
29
  uniform vec2 translation;
31
30
  uniform vec3 scaling;
32
-
33
31
  out vec3 vWeights;
34
-
35
32
  vec2 project_to_pixel(vec4 pos) {
36
- vec4 result;
37
- pos.xy = pos.xy/pos.w;
38
- result = pos + vec4(translation, 0., 0.);
39
- result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
40
- return result.xy;
33
+ vec4 result;
34
+ pos.xy = pos.xy/pos.w;
35
+ result = pos + vec4(translation, 0., 0.);
36
+ result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
37
+ return result.xy;
41
38
  }
42
-
43
39
  void main(void) {
44
-
45
- vWeights = weights;
46
-
47
- vec4 windowPos = vec4(positions, 1.);
48
- if (projectPoints) {
49
- windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
50
- }
51
-
52
- vec2 pos = project_to_pixel(windowPos);
53
-
54
- vec2 pixelXY64[2];
55
- pixelXY64[0] = vec2(pos.x, 0.);
56
- pixelXY64[1] = vec2(pos.y, 0.);
57
-
58
- // Transform (0,0):windowSize -> (0, 0): gridSize
59
- vec2 gridXY64[2];
60
- gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
61
- gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
62
- float x = floor(gridXY64[0].x);
63
- float y = floor(gridXY64[1].x);
64
- pos = vec2(x, y);
65
-
66
- // Transform (0,0):gridSize -> (-1, -1):(1,1)
67
- pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
68
-
69
- // Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
70
- vec2 offset = 1.0 / gridSize;
71
- pos = pos + offset;
72
-
73
- gl_Position = vec4(pos, 0.0, 1.0);
74
-
75
- // Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
76
- gl_PointSize = 1.0;
40
+ vWeights = weights;
41
+ vec4 windowPos = vec4(positions, 1.);
42
+ if (projectPoints) {
43
+ windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
44
+ }
45
+ vec2 pos = project_to_pixel(windowPos);
46
+ vec2 pixelXY64[2];
47
+ pixelXY64[0] = vec2(pos.x, 0.);
48
+ pixelXY64[1] = vec2(pos.y, 0.);
49
+ vec2 gridXY64[2];
50
+ gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
51
+ gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
52
+ float x = floor(gridXY64[0].x);
53
+ float y = floor(gridXY64[1].x);
54
+ pos = vec2(x, y);
55
+ pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
56
+ vec2 offset = 1.0 / gridSize;
57
+ pos = pos + offset;
58
+ gl_Position = vec4(pos, 0.0, 1.0);
59
+ gl_PointSize = 1.0;
77
60
  }
78
61
  `;
@@ -7,12 +7,12 @@ export const DEFAULT_RUN_PARAMS = {
7
7
  moduleSettings: {}
8
8
  };
9
9
  export const MAX_32_BIT_FLOAT = 3.402823466e38;
10
- export const MIN_BLEND_EQUATION = [GL.MIN, GL.FUNC_ADD];
11
- export const MAX_BLEND_EQUATION = [GL.MAX, GL.FUNC_ADD];
12
- export const MAX_MIN_BLEND_EQUATION = [GL.MAX, GL.MIN];
10
+ export const MIN_BLEND_EQUATION = [32775, 32774];
11
+ export const MAX_BLEND_EQUATION = [32776, 32774];
12
+ export const MAX_MIN_BLEND_EQUATION = [32776, 32775];
13
13
  export const EQUATION_MAP = {
14
- [AGGREGATION_OPERATION.SUM]: GL.FUNC_ADD,
15
- [AGGREGATION_OPERATION.MEAN]: GL.FUNC_ADD,
14
+ [AGGREGATION_OPERATION.SUM]: 32774,
15
+ [AGGREGATION_OPERATION.MEAN]: 32774,
16
16
  [AGGREGATION_OPERATION.MIN]: MIN_BLEND_EQUATION,
17
17
  [AGGREGATION_OPERATION.MAX]: MAX_BLEND_EQUATION
18
18
  };
@@ -27,15 +27,15 @@ export const DEFAULT_WEIGHT_PARAMS = {
27
27
  export const PIXEL_SIZE = 4; // RGBA32F
28
28
  export const WEIGHT_SIZE = 3;
29
29
  export const MAX_MIN_TEXTURE_OPTS = {
30
- format: GL.RGBA32F,
31
- type: GL.FLOAT,
30
+ format: 34836,
31
+ type: 5126,
32
32
  border: 0,
33
33
  mipmaps: false,
34
34
  sampler: {
35
35
  minFilter: 'nearest',
36
36
  magFilter: 'nearest'
37
37
  },
38
- dataFormat: GL.RGBA,
38
+ dataFormat: 6408,
39
39
  width: 1,
40
40
  height: 1
41
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-grid-aggregator.d.ts","sourceRoot":"","sources":["../../../src/utils/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,KAAK;IAUb,OAAO,CAAC,QAAQ,KAAA;;;;;;IA4BhB,aAAa,CAAC,aAAa,KAAK;IAMhC,2BAA2B,CAAC,IAAI,KAAA;IAUhC,QAAQ,CAAC,YAAY,KAAA;IAMrB,iBAAiB,CAAC,IAAI,KAAA;IA+CtB,oBAAoB,CAAC,IAAI,KAAA;IA2EzB,sBAAsB,CAAC,IAAI,KAAA;IAyB3B,uBAAuB,CAAC,IAAI,KAAA;IAqD5B,eAAe,CAAC,IAAI,KAAA;IAWpB,kBAAkB,CAAC,IAAI,KAAA;IAyEvB,iBAAiB,CAAC,IAAI,KAAA;IAQtB,YAAY,CAAC,EAAC,MAAU,EAAE,MAAU,EAAC;;;KAAK;IAW1C,sBAAsB,CAAC,IAAI,KAAA;IAQ3B,wHAAwH;IAExH,sBAAsB,CAAC,OAAO,KAAA,EAAE,OAAO,KAAA;IAoBvC,aAAa,CAAC,IAAI,KAAA;CAiBnB"}
@@ -20,7 +20,7 @@
20
20
  import { Model, TextureTransform } from '@luma.gl/engine';
21
21
  import { fp64arithmetic } from '@luma.gl/shadertools';
22
22
  import { GL } from '@luma.gl/constants';
23
- import { log, project32, _mergeShaders as mergeShaders, getShaderAssembler } from '@deck.gl/core';
23
+ import { project32, _mergeShaders as mergeShaders, getShaderAssembler } from '@deck.gl/core';
24
24
  import { DEFAULT_RUN_PARAMS, MAX_32_BIT_FLOAT, MIN_BLEND_EQUATION, MAX_BLEND_EQUATION, MAX_MIN_BLEND_EQUATION, EQUATION_MAP, DEFAULT_WEIGHT_PARAMS, PIXEL_SIZE } from "./gpu-grid-aggregator-constants.js";
25
25
  import { AGGREGATION_OPERATION } from "../aggregation-operation-utils.js";
26
26
  import AGGREGATE_TO_GRID_VS from "./aggregate-to-grid-vs.glsl.js";
@@ -36,11 +36,8 @@ const ARRAY_BUFFER_MAP = {
36
36
  maxMinData: 'maxMinBuffer'
37
37
  };
38
38
  const REQUIRED_FEATURES = [
39
- 'webgl2',
40
- 'blend-minmax-webgl1',
41
- 'texture-renderable-float32-webgl',
42
- 'texture-blend-float-webgl1',
43
- 'texture-formats-float32-webgl1'
39
+ 'float32-renderable-webgl',
40
+ 'texture-blend-float-webgl'
44
41
  ];
45
42
  export default class GPUGridAggregator {
46
43
  // Decode and return aggregation data of given pixel.
@@ -131,14 +128,9 @@ export default class GPUGridAggregator {
131
128
  this.id = props.id || 'gpu-grid-aggregator';
132
129
  this.device = device;
133
130
  const REQUIRED_FEATURES = [
134
- 'blend-minmax-webgl1', // set min/max blend modes
135
- 'texture-renderable-float32-webgl', // render to float texture
136
- 'texture-formats-float32-webgl1' // sample from a float texture
131
+ 'float32-renderable-webgl' // render to float texture
137
132
  ];
138
- // gl_InstanceID usage in min/max calculation shaders
139
- this._hasGPUSupport =
140
- this.device.info.type === 'webgl2' &&
141
- REQUIRED_FEATURES.every(feature => device.features.has(feature));
133
+ this._hasGPUSupport = REQUIRED_FEATURES.every(feature => device.features.has(feature));
142
134
  if (this._hasGPUSupport) {
143
135
  this._setupModels();
144
136
  }
@@ -165,9 +157,6 @@ export default class GPUGridAggregator {
165
157
  // reset results
166
158
  this.setState({ results: {} });
167
159
  const aggregationParams = this._normalizeAggregationParams(opts);
168
- if (!this._hasGPUSupport) {
169
- log.log(1, 'GPUGridAggregator: not supported')();
170
- }
171
160
  return this._runAggregation(aggregationParams);
172
161
  }
173
162
  // Reads aggregation data into JS Array object
@@ -220,12 +209,12 @@ export default class GPUGridAggregator {
220
209
  results[id].aggregationTexture = textures[id];
221
210
  results[id].aggregationBuffer = this.device.readPixelsToBufferWebGL(framebuffers[id], {
222
211
  target: weights[id].aggregationBuffer, // update if a buffer is provided
223
- sourceType: GL.FLOAT
212
+ sourceType: 5126
224
213
  });
225
214
  if (needMin && needMax && combineMaxMin) {
226
215
  results[id].maxMinBuffer = this.device.readPixelsToBufferWebGL(maxMinFramebuffers[id], {
227
216
  target: weights[id].maxMinBuffer, // update if a buffer is provided
228
- sourceType: GL.FLOAT
217
+ sourceType: 5126
229
218
  });
230
219
  results[id].maxMinTexture = resources[`${id}-maxMinTexture`];
231
220
  }
@@ -233,14 +222,14 @@ export default class GPUGridAggregator {
233
222
  if (needMin) {
234
223
  results[id].minBuffer = this.device.readPixelsToBufferWebGL(minFramebuffers[id], {
235
224
  target: weights[id].minBuffer, // update if a buffer is provided
236
- sourceType: GL.FLOAT
225
+ sourceType: 5126
237
226
  });
238
227
  results[id].minTexture = resources[`${id}-minTexture`];
239
228
  }
240
229
  if (needMax) {
241
230
  results[id].maxBuffer = this.device.readPixelsToBufferWebGL(maxFramebuffers[id], {
242
231
  target: weights[id].maxBuffer, // update if a buffer is provided
243
- sourceType: GL.FLOAT
232
+ sourceType: 5126
244
233
  });
245
234
  results[id].maxTexture = resources[`${id}-maxTexture`];
246
235
  }
@@ -256,7 +245,7 @@ export default class GPUGridAggregator {
256
245
  const parameters = {
257
246
  blend: true,
258
247
  depthTest: false,
259
- blendFunc: [GL.ONE, GL.ONE]
248
+ blendFunc: [1, 1]
260
249
  };
261
250
  const uniforms = {
262
251
  cellSize,
@@ -373,7 +362,7 @@ export default class GPUGridAggregator {
373
362
  }
374
363
  });
375
364
  // update framebuffer with mean results so device.readPixelsToBufferWebGL returns mean values
376
- framebuffers[id].attach({ [GL.COLOR_ATTACHMENT0]: textures[id] });
365
+ framebuffers[id].attach({ [36064]: textures[id] });
377
366
  }
378
367
  }
379
368
  _runAggregation(opts) {
@@ -408,7 +397,7 @@ export default class GPUGridAggregator {
408
397
  texture = meanTextures[id];
409
398
  }
410
399
  if (framebuffers[id]) {
411
- framebuffers[id].attach({ [GL.COLOR_ATTACHMENT0]: texture });
400
+ framebuffers[id].attach({ [36064]: texture });
412
401
  }
413
402
  else {
414
403
  framebuffers[id] = getFramebuffer(this.device, {
@@ -536,7 +525,7 @@ function getAggregationModel(device, shaderOptions) {
536
525
  return new Model(device, {
537
526
  id: 'Grid-Aggregation-Model',
538
527
  vertexCount: 1,
539
- drawMode: GL.POINTS,
528
+ drawMode: 0,
540
529
  shaderAssembler: getShaderAssembler(),
541
530
  ...shaders
542
531
  });
@@ -22,16 +22,11 @@ export default `\
22
22
  #define SHADER_NAME gpu-aggregation-transform-mean-vs
23
23
  in vec4 aggregationValues;
24
24
  out vec4 meanValues;
25
-
26
25
  void main()
27
26
  {
28
- // TODO: Use 64-bit division ?? not needed given this is aggregation ??
29
- bool isCellValid = bool(aggregationValues.w > 0.);
30
- // aggregationValues: XYZ contain aggregated values, W contains count
31
- meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
32
- meanValues.w = aggregationValues.w;
33
-
34
- // Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
35
- gl_PointSize = 1.0;
27
+ bool isCellValid = bool(aggregationValues.w > 0.);
28
+ meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
29
+ meanValues.w = aggregationValues.w;
30
+ gl_PointSize = 1.0;
36
31
  }
37
32
  `;