@luma.gl/engine 9.1.0-alpha.13 → 9.1.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-loop/animation-loop.d.ts +2 -0
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +19 -2
- package/dist/animation-loop/make-animation-loop.d.ts +5 -1
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +1 -1
- package/dist/async-texture/async-texture.d.ts +10 -0
- package/dist/async-texture/async-texture.d.ts.map +1 -1
- package/dist/async-texture/async-texture.js +14 -0
- package/dist/compute/buffer-transform.d.ts +41 -0
- package/dist/compute/buffer-transform.d.ts.map +1 -0
- package/dist/{transform → compute}/buffer-transform.js +18 -12
- package/dist/{computation.d.ts → compute/computation.d.ts} +3 -3
- package/dist/compute/computation.d.ts.map +1 -0
- package/dist/{computation.js → compute/computation.js} +4 -4
- package/dist/compute/swap.d.ts +22 -0
- package/dist/compute/swap.d.ts.map +1 -0
- package/dist/compute/swap.js +30 -0
- package/dist/{transform → compute}/texture-transform.d.ts +0 -6
- package/dist/compute/texture-transform.d.ts.map +1 -0
- package/dist/{transform → compute}/texture-transform.js +0 -12
- package/dist/debug/debug-framebuffer.js +1 -1
- package/dist/dist.dev.js +152 -31
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +155 -26
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/lib/clip-space.d.ts +2 -2
- package/dist/lib/clip-space.d.ts.map +1 -1
- package/dist/lib/clip-space.js +3 -3
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +2 -1
- package/dist/modules/picking/picking-manager.d.ts +27 -0
- package/dist/modules/picking/picking-manager.d.ts.map +1 -0
- package/dist/modules/picking/picking-manager.js +75 -0
- package/package.json +4 -4
- package/src/animation-loop/animation-loop.ts +20 -2
- package/src/animation-loop/make-animation-loop.ts +7 -3
- package/src/async-texture/async-texture.ts +14 -5
- package/src/{transform → compute}/buffer-transform.ts +30 -14
- package/src/{computation.ts → compute/computation.ts} +4 -4
- package/src/compute/swap.ts +36 -0
- package/src/{transform → compute}/texture-transform.ts +0 -15
- package/src/debug/debug-framebuffer.ts +1 -1
- package/src/index.ts +11 -6
- package/src/lib/clip-space.ts +3 -3
- package/src/model/model.ts +2 -1
- package/src/modules/picking/picking-manager.ts +96 -0
- package/dist/computation.d.ts.map +0 -1
- package/dist/transform/buffer-transform.d.ts +0 -35
- package/dist/transform/buffer-transform.d.ts.map +0 -1
- package/dist/transform/texture-transform.d.ts.map +0 -1
|
@@ -39,10 +39,12 @@ export declare class AnimationLoop {
|
|
|
39
39
|
_nextFramePromise: Promise<AnimationLoop> | null;
|
|
40
40
|
_resolveNextFrame: ((animationLoop: AnimationLoop) => void) | null;
|
|
41
41
|
_cpuStartTime: number;
|
|
42
|
+
_error: Error | null;
|
|
42
43
|
constructor(props: AnimationLoopProps);
|
|
43
44
|
destroy(): void;
|
|
44
45
|
/** @deprecated Use .destroy() */
|
|
45
46
|
delete(): void;
|
|
47
|
+
setError(error: Error): void;
|
|
46
48
|
/** Flags this animation loop as needing redraw */
|
|
47
49
|
setNeedsRedraw(reason: string): this;
|
|
48
50
|
/** TODO - move these props to CanvasContext? */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/animation-loop.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,MAAM,EAAC,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAC,QAAQ,EAAC,iCAA8B;AAC/C,OAAO,EAAC,cAAc,EAAC,6BAA0B;AACjD,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAI5C,+BAA+B;AAC/B,MAAM,MAAM,kBAAkB,GAAG;IAC/B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param {HTMLCanvasElement} canvas - if provided, width and height will be passed to context
|
|
@@ -74,6 +75,22 @@ export class AnimationLoop {
|
|
|
74
75
|
delete() {
|
|
75
76
|
this.destroy();
|
|
76
77
|
}
|
|
78
|
+
setError(error) {
|
|
79
|
+
this.props.onError(error);
|
|
80
|
+
this._error = Error();
|
|
81
|
+
const canvas = this.device?.canvasContext?.canvas;
|
|
82
|
+
if (canvas instanceof HTMLCanvasElement) {
|
|
83
|
+
const errorDiv = document.createElement('h1');
|
|
84
|
+
errorDiv.innerHTML = error.message;
|
|
85
|
+
errorDiv.style.position = 'absolute';
|
|
86
|
+
errorDiv.style.top = '20%'; // left: 50%; transform: translate(-50%, -50%);';
|
|
87
|
+
errorDiv.style.left = '10px';
|
|
88
|
+
errorDiv.style.color = 'black';
|
|
89
|
+
errorDiv.style.backgroundColor = 'red';
|
|
90
|
+
document.body.appendChild(errorDiv);
|
|
91
|
+
// canvas.style.position = 'absolute';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
77
94
|
/** Flags this animation loop as needing redraw */
|
|
78
95
|
setNeedsRedraw(reason) {
|
|
79
96
|
this.needsRedraw = this.needsRedraw || reason;
|
|
@@ -133,7 +150,7 @@ export class AnimationLoop {
|
|
|
133
150
|
if (this._running) {
|
|
134
151
|
// call callback
|
|
135
152
|
// If stop is called immediately, we can end up in a state where props haven't been initialized...
|
|
136
|
-
if (this.animationProps) {
|
|
153
|
+
if (this.animationProps && !this._error) {
|
|
137
154
|
this.props.onFinalize(this.animationProps);
|
|
138
155
|
}
|
|
139
156
|
this._cancelAnimationFrame();
|
|
@@ -145,7 +162,7 @@ export class AnimationLoop {
|
|
|
145
162
|
}
|
|
146
163
|
/** Explicitly draw a frame */
|
|
147
164
|
redraw() {
|
|
148
|
-
if (this.device?.isLost) {
|
|
165
|
+
if (this.device?.isLost || this._error) {
|
|
149
166
|
return this;
|
|
150
167
|
}
|
|
151
168
|
this._beginFrameTimers();
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { Adapter } from '@luma.gl/core';
|
|
1
2
|
import { AnimationLoopTemplate } from "./animation-loop-template.js";
|
|
2
3
|
import { AnimationLoop, AnimationLoopProps } from "./animation-loop.js";
|
|
3
|
-
export type MakeAnimationLoopProps = Omit<AnimationLoopProps, 'onCreateDevice' | 'onInitialize' | 'onRedraw' | 'onFinalize'
|
|
4
|
+
export type MakeAnimationLoopProps = Omit<AnimationLoopProps, 'onCreateDevice' | 'onInitialize' | 'onRedraw' | 'onFinalize'> & {
|
|
5
|
+
/** List of adapters to use when creating the device */
|
|
6
|
+
adapters?: Adapter[];
|
|
7
|
+
};
|
|
4
8
|
/** Instantiates and runs the render loop */
|
|
5
9
|
export declare function makeAnimationLoop(AnimationLoopTemplateCtor: typeof AnimationLoopTemplate, props?: MakeAnimationLoopProps): AnimationLoop;
|
|
6
10
|
//# sourceMappingURL=make-animation-loop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/make-animation-loop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"make-animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/make-animation-loop.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,OAAO,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAChE,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,4BAAyB;AAGnE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,kBAAkB,EAClB,gBAAgB,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,CAC9D,GAAG;IACF,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAC/B,yBAAyB,EAAE,OAAO,qBAAqB,EACvD,KAAK,CAAC,EAAE,sBAAsB,GAC7B,aAAa,CAmCf"}
|
|
@@ -6,7 +6,7 @@ import { AnimationLoop } from "./animation-loop.js";
|
|
|
6
6
|
/** Instantiates and runs the render loop */
|
|
7
7
|
export function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
|
|
8
8
|
let renderLoop = null;
|
|
9
|
-
const device = props?.device || luma.createDevice({ id: 'animation-loop' });
|
|
9
|
+
const device = props?.device || luma.createDevice({ id: 'animation-loop', adapters: props?.adapters });
|
|
10
10
|
// Create an animation loop;
|
|
11
11
|
const animationLoop = new AnimationLoop({
|
|
12
12
|
...props,
|
|
@@ -44,6 +44,16 @@ export declare class AsyncTexture {
|
|
|
44
44
|
constructor(device: Device, props: AsyncTextureProps);
|
|
45
45
|
initAsync(props: AsyncTextureProps): Promise<void>;
|
|
46
46
|
destroy(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Textures are immutable and cannot be resized after creation,
|
|
49
|
+
* but we can create a similar texture with the same parameters but a new size.
|
|
50
|
+
* @note Does not copy contents of the texture
|
|
51
|
+
* @todo Abort pending promise and create a texture with the new size?
|
|
52
|
+
*/
|
|
53
|
+
resize(size: {
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
}): void;
|
|
47
57
|
}
|
|
48
58
|
export {};
|
|
49
59
|
//# sourceMappingURL=async-texture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-texture.d.ts","sourceRoot":"","sources":["../../src/async-texture/async-texture.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,OAAO,EACP,WAAW,EACX,MAAM,EACN,aAAa,EACb,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,qBAAqB,CAAC;AAEnF,KAAK,qBAAqB,GACtB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB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AC,GAAG,gBAAgB,GAAG,IAAI,CAAC;CAC3D,CAAC;AACF,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,GAAG,IAAI,CAAC;CACzD,CAAC;AACF,KAAK,0BAA0B,GAAG;IAChC,SAAS,EAAE,YAAY,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,GAAG,IAAI,CAAC;CACnE,CAAC;AAKF;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAIxB,OAAO,EAAE,OAAO,CAAC;IAEjB,OAAO,EAAE,OAAO,CAAC;IAEjB,IAAI,EAAE,WAAW,CAAC;IAElB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAS;IACzB,SAAS,EAAE,OAAO,CAAS;IAE3B,SAAS,CAAC,YAAY,EAAE,MAAM,IAAI,CAAY;IAC9C,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAY;gBAE7C,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;IAmB9C,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBxD,OAAO,IAAI,IAAI;IASf;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI;CAQpD"}
|
|
@@ -61,6 +61,20 @@ export class AsyncTexture {
|
|
|
61
61
|
}
|
|
62
62
|
this.destroyed = true;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Textures are immutable and cannot be resized after creation,
|
|
66
|
+
* but we can create a similar texture with the same parameters but a new size.
|
|
67
|
+
* @note Does not copy contents of the texture
|
|
68
|
+
* @todo Abort pending promise and create a texture with the new size?
|
|
69
|
+
*/
|
|
70
|
+
resize(size) {
|
|
71
|
+
if (!this.isReady) {
|
|
72
|
+
throw new Error('Cannot resize texture before it is ready');
|
|
73
|
+
}
|
|
74
|
+
if (this.texture) {
|
|
75
|
+
this.texture = this.texture.createResizedTexture(size);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
64
78
|
}
|
|
65
79
|
// HELPERS
|
|
66
80
|
/** Resolve all promises in a nested data structure */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Device, Buffer, BufferRange, TransformFeedback, RenderPassProps } from '@luma.gl/core';
|
|
2
|
+
import { Model } from "../model/model.js";
|
|
3
|
+
import type { ModelProps } from "../model/model.js";
|
|
4
|
+
/**
|
|
5
|
+
* Properties for creating a {@link BufferTransform}
|
|
6
|
+
* @note Only works under WebGL2.
|
|
7
|
+
*/
|
|
8
|
+
export type BufferTransformProps = Omit<ModelProps, 'fs'> & {
|
|
9
|
+
/** Optional fragment shader - normally not used in transforms */
|
|
10
|
+
fs?: ModelProps['fs'];
|
|
11
|
+
/** A list of named outputs corresponding to shader declarations (varyings in WebGL) */
|
|
12
|
+
outputs?: string[];
|
|
13
|
+
/** @deprecated Use run({outputBuffers}) instead - Map of output buffers that the shaders will write results of computations to */
|
|
14
|
+
feedbackBuffers?: Record<string, Buffer | BufferRange>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Manages a WebGL program (pipeline) for buffer→buffer transforms.
|
|
18
|
+
* @note Only works under WebGL2.
|
|
19
|
+
*/
|
|
20
|
+
export declare class BufferTransform {
|
|
21
|
+
readonly device: Device;
|
|
22
|
+
readonly model: Model;
|
|
23
|
+
readonly transformFeedback: TransformFeedback;
|
|
24
|
+
static defaultProps: Required<BufferTransformProps>;
|
|
25
|
+
static isSupported(device: Device): boolean;
|
|
26
|
+
constructor(device: Device, props?: BufferTransformProps);
|
|
27
|
+
/** Destroy owned resources. */
|
|
28
|
+
destroy(): void;
|
|
29
|
+
/** @deprecated Use {@link destroy}. */
|
|
30
|
+
delete(): void;
|
|
31
|
+
/** Run one transform loop. */
|
|
32
|
+
run(options?: RenderPassProps & {
|
|
33
|
+
inputBuffers?: Record<string, Buffer>;
|
|
34
|
+
outputBuffers?: Record<string, Buffer>;
|
|
35
|
+
}): void;
|
|
36
|
+
/** @deprecated App knows what buffers it is passing in - Returns the {@link Buffer} or {@link BufferRange} for given varying name. */
|
|
37
|
+
getBuffer(varyingName: string): Buffer | BufferRange | null;
|
|
38
|
+
/** @deprecated App knows what buffers it is passing in - Reads the {@link Buffer} or {@link BufferRange} for given varying name. */
|
|
39
|
+
readAsync(varyingName: string): Promise<Uint8Array>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=buffer-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-transform.d.ts","sourceRoot":"","sources":["../../src/compute/buffer-transform.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAE9F,OAAO,EAAC,KAAK,EAAC,0BAAuB;AACrC,OAAO,KAAK,EAAC,UAAU,EAAC,0BAAuB;AAE/C;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG;IAC1D,iEAAiE;IACjE,EAAE,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACtB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,kIAAkI;IAClI,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;CACxD,CAAC;AAEF;;;GAGG;AACH,qBAAa,eAAe;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAE9C,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAIjD;IAEF,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;gBAI/B,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,oBAAmD;IA0BtF,+BAA+B;IAC/B,OAAO,IAAI,IAAI;IAMf,uCAAuC;IACvC,MAAM,IAAI,IAAI;IAId,8BAA8B;IAC9B,GAAG,CACD,OAAO,CAAC,EAAE,eAAe,GAAG;QAC1B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACxC,GACA,IAAI;IAcP,sIAAsI;IACtI,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI;IAI3D,oIAAoI;IACpI,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAWpD"}
|
|
@@ -5,18 +5,22 @@ import { Buffer } from '@luma.gl/core';
|
|
|
5
5
|
import { getPassthroughFS } from '@luma.gl/shadertools';
|
|
6
6
|
import { Model } from "../model/model.js";
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
8
|
+
* Manages a WebGL program (pipeline) for buffer→buffer transforms.
|
|
9
|
+
* @note Only works under WebGL2.
|
|
10
10
|
*/
|
|
11
11
|
export class BufferTransform {
|
|
12
12
|
device;
|
|
13
13
|
model;
|
|
14
14
|
transformFeedback;
|
|
15
|
-
|
|
15
|
+
static defaultProps = {
|
|
16
|
+
...Model.defaultProps,
|
|
17
|
+
outputs: undefined,
|
|
18
|
+
feedbackBuffers: undefined
|
|
19
|
+
};
|
|
16
20
|
static isSupported(device) {
|
|
17
21
|
return device?.info?.type === 'webgl';
|
|
18
22
|
}
|
|
19
|
-
constructor(device, props =
|
|
23
|
+
constructor(device, props = BufferTransform.defaultProps) {
|
|
20
24
|
if (!BufferTransform.isSupported(device)) {
|
|
21
25
|
throw new Error('BufferTransform not yet implemented on WebGPU');
|
|
22
26
|
}
|
|
@@ -25,6 +29,7 @@ export class BufferTransform {
|
|
|
25
29
|
id: props.id || 'buffer-transform-model',
|
|
26
30
|
fs: props.fs || getPassthroughFS(),
|
|
27
31
|
topology: props.topology || 'point-list',
|
|
32
|
+
varyings: props.outputs || props.varyings,
|
|
28
33
|
...props
|
|
29
34
|
});
|
|
30
35
|
this.transformFeedback = this.device.createTransformFeedback({
|
|
@@ -47,21 +52,22 @@ export class BufferTransform {
|
|
|
47
52
|
}
|
|
48
53
|
/** Run one transform loop. */
|
|
49
54
|
run(options) {
|
|
55
|
+
if (options?.inputBuffers) {
|
|
56
|
+
this.model.setAttributes(options.inputBuffers);
|
|
57
|
+
}
|
|
58
|
+
if (options?.outputBuffers) {
|
|
59
|
+
this.transformFeedback.setBuffers(options.outputBuffers);
|
|
60
|
+
}
|
|
50
61
|
const renderPass = this.device.beginRenderPass(options);
|
|
51
62
|
this.model.draw(renderPass);
|
|
52
63
|
renderPass.end();
|
|
53
64
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// TODO(v9): Method should likely be removed for v9. Keeping a method stub
|
|
57
|
-
// to assist with migrating DeckGL usage.
|
|
58
|
-
// eslint-disable-next-line no-console
|
|
59
|
-
console.warn('TextureTransform#update() not implemented');
|
|
60
|
-
}
|
|
61
|
-
/** Returns the {@link Buffer} or {@link BufferRange} for given varying name. */
|
|
65
|
+
// DEPRECATED METHODS
|
|
66
|
+
/** @deprecated App knows what buffers it is passing in - Returns the {@link Buffer} or {@link BufferRange} for given varying name. */
|
|
62
67
|
getBuffer(varyingName) {
|
|
63
68
|
return this.transformFeedback.getBuffer(varyingName);
|
|
64
69
|
}
|
|
70
|
+
/** @deprecated App knows what buffers it is passing in - Reads the {@link Buffer} or {@link BufferRange} for given varying name. */
|
|
65
71
|
readAsync(varyingName) {
|
|
66
72
|
const result = this.getBuffer(varyingName);
|
|
67
73
|
if (!result) {
|
|
@@ -3,9 +3,9 @@ import { Device, Buffer, ComputePipeline, ComputePass, UniformStore } from '@lum
|
|
|
3
3
|
import type { ShaderModule, PlatformInfo } from '@luma.gl/shadertools';
|
|
4
4
|
import { ShaderAssembler } from '@luma.gl/shadertools';
|
|
5
5
|
import { TypedArray } from '@math.gl/types';
|
|
6
|
-
import { ShaderInputs } from "
|
|
7
|
-
import { PipelineFactory } from "
|
|
8
|
-
import { ShaderFactory } from "
|
|
6
|
+
import { ShaderInputs } from "../shader-inputs.js";
|
|
7
|
+
import { PipelineFactory } from "../lib/pipeline-factory.js";
|
|
8
|
+
import { ShaderFactory } from "../lib/shader-factory.js";
|
|
9
9
|
export type ComputationProps = Omit<ComputePipelineProps, 'shader'> & {
|
|
10
10
|
source?: string;
|
|
11
11
|
/** shadertool shader modules (added to shader code) */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computation.d.ts","sourceRoot":"","sources":["../../src/compute/computation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAgB,oBAAoB,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACxF,OAAO,EACL,MAAM,EACN,MAAM,EACN,eAAe,EACf,WAAW,EACX,YAAY,EAGb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAC,eAAe,EAA0B,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAC,UAAU,EAAiB,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAC9C,OAAO,EAAC,eAAe,EAAC,mCAAgC;AACxD,OAAO,EAAC,aAAa,EAAC,iCAA8B;AAOpD,MAAM,MAAM,gBAAgB,GAAG,IAAI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
4
|
import { Buffer, ComputePipeline, UniformStore, log, getTypedArrayFromDataType } from '@luma.gl/core';
|
|
5
5
|
import { ShaderAssembler, getShaderLayoutFromWGSL } from '@luma.gl/shadertools';
|
|
6
6
|
import { isNumericArray } from '@math.gl/types';
|
|
7
|
-
import { ShaderInputs } from "
|
|
8
|
-
import { PipelineFactory } from "
|
|
9
|
-
import { ShaderFactory } from "
|
|
10
|
-
import { uid } from "
|
|
7
|
+
import { ShaderInputs } from "../shader-inputs.js";
|
|
8
|
+
import { PipelineFactory } from "../lib/pipeline-factory.js";
|
|
9
|
+
import { ShaderFactory } from "../lib/shader-factory.js";
|
|
10
|
+
import { uid } from "../utils/uid.js";
|
|
11
11
|
// import {getDebugTableForShaderLayout} from '../debug/debug-shader-layout';
|
|
12
12
|
const LOG_DRAW_PRIORITY = 2;
|
|
13
13
|
const LOG_DRAW_TIMEOUT = 10000;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Resource } from '@luma.gl/core';
|
|
2
|
+
/**
|
|
3
|
+
* Helper class for working with repeated transformations / computations
|
|
4
|
+
* Primarily intended for GPU buffers `Swap<Buffer>` or textures `Swap<Texture>`)
|
|
5
|
+
* @note the two resources are expected to be structurally identical (same size, length, format, etc)
|
|
6
|
+
* @note the two resources can be destroyed by calling `destroy()`
|
|
7
|
+
*/
|
|
8
|
+
export declare class Swap<T extends Resource<any>> {
|
|
9
|
+
/** The current resource - usually the source for renders or computations */
|
|
10
|
+
current: T;
|
|
11
|
+
/** The next resource - usually the target/destination for transforms / computations */
|
|
12
|
+
next: T;
|
|
13
|
+
constructor(props: {
|
|
14
|
+
current: T;
|
|
15
|
+
next: T;
|
|
16
|
+
});
|
|
17
|
+
/** Destroys the two managed resources */
|
|
18
|
+
destroy(): void;
|
|
19
|
+
/** Make the next resource into the current resource, and reuse the current resource as the next resource */
|
|
20
|
+
swap(): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=swap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/compute/swap.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC;;;;;GAKG;AACH,qBAAa,IAAI,CAAC,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC;IACvC,4EAA4E;IAC5E,OAAO,EAAE,CAAC,CAAC;IACX,uFAAuF;IACvF,IAAI,EAAE,CAAC,CAAC;gBAEI,KAAK,EAAE;QAAC,OAAO,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,CAAC,CAAA;KAAC;IAKxC,yCAAyC;IACzC,OAAO;IAKP,4GAA4G;IAC5G,IAAI;CAKL"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
/**
|
|
5
|
+
* Helper class for working with repeated transformations / computations
|
|
6
|
+
* Primarily intended for GPU buffers `Swap<Buffer>` or textures `Swap<Texture>`)
|
|
7
|
+
* @note the two resources are expected to be structurally identical (same size, length, format, etc)
|
|
8
|
+
* @note the two resources can be destroyed by calling `destroy()`
|
|
9
|
+
*/
|
|
10
|
+
export class Swap {
|
|
11
|
+
/** The current resource - usually the source for renders or computations */
|
|
12
|
+
current;
|
|
13
|
+
/** The next resource - usually the target/destination for transforms / computations */
|
|
14
|
+
next;
|
|
15
|
+
constructor(props) {
|
|
16
|
+
this.current = props.current;
|
|
17
|
+
this.next = props.next;
|
|
18
|
+
}
|
|
19
|
+
/** Destroys the two managed resources */
|
|
20
|
+
destroy() {
|
|
21
|
+
this.current?.destroy();
|
|
22
|
+
this.next?.destroy();
|
|
23
|
+
}
|
|
24
|
+
/** Make the next resource into the current resource, and reuse the current resource as the next resource */
|
|
25
|
+
swap() {
|
|
26
|
+
const current = this.current;
|
|
27
|
+
this.current = this.next;
|
|
28
|
+
this.next = current;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -2,7 +2,6 @@ import { Buffer, Device, Framebuffer, RenderPassProps, Sampler, Texture } from '
|
|
|
2
2
|
import { Model, ModelProps } from "../model/model.js";
|
|
3
3
|
/**
|
|
4
4
|
* Properties for creating a {@link TextureTransform}
|
|
5
|
-
* @deprecated
|
|
6
5
|
*/
|
|
7
6
|
export type TextureTransformProps = Omit<ModelProps, 'fs'> & {
|
|
8
7
|
fs?: ModelProps['fs'];
|
|
@@ -41,11 +40,6 @@ export declare class TextureTransform {
|
|
|
41
40
|
/** @deprecated Use {@link destroy}. */
|
|
42
41
|
delete(): void;
|
|
43
42
|
run(options?: RenderPassProps): void;
|
|
44
|
-
/** @deprecated */
|
|
45
|
-
update(...args: any[]): void;
|
|
46
|
-
getData({ packed }?: {
|
|
47
|
-
packed?: boolean | undefined;
|
|
48
|
-
}): void;
|
|
49
43
|
getTargetTexture(): Texture;
|
|
50
44
|
getFramebuffer(): Framebuffer | undefined;
|
|
51
45
|
_initialize(props: TextureTransformProps): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texture-transform.d.ts","sourceRoot":"","sources":["../../src/compute/texture-transform.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,KAAK,EAAE,UAAU,EAAC,0BAAuB;AAGjD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG;IAC3D,EAAE,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACtB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,4CAA4C;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gEAAgE;IAChE,aAAa,CAAC,EAAE,M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AE,cAAc,EAAE,aAAa,EAAC,EAAE,qBAAqB,GACpE,cAAc;IA8BjB,2BAA2B,IAAI,IAAI;CAOpC"}
|
|
@@ -52,18 +52,6 @@ export class TextureTransform {
|
|
|
52
52
|
this.model.draw(renderPass);
|
|
53
53
|
renderPass.end();
|
|
54
54
|
}
|
|
55
|
-
/** @deprecated */
|
|
56
|
-
update(...args) {
|
|
57
|
-
// TODO(v9): Method should likely be removed for v9. Keeping a method stub
|
|
58
|
-
// to assist with migrating DeckGL usage.
|
|
59
|
-
// eslint-disable-next-line no-console
|
|
60
|
-
console.warn('TextureTransform#update() not implemented');
|
|
61
|
-
}
|
|
62
|
-
getData({ packed = false } = {}) {
|
|
63
|
-
// TODO(v9): Method should likely be removed for v9. Keeping a method stub
|
|
64
|
-
// to assist with migrating DeckGL usage.
|
|
65
|
-
throw new Error('getData() not implemented');
|
|
66
|
-
}
|
|
67
55
|
getTargetTexture() {
|
|
68
56
|
const { targetTexture } = this.bindings[this.currentIndex];
|
|
69
57
|
return targetTexture;
|
|
@@ -17,7 +17,7 @@ export function debugFramebuffer(fbo, { id, minimap, opaque, top = '0', left = '
|
|
|
17
17
|
canvas.style.position = 'absolute';
|
|
18
18
|
canvas.style.top = top; // ⚠️
|
|
19
19
|
canvas.style.left = left; // ⚠️
|
|
20
|
-
canvas.style.border = 'blue
|
|
20
|
+
canvas.style.border = 'blue 5px solid';
|
|
21
21
|
canvas.style.transform = 'scaleY(-1)';
|
|
22
22
|
document.body.appendChild(canvas);
|
|
23
23
|
ctx = canvas.getContext('2d');
|