@luma.gl/webgpu 9.0.11 → 9.1.0-alpha.1
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/LICENSE +34 -0
- package/dist/adapter/helpers/get-bind-group.d.ts +1 -1
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +5 -5
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +11 -7
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +27 -12
- package/dist/adapter/resources/webgpu-command-encoder.js +5 -5
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +1 -0
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +1 -1
- package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.js +1 -0
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +3 -0
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +2 -0
- package/dist/adapter/resources/webgpu-render-pass.d.ts +3 -2
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +8 -5
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +2 -2
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +11 -17
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.js +2 -0
- package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.d.ts +10 -1
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +29 -10
- package/dist/adapter/resources/webgpu-vertex-array.d.ts +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js +3 -1
- package/dist/adapter/webgpu-canvas-context.d.ts +2 -2
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +18 -6
- package/dist/dist.dev.js +114 -87
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +99 -54
- package/dist/index.cjs.map +2 -2
- package/package.json +4 -4
- package/src/adapter/helpers/get-bind-group.ts +6 -6
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +14 -8
- package/src/adapter/helpers/webgpu-parameters.ts +29 -12
- package/src/adapter/resources/webgpu-command-encoder.ts +7 -7
- package/src/adapter/resources/webgpu-compute-pass.ts +1 -0
- package/src/adapter/resources/webgpu-compute-pipeline.ts +1 -6
- package/src/adapter/resources/webgpu-external-texture.ts +1 -0
- package/src/adapter/resources/webgpu-framebuffer.ts +4 -0
- package/src/adapter/resources/webgpu-render-pass.ts +16 -10
- package/src/adapter/resources/webgpu-render-pipeline.ts +11 -23
- package/src/adapter/resources/webgpu-sampler.ts +3 -0
- package/src/adapter/resources/webgpu-texture-view.ts +15 -0
- package/src/adapter/resources/webgpu-texture.ts +55 -11
- package/src/adapter/resources/webgpu-vertex-array.ts +2 -1
- package/src/adapter/webgpu-canvas-context.ts +1 -1
- package/src/adapter/webgpu-device.ts +23 -6
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// luma.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
1
|
import { Texture } from '@luma.gl/core';
|
|
5
2
|
import { getWebGPUTextureFormat } from "../helpers/convert-texture-format.js";
|
|
6
3
|
import { WebGPUSampler } from "./webgpu-sampler.js";
|
|
@@ -32,7 +29,7 @@ export class WebGPUTexture extends Texture {
|
|
|
32
29
|
if (props.data instanceof Promise) {
|
|
33
30
|
props.data.then(resolvedImageData => {
|
|
34
31
|
// @ts-expect-error
|
|
35
|
-
this.props = { ...props, data: resolvedImageData };
|
|
32
|
+
this.props = { ...this.props, data: resolvedImageData };
|
|
36
33
|
this.initialize(this.props);
|
|
37
34
|
});
|
|
38
35
|
return;
|
|
@@ -68,7 +65,7 @@ export class WebGPUTexture extends Texture {
|
|
|
68
65
|
this.sampler =
|
|
69
66
|
props.sampler instanceof WebGPUSampler
|
|
70
67
|
? props.sampler
|
|
71
|
-
: new WebGPUSampler(this.device, props.sampler);
|
|
68
|
+
: new WebGPUSampler(this.device, props.sampler || {});
|
|
72
69
|
// TODO - To support texture arrays we need to create custom views...
|
|
73
70
|
// But we are not ready to expose TextureViews to the public API.
|
|
74
71
|
// @ts-expect-error
|
|
@@ -92,15 +89,19 @@ export class WebGPUTexture extends Texture {
|
|
|
92
89
|
size: {
|
|
93
90
|
width,
|
|
94
91
|
height,
|
|
95
|
-
depthOrArrayLayers: this.
|
|
92
|
+
depthOrArrayLayers: this.depth
|
|
96
93
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
mipLevelCount: this.
|
|
94
|
+
usage: this.props.usage || Texture.TEXTURE | Texture.COPY_DST,
|
|
95
|
+
dimension: BASE_DIMENSIONS[this.dimension],
|
|
96
|
+
format: getWebGPUTextureFormat(this.format),
|
|
97
|
+
mipLevelCount: this.mipLevels,
|
|
101
98
|
sampleCount: this.props.samples
|
|
102
99
|
});
|
|
103
100
|
}
|
|
101
|
+
/** @deprecated - intention is to use the createView public API */
|
|
102
|
+
createGPUTextureView() {
|
|
103
|
+
return this.handle.createView({ label: this.id });
|
|
104
|
+
}
|
|
104
105
|
/**
|
|
105
106
|
* Set default sampler
|
|
106
107
|
* Accept a sampler instance or set of props;
|
|
@@ -110,6 +111,24 @@ export class WebGPUTexture extends Texture {
|
|
|
110
111
|
sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
|
|
111
112
|
return this;
|
|
112
113
|
}
|
|
114
|
+
setTexture1DData(data) {
|
|
115
|
+
throw new Error('not implemented');
|
|
116
|
+
}
|
|
117
|
+
setTexture2DData(lodData, depth, target) {
|
|
118
|
+
throw new Error('not implemented');
|
|
119
|
+
}
|
|
120
|
+
setTexture3DData(lodData, depth, target) {
|
|
121
|
+
throw new Error('not implemented');
|
|
122
|
+
}
|
|
123
|
+
setTextureCubeData(data, depth) {
|
|
124
|
+
throw new Error('not implemented');
|
|
125
|
+
}
|
|
126
|
+
setTextureArrayData(data) {
|
|
127
|
+
throw new Error('not implemented');
|
|
128
|
+
}
|
|
129
|
+
setTextureCubeArrayData(data) {
|
|
130
|
+
throw new Error('not implemented');
|
|
131
|
+
}
|
|
113
132
|
setData(options) {
|
|
114
133
|
return this.setImage({ source: options.data });
|
|
115
134
|
}
|
|
@@ -7,7 +7,7 @@ export declare class WebGPUVertexArray extends VertexArray {
|
|
|
7
7
|
readonly device: WebGPUDevice;
|
|
8
8
|
/** Vertex Array is a helper class under WebGPU */
|
|
9
9
|
readonly handle: never;
|
|
10
|
-
constructor(device: WebGPUDevice, props
|
|
10
|
+
constructor(device: WebGPUDevice, props: VertexArrayProps);
|
|
11
11
|
destroy(): void;
|
|
12
12
|
/**
|
|
13
13
|
* Set an elements buffer, for indexed rendering.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAChF,OAAO,EAAC,WAAW,EAAM,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAK9C,gCAAgC;AAChC,qBAAa,iBAAk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GPUVertexArray extends VertexArray {
|
|
|
39
39
|
if (webgpuIndexBuffer?.handle) {
|
|
40
40
|
// Note we can't unset an index buffer
|
|
41
41
|
log.warn('setting index buffer', webgpuIndexBuffer?.handle, webgpuIndexBuffer?.indexType)();
|
|
42
|
-
webgpuRenderPass.handle.setIndexBuffer(webgpuIndexBuffer?.handle,
|
|
42
|
+
webgpuRenderPass.handle.setIndexBuffer(webgpuIndexBuffer?.handle,
|
|
43
|
+
// @ts-expect-error TODO - we must enforce type
|
|
44
|
+
webgpuIndexBuffer?.indexType);
|
|
43
45
|
}
|
|
44
46
|
for (let location = 0; location < this.maxVertexAttributes; location++) {
|
|
45
47
|
const webgpuBuffer = this.attributes[location];
|
|
@@ -15,7 +15,7 @@ export declare class WebGPUCanvasContext extends CanvasContext {
|
|
|
15
15
|
/** Format of returned textures: "bgra8unorm", "rgba8unorm", "rgba16float". */
|
|
16
16
|
readonly format: TextureFormat;
|
|
17
17
|
/** Default stencil format for depth textures */
|
|
18
|
-
depthStencilFormat: TextureFormat;
|
|
18
|
+
readonly depthStencilFormat: TextureFormat;
|
|
19
19
|
private depthStencilAttachment;
|
|
20
20
|
constructor(device: WebGPUDevice, adapter: GPUAdapter, props: CanvasContextProps);
|
|
21
21
|
/** Destroy any textures produced while configured and remove the context configuration. */
|
|
@@ -32,6 +32,6 @@ export declare class WebGPUCanvasContext extends CanvasContext {
|
|
|
32
32
|
/** Wrap the current canvas context texture in a luma.gl texture */
|
|
33
33
|
getCurrentTexture(): WebGPUTexture;
|
|
34
34
|
/** We build render targets on demand (i.e. not when size changes but when about to render) */
|
|
35
|
-
_createDepthStencilAttachment(): Texture
|
|
35
|
+
_createDepthStencilAttachment(): Texture;
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=webgpu-canvas-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-canvas-context.ts"],"names":[],"m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BAAkB;IAehF,2FAA2F;IAC3F,OAAO,IAAI,IAAI;IAIf,0EAA0E;IAC1E,qBAAqB,IAAI,iBAAiB;IA2B1C,sDAAsD;IACtD,MAAM;IA6BN,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAC,GAAG,IAAI;IAI7F,mEAAmE;IACnE,iBAAiB,IAAI,aAAa;IAQlC,8FAA8F;IAC9F,6BAA6B;CAY9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-device.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EAEZ,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,EACP,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAEhB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,QAAQ,EACR,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"webgpu-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-device.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EAEZ,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,EACP,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAEhB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,QAAQ,EACR,aAAa,EACd,MAAM,eAAe,CAA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mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB;IAInE,MAAM,IAAI,IAAI;IAYd,SAAS,CAAC,QAAQ,IAAI,UAAU;IA2BhC,SAAS,CAAC,YAAY,IAAI,cAAc;IAiCxC,0BAA0B,CAAC,OAAO,EAAE;QAClC,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;QAC/C,UAAU,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;QACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAE7B,MAAM,EAAE,WAAW,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,CAAC;QAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;CAyCT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { Device, DeviceFeatures, CanvasContext, log
|
|
4
|
+
import { Device, DeviceFeatures, CanvasContext, log } from '@luma.gl/core';
|
|
5
5
|
import { WebGPUBuffer } from "./resources/webgpu-buffer.js";
|
|
6
6
|
import { WebGPUTexture } from "./resources/webgpu-texture.js";
|
|
7
7
|
import { WebGPUExternalTexture } from "./resources/webgpu-external-texture.js";
|
|
@@ -56,12 +56,18 @@ export class WebGPUDevice extends Device {
|
|
|
56
56
|
const requiredFeatures = [];
|
|
57
57
|
const requiredLimits = {};
|
|
58
58
|
if (props.requestMaxLimits) {
|
|
59
|
+
// Require all features
|
|
59
60
|
requiredFeatures.push(...Array.from(adapter.features));
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
// Require all limits
|
|
62
|
+
// Filter out chrome specific keys (avoid crash)
|
|
63
|
+
const limits = Object.keys(adapter.limits).filter(key => !['minSubgroupSize', 'maxSubgroupSize'].includes(key));
|
|
64
|
+
for (const key of limits) {
|
|
65
|
+
const limit = key;
|
|
66
|
+
const value = adapter.limits[limit];
|
|
67
|
+
if (typeof value === 'number') {
|
|
68
|
+
requiredLimits[limit] = value;
|
|
69
|
+
}
|
|
62
70
|
}
|
|
63
|
-
delete requiredLimits.minSubgroupSize;
|
|
64
|
-
delete requiredLimits.maxSubgroupSize;
|
|
65
71
|
}
|
|
66
72
|
const gpuDevice = await adapter.requestDevice({
|
|
67
73
|
requiredFeatures,
|
|
@@ -79,13 +85,19 @@ export class WebGPUDevice extends Device {
|
|
|
79
85
|
return device;
|
|
80
86
|
}
|
|
81
87
|
constructor(device, adapter, adapterInfo, props) {
|
|
82
|
-
super({ ...props, id: props.id ||
|
|
88
|
+
super({ ...props, id: props.id || 'webgpu-device' });
|
|
83
89
|
this.handle = device;
|
|
84
90
|
this.adapter = adapter;
|
|
85
91
|
this.adapterInfo = adapterInfo;
|
|
86
92
|
this.info = this._getInfo();
|
|
87
93
|
this.features = this._getFeatures();
|
|
88
94
|
this.limits = this.handle.limits;
|
|
95
|
+
// Listen for uncaptured WebGPU errors
|
|
96
|
+
device.addEventListener('uncapturederror', (event) => {
|
|
97
|
+
// TODO is this the right way to make sure the error is an Error instance?
|
|
98
|
+
const errorMessage = event instanceof GPUUncapturedErrorEvent ? event.error.message : 'Unknown error';
|
|
99
|
+
this.error(new Error(errorMessage));
|
|
100
|
+
});
|
|
89
101
|
// "Context" loss handling
|
|
90
102
|
this.lost = new Promise(async (resolve) => {
|
|
91
103
|
const lostInfo = await this.handle.lost;
|
package/dist/dist.dev.js
CHANGED
|
@@ -223,7 +223,7 @@ var __exports__ = (() => {
|
|
|
223
223
|
this.device = device;
|
|
224
224
|
if (props.data instanceof Promise) {
|
|
225
225
|
props.data.then((resolvedImageData) => {
|
|
226
|
-
this.props = { ...props, data: resolvedImageData };
|
|
226
|
+
this.props = { ...this.props, data: resolvedImageData };
|
|
227
227
|
this.initialize(this.props);
|
|
228
228
|
});
|
|
229
229
|
return;
|
|
@@ -245,7 +245,7 @@ var __exports__ = (() => {
|
|
|
245
245
|
}
|
|
246
246
|
this.width = this.handle.width;
|
|
247
247
|
this.height = this.handle.height;
|
|
248
|
-
this.sampler = props.sampler instanceof WebGPUSampler ? props.sampler : new WebGPUSampler(this.device, props.sampler);
|
|
248
|
+
this.sampler = props.sampler instanceof WebGPUSampler ? props.sampler : new WebGPUSampler(this.device, props.sampler || {});
|
|
249
249
|
this.view = new WebGPUTextureView(this.device, { ...this.props, texture: this });
|
|
250
250
|
}
|
|
251
251
|
createHandle() {
|
|
@@ -256,15 +256,19 @@ var __exports__ = (() => {
|
|
|
256
256
|
size: {
|
|
257
257
|
width,
|
|
258
258
|
height,
|
|
259
|
-
depthOrArrayLayers: this.
|
|
259
|
+
depthOrArrayLayers: this.depth
|
|
260
260
|
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
mipLevelCount: this.
|
|
261
|
+
usage: this.props.usage || import_core4.Texture.TEXTURE | import_core4.Texture.COPY_DST,
|
|
262
|
+
dimension: BASE_DIMENSIONS[this.dimension],
|
|
263
|
+
format: getWebGPUTextureFormat(this.format),
|
|
264
|
+
mipLevelCount: this.mipLevels,
|
|
265
265
|
sampleCount: this.props.samples
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
|
+
/** @deprecated - intention is to use the createView public API */
|
|
269
|
+
createGPUTextureView() {
|
|
270
|
+
return this.handle.createView({ label: this.id });
|
|
271
|
+
}
|
|
268
272
|
/**
|
|
269
273
|
* Set default sampler
|
|
270
274
|
* Accept a sampler instance or set of props;
|
|
@@ -273,6 +277,24 @@ var __exports__ = (() => {
|
|
|
273
277
|
this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
|
|
274
278
|
return this;
|
|
275
279
|
}
|
|
280
|
+
setTexture1DData(data) {
|
|
281
|
+
throw new Error("not implemented");
|
|
282
|
+
}
|
|
283
|
+
setTexture2DData(lodData, depth, target) {
|
|
284
|
+
throw new Error("not implemented");
|
|
285
|
+
}
|
|
286
|
+
setTexture3DData(lodData, depth, target) {
|
|
287
|
+
throw new Error("not implemented");
|
|
288
|
+
}
|
|
289
|
+
setTextureCubeData(data, depth) {
|
|
290
|
+
throw new Error("not implemented");
|
|
291
|
+
}
|
|
292
|
+
setTextureArrayData(data) {
|
|
293
|
+
throw new Error("not implemented");
|
|
294
|
+
}
|
|
295
|
+
setTextureCubeArrayData(data) {
|
|
296
|
+
throw new Error("not implemented");
|
|
297
|
+
}
|
|
276
298
|
setData(options) {
|
|
277
299
|
return this.setImage({ source: options.data });
|
|
278
300
|
}
|
|
@@ -479,6 +501,14 @@ var __exports__ = (() => {
|
|
|
479
501
|
};
|
|
480
502
|
return descriptor.depthStencil;
|
|
481
503
|
}
|
|
504
|
+
function addDepthStencilFront(descriptor) {
|
|
505
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
506
|
+
return depthStencil.stencilFront;
|
|
507
|
+
}
|
|
508
|
+
function addDepthStencilBack(descriptor) {
|
|
509
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
510
|
+
return depthStencil.stencilBack;
|
|
511
|
+
}
|
|
482
512
|
var PARAMETER_TABLE = {
|
|
483
513
|
// RASTERIZATION PARAMETERS
|
|
484
514
|
cullMode: (parameter, value, descriptor) => {
|
|
@@ -524,24 +554,28 @@ var __exports__ = (() => {
|
|
|
524
554
|
depthStencil.stencilWriteMask = value;
|
|
525
555
|
},
|
|
526
556
|
stencilCompare: (parameter, value, descriptor) => {
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
557
|
+
const stencilFront = addDepthStencilFront(descriptor);
|
|
558
|
+
const stencilBack = addDepthStencilBack(descriptor);
|
|
559
|
+
stencilFront.compare = value;
|
|
560
|
+
stencilBack.compare = value;
|
|
530
561
|
},
|
|
531
562
|
stencilPassOperation: (parameter, value, descriptor) => {
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
563
|
+
const stencilFront = addDepthStencilFront(descriptor);
|
|
564
|
+
const stencilBack = addDepthStencilBack(descriptor);
|
|
565
|
+
stencilFront.passOp = value;
|
|
566
|
+
stencilBack.passOp = value;
|
|
535
567
|
},
|
|
536
568
|
stencilFailOperation: (parameter, value, descriptor) => {
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
|
|
569
|
+
const stencilFront = addDepthStencilFront(descriptor);
|
|
570
|
+
const stencilBack = addDepthStencilBack(descriptor);
|
|
571
|
+
stencilFront.failOp = value;
|
|
572
|
+
stencilBack.failOp = value;
|
|
540
573
|
},
|
|
541
574
|
stencilDepthFailOperation: (parameter, value, descriptor) => {
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
575
|
+
const stencilFront = addDepthStencilFront(descriptor);
|
|
576
|
+
const stencilBack = addDepthStencilBack(descriptor);
|
|
577
|
+
stencilFront.depthFailOp = value;
|
|
578
|
+
stencilBack.depthFailOp = value;
|
|
545
579
|
},
|
|
546
580
|
// MULTISAMPLE
|
|
547
581
|
sampleCount: (parameter, value, descriptor) => {
|
|
@@ -666,7 +700,7 @@ var __exports__ = (() => {
|
|
|
666
700
|
if (!bindingLayout) {
|
|
667
701
|
import_core7.log.warn(`Binding ${bindingName} not set: Not found in shader layout.`)();
|
|
668
702
|
}
|
|
669
|
-
return bindingLayout;
|
|
703
|
+
return bindingLayout || null;
|
|
670
704
|
}
|
|
671
705
|
function getBindGroupEntries(bindings, shaderLayout) {
|
|
672
706
|
const entries = [];
|
|
@@ -683,19 +717,19 @@ var __exports__ = (() => {
|
|
|
683
717
|
return {
|
|
684
718
|
binding: index,
|
|
685
719
|
resource: {
|
|
686
|
-
buffer:
|
|
720
|
+
buffer: binding.handle
|
|
687
721
|
}
|
|
688
722
|
};
|
|
689
723
|
}
|
|
690
724
|
if (binding instanceof import_core7.Sampler) {
|
|
691
725
|
return {
|
|
692
726
|
binding: index,
|
|
693
|
-
resource:
|
|
727
|
+
resource: binding.handle
|
|
694
728
|
};
|
|
695
729
|
} else if (binding instanceof import_core7.Texture) {
|
|
696
730
|
return {
|
|
697
731
|
binding: index,
|
|
698
|
-
resource:
|
|
732
|
+
resource: binding.handle.createView({ label: "bind-group-auto-created" })
|
|
699
733
|
};
|
|
700
734
|
}
|
|
701
735
|
throw new Error("invalid binding");
|
|
@@ -716,27 +750,29 @@ var __exports__ = (() => {
|
|
|
716
750
|
const vertexAttributes = [];
|
|
717
751
|
let stepMode = "vertex";
|
|
718
752
|
let byteStride = 0;
|
|
753
|
+
const format = mapping.format;
|
|
719
754
|
if (mapping.attributes) {
|
|
720
755
|
for (const attributeMapping of mapping.attributes) {
|
|
721
756
|
const attributeName = attributeMapping.attribute;
|
|
722
757
|
const attributeLayout = findAttributeLayout(shaderLayout, attributeName, usedAttributes);
|
|
723
|
-
|
|
758
|
+
const location = attributeLayout?.location;
|
|
759
|
+
stepMode = attributeLayout?.stepMode || (attributeLayout?.name.startsWith("instance") ? "instance" : "vertex");
|
|
724
760
|
vertexAttributes.push({
|
|
725
761
|
format: getWebGPUVertexFormat(attributeMapping.format || mapping.format),
|
|
726
762
|
offset: attributeMapping.byteOffset,
|
|
727
|
-
shaderLocation:
|
|
763
|
+
shaderLocation: location
|
|
728
764
|
});
|
|
729
|
-
byteStride += (0, import_core8.decodeVertexFormat)(
|
|
765
|
+
byteStride += (0, import_core8.decodeVertexFormat)(format).byteLength;
|
|
730
766
|
}
|
|
731
767
|
} else {
|
|
732
768
|
const attributeLayout = findAttributeLayout(shaderLayout, mapping.name, usedAttributes);
|
|
733
769
|
if (!attributeLayout) {
|
|
734
770
|
continue;
|
|
735
771
|
}
|
|
736
|
-
byteStride = (0, import_core8.decodeVertexFormat)(
|
|
772
|
+
byteStride = (0, import_core8.decodeVertexFormat)(format).byteLength;
|
|
737
773
|
stepMode = attributeLayout.stepMode || (attributeLayout.name.startsWith("instance") ? "instance" : "vertex");
|
|
738
774
|
vertexAttributes.push({
|
|
739
|
-
format: getWebGPUVertexFormat(
|
|
775
|
+
format: getWebGPUVertexFormat(format),
|
|
740
776
|
// We only support 0 offset for non-interleaved buffer layouts
|
|
741
777
|
offset: 0,
|
|
742
778
|
shaderLocation: attributeLayout.location
|
|
@@ -800,8 +836,8 @@ var __exports__ = (() => {
|
|
|
800
836
|
this.handle = this.device.handle.createRenderPipeline(descriptor);
|
|
801
837
|
}
|
|
802
838
|
this.handle.label = this.props.id;
|
|
803
|
-
this.vs =
|
|
804
|
-
this.fs =
|
|
839
|
+
this.vs = props.vs;
|
|
840
|
+
this.fs = props.fs;
|
|
805
841
|
this._bindings = { ...this.props.bindings };
|
|
806
842
|
}
|
|
807
843
|
destroy() {
|
|
@@ -844,16 +880,11 @@ var __exports__ = (() => {
|
|
|
844
880
|
}
|
|
845
881
|
/** Return a bind group created by setBindings */
|
|
846
882
|
_getBindGroup() {
|
|
847
|
-
if (this.
|
|
883
|
+
if (this.shaderLayout.bindings.length === 0) {
|
|
848
884
|
return null;
|
|
849
885
|
}
|
|
850
886
|
this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);
|
|
851
|
-
this._bindGroup = this._bindGroup || getBindGroup(
|
|
852
|
-
this.device.handle,
|
|
853
|
-
this._bindGroupLayout,
|
|
854
|
-
this.props.shaderLayout,
|
|
855
|
-
this._bindings
|
|
856
|
-
);
|
|
887
|
+
this._bindGroup = this._bindGroup || getBindGroup(this.device.handle, this._bindGroupLayout, this.shaderLayout, this._bindings);
|
|
857
888
|
return this._bindGroup;
|
|
858
889
|
}
|
|
859
890
|
/**
|
|
@@ -861,26 +892,20 @@ var __exports__ = (() => {
|
|
|
861
892
|
*/
|
|
862
893
|
_getRenderPipelineDescriptor() {
|
|
863
894
|
const vertex = {
|
|
864
|
-
module:
|
|
895
|
+
module: this.props.vs.handle,
|
|
865
896
|
entryPoint: this.props.vertexEntryPoint || "main",
|
|
866
|
-
buffers: getVertexBufferLayout(this.
|
|
897
|
+
buffers: getVertexBufferLayout(this.shaderLayout, this.props.bufferLayout)
|
|
867
898
|
};
|
|
868
899
|
const fragment = {
|
|
869
|
-
module:
|
|
900
|
+
module: this.props.fs.handle,
|
|
870
901
|
entryPoint: this.props.fragmentEntryPoint || "main",
|
|
871
902
|
targets: [
|
|
872
903
|
{
|
|
873
904
|
// TODO exclamation mark hack!
|
|
874
|
-
format: getWebGPUTextureFormat(this.device
|
|
905
|
+
format: getWebGPUTextureFormat(this.device.getCanvasContext().format)
|
|
875
906
|
}
|
|
876
907
|
]
|
|
877
908
|
};
|
|
878
|
-
switch (this.props.topology) {
|
|
879
|
-
case "triangle-fan-webgl":
|
|
880
|
-
case "line-loop-webgl":
|
|
881
|
-
throw new Error(`WebGPU does not support primitive topology ${this.props.topology}`);
|
|
882
|
-
default:
|
|
883
|
-
}
|
|
884
909
|
const descriptor = {
|
|
885
910
|
vertex,
|
|
886
911
|
fragment,
|
|
@@ -898,6 +923,8 @@ var __exports__ = (() => {
|
|
|
898
923
|
var import_core10 = __toESM(require_core(), 1);
|
|
899
924
|
var WebGPUFramebuffer = class extends import_core10.Framebuffer {
|
|
900
925
|
device;
|
|
926
|
+
colorAttachments = [];
|
|
927
|
+
depthStencilAttachment = null;
|
|
901
928
|
constructor(device, props) {
|
|
902
929
|
super(device, props);
|
|
903
930
|
this.device = device;
|
|
@@ -939,12 +966,7 @@ var __exports__ = (() => {
|
|
|
939
966
|
/** Return a bind group created by setBindings */
|
|
940
967
|
_getBindGroup() {
|
|
941
968
|
this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);
|
|
942
|
-
this._bindGroup = this._bindGroup || getBindGroup(
|
|
943
|
-
this.device.handle,
|
|
944
|
-
this._bindGroupLayout,
|
|
945
|
-
this.props.shaderLayout,
|
|
946
|
-
this._bindings
|
|
947
|
-
);
|
|
969
|
+
this._bindGroup = this._bindGroup || getBindGroup(this.device.handle, this._bindGroupLayout, this.shaderLayout, this._bindings);
|
|
948
970
|
return this._bindGroup;
|
|
949
971
|
}
|
|
950
972
|
};
|
|
@@ -959,7 +981,7 @@ var __exports__ = (() => {
|
|
|
959
981
|
constructor(device, props = {}) {
|
|
960
982
|
super(device, props);
|
|
961
983
|
this.device = device;
|
|
962
|
-
const framebuffer = props.framebuffer || device.
|
|
984
|
+
const framebuffer = props.framebuffer || device.getCanvasContext().getCurrentFramebuffer();
|
|
963
985
|
const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);
|
|
964
986
|
const webgpuQuerySet = props.timestampQuerySet;
|
|
965
987
|
if (webgpuQuerySet) {
|
|
@@ -973,6 +995,9 @@ var __exports__ = (() => {
|
|
|
973
995
|
endOfPassWriteIndex: props.endTimestampIndex
|
|
974
996
|
} : void 0;
|
|
975
997
|
}
|
|
998
|
+
if (!device.commandEncoder) {
|
|
999
|
+
throw new Error("commandEncoder not available");
|
|
1000
|
+
}
|
|
976
1001
|
this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
|
|
977
1002
|
this.handle.label = this.props.id;
|
|
978
1003
|
import_core12.log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();
|
|
@@ -985,7 +1010,7 @@ var __exports__ = (() => {
|
|
|
985
1010
|
this.handle.end();
|
|
986
1011
|
}
|
|
987
1012
|
setPipeline(pipeline) {
|
|
988
|
-
this.pipeline =
|
|
1013
|
+
this.pipeline = pipeline;
|
|
989
1014
|
this.handle.setPipeline(this.pipeline.handle);
|
|
990
1015
|
}
|
|
991
1016
|
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
@@ -997,10 +1022,10 @@ var __exports__ = (() => {
|
|
|
997
1022
|
}
|
|
998
1023
|
}
|
|
999
1024
|
setIndexBuffer(buffer, indexFormat, offset = 0, size) {
|
|
1000
|
-
this.handle.setIndexBuffer(
|
|
1025
|
+
this.handle.setIndexBuffer(buffer.handle, indexFormat, offset, size);
|
|
1001
1026
|
}
|
|
1002
1027
|
setVertexBuffer(slot, buffer, offset = 0) {
|
|
1003
|
-
this.handle.setVertexBuffer(slot,
|
|
1028
|
+
this.handle.setVertexBuffer(slot, buffer.handle, offset);
|
|
1004
1029
|
}
|
|
1005
1030
|
draw(options) {
|
|
1006
1031
|
if (options.indexCount) {
|
|
@@ -1180,38 +1205,35 @@ var __exports__ = (() => {
|
|
|
1180
1205
|
// src/adapter/resources/webgpu-vertex-array.ts
|
|
1181
1206
|
var import_core14 = __toESM(require_core(), 1);
|
|
1182
1207
|
|
|
1208
|
+
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
1209
|
+
var document_ = globalThis.document || {};
|
|
1210
|
+
var process_ = globalThis.process || {};
|
|
1211
|
+
var console_ = globalThis.console;
|
|
1212
|
+
var navigator_ = globalThis.navigator || {};
|
|
1213
|
+
|
|
1183
1214
|
// ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
1184
1215
|
function isElectron(mockUserAgent) {
|
|
1185
|
-
if (typeof window !== "undefined" &&
|
|
1216
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
1186
1217
|
return true;
|
|
1187
1218
|
}
|
|
1188
|
-
if (typeof process !== "undefined" &&
|
|
1219
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
1189
1220
|
return true;
|
|
1190
1221
|
}
|
|
1191
|
-
const realUserAgent = typeof navigator
|
|
1222
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
1192
1223
|
const userAgent = mockUserAgent || realUserAgent;
|
|
1193
|
-
|
|
1194
|
-
return true;
|
|
1195
|
-
}
|
|
1196
|
-
return false;
|
|
1224
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
1197
1225
|
}
|
|
1198
1226
|
|
|
1199
1227
|
// ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
1200
1228
|
function isBrowser() {
|
|
1201
|
-
const isNode =
|
|
1229
|
+
const isNode = (
|
|
1230
|
+
// @ts-expect-error
|
|
1231
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
1232
|
+
);
|
|
1202
1233
|
return !isNode || isElectron();
|
|
1203
1234
|
}
|
|
1204
1235
|
|
|
1205
|
-
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
1206
|
-
var self_ = globalThis.self || globalThis.window || globalThis.global;
|
|
1207
|
-
var window_ = globalThis.window || globalThis.self || globalThis.global;
|
|
1208
|
-
var document_ = globalThis.document || {};
|
|
1209
|
-
var process_ = globalThis.process || {};
|
|
1210
|
-
var console_ = globalThis.console;
|
|
1211
|
-
var navigator_ = globalThis.navigator || {};
|
|
1212
|
-
|
|
1213
1236
|
// ../../node_modules/@probe.gl/env/dist/lib/get-browser.js
|
|
1214
|
-
var window2 = globalThis;
|
|
1215
1237
|
function getBrowser(mockUserAgent) {
|
|
1216
1238
|
if (!mockUserAgent && !isBrowser()) {
|
|
1217
1239
|
return "Node";
|
|
@@ -1223,18 +1245,13 @@ var __exports__ = (() => {
|
|
|
1223
1245
|
if (userAgent.indexOf("Edge") > -1) {
|
|
1224
1246
|
return "Edge";
|
|
1225
1247
|
}
|
|
1226
|
-
|
|
1227
|
-
const isTrident = userAgent.indexOf("Trident/") !== -1;
|
|
1228
|
-
if (isMSIE || isTrident) {
|
|
1229
|
-
return "IE";
|
|
1230
|
-
}
|
|
1231
|
-
if (window2.chrome) {
|
|
1248
|
+
if (globalThis.chrome) {
|
|
1232
1249
|
return "Chrome";
|
|
1233
1250
|
}
|
|
1234
|
-
if (
|
|
1251
|
+
if (globalThis.safari) {
|
|
1235
1252
|
return "Safari";
|
|
1236
1253
|
}
|
|
1237
|
-
if (
|
|
1254
|
+
if (globalThis.mozInnerScreenX) {
|
|
1238
1255
|
return "Firefox";
|
|
1239
1256
|
}
|
|
1240
1257
|
return "Unknown";
|
|
@@ -1273,6 +1290,7 @@ var __exports__ = (() => {
|
|
|
1273
1290
|
import_core14.log.warn("setting index buffer", webgpuIndexBuffer?.handle, webgpuIndexBuffer?.indexType)();
|
|
1274
1291
|
webgpuRenderPass.handle.setIndexBuffer(
|
|
1275
1292
|
webgpuIndexBuffer?.handle,
|
|
1293
|
+
// @ts-expect-error TODO - we must enforce type
|
|
1276
1294
|
webgpuIndexBuffer?.indexType
|
|
1277
1295
|
);
|
|
1278
1296
|
}
|
|
@@ -1441,11 +1459,16 @@ var __exports__ = (() => {
|
|
|
1441
1459
|
const requiredLimits = {};
|
|
1442
1460
|
if (props.requestMaxLimits) {
|
|
1443
1461
|
requiredFeatures.push(...Array.from(adapter.features));
|
|
1444
|
-
|
|
1445
|
-
|
|
1462
|
+
const limits = Object.keys(adapter.limits).filter(
|
|
1463
|
+
(key) => !["minSubgroupSize", "maxSubgroupSize"].includes(key)
|
|
1464
|
+
);
|
|
1465
|
+
for (const key of limits) {
|
|
1466
|
+
const limit = key;
|
|
1467
|
+
const value = adapter.limits[limit];
|
|
1468
|
+
if (typeof value === "number") {
|
|
1469
|
+
requiredLimits[limit] = value;
|
|
1470
|
+
}
|
|
1446
1471
|
}
|
|
1447
|
-
delete requiredLimits.minSubgroupSize;
|
|
1448
|
-
delete requiredLimits.maxSubgroupSize;
|
|
1449
1472
|
}
|
|
1450
1473
|
const gpuDevice = await adapter.requestDevice({
|
|
1451
1474
|
requiredFeatures,
|
|
@@ -1466,13 +1489,17 @@ var __exports__ = (() => {
|
|
|
1466
1489
|
return device;
|
|
1467
1490
|
}
|
|
1468
1491
|
constructor(device, adapter, adapterInfo, props) {
|
|
1469
|
-
super({ ...props, id: props.id ||
|
|
1492
|
+
super({ ...props, id: props.id || "webgpu-device" });
|
|
1470
1493
|
this.handle = device;
|
|
1471
1494
|
this.adapter = adapter;
|
|
1472
1495
|
this.adapterInfo = adapterInfo;
|
|
1473
1496
|
this.info = this._getInfo();
|
|
1474
1497
|
this.features = this._getFeatures();
|
|
1475
1498
|
this.limits = this.handle.limits;
|
|
1499
|
+
device.addEventListener("uncapturederror", (event) => {
|
|
1500
|
+
const errorMessage = event instanceof GPUUncapturedErrorEvent ? event.error.message : "Unknown error";
|
|
1501
|
+
this.error(new Error(errorMessage));
|
|
1502
|
+
});
|
|
1476
1503
|
this.lost = new Promise(async (resolve) => {
|
|
1477
1504
|
const lostInfo = await this.handle.lost;
|
|
1478
1505
|
this._isLost = true;
|