Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat): Upgrade deck.gl and luma.gl #805

Merged
merged 63 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
567cad0
chore: wip attempt to upgrade deck&luma
xinaesthete Jun 12, 2024
c9236b0
(fix): set `UNPACK_ALIGNMENT` and `PACK_ALIGNMENT` correctly
ilan-gold Jun 17, 2024
5d7cba6
(fix): use `float64` string instead of `GL.DOUBLE`
ilan-gold Jun 17, 2024
6eb593b
(fix): `parameters` -> `sampler` and fix some consts related to `getR…
ilan-gold Jun 17, 2024
c568ec8
change Geometry drawMode to topology
xinaesthete Jun 17, 2024
a656b2f
use triangle-list rather than fan (not verified to be correct)
xinaesthete Jun 17, 2024
aa15140
use setBindings in place of setUniforms
xinaesthete Jun 17, 2024
1116671
correct size of texCoord attribute
xinaesthete Jun 17, 2024
017c7ae
add bufferLayout to model, texCoords to attributeManager, rename shad…
xinaesthete Jun 17, 2024
900c8d5
chore: apply biome fix & remove unused GL imports
xinaesthete Jun 19, 2024
9b50d6c
chore: remove some dead code, rename (unused) gl arg, add comments
xinaesthete Jun 19, 2024
bf3899c
rename 'device' to 'gl' (and comment that it's unused)
xinaesthete Jun 19, 2024
becddae
set log level, allows us to see shader compilation errors
xinaesthete Jun 19, 2024
9e0c2e8
change 'attribute' & 'varying' to 'in' & 'out', don't use gl_FragColor
xinaesthete Jun 19, 2024
aa7ec24
make sure opts are passed through draw, no null textures and 'uniform…
xinaesthete Jun 19, 2024
063a2fc
(fix) geometry indices, remove bad texCoord attribute val
xinaesthete Jun 19, 2024
d6ebc3e
no more cursed shader version patching
xinaesthete Jun 19, 2024
002495b
correct format of setParametersWebGL args
xinaesthete Jun 19, 2024
85bf153
check if texture format is filterable
xinaesthete Jun 19, 2024
64d1e83
use setBindings for textures, setUniforms for uniforms.
xinaesthete Jun 19, 2024
a24b459
remove references to WebGL1
xinaesthete Jun 20, 2024
b363979
(fix): less wrong null texture handling
xinaesthete Jun 20, 2024
50b1dbf
(fix): remove filterable check
ilan-gold Jun 21, 2024
14fc06a
passing simpler texture format, 3D still not working seemingly becaus…
xinaesthete Jun 24, 2024
2b1801b
(chore) update luma&deck
xinaesthete Jun 24, 2024
7bc0312
(chore): `model.delete` -> `model.destroy`
ilan-gold Jun 28, 2024
2cf31b0
chore: update zustand
xinaesthete Jun 28, 2024
e2b5d50
fix warning about deprecated 'import shallow'
xinaesthete Jun 28, 2024
a483ca6
Merge remote-tracking branch 'xinaesthete/depbump' into depbump
ilan-gold Jun 28, 2024
dfa1c60
fix typo 'magFilterFilter'
xinaesthete Jul 3, 2024
f57a288
add comments on format to source-info
xinaesthete Jul 4, 2024
774af79
SizeZ comments
xinaesthete Jul 5, 2024
6894770
Merge remote-tracking branch 'origin/main' into depbump, update "gl" …
xinaesthete Jul 22, 2024
0a4c36a
attempt to upgrade to luma.gl 9.0.16, dodgy lock file
xinaesthete Jul 22, 2024
d8df8b0
regenerate pnpm-lock to fix multiple luma.gl versions
xinaesthete Jul 22, 2024
4ddc6d7
update deck & luma
xinaesthete Aug 20, 2024
fbba34c
apply work-around for null textures
xinaesthete Aug 20, 2024
d5da9ae
(fix): rgb images, add alpha channel
ilan-gold Aug 20, 2024
996fea3
lensSelection was being set as string when it should be int
xinaesthete Aug 21, 2024
fcfbd31
(chore) update luma.gl
xinaesthete Sep 3, 2024
7b72406
(chore) update deck.gl
xinaesthete Sep 3, 2024
d6aaeb8
allow newer react
xinaesthete Sep 4, 2024
7a1dd44
remove apparently redundant and deprecated gl alignment parameter set…
xinaesthete Sep 30, 2024
bd247d9
(chore) cleanup some old comments and unused imports
xinaesthete Sep 30, 2024
8ae8c96
(fix) move null texture patching to a more appropriate place
xinaesthete Sep 30, 2024
8971d32
remove commented code
xinaesthete Sep 30, 2024
7b7fd7f
(chore) remove redundant comments
xinaesthete Sep 30, 2024
f49b563
(chore) remove more redundant comments
xinaesthete Sep 30, 2024
ad97b4e
fix issue with scale-bar empty layer test by passing viewState width …
xinaesthete Sep 30, 2024
f4be45b
fix glsl-colormap needed to be a non-dev dependency
xinaesthete Sep 30, 2024
fed2d84
Revert "chore: update zustand"
xinaesthete Oct 1, 2024
f1bff49
Revert "fix warning about deprecated 'import shallow'"
xinaesthete Oct 1, 2024
7bf5292
Revert "remove apparently redundant and deprecated gl alignment param…
xinaesthete Oct 1, 2024
39c6ff2
change comment on setParametersWebGL
xinaesthete Oct 1, 2024
270733a
Revert "fix glsl-colormap needed to be a non-dev dependency"
xinaesthete Oct 3, 2024
4732259
Merge branch 'main' into depbump
xinaesthete Oct 3, 2024
318c826
fix missing GL import
xinaesthete Oct 3, 2024
879bdae
update type and documentation of 'interpolation' prop in line with lu…
xinaesthete Oct 3, 2024
8654861
fix type of interpolation in defaultProps
xinaesthete Oct 3, 2024
974ca9d
(chore) update deck.gl
xinaesthete Oct 20, 2024
533b0fb
(chore): rgb comment
ilan-gold Nov 20, 2024
bb1912f
Merge branch 'main' into depbump
ilan-gold Nov 20, 2024
cbf1b71
(fix): lint
ilan-gold Nov 20, 2024
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
9 changes: 6 additions & 3 deletions .meta-updater/main.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const DECK_VERSION = '~8.8.27';
const LUMAGL_VERSION = '~8.5.21';
const MATHGL_VERSION = '^3.5.7';
// const DECK_VERSION = '~8.8.27';
// const LUMAGL_VERSION = '~8.5.21';
// const MATHGL_VERSION = '^3.5.7';
const DECK_VERSION = '~9.0.17';
const LUMAGL_VERSION = '~9.0.14';
const MATHGL_VERSION = '^4.0.1';
const REACT_VERSION = '^16.8.0 || ^17.0.0';

/** @typedef {import('@pnpm/types').PackageManifest} PackageManifest */
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@
"publish": "pnpm build && pnpm changeset publish"
},
"dependencies": {
"@deck.gl/core": "~8.8.27",
"@deck.gl/geo-layers": "~8.8.27",
"@deck.gl/layers": "~8.8.27",
"@deck.gl/react": "~8.8.27",
"@luma.gl/constants": "~8.5.21",
"@luma.gl/core": "~8.5.21",
"@luma.gl/shadertools": "~8.5.21",
"@luma.gl/webgl": "~8.5.21"
"@deck.gl/core": "~9.0.17",
"@deck.gl/geo-layers": "~9.0.17",
"@deck.gl/layers": "~9.0.17",
"@deck.gl/react": "~9.0.17",
"@luma.gl/constants": "~9.0.14",
"@luma.gl/core": "~9.0.14",
"@luma.gl/shadertools": "~9.0.14",
"@luma.gl/webgl": "~9.0.14"
},
"devDependencies": {
"@biomejs/biome": "^1.7.3",
"@changesets/cli": "^2.27.1",
"@deck.gl/extensions": "~8.8.27",
"@deck.gl/mesh-layers": "~8.8.27",
"@deck.gl/test-utils": "~8.8.27",
"@deck.gl/extensions": "~9.0.17",
"@deck.gl/mesh-layers": "~9.0.17",
"@deck.gl/test-utils": "~9.0.17",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@luma.gl/test-utils": "~8.5.21",
"@luma.gl/test-utils": "~9.0.14",
"@pnpm/meta-updater": "^1.0.0",
"@pnpm/types": "^10.0.0",
"@probe.gl/test-utils": "^3.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"build": "unbuild"
},
"dependencies": {
"@luma.gl/constants": "~8.5.21"
"@luma.gl/constants": "~9.0.14"
},
"unbuild": {
"entries": [
Expand Down
18 changes: 9 additions & 9 deletions packages/constants/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GL from '@luma.gl/constants';
import { GL } from '@luma.gl/constants';

export const MAX_COLOR_INTENSITY = 255;

Expand All @@ -18,28 +18,28 @@ export const DEFAULT_FONT_FAMILY =
*/
export const DTYPE_VALUES = {
Uint8: {
format: GL.R8UI,
format: 'r8uint',
dataFormat: GL.RED_INTEGER,
type: GL.UNSIGNED_BYTE,
max: 2 ** 8 - 1,
sampler: 'usampler2D'
},
Uint16: {
format: GL.R16UI,
format: 'r16uint',
dataFormat: GL.RED_INTEGER,
type: GL.UNSIGNED_SHORT,
max: 2 ** 16 - 1,
sampler: 'usampler2D'
},
Uint32: {
format: GL.R32UI,
format: 'r32uint',
dataFormat: GL.RED_INTEGER,
type: GL.UNSIGNED_INT,
max: 2 ** 32 - 1,
sampler: 'usampler2D'
},
Float32: {
format: GL.R32F,
format: 'r32float',
dataFormat: GL.RED,
type: GL.FLOAT,
// Not sure what to do about this one - a good use case for channel stats, I suppose:
Expand All @@ -48,29 +48,29 @@ export const DTYPE_VALUES = {
sampler: 'sampler2D'
},
Int8: {
format: GL.R8I,
format: 'r8int',
dataFormat: GL.RED_INTEGER,
type: GL.BYTE,
max: 2 ** (8 - 1) - 1,
sampler: 'isampler2D'
},
Int16: {
format: GL.R16I,
format: 'r16int',
dataFormat: GL.RED_INTEGER,
type: GL.SHORT,
max: 2 ** (16 - 1) - 1,
sampler: 'isampler2D'
},
Int32: {
format: GL.R32I,
format: 'r32int',
dataFormat: GL.RED_INTEGER,
type: GL.INT,
max: 2 ** (32 - 1) - 1,
sampler: 'isampler2D'
},
// Cast Float64 as 32 bit float point so it can be rendered.
Float64: {
format: GL.R32F,
format: 'r32float',
dataFormat: GL.RED,
type: GL.FLOAT,
// Not sure what to do about this one - a good use case for channel stats, I suppose:
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"prepare": "node prepare.mjs"
},
"peerDependencies": {
"@deck.gl/core": "~8.8.27"
"@deck.gl/core": "~9.0.17"
},
"dependencies": {
"@vivjs/constants": "workspace:*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ const BaseExtension = class extends LayerExtension {
updateState({ props, oldProps, changeFlags, ...rest }) {
super.updateState({ props, oldProps, changeFlags, ...rest });
if (props.colormap !== oldProps.colormap) {
const { gl } = this.context;
const { device } = this.context;
if (this.state.model) {
this.state.model.delete();
this.setState({ model: this._getModel(gl) });
this.setState({ model: this._getModel(device) });
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ const AdditiveColormapExtension = class extends LayerExtension {
updateState({ props, oldProps, changeFlags, ...rest }) {
super.updateState({ props, oldProps, changeFlags, ...rest });
if (props.colormap !== oldProps.colormap) {
const { gl } = this.context;
const { device } = this.context;
if (this.state.model) {
this.state.model.delete();
this.setState({ model: this._getModel(gl) });
this.setState({ model: this._getModel(device) });
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions packages/layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
"test": "node ../../scripts/bundle-test.mjs tests/index.spec.js | tape-run | tap-spec"
},
"peerDependencies": {
"@deck.gl/core": "~8.8.27",
"@deck.gl/geo-layers": "~8.8.27",
"@deck.gl/layers": "~8.8.27",
"@luma.gl/constants": "~8.5.21",
"@luma.gl/core": "~8.5.21",
"@luma.gl/engine": "~8.5.21",
"@luma.gl/webgl": "~8.5.21"
"@deck.gl/core": "~9.0.17",
"@deck.gl/geo-layers": "~9.0.17",
"@deck.gl/layers": "~9.0.17",
"@luma.gl/constants": "~9.0.14",
"@luma.gl/core": "~9.0.14",
"@luma.gl/engine": "~9.0.14",
"@luma.gl/webgl": "~9.0.14"
},
"dependencies": {
"@math.gl/core": "^3.5.7",
"@math.gl/culling": "^3.5.7",
"@math.gl/core": "^4.0.1",
"@math.gl/culling": "^4.0.1",
"@vivjs/constants": "workspace:*",
"@vivjs/extensions": "workspace:*",
"@vivjs/loaders": "workspace:*",
Expand Down
12 changes: 6 additions & 6 deletions packages/layers/src/bitmap-layer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { COORDINATE_SYSTEM, CompositeLayer } from '@deck.gl/core';
import { BitmapLayer as BaseBitmapLayer } from '@deck.gl/layers';
import GL from '@luma.gl/constants';
import { Geometry, Model } from '@luma.gl/core';
import { GL } from '@luma.gl/constants';
import { Geometry, Model } from '@luma.gl/engine';

const PHOTOMETRIC_INTERPRETATIONS = {
WhiteIsZero: 0,
Expand Down Expand Up @@ -101,7 +101,7 @@ class BitmapLayerWrapper extends BaseBitmapLayer {
...this.getShaders(),
id: this.props.id,
geometry: new Geometry({
drawMode: GL.TRIANGLES,
topology: 'triangle-list',
vertexCount: 6
}),
isInstanced: false,
Expand Down Expand Up @@ -131,15 +131,15 @@ class BitmapLayerWrapper extends BaseBitmapLayer {
*/
const BitmapLayer = class extends CompositeLayer {
initializeState(args) {
const { gl } = this.context;
const { device } = this.context;
// This tells WebGL how to read row data from the texture. For example, the default here is 4 (i.e for RGBA, one byte per channel) so
// each row of data is expected to be a multiple of 4. This setting (i.e 1) allows us to have non-multiple-of-4 row sizes. For example, for 2 byte (16 bit data),
// we could use 2 as the value and it would still work, but 1 also works fine (and is more flexible for 8 bit - 1 byte - textures as well).
// https://stackoverflow.com/questions/42789896/webgl-error-arraybuffer-not-big-enough-for-request-in-case-of-gl-luminance
// This needs to be called here and not in the BitmapLayerWrapper because the `image` prop is converted to a texture outside of the layer, as controlled by the `image` type.
// See: https://github.com/visgl/deck.gl/pull/5197
gl.pixelStorei(GL.UNPACK_ALIGNMENT, 1);
gl.pixelStorei(GL.PACK_ALIGNMENT, 1);
device.setParametersWebGL(GL.UNPACK_ALIGNMENT, 1);
device.setParametersWebGL(GL.PACK_ALIGNMENT, 1);
super.initializeState(args);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/layers/src/image-layer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { COORDINATE_SYSTEM, CompositeLayer } from '@deck.gl/core';
import GL from '@luma.gl/constants';
import { GL } from '@luma.gl/constants';

import { ColorPaletteExtension } from '@vivjs/extensions';
import { SIGNAL_ABORTED, isInterleaved } from '@vivjs/loaders';
Expand Down Expand Up @@ -27,7 +27,7 @@ const defaultProps = {
onViewportLoad: { type: 'function', value: null, compare: true },
interpolation: {
type: 'number',
value: GL.NEAREST,
value: 'nearest',
compare: true
},
extensions: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CompositeLayer } from '@deck.gl/core';
import GL from '@luma.gl/constants';
import { GL } from '@luma.gl/constants';
import { Matrix4 } from '@math.gl/core';

import { ColorPaletteExtension } from '@vivjs/extensions';
Expand Down Expand Up @@ -179,7 +179,7 @@ const MultiscaleImageLayer = class extends CompositeLayer {
onHover,
onClick,
// Background image is nicest when LINEAR in my opinion.
interpolation: GL.LINEAR,
interpolation: 'linear',
onViewportLoad: null
});
const layers = [baseLayer, tiledLayer];
Expand Down
3 changes: 1 addition & 2 deletions packages/layers/src/multiscale-image-layer/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import GL from '@luma.gl/constants';
import { getImageSize, isInterleaved } from '@vivjs/loaders';

import BitmapLayer from '../bitmap-layer';
Expand Down Expand Up @@ -50,6 +49,6 @@ export function renderSubLayers(props) {
id: `tile-sub-layer-${bounds}-${id}`,
tileId: { x, y, z },
// The auto setting is NEAREST at the highest resolution but LINEAR otherwise.
interpolation: z === maxZoom ? GL.NEAREST : GL.LINEAR
interpolation: z === maxZoom ? 'nearest' : 'linear'
});
}
21 changes: 3 additions & 18 deletions packages/layers/src/volume-layer/volume-layer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { COORDINATE_SYSTEM, CompositeLayer } from '@deck.gl/core';
import GL from '@luma.gl/constants';
import { isWebGL2 } from '@luma.gl/core';
import { GL } from '@luma.gl/constants';
// import { isWebGL2 } from '@luma.gl/core';
xinaesthete marked this conversation as resolved.
Show resolved Hide resolved
import { Matrix4 } from '@math.gl/core';
import { ColorPalette3DExtensions } from '@vivjs/extensions';

Expand Down Expand Up @@ -150,8 +150,7 @@ const VolumeLayer = class extends CompositeLayer {
}

renderLayers() {
const { loader, id, resolution, useProgressIndicator, useWebGL1Warning } =
this.props;
const { loader, id, resolution, useProgressIndicator } = this.props;
const { dtype } = loader[resolution];
const {
data,
Expand All @@ -162,20 +161,6 @@ const VolumeLayer = class extends CompositeLayer {
physicalSizeScalingMatrix,
resolutionMatrix
} = this.state;
const { gl } = this.context;
if (!isWebGL2(gl) && useWebGL1Warning) {
const { viewport } = this.context;
return getTextLayer(
[
'Volume rendering is only available on browsers that support WebGL2. If you',
'are using Safari, you can turn on WebGL2 by navigating in the top menubar',
'to check Develop > Experimental Features > WebGL 2.0 and then refreshing',
'the page.'
].join('\n'),
viewport,
id
);
}
if (!(width && height) && useProgressIndicator) {
const { viewport } = this.context;
return getTextLayer(
Expand Down
Loading