New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@deck.gl/aggregation-layers

Package Overview
Dependencies
Maintainers
6
Versions
412
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deck.gl/aggregation-layers - npm Package Compare versions

Comparing version 9.0.0-beta.5 to 9.0.0-beta.6

5

dist/contour-layer/contour-layer.js

@@ -20,3 +20,2 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

// THE SOFTWARE.
import { GL } from '@luma.gl/constants';
import { LineLayer, SolidPolygonLayer } from '@deck.gl/layers';

@@ -81,3 +80,3 @@ import { generateContours } from "./contour-utils.js";

accessor: 'getPosition',
type: GL.DOUBLE,
type: 'float64',
fp64: this.use64bitPositions()

@@ -215,3 +214,3 @@ },

// @ts-ignore
aggregationData = count.aggregationBuffer.readSyncWebGL2();
aggregationData = count.aggregationBuffer.readSyncWebGL();
count.aggregationData = aggregationData;

@@ -218,0 +217,0 @@ }

3

dist/cpu-grid-layer/cpu-grid-layer.js

@@ -20,3 +20,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

// THE SOFTWARE.
import { GL } from '@luma.gl/constants';
import { GridCellLayer } from '@deck.gl/layers';

@@ -77,3 +76,3 @@ import { defaultColorRange } from "../utils/color-utils.js";

attributeManager.add({
positions: { size: 3, type: GL.DOUBLE, accessor: 'getPosition' }
positions: { size: 3, type: 'float64', accessor: 'getPosition' }
});

@@ -80,0 +79,0 @@ // color and elevation attributes can't be added as attributes

@@ -23,13 +23,9 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
precision highp float;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
fragColor = vColor;
fragColor = picking_filterColor(fragColor);
fragColor = vColor;
fragColor = picking_filterColor(fragColor);
}
`;

@@ -25,11 +25,7 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

#define RANGE_COUNT 6
in vec3 positions;
in vec3 normals;
in vec4 colors;
in vec4 elevations;
in vec3 instancePickingColors;
// Custom uniforms
uniform vec2 offset;

@@ -41,3 +37,2 @@ uniform bool extruded;

uniform float elevationScale;
uniform ivec2 gridSize;

@@ -50,4 +45,2 @@ uniform vec2 gridOrigin;

uniform vec2 elevationRange;
// Domain uniforms
uniform vec2 colorDomain;

@@ -57,89 +50,67 @@ uniform bool colorDomainValid;

uniform bool elevationDomainValid;
layout(std140) uniform;
uniform ColorData
{
vec4 maxMinCount;
vec4 maxMinCount;
} colorData;
uniform ElevationData
{
vec4 maxMinCount;
vec4 maxMinCount;
} elevationData;
#define EPSILON 0.00001
// Result
out vec4 vColor;
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
vec4 outColor = vec4(0., 0., 0., 0.);
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
float domainRange = domain.y - domain.x;
if (domainRange <= 0.) {
outColor = colorRange[0];
} else {
float rangeCount = float(RANGE_COUNT);
float rangeStep = domainRange / rangeCount;
float idx = floor((value - domain.x) / rangeStep);
idx = clamp(idx, 0., rangeCount - 1.);
int intIdx = int(idx);
outColor = colorRange[intIdx];
}
}
return outColor;
vec4 outColor = vec4(0., 0., 0., 0.);
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
float domainRange = domain.y - domain.x;
if (domainRange <= 0.) {
outColor = colorRange[0];
} else {
float rangeCount = float(RANGE_COUNT);
float rangeStep = domainRange / rangeCount;
float idx = floor((value - domain.x) / rangeStep);
idx = clamp(idx, 0., rangeCount - 1.);
int intIdx = int(idx);
outColor = colorRange[intIdx];
}
}
return outColor;
}
float linearScale(vec2 domain, vec2 range, float value) {
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
}
return -1.;
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
}
return -1.;
}
void main(void) {
vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
float elevation = 0.0;
if (extruded) {
vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
elevation = linearScale(elvDomain, elevationRange, elevations.r);
elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
}
// if aggregated color or elevation is 0 do not render
float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
float dotRadius = cellSize / 2. * coverage * shouldRender;
int yIndex = (gl_InstanceID / gridSize[0]);
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
geometry.worldPosition = centroidPosition;
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
// Set color to be rendered to picking fbo (also used to check for selection highlight).
picking_setPickingColor(instancePickingColors);
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
// Light calculations
// Worldspace is the linear space after Mercator projection
vec3 normals_commonspace = project_normal(normals);
if (extruded) {
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
vColor = vec4(lightColor, color.a * opacity) / 255.;
} else {
vColor = vec4(color.rgb, color.a * opacity) / 255.;
}
vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
float elevation = 0.0;
if (extruded) {
vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
elevation = linearScale(elvDomain, elevationRange, elevations.r);
elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
}
float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
float dotRadius = cellSize / 2. * coverage * shouldRender;
int yIndex = (gl_InstanceID / gridSize[0]);
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
geometry.worldPosition = centroidPosition;
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
picking_setPickingColor(instancePickingColors);
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
vec3 normals_commonspace = project_normal(normals);
if (extruded) {
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
vColor = vec4(lightColor, color.a * opacity) / 255.;
} else {
vColor = vec4(color.rgb, color.a * opacity) / 255.;
}
}
`;

