@luma.gl/webgpu 9.0.0-beta.4 → 9.0.0-beta.6
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/adapter/helpers/accessor-to-format.js +102 -1
- package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
- package/dist/adapter/helpers/convert-texture-format.js +8 -5
- package/dist/adapter/helpers/generate-mipmaps.d.ts.map +1 -1
- package/dist/adapter/helpers/generate-mipmaps.js +85 -82
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +57 -41
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +117 -80
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +185 -125
- package/dist/adapter/resources/webgpu-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js +117 -62
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +7 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +81 -49
- package/dist/adapter/resources/webgpu-compute-pass.d.ts +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +71 -41
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +28 -19
- package/dist/adapter/resources/webgpu-external-texture.d.ts +2 -2
- package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.js +33 -18
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +14 -7
- package/dist/adapter/resources/webgpu-query-set.d.ts +17 -0
- package/dist/adapter/resources/webgpu-query-set.d.ts.map +1 -0
- package/dist/adapter/resources/webgpu-query-set.js +25 -0
- package/dist/adapter/resources/webgpu-query.js +42 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts +4 -2
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +133 -105
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +3 -4
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +137 -80
- package/dist/adapter/resources/webgpu-sampler.d.ts +1 -1
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.js +18 -15
- package/dist/adapter/resources/webgpu-shader.d.ts +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.js +56 -45
- package/dist/adapter/resources/webgpu-texture-view.d.ts +20 -0
- package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/webgpu-texture-view.js +32 -0
- package/dist/adapter/resources/webgpu-texture.d.ts +5 -4
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +130 -107
- package/dist/adapter/resources/webgpu-vertex-array.d.ts +7 -6
- package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js +60 -39
- package/dist/adapter/webgpu-canvas-context.d.ts +3 -3
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +100 -67
- package/dist/adapter/webgpu-device.d.ts +24 -21
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +264 -220
- package/dist/adapter/webgpu-types.js +0 -2
- package/dist/dist.dev.js +782 -2222
- package/dist/glsl/glsllang.js +9 -6
- package/dist/index.cjs +279 -388
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist.min.js +1 -22
- package/package.json +9 -7
- package/src/adapter/helpers/accessor-to-format.ts +5 -1
- package/src/adapter/helpers/convert-texture-format.ts +4 -1
- package/src/adapter/helpers/generate-mipmaps.ts +37 -26
- package/src/adapter/helpers/get-bind-group.ts +8 -2
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +12 -4
- package/src/adapter/helpers/webgpu-parameters.ts +79 -15
- package/src/adapter/resources/webgpu-buffer.ts +21 -10
- package/src/adapter/resources/webgpu-command-encoder.ts +24 -9
- package/src/adapter/resources/webgpu-compute-pass.ts +26 -8
- package/src/adapter/resources/webgpu-compute-pipeline.ts +15 -10
- package/src/adapter/resources/webgpu-external-texture.ts +12 -6
- package/src/adapter/resources/webgpu-framebuffer.ts +4 -0
- package/src/adapter/resources/webgpu-query-set.ts +35 -0
- package/src/adapter/resources/webgpu-render-pass.ts +37 -14
- package/src/adapter/resources/webgpu-render-pipeline.ts +30 -41
- package/src/adapter/resources/webgpu-sampler.ts +1 -1
- package/src/adapter/resources/webgpu-shader.ts +5 -4
- package/src/adapter/resources/webgpu-texture-view.ts +43 -0
- package/src/adapter/resources/webgpu-texture.ts +23 -19
- package/src/adapter/resources/webgpu-vertex-array.ts +25 -17
- package/src/adapter/webgpu-canvas-context.ts +8 -3
- package/src/adapter/webgpu-device.ts +100 -88
- package/src/index.ts +2 -1
- package/dist/adapter/helpers/accessor-to-format.js.map +0 -1
- package/dist/adapter/helpers/convert-texture-format.js.map +0 -1
- package/dist/adapter/helpers/generate-mipmaps.js.map +0 -1
- package/dist/adapter/helpers/get-bind-group.js.map +0 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +0 -1
- package/dist/adapter/helpers/webgpu-parameters.js.map +0 -1
- package/dist/adapter/resources/webgpu-buffer.js.map +0 -1
- package/dist/adapter/resources/webgpu-command-encoder.js.map +0 -1
- package/dist/adapter/resources/webgpu-compute-pass.js.map +0 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgpu-external-texture.js.map +0 -1
- package/dist/adapter/resources/webgpu-framebuffer.js.map +0 -1
- package/dist/adapter/resources/webgpu-query.js.map +0 -1
- package/dist/adapter/resources/webgpu-render-pass.js.map +0 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgpu-sampler.js.map +0 -1
- package/dist/adapter/resources/webgpu-shader.js.map +0 -1
- package/dist/adapter/resources/webgpu-texture.js.map +0 -1
- package/dist/adapter/resources/webgpu-vertex-array.js.map +0 -1
- package/dist/adapter/webgpu-canvas-context.js.map +0 -1
- package/dist/adapter/webgpu-device.js.map +0 -1
- package/dist/adapter/webgpu-types.js.map +0 -1
- package/dist/glsl/glsllang.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/src/adapter/resources/webgpu-query.ts +0 -43
- package/src/adapter/webgpu-types.ts +0 -0
- package/src/glsl/glsllang.ts +0 -14
|
@@ -1,52 +1,84 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { CommandEncoder } from '@luma.gl/core';
|
|
2
5
|
export class WebGPUCommandEncoder extends CommandEncoder {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
6
|
+
device;
|
|
7
|
+
handle;
|
|
8
|
+
constructor(device, props) {
|
|
9
|
+
super(device, props);
|
|
10
|
+
this.device = device;
|
|
11
|
+
this.handle =
|
|
12
|
+
props.handle ||
|
|
13
|
+
this.device.handle.createCommandEncoder({
|
|
14
|
+
// TODO was this removed in standard?
|
|
15
|
+
// measureExecutionTime: this.props.measureExecutionTime
|
|
16
|
+
});
|
|
17
|
+
this.handle.label = this.props.id;
|
|
18
|
+
}
|
|
19
|
+
destroy() { }
|
|
20
|
+
finish(options) {
|
|
21
|
+
return this.finish(options);
|
|
22
|
+
}
|
|
23
|
+
// beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;
|
|
24
|
+
// beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;
|
|
25
|
+
copyBufferToBuffer(options) {
|
|
26
|
+
const webgpuSourceBuffer = options.source;
|
|
27
|
+
const WebGPUDestinationBuffer = options.destination;
|
|
28
|
+
this.handle.copyBufferToBuffer(webgpuSourceBuffer.handle, options.sourceOffset ?? 0, WebGPUDestinationBuffer.handle, options.destinationOffset ?? 0, options.size ?? 0);
|
|
29
|
+
}
|
|
30
|
+
copyBufferToTexture(options) {
|
|
31
|
+
const webgpuSourceBuffer = options.source;
|
|
32
|
+
const WebGPUDestinationTexture = options.destination;
|
|
33
|
+
this.handle.copyBufferToTexture({
|
|
34
|
+
buffer: webgpuSourceBuffer.handle,
|
|
35
|
+
offset: options.offset ?? 0,
|
|
36
|
+
bytesPerRow: options.bytesPerRow,
|
|
37
|
+
rowsPerImage: options.rowsPerImage
|
|
38
|
+
}, {
|
|
39
|
+
texture: WebGPUDestinationTexture.handle,
|
|
40
|
+
mipLevel: options.mipLevel ?? 0,
|
|
41
|
+
origin: options.origin ?? {}
|
|
42
|
+
// aspect: options.aspect
|
|
43
|
+
}, {
|
|
44
|
+
// TODO exclamation mark hack
|
|
45
|
+
width: options.extent[0],
|
|
46
|
+
height: options.extent[1],
|
|
47
|
+
depthOrArrayLayers: options.extent[2]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
copyTextureToBuffer(options) {
|
|
51
|
+
// this.handle.copyTextureToBuffer(
|
|
52
|
+
// // source
|
|
53
|
+
// {},
|
|
54
|
+
// // destination
|
|
55
|
+
// {},
|
|
56
|
+
// // copySize
|
|
57
|
+
// {}
|
|
58
|
+
// );
|
|
59
|
+
}
|
|
60
|
+
copyTextureToTexture(options) {
|
|
61
|
+
// this.handle.copyTextureToTexture(
|
|
62
|
+
// // source
|
|
63
|
+
// {},
|
|
64
|
+
// // destination
|
|
65
|
+
// {},
|
|
66
|
+
// // copySize
|
|
67
|
+
// {}
|
|
68
|
+
// );
|
|
69
|
+
}
|
|
70
|
+
pushDebugGroup(groupLabel) {
|
|
71
|
+
this.handle.pushDebugGroup(groupLabel);
|
|
72
|
+
}
|
|
73
|
+
popDebugGroup() {
|
|
74
|
+
this.handle.popDebugGroup();
|
|
75
|
+
}
|
|
76
|
+
insertDebugMarker(markerLabel) {
|
|
77
|
+
this.handle.insertDebugMarker(markerLabel);
|
|
78
|
+
}
|
|
79
|
+
resolveQuerySet(querySet, destination, options) {
|
|
80
|
+
const webgpuQuerySet = querySet;
|
|
81
|
+
const webgpuBuffer = destination;
|
|
82
|
+
this.handle.resolveQuerySet(webgpuQuerySet.handle, options.firstQuery || 0, options.queryCount || querySet.props.count - (options.firstQuery || 0), webgpuBuffer.handle, options.destinationOffset || 0);
|
|
83
|
+
}
|
|
51
84
|
}
|
|
52
|
-
//# sourceMappingURL=webgpu-command-encoder.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
2
|
import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/core';
|
|
3
|
-
import { WebGPUDevice } from
|
|
3
|
+
import { WebGPUDevice } from "../webgpu-device.js";
|
|
4
4
|
export declare class WebGPUComputePass extends ComputePass {
|
|
5
5
|
readonly device: WebGPUDevice;
|
|
6
6
|
readonly handle: GPUComputePassEncoder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAM9C,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,GAAG,IAAI,CAAQ;gBAEvC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAyBzD,8CAA8C;IACrC,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAM5C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;OAIG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,GAAE,MAAU,GAAG,IAAI;IAK1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAIrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAG7C"}
|
|
@@ -1,44 +1,74 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { ComputePass } from '@luma.gl/core';
|
|
2
5
|
export class WebGPUComputePass extends ComputePass {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
6
|
+
device;
|
|
7
|
+
handle;
|
|
8
|
+
_bindGroupLayout = null;
|
|
9
|
+
constructor(device, props) {
|
|
10
|
+
super(device, props);
|
|
11
|
+
this.device = device;
|
|
12
|
+
// Set up queries
|
|
13
|
+
let timestampWrites;
|
|
14
|
+
if (device.features.has('timestamp-query')) {
|
|
15
|
+
const webgpuQuerySet = props.timestampQuerySet;
|
|
16
|
+
if (webgpuQuerySet) {
|
|
17
|
+
timestampWrites = {
|
|
18
|
+
querySet: webgpuQuerySet.handle,
|
|
19
|
+
beginningOfPassWriteIndex: props.beginTimestampIndex,
|
|
20
|
+
endOfPassWriteIndex: props.endTimestampIndex
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
this.handle =
|
|
25
|
+
this.props.handle ||
|
|
26
|
+
device.commandEncoder?.beginComputePass({
|
|
27
|
+
label: this.props.id,
|
|
28
|
+
timestampWrites
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** @note no WebGPU destroy method, just gc */
|
|
32
|
+
destroy() { }
|
|
33
|
+
end() {
|
|
34
|
+
this.handle.end();
|
|
35
|
+
}
|
|
36
|
+
setPipeline(pipeline) {
|
|
37
|
+
const wgpuPipeline = pipeline;
|
|
38
|
+
this.handle.setPipeline(wgpuPipeline.handle);
|
|
39
|
+
this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
|
|
40
|
+
}
|
|
41
|
+
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
42
|
+
setBindings(bindings) {
|
|
43
|
+
throw new Error('fix me');
|
|
44
|
+
// const bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.bindings);
|
|
45
|
+
// this.handle.setBindGroup(0, bindGroup);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Dispatch work to be performed with the current ComputePipeline.
|
|
49
|
+
* @param x X dimension of the grid of workgroups to dispatch.
|
|
50
|
+
* @param y Y dimension of the grid of workgroups to dispatch.
|
|
51
|
+
* @param z Z dimension of the grid of workgroups to dispatch.
|
|
52
|
+
*/
|
|
53
|
+
dispatch(x, y, z) {
|
|
54
|
+
this.handle.dispatchWorkgroups(x, y, z);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Dispatch work to be performed with the current ComputePipeline.
|
|
58
|
+
* @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()
|
|
59
|
+
* @param indirectOffset
|
|
60
|
+
*/
|
|
61
|
+
dispatchIndirect(indirectBuffer, indirectOffset = 0) {
|
|
62
|
+
const webgpuBuffer = indirectBuffer;
|
|
63
|
+
this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectOffset);
|
|
64
|
+
}
|
|
65
|
+
pushDebugGroup(groupLabel) {
|
|
66
|
+
this.handle.pushDebugGroup(groupLabel);
|
|
67
|
+
}
|
|
68
|
+
popDebugGroup() {
|
|
69
|
+
this.handle.popDebugGroup();
|
|
70
|
+
}
|
|
71
|
+
insertDebugMarker(markerLabel) {
|
|
72
|
+
this.handle.insertDebugMarker(markerLabel);
|
|
73
|
+
}
|
|
43
74
|
}
|
|
44
|
-
//# sourceMappingURL=webgpu-compute-pass.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
2
|
import { ComputePipeline, ComputePipelineProps } from '@luma.gl/core';
|
|
3
|
-
import { WebGPUDevice } from
|
|
3
|
+
import { WebGPUDevice } from "../webgpu-device.js";
|
|
4
4
|
/** Creates a new compute pipeline when parameters change */
|
|
5
5
|
export declare class WebGPUComputePipeline extends ComputePipeline {
|
|
6
6
|
device: WebGPUDevice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAK9C,4DAA4D;AAC5D,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAkB7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
|
|
@@ -1,22 +1,31 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { ComputePipeline } from '@luma.gl/core';
|
|
5
|
+
// COMPUTE PIPELINE
|
|
6
|
+
/** Creates a new compute pipeline when parameters change */
|
|
2
7
|
export class WebGPUComputePipeline extends ComputePipeline {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
device;
|
|
9
|
+
handle;
|
|
10
|
+
constructor(device, props) {
|
|
11
|
+
super(device, props);
|
|
12
|
+
this.device = device;
|
|
13
|
+
const webgpuShader = this.props.cs;
|
|
14
|
+
this.handle =
|
|
15
|
+
this.props.handle ||
|
|
16
|
+
this.device.handle.createComputePipeline({
|
|
17
|
+
label: this.props.id,
|
|
18
|
+
compute: {
|
|
19
|
+
module: webgpuShader.handle,
|
|
20
|
+
entryPoint: this.props.csEntryPoint
|
|
21
|
+
// constants: this.props.csConstants
|
|
22
|
+
},
|
|
23
|
+
layout: 'auto'
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** For internal use in render passes */
|
|
27
|
+
_getBindGroupLayout() {
|
|
28
|
+
// TODO: Cache?
|
|
29
|
+
return this.handle.getBindGroupLayout(0);
|
|
30
|
+
}
|
|
21
31
|
}
|
|
22
|
-
//# sourceMappingURL=webgpu-compute-pipeline.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
2
|
import { ExternalTexture, ExternalTextureProps, Sampler, SamplerProps } from '@luma.gl/core';
|
|
3
|
-
import type { WebGPUDevice } from
|
|
4
|
-
import { WebGPUSampler } from
|
|
3
|
+
import type { WebGPUDevice } from "../webgpu-device.js";
|
|
4
|
+
import { WebGPUSampler } from "./webgpu-sampler.js";
|
|
5
5
|
/**
|
|
6
6
|
* Cheap, temporary texture view for videos
|
|
7
7
|
* Only valid within same callback, destroyed automatically as a microtask.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AACnD,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAE/C;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,OAAO,EAAE,aAAa,CAAC;gBAEX,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAYpD,OAAO,IAAI,IAAI;IAMxB,0BAA0B;IAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAMlD"}
|
|
@@ -1,22 +1,37 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { ExternalTexture } from '@luma.gl/core';
|
|
2
5
|
import { WebGPUSampler } from "./webgpu-sampler.js";
|
|
6
|
+
/**
|
|
7
|
+
* Cheap, temporary texture view for videos
|
|
8
|
+
* Only valid within same callback, destroyed automatically as a microtask.
|
|
9
|
+
*/
|
|
3
10
|
export class WebGPUExternalTexture extends ExternalTexture {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
device;
|
|
12
|
+
handle;
|
|
13
|
+
sampler;
|
|
14
|
+
constructor(device, props) {
|
|
15
|
+
super(device, props);
|
|
16
|
+
this.device = device;
|
|
17
|
+
this.handle =
|
|
18
|
+
this.props.handle ||
|
|
19
|
+
this.device.handle.importExternalTexture({
|
|
20
|
+
source: props.source,
|
|
21
|
+
colorSpace: props.colorSpace
|
|
22
|
+
});
|
|
23
|
+
this.sampler = null;
|
|
24
|
+
}
|
|
25
|
+
destroy() {
|
|
26
|
+
// External textures are destroyed automatically,
|
|
27
|
+
// as a microtask, instead of manually or upon garbage collection like other resources.
|
|
28
|
+
// this.handle.destroy();
|
|
29
|
+
}
|
|
30
|
+
/** Set default sampler */
|
|
31
|
+
setSampler(sampler) {
|
|
32
|
+
// We can accept a sampler instance or set of props;
|
|
33
|
+
this.sampler =
|
|
34
|
+
sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
21
37
|
}
|
|
22
|
-
//# sourceMappingURL=webgpu-external-texture.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FramebufferProps } from '@luma.gl/core';
|
|
2
2
|
import { Framebuffer } from '@luma.gl/core';
|
|
3
|
-
import { WebGPUDevice } from
|
|
3
|
+
import { WebGPUDevice } from "../webgpu-device.js";
|
|
4
4
|
/**
|
|
5
5
|
* Create new textures with correct size for all attachments.
|
|
6
6
|
* @note resize() destroys existing textures (if size has changed).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAE9C;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;gBAElB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CAO1D"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { Framebuffer } from '@luma.gl/core';
|
|
5
|
+
/**
|
|
6
|
+
* Create new textures with correct size for all attachments.
|
|
7
|
+
* @note resize() destroys existing textures (if size has changed).
|
|
8
|
+
*/
|
|
2
9
|
export class WebGPUFramebuffer extends Framebuffer {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
device;
|
|
11
|
+
constructor(device, props) {
|
|
12
|
+
super(device, props);
|
|
13
|
+
this.device = device;
|
|
14
|
+
// Auto create textures for attachments if needed
|
|
15
|
+
this.autoCreateAttachmentTextures();
|
|
16
|
+
}
|
|
9
17
|
}
|
|
10
|
-
//# sourceMappingURL=webgpu-framebuffer.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="dist" />
|
|
2
|
+
import { QuerySet, QuerySetProps } from '@luma.gl/core';
|
|
3
|
+
import { WebGPUDevice } from "../webgpu-device.js";
|
|
4
|
+
export type QuerySetProps2 = {
|
|
5
|
+
type: 'occlusion' | 'timestamp';
|
|
6
|
+
count: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Immutable
|
|
10
|
+
*/
|
|
11
|
+
export declare class WebGPUQuerySet extends QuerySet {
|
|
12
|
+
readonly device: WebGPUDevice;
|
|
13
|
+
readonly handle: GPUQuerySet;
|
|
14
|
+
constructor(device: WebGPUDevice, props: QuerySetProps);
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=webgpu-query-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgpu-query-set.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-query-set.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAE9C,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;gBAEjB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa;IAY7C,OAAO,IAAI,IAAI;CAGzB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { QuerySet } from '@luma.gl/core';
|
|
5
|
+
/**
|
|
6
|
+
* Immutable
|
|
7
|
+
*/
|
|
8
|
+
export class WebGPUQuerySet extends QuerySet {
|
|
9
|
+
device;
|
|
10
|
+
handle;
|
|
11
|
+
constructor(device, props) {
|
|
12
|
+
super(device, props);
|
|
13
|
+
this.device = device;
|
|
14
|
+
this.handle =
|
|
15
|
+
this.props.handle ||
|
|
16
|
+
this.device.handle.createQuerySet({
|
|
17
|
+
type: this.props.type,
|
|
18
|
+
count: this.props.count
|
|
19
|
+
});
|
|
20
|
+
this.handle.label = this.props.id;
|
|
21
|
+
}
|
|
22
|
+
destroy() {
|
|
23
|
+
this.handle.destroy();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,2 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
import {Resource, Query, QueryProps} from '@luma.gl/core';
|
|
3
|
+
import {WebGPUDevice} from '../webgpu-device';
|
|
1
4
|
|
|
2
|
-
|
|
5
|
+
export type WebGPUQueryProps = QueryProps & {
|
|
6
|
+
handle?: any;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const DEFAULT_QUERY_PROPS: Required<WebGPUQueryProps> = {
|
|
10
|
+
id: undefined,
|
|
11
|
+
handle: undefined,
|
|
12
|
+
userData: undefined,
|
|
13
|
+
type: 'timestamp',
|
|
14
|
+
count: 1,
|
|
15
|
+
pipelineStatistics: []
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Immutable
|
|
20
|
+
*
|
|
21
|
+
class WebGPUQuery extends Resource<WebGPUQueryProps> implements Query {
|
|
22
|
+
readonly device: WebGPUDevice;
|
|
23
|
+
readonly handle: GPUQuerySet;
|
|
24
|
+
|
|
25
|
+
constructor(device: WebGPUDevice, props: WebGPUQueryProps) {
|
|
26
|
+
super(device, props, DEFAULT_QUERY_PROPS);
|
|
27
|
+
this.handle = this.props.handle as GPUQuerySet || this.createHandle();
|
|
28
|
+
this.handle.label = this.props.id;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected createHandle() {
|
|
32
|
+
return this.device.handle.createQuerySet({
|
|
33
|
+
type: this.props.type,
|
|
34
|
+
count: this.props.count,
|
|
35
|
+
pipelineStatistics: this.props.pipelineStatistics
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override destroy(): void {
|
|
40
|
+
this.handle.destroy();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
2
|
import type { RenderPassProps, RenderPassParameters, Binding, Framebuffer } from '@luma.gl/core';
|
|
3
3
|
import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/core';
|
|
4
|
-
import { WebGPUDevice } from
|
|
5
|
-
import { WebGPURenderPipeline } from
|
|
4
|
+
import { WebGPUDevice } from "../webgpu-device.js";
|
|
5
|
+
import { WebGPURenderPipeline } from "./webgpu-render-pipeline.js";
|
|
6
6
|
export declare class WebGPURenderPass extends RenderPass {
|
|
7
7
|
readonly device: WebGPUDevice;
|
|
8
8
|
readonly handle: GPURenderPassEncoder;
|
|
@@ -30,6 +30,8 @@ export declare class WebGPURenderPass extends RenderPass {
|
|
|
30
30
|
pushDebugGroup(groupLabel: string): void;
|
|
31
31
|
popDebugGroup(): void;
|
|
32
32
|
insertDebugMarker(markerLabel: string): void;
|
|
33
|
+
beginOcclusionQuery(queryIndex: number): void;
|
|
34
|
+
endOcclusionQuery(): void;
|
|
33
35
|
/**
|
|
34
36
|
* Partial render pass descriptor. Used by WebGPURenderPass.
|
|
35
37
|
* @returns attachments fields of a renderpass descriptor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAY,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAI9C,OAAO,EAAC,oBAAoB,EAAC,oCAAiC;AAG9D,qBAAa,gBAAiB,SAAQ,UAAU;IAC9C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAEtC,sBAAsB;IACtB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAQ;gBAEjC,MAAM,EAAE,YAAY,EAAE,KAAK,GAAE,eAAoB;IA6BpD,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAK3C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAQpD,cAAc,CACZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,cAAc,EAC3B,MAAM,GAAE,MAAU,EAClB,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI;IAIP,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,IAAI;IAIvE,IAAI,CAAC,OAAO,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI;IAmBR,YAAY,IAAI,IAAI;IAKpB,aAAa,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAwBrD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAI5C,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAG7C,iBAAiB,IAAI,IAAI;IAQzB;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,uBAAuB;CA2CrF"}
|