Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@loaders.gl/csv": "^4.4.0-alpha.18",
"@loaders.gl/draco": "^4.4.0-alpha.18",
"@loaders.gl/gltf": "^4.4.0-alpha.18",
"@luma.gl/constants": "^9.3.0-alpha.6",
"deck.gl": "^9.0.0",
"maplibre-gl": "^5.0.0",
"monaco-editor": "^0.39.0",
Expand Down
1 change: 1 addition & 0 deletions examples/vite.config.local.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/namespace */
import {defineConfig} from 'vite';
import {getOcularConfig} from '@vis.gl/dev-tools';
import {join} from 'path';
Expand Down
7 changes: 3 additions & 4 deletions modules/aggregation-layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,16 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@luma.gl/constants": "^9.3.0-alpha.6",
"@luma.gl/shadertools": "^9.3.0-alpha.6",
"@luma.gl/shadertools": "^9.3.0-alpha.10",
"@math.gl/core": "^4.1.0",
"@math.gl/web-mercator": "^4.1.0",
"d3-hexbin": "^0.2.1"
},
"peerDependencies": {
"@deck.gl/core": "~9.2.0",
"@deck.gl/layers": "~9.2.0",
"@luma.gl/core": "~9.3.0-alpha.6",
"@luma.gl/engine": "~9.3.0-alpha.6"
"@luma.gl/core": "~9.3.0-alpha.10",
"@luma.gl/engine": "~9.3.0-alpha.10"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {ShaderModule} from '@luma.gl/shadertools';
import {Texture} from '@luma.gl/core';

const uniformBlock = /* glsl */ `\
uniform aggregatorTransformUniforms {
layout(std140) uniform aggregatorTransformUniforms {
ivec4 binIdRange;
bvec3 isCount;
bvec3 isMean;
Expand All @@ -19,6 +19,7 @@ export type AggregatorTransformProps = {
binIdRange: NumberArray4;
isCount: NumberArray3;
isMean: NumberArray3;
naN: number;
bins: Texture;
};

Expand All @@ -28,6 +29,7 @@ export const aggregatorTransformUniforms = {
uniformTypes: {
binIdRange: 'vec4<i32>',
isCount: 'vec3<f32>',
isMean: 'vec3<f32>'
isMean: 'vec3<f32>',
naN: 'f32'
}
} as const satisfies ShaderModule<AggregatorTransformProps>;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {NumberArray2, NumberArray4} from '@math.gl/core';
import {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = /* glsl */ `\
uniform binSorterUniforms {
layout(std140) uniform binSorterUniforms {
ivec4 binIdRange;
ivec2 targetSize;
} binSorter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = /* glsl */ `\
uniform binOptionsUniforms {
layout(std140) uniform binOptionsUniforms {
vec2 cellOriginCommon;
vec2 cellSizeCommon;
} binOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = /* glsl */ `\
uniform binOptionsUniforms {
layout(std140) uniform binOptionsUniforms {
vec2 cellOriginCommon;
vec2 cellSizeCommon;
} binOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = /* glsl */ `\
uniform gridUniforms {
layout(std140) uniform gridUniforms {
vec4 colorDomain;
vec4 elevationDomain;
vec2 elevationRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = `\
uniform weightUniforms {
layout(std140) uniform weightUniforms {
vec4 commonBounds;
float radiusPixels;
float textureWidth;
Expand Down Expand Up @@ -40,7 +40,7 @@ export type MaxWeightProps = {
export const maxWeightUniforms = {
name: 'maxWeight',
vs: `\
uniform maxWeightUniforms {
layout(std140) uniform maxWeightUniforms {
float textureSize;
} maxWeight;
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = `\
uniform triangleUniforms {
layout(std140) uniform triangleUniforms {
float aggregationMode;
vec2 colorDomain;
float intensity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {ShaderModule} from '@luma.gl/shadertools';
import {NumberArray2} from '@math.gl/core';

const uniformBlock = /* glsl */ `\
uniform binOptionsUniforms {
layout(std140) uniform binOptionsUniforms {
vec2 hexOriginCommon;
float radiusCommon;
} binOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = /* glsl */ `\
uniform hexagonUniforms {
layout(std140) uniform hexagonUniforms {
vec4 colorDomain;
vec4 elevationDomain;
vec2 elevationRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = /* glsl */ `\
uniform binOptionsUniforms {
layout(std140) uniform binOptionsUniforms {
float cellSizePixels;
} binOptions;
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = /* glsl */ `\
uniform screenGridUniforms {
layout(std140) uniform screenGridUniforms {
vec2 cellSizeClipspace;
vec2 gridSizeClipspace;
vec2 colorDomain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class ScreenGridLayer<

void getBin(out ivec2 binId) {
vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0));
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio;
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize.xy / project.devicePixelRatio;
vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels);
binId = ivec2(gridCoords);
}
Expand Down
7 changes: 3 additions & 4 deletions modules/arcgis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
},
"dependencies": {
"@luma.gl/constants": "^9.3.0-alpha.6",
"esri-loader": "^3.7.0"
},
"peerDependencies": {
"@arcgis/core": "^4.0.0",
"@deck.gl/core": "~9.2.0",
"@luma.gl/core": "~9.3.0-alpha.6",
"@luma.gl/engine": "~9.3.0-alpha.6",
"@luma.gl/webgl": "~9.3.0-alpha.6"
"@luma.gl/core": "~9.3.0-alpha.10",
"@luma.gl/engine": "~9.3.0-alpha.10",
"@luma.gl/webgl": "~9.3.0-alpha.10"
},
"devDependencies": {
"@arcgis/core": "^4.21.0"
Expand Down
2 changes: 1 addition & 1 deletion modules/arcgis/src/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/* eslint-disable no-invalid-this */

import {GL} from '@luma.gl/constants';
import {GL} from '@luma.gl/webgl/constants';
import type {Device, Texture, Framebuffer} from '@luma.gl/core';
import {Deck} from '@deck.gl/core';
import {Model, Geometry} from '@luma.gl/engine';
Expand Down
6 changes: 3 additions & 3 deletions modules/carto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"@loaders.gl/mvt": "^4.4.0-alpha.18",
"@loaders.gl/schema": "^4.4.0-alpha.18",
"@loaders.gl/tiles": "^4.4.0-alpha.18",
"@luma.gl/core": "^9.3.0-alpha.6",
"@luma.gl/shadertools": "^9.3.0-alpha.6",
"@luma.gl/core": "^9.3.0-alpha.10",
"@luma.gl/shadertools": "^9.3.0-alpha.10",
"@math.gl/web-mercator": "^4.1.0",
"@types/d3-array": "^3.0.2",
"@types/d3-color": "^1.4.2",
Expand All @@ -73,7 +73,7 @@
"@deck.gl/geo-layers": "~9.2.0",
"@deck.gl/layers": "~9.2.0",
"@loaders.gl/core": "^4.4.0-alpha.18",
"@luma.gl/core": "~9.3.0-alpha.6"
"@luma.gl/core": "~9.3.0-alpha.10"
},
"gitHead": "13ace64fc2cee08c133afc882fc307253489a4e4"
}
2 changes: 1 addition & 1 deletion modules/carto/src/layers/heatmap-tile-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
}

const uniformBlock = `\
uniform densityUniforms {
layout(std140) uniform densityUniforms {
float factor;
} density;
`;
Expand Down Expand Up @@ -233,7 +233,7 @@
}
}

renderLayers(): Layer {

Check warning on line 236 in modules/carto/src/layers/heatmap-tile-layer.ts

View workflow job for this annotation

GitHub Actions / test-node

Method 'renderLayers' has too many statements (27). Maximum allowed is 25
const {
data,
getWeight,
Expand Down
2 changes: 1 addition & 1 deletion modules/carto/src/layers/heatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {Texture} from '@luma.gl/core';
*/

const fs = /* glsl */ `\
uniform heatmapUniforms {
layout(std140) uniform heatmapUniforms {
vec2 colorDomain;
vec2 delta;
float intensity;
Expand Down
2 changes: 2 additions & 0 deletions modules/carto/src/layers/raster-tile-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type _RasterTileLayerProps<DataT> = Omit<RasterLayerProps<DataT>, 'data'> &
};

class PostProcessTileLayer extends PostProcessModifier(TileLayer, copy) {
static layerName = 'PostProcessTileLayer';

filterSubLayer(context: FilterContext) {
// Handle DrawCallbackLayer
const {tile} = (context.layer as Layer<{tile: any}>).props;
Expand Down
9 changes: 4 additions & 5 deletions modules/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
"dependencies": {
"@loaders.gl/core": "^4.4.0-alpha.18",
"@loaders.gl/images": "^4.4.0-alpha.18",
"@luma.gl/constants": "^9.3.0-alpha.6",
"@luma.gl/core": "^9.3.0-alpha.6",
"@luma.gl/engine": "^9.3.0-alpha.6",
"@luma.gl/shadertools": "^9.3.0-alpha.6",
"@luma.gl/webgl": "^9.3.0-alpha.6",
"@luma.gl/core": "^9.3.0-alpha.10",
"@luma.gl/engine": "^9.3.0-alpha.10",
"@luma.gl/shadertools": "^9.3.0-alpha.10",
"@luma.gl/webgl": "^9.3.0-alpha.10",
"@math.gl/core": "^4.1.0",
"@math.gl/sun": "^4.1.0",
"@math.gl/types": "^4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/lib/attribute/gl-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

import {getTypedArrayConstructor, getDataType} from '@luma.gl/core';
import {dataTypeDecoder, getTypedArrayConstructor} from '@luma.gl/core';
import type {BufferAttributeLayout, VertexFormat} from '@luma.gl/core';
import type {TypedArrayConstructor} from '../../types/types';
import type {BufferAccessor, DataColumnSettings, LogicalDataType} from './data-column';
Expand All @@ -20,7 +20,7 @@ export function typedArrayFromDataType(type: LogicalDataType): TypedArrayConstru
}
}

export const dataTypeFromTypedArray = getDataType;
export const dataTypeFromTypedArray = dataTypeDecoder.getDataType.bind(dataTypeDecoder);

export function getBufferAttributeLayout(
name: string,
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/lib/deck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {luma} from '@luma.gl/core';
import {webgl2Adapter} from '@luma.gl/webgl';
import {Timeline} from '@luma.gl/engine';
import {AnimationLoop} from '@luma.gl/engine';
import {GL} from '@luma.gl/constants';
import {GL} from '@luma.gl/webgl/constants';
import type {CanvasContextProps, Device, DeviceProps, Framebuffer, Parameters} from '@luma.gl/core';
import type {ShaderModule} from '@luma.gl/shadertools';

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/lib/view-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default class ViewManager<ViewsT extends View[]> {
typeof viewOrViewId === 'string' ? this.getView(viewOrViewId) : viewOrViewId;
// Backward compatibility: view state for single view
const viewState = (view && this.viewState[view.getViewStateId()]) || this.viewState;
return view ? view.filterViewState(viewState) : viewState;
return (view ? view.filterViewState(viewState) : viewState) as AnyViewStateOf<ViewsT>;
}

getViewport(viewId: string): Viewport | undefined {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/passes/screen-pass-uniforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {TextureView} from '@luma.gl/core';
import type {ShaderModule} from '@luma.gl/shadertools';

const uniformBlock = `\
uniform screenUniforms {
layout(std140) uniform screenUniforms {
vec2 texSize;
} screen;
`;
Expand Down
3 changes: 0 additions & 3 deletions modules/core/src/shaderlib/color/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ export default {
// TODO - v10: use raw opacity?
// opacity: Math.pow(props.opacity!, 1 / 2.2)
return {};
},
uniformTypes: {
opacity: 'f32'
}
// @ts-ignore TODO v9.1
} as const satisfies ShaderModule<LayerProps, ColorUniforms, {}>;
2 changes: 1 addition & 1 deletion modules/core/src/shaderlib/misc/layer-uniforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {ShaderModule} from '@luma.gl/shadertools';
import type {LayerProps} from '../../types/layer-props';

const uniformBlock = `\
uniform layerUniforms {
layout(std140) uniform layerUniforms {
uniform float opacity;
} layer;
`;
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/shaderlib/project/project.glsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ${COORDINATE_SYSTEM_GLSL_CONSTANTS}
${PROJECTION_MODE_GLSL_CONSTANTS}
${UNIT_GLSL_CONSTANTS}

uniform projectUniforms {
layout(std140) uniform projectUniforms {
bool wrapLongitude;
int coordinateSystem;
vec3 commonUnitsPerMeter;
Comment on lines +23 to 26
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pad ProjectUniforms before opting it into std140

Making projectUniforms a layout(std140) block changes every vec3 in this UBO to a 16-byte slot, but the matching WGSL struct in modules/core/src/shaderlib/project/project.wgsl.ts still packs projectionMode, devicePixelRatio, commonOrigin, etc. immediately after the preceding vec3<f32> fields. On WebGPU, any layer that uses the shared project module will therefore read those uniforms from the wrong offsets and produce corrupted transforms. This needs explicit padding on the WGSL side (or the GLSL block must stay out of std140).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Doesn't luma.gl calculate offsets using the appropriate layout for each device?

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/shaderlib/project/project.wgsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct ProjectUniforms {
pseudoMeters: i32,
};

@group(0) @binding(0)
@group(0) @binding(auto)
var<uniform> project: ProjectUniforms;

// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/shaderlib/shadow/shadow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type Viewport from '../../viewports/viewport';
import type {ProjectProps, ProjectUniforms} from '../project/viewport-uniforms';

const uniformBlock = /* glsl */ `
uniform shadowUniforms {
layout(std140) uniform shadowUniforms {
bool drawShadowMap;
bool useShadowMap;
vec4 color;
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/transitions/gpu-interpolation-transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {Device} from '@luma.gl/core';
import {Timeline, BufferTransform} from '@luma.gl/engine';
import {fp64arithmetic} from '@luma.gl/shadertools';
import type {ShaderModule} from '@luma.gl/shadertools';
import {GL} from '@luma.gl/constants';
import {GL} from '@luma.gl/webgl/constants';
import Attribute from '../lib/attribute/attribute';
import {
getAttributeTypeFromSize,
Expand Down Expand Up @@ -112,7 +112,7 @@ export default class GPUInterpolationTransition extends GPUTransitionBase<Interp
}

const uniformBlock = `\
uniform interpolationUniforms {
layout(std140) uniform interpolationUniforms {
float time;
} interpolation;
`;
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/transitions/gpu-spring-transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default class GPUSpringTransition extends GPUTransitionBase<SpringTransit
}

const uniformBlock = `\
uniform springUniforms {
layout(std140) uniform springUniforms {
float damping;
float stiffness;
} spring;
Expand Down
Loading
Loading