Skip to content
Closed
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
17 changes: 16 additions & 1 deletion modules/layers/src/scatterplot-layer/scatterplot-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
Color,
DefaultProps
} from '@deck.gl/core';
import {Parameters} from '@luma.gl/core';

const DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];

Expand Down Expand Up @@ -257,10 +258,23 @@ export default class ScatterplotLayer<DataT = any, ExtraPropsT extends {} = {}>
};
const model = this.state.model!;
model.shaderInputs.setProps({scatterplot: scatterplotProps});
if (this.context.device.type === 'webgpu') {
// @ts-expect-error TODO - this line was needed during WebGPU port
model.instanceCount = this.props.data.length;
}
model.draw(this.context.renderPass);
}

protected _getModel() {
// TODO(ibgreen): WebGPU complication: Matching attachment state of the renderpass requires including a depth buffer
const parameters =
this.context.device.type === 'webgpu'
? ({
depthWriteEnabled: true,
depthCompare: 'less-equal'
} satisfies Parameters)
: undefined;

// a square that minimally cover the unit circle
const positions = [-1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0];
return new Model(this.context.device, {
Expand All @@ -273,7 +287,8 @@ export default class ScatterplotLayer<DataT = any, ExtraPropsT extends {} = {}>
positions: {size: 3, value: new Float32Array(positions)}
}
}),
isInstanced: true
isInstanced: true,
parameters
});
}
}
Loading