@@ -110,8 +110,8 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
colorMaxMinBuffer.bind({ target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX });
elevationMaxMinBuffer.bind({ target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX });
colorMaxMinBuffer.bind({ target: 35345, index: COLOR_DATA_UBO_INDEX });
elevationMaxMinBuffer.bind({ target: 35345, index: ELEVATION_DATA_UBO_INDEX });
}
unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
colorMaxMinBuffer.unbind({ target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX });
elevationMaxMinBuffer.unbind({ target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX });
colorMaxMinBuffer.unbind({ target: 35345, index: COLOR_DATA_UBO_INDEX });
elevationMaxMinBuffer.unbind({ target: 35345, index: ELEVATION_DATA_UBO_INDEX });
}

@@ -118,0 +118,0 @@ getDomainUniforms() {

@@ -81,3 +81,3 @@ import { Accessor, AccessorFunction, Color, Material, GetPickingInfoParams, LayerContext, PickingInfo, Position, DefaultProps } from '@deck.gl/core';

};
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU (WebGL2 only). */
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
export default class GPUGridLayer<DataT = any, ExtraPropsT extends {} = {}> extends GridAggregationLayer<DataT, ExtraPropsT & Required<_GPUGridLayerProps<DataT>>> {

@@ -84,0 +84,0 @@ static layerName: string;

@@ -58,3 +58,3 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

const POSITION_ATTRIBUTE_NAME = 'positions';
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU (WebGL2 only). */
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
export default class GPUGridLayer extends GridAggregationLayer {

@@ -83,3 +83,3 @@ static { this.layerName = 'GPUGridLayer'; }

// @ts-expect-error webgl-legacy
accessor: { size: 4, type: GL.FLOAT, divisor: 1 }
accessor: { size: 4, type: 5126, divisor: 1 }
})

@@ -94,3 +94,3 @@ },

// @ts-expect-error
accessor: { size: 4, type: GL.FLOAT, divisor: 1 }
accessor: { size: 4, type: 5126, divisor: 1 }
})

@@ -106,3 +106,3 @@ }

accessor: 'getPosition',
type: GL.DOUBLE,
type: 'float64',
fp64: this.use64bitPositions()

@@ -109,0 +109,0 @@ },

@@ -96,3 +96,3 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

size: 4,
type: GL.FLOAT,
type: 5126,
divisor: 1

@@ -99,0 +99,0 @@ }

@@ -77,3 +77,2 @@ import { Buffer, Texture, TextureFormat } from '@luma.gl/core';

state: AggregationLayer<DataT>['state'] & {
supported: boolean;
colorDomain?: number[];

@@ -80,0 +79,0 @@ isWeightMapDirty?: boolean;

@@ -22,3 +22,2 @@ // Copyright (c) 2015 - 2019 Uber Technologies, Inc.

import { getBounds, boundsContain, packVertices, scaleToAspectRatio, getTextureCoordinates } from "./heatmap-layer-utils.js";
import { GL } from '@luma.gl/constants';
import { TextureTransform } from '@luma.gl/engine';

@@ -62,9 +61,5 @@ import { AttributeManager, COORDINATE_SYSTEM, log } from '@deck.gl/core';

};
const REQUIRED_FEATURES = [
'blend-minmax-webgl1', // max weight calculation
'texture-formats-float32-webgl1' // weight-map as texture
];
const FLOAT_TARGET_FEATURES = [
'texture-renderable-float32-webgl', // ability to render to float texture
'texture-blend-float-webgl1' // ability to blend when rendering to float texture
'float32-renderable-webgl', // ability to render to float texture
'texture-blend-float-webgl' // ability to blend when rendering to float texture
];

