Visitar URL original
Forward shader plugins to GPU aggregation models · visgl/deck.gl@9023741 · GitHub
Skip to content

Commit 9023741

Browse files
committed
Forward shader plugins to GPU aggregation models
1 parent 18289a2 commit 9023741

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎modules/aggregation-layers/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {_deepEqual as deepEqual, log, BinaryAttribute} from '@deck.gl/core';
88

99
import type {Aggregator, AggregationProps, AggregatedBin} from '../aggregator';
1010
import type {Device, Buffer, BufferLayout, TypedArray} from '@luma.gl/core';
11-
import type {ShaderModule, ShaderAssembler} from '@luma.gl/shaders';
11+
import type {ShaderModule, ShaderAssembler, ShaderPlugin} from '@luma.gl/shaders';
1212

1313
/** Options used to construct a new WebGLAggregator */
1414
export type WebGLAggregatorProps = {
@@ -33,6 +33,8 @@ export type WebGLAggregatorProps = {
3333
* Required to support certain layer extensions (e.g. data filter)
3434
*/
3535
modules?: ShaderModule[];
36+
/** Shader plugins applied while assigning points to bins. */
37+
plugins?: ShaderPlugin[];
3638
/** Shadertool module defines */
3739
defines?: Record<string, string | number | boolean>;
3840
} & Partial<WebGLAggregationProps>;

‎modules/aggregation-layers/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ void main() {
247247
`;
248248
const model = new Model(device, {
249249
shaderAssembler: props.shaderAssembler,
250+
plugins: props.plugins,
250251
bufferLayout: props.bufferLayout,
251252
modules: [...(props.modules || []), binSorterUniforms],
252253
defines: {...props.defines, NON_INSTANCED_MODEL: 1, NUM_CHANNELS: props.channelCount},

‎modules/geo-layers/src/trips-layer/trips-layer.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ const defaultProps: DefaultProps<TripsLayerProps> = {
1818
};
1919

2020
const tripsShaderInjectionsGLSL = {
21-
'vs:#decl': `\
21+
'glsl:vs:#decl': `\
2222
in float instanceTimestamps;
2323
in float instanceNextTimestamps;
2424
out float vTime;
2525
`,
2626
// Timestamp of the vertex
27-
'vs:#main-end': `\
27+
'glsl:vs:#main-end': `\
2828
vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength;
2929
`,
30-
'fs:#decl': `\
30+
'glsl:fs:#decl': `\
3131
in float vTime;
3232
`,
3333
// Drop segments only after PathLayer evaluates analytic-coverage derivatives, then
3434
// fade the color (currentTime - 100%, end of trail - 0%).
35-
'fs:DECKGL_FILTER_COLOR': `\
35+
'glsl:fs:DECKGL_FILTER_COLOR': `\
3636
if(vTime > trips.currentTime || (trips.fadeTrail && (vTime < trips.currentTime - trips.trailLength))) {
3737
discard;
3838
}

0 commit comments

Comments
 (0)