@@ -81,9 +76,4 @@ const DIMENSIONS = {

initializeState() {
if (!REQUIRED_FEATURES.every(feature => this.context.device.features.has(feature))) {
this.setState({ supported: false });
log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();
return;
}
super.initializeAggregationLayer(DIMENSIONS);
this.setState({ supported: true, colorDomain: DEFAULT_COLOR_DOMAIN });
this.setState({ colorDomain: DEFAULT_COLOR_DOMAIN });
this._setupTextureParams();

@@ -99,5 +89,2 @@ this._setupAttributes();

updateState(opts) {
if (!this.state.supported) {
return;
}
super.updateState(opts);

@@ -132,5 +119,2 @@ this._updateHeatmapState(opts);

renderLayers() {
if (!this.state.supported) {
return [];
}
const { weightsTexture, triPositionBuffer, triTexCoordBuffer, maxWeightsTexture, colorTexture, colorDomain } = this.state;

@@ -221,3 +205,3 @@ const { updateTriggers, intensity, threshold, aggregation } = this.props;

attributeManager.add({
positions: { size: 3, type: GL.DOUBLE, accessor: 'getPosition' },
positions: { size: 3, type: 'float64', accessor: 'getPosition' },
weights: { size: 1, accessor: 'getWeight' }

@@ -224,0 +208,0 @@ });

@@ -6,5 +6,5 @@ export default `\

void main() {
fragColor = outTexture;
fragColor.g = outTexture.r / max(1.0, outTexture.a);
fragColor = outTexture;
fragColor.g = outTexture.r / max(1.0, outTexture.a);
}
`;

@@ -6,15 +6,11 @@ export default `\

out vec4 outTexture;
void main()
{
// Sample every pixel in texture
int yIndex = gl_VertexID / int(textureSize);
int xIndex = gl_VertexID - (yIndex * int(textureSize));
vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
outTexture = texture(inTexture, uv);
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
gl_PointSize = 1.0;
int yIndex = gl_VertexID / int(textureSize);
int xIndex = gl_VertexID - (yIndex * int(textureSize));
vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
outTexture = texture(inTexture, uv);
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
gl_PointSize = 1.0;
}
`;

@@ -23,5 +23,3 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

#define SHADER_NAME triangle-layer-fragment-shader
precision highp float;
uniform float opacity;

@@ -31,33 +29,25 @@ uniform sampler2D weightsTexture;

uniform float aggregationMode;
in vec2 vTexCoords;
in float vIntensityMin;
in float vIntensityMax;
out vec4 fragColor;
vec4 getLinearColor(float value) {
float factor = clamp(value * vIntensityMax, 0., 1.);
vec4 color = texture(colorTexture, vec2(factor, 0.5));
color.a *= min(value * vIntensityMin, 1.0);
return color;
float factor = clamp(value * vIntensityMax, 0., 1.);
vec4 color = texture(colorTexture, vec2(factor, 0.5));
color.a *= min(value * vIntensityMin, 1.0);
return color;
}
void main(void) {
vec4 weights = texture(weightsTexture, vTexCoords);
float weight = weights.r;
if (aggregationMode > 0.5) {
weight /= max(1.0, weights.a);
}
// discard pixels with 0 weight.
if (weight <= 0.) {
discard;
}
vec4 linearColor = getLinearColor(weight);
linearColor.a *= opacity;
fragColor = linearColor;
vec4 weights = texture(weightsTexture, vTexCoords);
float weight = weights.r;
if (aggregationMode > 0.5) {
weight /= max(1.0, weights.a);
}
if (weight <= 0.) {
discard;
}
vec4 linearColor = getLinearColor(weight);
linearColor.a *= opacity;
fragColor = linearColor;
}
`;

@@ -24,3 +24,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

#define SHADER_NAME heatp-map-layer-vertex-shader
uniform sampler2D maxTexture;

@@ -31,24 +30,20 @@ uniform float intensity;

uniform float aggregationMode;
in vec3 positions;
in vec2 texCoords;
out vec2 vTexCoords;
out float vIntensityMin;
out float vIntensityMax;
void main(void) {
gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
vTexCoords = texCoords;
vec4 maxTexture = texture(maxTexture, vec2(0.5));
float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
float minValue = maxValue * threshold;
if (colorDomain[1] > 0.) {
// if user specified custom domain use it.
maxValue = colorDomain[1];
minValue = colorDomain[0];
}
vIntensityMax = intensity / maxValue;
vIntensityMin = intensity / minValue;
gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
vTexCoords = texCoords;
vec4 maxTexture = texture(maxTexture, vec2(0.5));
float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
float minValue = maxValue * threshold;
if (colorDomain[1] > 0.) {
maxValue = colorDomain[1];
minValue = colorDomain[0];
}
vIntensityMax = intensity / maxValue;
vIntensityMin = intensity / minValue;
}
`;

@@ -5,18 +5,14 @@ export default `\

out vec4 fragColor;
// Epanechnikov function, keeping for reference
// float epanechnikovKDE(float u) {
// return 0.75 * (1.0 - u * u);
// }
float gaussianKDE(float u){
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
}
void main()
{
float dist = length(gl_PointCoord - vec2(0.5, 0.5));
if (dist > 0.5) {
discard;
}
fragColor = weightsTexture * gaussianKDE(2. * dist);
DECKGL_FILTER_COLOR(fragColor, geometry);
float dist = length(gl_PointCoord - vec2(0.5, 0.5));
if (dist > 0.5) {
discard;
}
fragColor = weightsTexture * gaussianKDE(2. * dist);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;

@@ -11,17 +11,12 @@ export default `\

uniform float weightsScale;
void main()
{
weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
gl_PointSize = radiusTexels * 2.;
vec3 commonPosition = project_position(positions, positions64Low);
// // map xy from commonBounds to [-1, 1]
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
gl_Position.w = 1.0;
weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
gl_PointSize = radiusTexels * 2.;
vec3 commonPosition = project_position(positions, positions64Low);
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
gl_Position.w = 1.0;
}
`;

@@ -147,3 +147,3 @@ import { Accessor, AccessorFunction, Color, Position, Material, UpdateParameters, DefaultProps } from '@deck.gl/core';

/** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */
export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_HexagonLayerProps>> {
export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_HexagonLayerProps<DataT>>> {
static layerName: string;

@@ -150,0 +150,0 @@ static defaultProps: DefaultProps<HexagonLayerProps<unknown>>;

@@ -22,3 +22,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

import { ColumnLayer } from '@deck.gl/layers';
import { GL } from '@luma.gl/constants';
import { defaultColorRange } from "../utils/color-utils.js";

@@ -78,3 +77,3 @@ import { pointToHexbin } from "./hexagon-aggregator.js";

attributeManager.add({
positions: { size: 3, type: GL.DOUBLE, accessor: 'getPosition' }
positions: { size: 3, type: 'float64', accessor: 'getPosition' }
});

@@ -81,0 +80,0 @@ // color and elevation attributes can't be added as attributes

@@ -1,2 +0,2 @@

import { Device, Texture } from '@luma.gl/core';
import { Texture } from '@luma.gl/core';
import { Model } from '@luma.gl/engine';

@@ -15,3 +15,2 @@ import { Layer, LayerProps, UpdateParameters, DefaultProps } from '@deck.gl/core';

static defaultProps: DefaultProps<ScreenGridCellLayerProps<unknown>>;
static isSupported(device: Device): boolean;
state: {

@@ -18,0 +17,0 @@ model?: Model;

@@ -37,5 +37,2 @@ // Copyright (c) 2015 - 2019 Uber Technologies, Inc.

static { this.defaultProps = defaultProps; }
static isSupported(device) {
return device.features.has('texture-formats-float32-webgl1');
}
getShaders() {

@@ -42,0 +39,0 @@ return { vs, fs, modules: [picking] };

@@ -24,18 +24,13 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

#define SHADER_NAME screen-grid-layer-fragment-shader
precision highp float;
in vec4 vColor;
in float vSampleCount;
out vec4 fragColor;
void main(void) {
if (vSampleCount <= 0.0) {
discard;
}
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
if (vSampleCount <= 0.0) {
discard;
}
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;

@@ -24,3 +24,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

#define RANGE_COUNT 6
in vec3 positions;

@@ -30,3 +29,2 @@ in vec3 instancePositions;

in vec3 instancePickingColors;
uniform float opacity;

@@ -40,48 +38,38 @@ uniform vec3 cellScale;

uniform sampler2D maxTexture;
out vec4 vColor;
out float vSampleCount;
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
vec4 outColor = vec4(0., 0., 0., 0.);
if (value >= domain.x && value <= domain.y) {
float domainRange = domain.y - domain.x;
if (domainRange <= 0.) {
outColor = colorRange[0];
} else {
float rangeCount = float(RANGE_COUNT);
float rangeStep = domainRange / rangeCount;
float idx = floor((value - domain.x) / rangeStep);
idx = clamp(idx, 0., rangeCount - 1.);
int intIdx = int(idx);
outColor = colorRange[intIdx];
}
}
outColor = outColor / 255.;
return outColor;
vec4 outColor = vec4(0., 0., 0., 0.);
if (value >= domain.x && value <= domain.y) {
float domainRange = domain.y - domain.x;
if (domainRange <= 0.) {
outColor = colorRange[0];
} else {
float rangeCount = float(RANGE_COUNT);
float rangeStep = domainRange / rangeCount;
float idx = floor((value - domain.x) / rangeStep);
idx = clamp(idx, 0., rangeCount - 1.);
int intIdx = int(idx);
outColor = colorRange[intIdx];
}
}
outColor = outColor / 255.;
return outColor;
}
void main(void) {
vSampleCount = instanceCounts.a;
float weight = instanceCounts.r;
float maxWeight = texture(maxTexture, vec2(0.5)).r;
float step = weight / maxWeight;
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
vec2 domain = colorDomain;
float domainMaxValid = float(colorDomain.y != 0.);
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
float rangeMinMax = float(shouldUseMinMax);
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
vColor = vec4(color.rgb, color.a * opacity);
// Set color to be rendered to picking fbo (also used to check for selection highlight).
picking_setPickingColor(instancePickingColors);
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
vSampleCount = instanceCounts.a;
float weight = instanceCounts.r;
float maxWeight = texture(maxTexture, vec2(0.5)).r;
float step = weight / maxWeight;
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
vec2 domain = colorDomain;
float domainMaxValid = float(colorDomain.y != 0.);
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
float rangeMinMax = float(shouldUseMinMax);
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
vColor = vec4(color.rgb, color.a * opacity);
picking_setPickingColor(instancePickingColors);
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
}
`;

@@ -56,5 +56,2 @@ import { Accessor, Color, GetPickingInfoParams, Layer, LayerContext, LayersList, PickingInfo, Position, UpdateParameters, DefaultProps } from '@deck.gl/core';

*
* NOTE: GPU Aggregation requires WebGL2 support by the browser.
* When `gpuAggregation` is set to true and browser doesn't support WebGL2, aggregation falls back to CPU.
*
* @default true

@@ -61,0 +58,0 @@ */

@@ -21,3 +21,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

import { log } from '@deck.gl/core';
import { GL } from '@luma.gl/constants';
import GPUGridAggregator from "../utils/gpu-grid-aggregation/gpu-grid-aggregator.js";

@@ -50,8 +49,2 @@ import { AGGREGATION_OPERATION, getValueFunc } from "../utils/aggregation-operation-utils.js";

initializeState() {
if (!ScreenGridCellLayer.isSupported(this.context.device)) {
// max aggregated value is sampled from a float texture
this.setState({ supported: false });
log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();
return;
}
super.initializeAggregationLayer({

@@ -85,3 +78,3 @@ dimensions: DIMENSIONS,

accessor: 'getPosition',
type: GL.DOUBLE,
type: 'float64',
fp64: this.use64bitPositions()

@@ -88,0 +81,0 @@ },

@@ -23,5 +23,3 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

#define SHADER_NAME gpu-aggregation-all-fs
precision highp float;
in vec2 vTextureCoord;

@@ -32,10 +30,9 @@ uniform sampler2D uSampler;

void main(void) {
vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
if (textureColor.a == 0.) {
discard;
}
fragColor.rgb = textureColor.rgb;
// if combineMinMax is true, use Alpha channel for first weights min value.
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
if (textureColor.a == 0.) {
discard;
}
fragColor.rgb = textureColor.rgb;
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
}
`;

@@ -23,32 +23,21 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

#define SHADER_NAME gpu-aggregation-all-vs-64
in vec2 position;
uniform ivec2 gridSize;
out vec2 vTextureCoord;
void main(void) {
// Map each position to single pixel
vec2 pos = vec2(-1.0, -1.0);
// Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
vec2 offset = 1.0 / vec2(gridSize);
pos = pos + offset;
gl_Position = vec4(pos, 0.0, 1.0);
int yIndex = gl_InstanceID / gridSize[0];
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
vec2 yIndexFP64 = vec2(float(yIndex), 0.);
vec2 xIndexFP64 = vec2(float(xIndex), 0.);
vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
gl_PointSize = 1.0;
vec2 pos = vec2(-1.0, -1.0);
vec2 offset = 1.0 / vec2(gridSize);
pos = pos + offset;
gl_Position = vec4(pos, 0.0, 1.0);
int yIndex = gl_InstanceID / gridSize[0];
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
vec2 yIndexFP64 = vec2(float(yIndex), 0.);
vec2 xIndexFP64 = vec2(float(xIndex), 0.);
vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
gl_PointSize = 1.0;
}
`;

@@ -23,13 +23,9 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

#define SHADER_NAME gpu-aggregation-to-grid-fs
precision highp float;
in vec3 vWeights;
out vec4 fragColor;
void main(void) {
fragColor = vec4(vWeights, 1.0);
DECKGL_FILTER_COLOR(fragColor, geometry);
fragColor = vec4(vWeights, 1.0);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;

@@ -23,3 +23,2 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

#define SHADER_NAME gpu-aggregation-to-grid-vs
in vec3 positions;

@@ -33,48 +32,32 @@ in vec3 positions64Low;

uniform vec3 scaling;
out vec3 vWeights;
vec2 project_to_pixel(vec4 pos) {
vec4 result;
pos.xy = pos.xy/pos.w;
result = pos + vec4(translation, 0., 0.);
result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
return result.xy;
vec4 result;
pos.xy = pos.xy/pos.w;
result = pos + vec4(translation, 0., 0.);
result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
return result.xy;
}
void main(void) {
vWeights = weights;
vec4 windowPos = vec4(positions, 1.);
if (projectPoints) {
windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
}
vec2 pos = project_to_pixel(windowPos);
vec2 pixelXY64[2];
pixelXY64[0] = vec2(pos.x, 0.);
pixelXY64[1] = vec2(pos.y, 0.);
// Transform (0,0):windowSize -> (0, 0): gridSize
vec2 gridXY64[2];
gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
float x = floor(gridXY64[0].x);
float y = floor(gridXY64[1].x);
pos = vec2(x, y);
// Transform (0,0):gridSize -> (-1, -1):(1,1)
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
// Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
vec2 offset = 1.0 / gridSize;
pos = pos + offset;
gl_Position = vec4(pos, 0.0, 1.0);
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
gl_PointSize = 1.0;
vWeights = weights;
vec4 windowPos = vec4(positions, 1.);
if (projectPoints) {
windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
}
vec2 pos = project_to_pixel(windowPos);
vec2 pixelXY64[2];
pixelXY64[0] = vec2(pos.x, 0.);
pixelXY64[1] = vec2(pos.y, 0.);
vec2 gridXY64[2];
gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
float x = floor(gridXY64[0].x);
float y = floor(gridXY64[1].x);
pos = vec2(x, y);
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
vec2 offset = 1.0 / gridSize;
pos = pos + offset;
gl_Position = vec4(pos, 0.0, 1.0);
gl_PointSize = 1.0;
}
`;

@@ -10,8 +10,8 @@ import { GL } from '@luma.gl/constants';

export const MAX_32_BIT_FLOAT = 3.402823466e38;
export const MIN_BLEND_EQUATION = [GL.MIN, GL.FUNC_ADD];
export const MAX_BLEND_EQUATION = [GL.MAX, GL.FUNC_ADD];
export const MAX_MIN_BLEND_EQUATION = [GL.MAX, GL.MIN];
export const MIN_BLEND_EQUATION = [32775, 32774];
export const MAX_BLEND_EQUATION = [32776, 32774];
export const MAX_MIN_BLEND_EQUATION = [32776, 32775];
export const EQUATION_MAP = {
[AGGREGATION_OPERATION.SUM]: GL.FUNC_ADD,
[AGGREGATION_OPERATION.MEAN]: GL.FUNC_ADD,
[AGGREGATION_OPERATION.SUM]: 32774,
[AGGREGATION_OPERATION.MEAN]: 32774,
[AGGREGATION_OPERATION.MIN]: MIN_BLEND_EQUATION,

@@ -31,4 +31,4 @@ [AGGREGATION_OPERATION.MAX]: MAX_BLEND_EQUATION

export const MAX_MIN_TEXTURE_OPTS = {
format: GL.RGBA32F,
type: GL.FLOAT,
format: 34836,
type: 5126,
border: 0,

@@ -40,5 +40,5 @@ mipmaps: false,

},
dataFormat: GL.RGBA,
dataFormat: 6408,
width: 1,
height: 1
};

@@ -23,3 +23,3 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

import { GL } from '@luma.gl/constants';
import { log, project32, _mergeShaders as mergeShaders, getShaderAssembler } from '@deck.gl/core';
import { project32, _mergeShaders as mergeShaders, getShaderAssembler } from '@deck.gl/core';
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";

@@ -40,7 +40,4 @@ import { AGGREGATION_OPERATION } from "../aggregation-operation-utils.js";

const REQUIRED_FEATURES = [
'webgl2',
'blend-minmax-webgl1',
'texture-renderable-float32-webgl',
'texture-blend-float-webgl1',
'texture-formats-float32-webgl1'
'float32-renderable-webgl',
'texture-blend-float-webgl'
];

@@ -136,10 +133,5 @@ export default class GPUGridAggregator {

const REQUIRED_FEATURES = [
'blend-minmax-webgl1', // set min/max blend modes
'texture-renderable-float32-webgl', // render to float texture
'texture-formats-float32-webgl1' // sample from a float texture
'float32-renderable-webgl' // render to float texture
];
// gl_InstanceID usage in min/max calculation shaders
this._hasGPUSupport =
this.device.info.type === 'webgl2' &&
REQUIRED_FEATURES.every(feature => device.features.has(feature));
this._hasGPUSupport = REQUIRED_FEATURES.every(feature => device.features.has(feature));
if (this._hasGPUSupport) {

@@ -171,5 +163,2 @@ this._setupModels();

const aggregationParams = this._normalizeAggregationParams(opts);
if (!this._hasGPUSupport) {
log.log(1, 'GPUGridAggregator: not supported')();
}
return this._runAggregation(aggregationParams);

@@ -227,3 +216,3 @@ }

target: weights[id].aggregationBuffer, // update if a buffer is provided
sourceType: GL.FLOAT
sourceType: 5126
});

@@ -233,3 +222,3 @@ if (needMin && needMax && combineMaxMin) {

target: weights[id].maxMinBuffer, // update if a buffer is provided
sourceType: GL.FLOAT
sourceType: 5126
});

@@ -242,3 +231,3 @@ results[id].maxMinTexture = resources[`${id}-maxMinTexture`];

target: weights[id].minBuffer, // update if a buffer is provided
sourceType: GL.FLOAT
sourceType: 5126
});

@@ -250,3 +239,3 @@ results[id].minTexture = resources[`${id}-minTexture`];

target: weights[id].maxBuffer, // update if a buffer is provided
sourceType: GL.FLOAT
sourceType: 5126
});

@@ -267,3 +256,3 @@ results[id].maxTexture = resources[`${id}-maxTexture`];

depthTest: false,
blendFunc: [GL.ONE, GL.ONE]
blendFunc: [1, 1]
};

@@ -385,3 +374,3 @@ const uniforms = {

// update framebuffer with mean results so device.readPixelsToBufferWebGL returns mean values
framebuffers[id].attach({ [GL.COLOR_ATTACHMENT0]: textures[id] });
framebuffers[id].attach({ [36064]: textures[id] });
}

@@ -421,3 +410,3 @@ }

if (framebuffers[id]) {
framebuffers[id].attach({ [GL.COLOR_ATTACHMENT0]: texture });
framebuffers[id].attach({ [36064]: texture });
}

@@ -550,3 +539,3 @@ else {

vertexCount: 1,
drawMode: GL.POINTS,
drawMode: 0,
shaderAssembler: getShaderAssembler(),

@@ -553,0 +542,0 @@ ...shaders

@@ -25,14 +25,9 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

out vec4 meanValues;
void main()
{
// TODO: Use 64-bit division ?? not needed given this is aggregation ??
bool isCellValid = bool(aggregationValues.w > 0.);
// aggregationValues: XYZ contain aggregated values, W contains count
meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
meanValues.w = aggregationValues.w;
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
gl_PointSize = 1.0;
bool isCellValid = bool(aggregationValues.w > 0.);
meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
meanValues.w = aggregationValues.w;
gl_PointSize = 1.0;
}
`;

@@ -6,3 +6,3 @@ {

"type": "module",
"version": "9.0.0-beta.5",
"version": "9.0.0-beta.6",
"publishConfig": {

@@ -43,5 +43,5 @@ "access": "public"

"@babel/runtime": "^7.0.0",
"@luma.gl/constants": "9.0.0-beta.4",
"@luma.gl/core": "9.0.0-beta.4",
"@luma.gl/shadertools": "9.0.0-beta.4",
"@luma.gl/constants": "9.0.0-beta.6",
"@luma.gl/core": "9.0.0-beta.6",
"@luma.gl/shadertools": "9.0.0-beta.6",
"@math.gl/web-mercator": "^4.0.0",

@@ -53,6 +53,6 @@ "d3-hexbin": "^0.2.1"

"@deck.gl/layers": "^9.0.0-alpha",
"@luma.gl/core": "9.0.0-beta.4",
"@luma.gl/engine": "9.0.0-beta.4"
"@luma.gl/core": "9.0.0-beta.6",
"@luma.gl/engine": "9.0.0-beta.6"
},
"gitHead": "02588aba7cbf25d48cec20b30a686bba9be32bff"
"gitHead": "373729308eb3fdec4b7c8b5842ddeff4f2d70338"
}

@@ -21,3 +21,2 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

import {GL} from '@luma.gl/constants';
import {LineLayer, SolidPolygonLayer} from '@deck.gl/layers';

@@ -189,3 +188,3 @@ import {generateContours} from './contour-utils';

accessor: 'getPosition',
type: GL.DOUBLE,
type: 'float64',
fp64: this.use64bitPositions()

@@ -356,3 +355,3 @@ },

// @ts-ignore
aggregationData = count.aggregationBuffer!.readSyncWebGL2() as Float32Array;
aggregationData = count.aggregationBuffer!.readSyncWebGL() as Float32Array;
count.aggregationData = aggregationData;

@@ -359,0 +358,0 @@ }

@@ -21,3 +21,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

import {GL} from '@luma.gl/constants';
import {GridCellLayer} from '@deck.gl/layers';

@@ -265,3 +264,3 @@ import {Accessor, AccessorFunction, Color, Position, Material, DefaultProps} from '@deck.gl/core';

attributeManager.add({
positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'}
positions: {size: 3, type: 'float64', accessor: 'getPosition'}
});

@@ -268,0 +267,0 @@ // color and elevation attributes can't be added as attributes

@@ -195,3 +195,3 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

const gl = this.context.gl as WebGL2RenderingContext;
const gl = this.context.gl;
const colorIndex = gl.getUniformBlockIndex(programHandle, 'ColorData');

@@ -198,0 +198,0 @@ const elevationIndex = gl.getUniformBlockIndex(programHandle, 'ElevationData');

@@ -170,3 +170,3 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU (WebGL2 only). */
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
export default class GPUGridLayer<

@@ -225,3 +225,3 @@ DataT = any,

accessor: 'getPosition',
type: GL.DOUBLE,
type: 'float64',
fp64: this.use64bitPositions()

@@ -228,0 +228,0 @@ },

@@ -30,3 +30,2 @@ // Copyright (c) 2015 - 2019 Uber Technologies, Inc.

import {Buffer, DeviceFeature, Texture, TextureProps, TextureFormat} from '@luma.gl/core';
import {GL} from '@luma.gl/constants';
import {TextureTransform, TextureTransformProps} from '@luma.gl/engine';

@@ -87,10 +86,5 @@ import {

const REQUIRED_FEATURES: DeviceFeature[] = [
'blend-minmax-webgl1', // max weight calculation
'texture-formats-float32-webgl1' // weight-map as texture
];
const FLOAT_TARGET_FEATURES: DeviceFeature[] = [
'texture-renderable-float32-webgl', // ability to render to float texture
'texture-blend-float-webgl1' // ability to blend when rendering to float texture
'float32-renderable-webgl', // ability to render to float texture
'texture-blend-float-webgl' // ability to blend when rendering to float texture
];

@@ -192,3 +186,2 @@

state!: AggregationLayer<DataT>['state'] & {
supported: boolean;
colorDomain?: number[];

@@ -215,9 +208,4 @@ isWeightMapDirty?: boolean;

initializeState() {
if (!REQUIRED_FEATURES.every(feature => this.context.device.features.has(feature))) {
this.setState({supported: false});
log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();
return;
}
super.initializeAggregationLayer(DIMENSIONS);
this.setState({supported: true, colorDomain: DEFAULT_COLOR_DOMAIN});
this.setState({colorDomain: DEFAULT_COLOR_DOMAIN});
this._setupTextureParams();

@@ -235,5 +223,2 @@ this._setupAttributes();

updateState(opts: UpdateParameters<this>) {
if (!this.state.supported) {
return;
}
super.updateState(opts);

@@ -274,5 +259,2 @@ this._updateHeatmapState(opts);

renderLayers(): LayersList | Layer {
if (!this.state.supported) {
return [];
}
const {

@@ -396,3 +378,3 @@ weightsTexture,

attributeManager.add({
positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'},
positions: {size: 3, type: 'float64', accessor: 'getPosition'},
weights: {size: 1, accessor: 'getWeight'}

@@ -407,3 +389,3 @@ });

const textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D as number);
const textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D);
const floatTargetSupport = FLOAT_TARGET_FEATURES.every(feature => device.features.has(feature));

@@ -410,0 +392,0 @@ const format: TextureFormat = floatTargetSupport ? 'rgba32float' : 'rgba8unorm';

@@ -32,3 +32,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

import {ColumnLayer} from '@deck.gl/layers';
import {GL} from '@luma.gl/constants';

@@ -253,3 +252,3 @@ import {defaultColorRange} from '../utils/color-utils';

DataT,
ExtraPropsT & Required<_HexagonLayerProps>
ExtraPropsT & Required<_HexagonLayerProps<DataT>>
> {

@@ -277,3 +276,3 @@ static layerName = 'HexagonLayer';

attributeManager.add({
positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'}
positions: {size: 3, type: 'float64', accessor: 'getPosition'}
});

@@ -280,0 +279,0 @@ // color and elevation attributes can't be added as attributes

@@ -57,6 +57,2 @@ // Copyright (c) 2015 - 2019 Uber Technologies, Inc.

static isSupported(device: Device) {
return device.features.has('texture-formats-float32-webgl1');
}
state!: {

@@ -63,0 +59,0 @@ model?: Model;

@@ -35,3 +35,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

import type {Buffer, Texture} from '@luma.gl/core';
import {GL} from '@luma.gl/constants';
import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';

@@ -125,5 +124,2 @@ import {AGGREGATION_OPERATION, getValueFunc} from '../utils/aggregation-operation-utils';

*
* NOTE: GPU Aggregation requires WebGL2 support by the browser.
* When `gpuAggregation` is set to true and browser doesn't support WebGL2, aggregation falls back to CPU.
*
* @default true

@@ -162,8 +158,2 @@ */

initializeState() {
if (!ScreenGridCellLayer.isSupported(this.context.device)) {
// max aggregated value is sampled from a float texture
this.setState({supported: false});
log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();
return;
}
super.initializeAggregationLayer({

@@ -197,3 +187,3 @@ dimensions: DIMENSIONS,

accessor: 'getPosition',
type: GL.DOUBLE,
type: 'float64',
fp64: this.use64bitPositions()

@@ -200,0 +190,0 @@ },

@@ -54,7 +54,4 @@ // Copyright (c) 2015 - 2018 Uber Technologies, Inc.

const REQUIRED_FEATURES: DeviceFeature[] = [
'webgl2',
'blend-minmax-webgl1',
'texture-renderable-float32-webgl',
'texture-blend-float-webgl1',
'texture-formats-float32-webgl1'
'float32-renderable-webgl',
'texture-blend-float-webgl'
];

@@ -183,11 +180,6 @@

const REQUIRED_FEATURES: DeviceFeature[] = [
'blend-minmax-webgl1', // set min/max blend modes
'texture-renderable-float32-webgl', // render to float texture
'texture-formats-float32-webgl1' // sample from a float texture
'float32-renderable-webgl' // render to float texture
];
// gl_InstanceID usage in min/max calculation shaders
this._hasGPUSupport =
this.device.info.type === 'webgl2' &&
REQUIRED_FEATURES.every(feature => device.features.has(feature));
this._hasGPUSupport = REQUIRED_FEATURES.every(feature => device.features.has(feature));
if (this._hasGPUSupport) {

@@ -231,5 +223,2 @@ this._setupModels();

const aggregationParams = this._normalizeAggregationParams(opts);
if (!this._hasGPUSupport) {
log.log(1, 'GPUGridAggregator: not supported')();
}
return this._runAggregation(aggregationParams);

@@ -236,0 +225,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc