@luma.gl/webgpu 9.1.9 → 9.2.0-alpha.2
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 +1 -0
- package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
- package/dist/adapter/helpers/get-bind-group.d.ts +3 -1
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +28 -10
- package/dist/adapter/helpers/get-bind-group.js.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +5 -5
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +89 -75
- package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts +13 -16
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js +132 -93
- package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-command-buffer.d.ts +10 -0
- package/dist/adapter/resources/webgpu-command-buffer.d.ts.map +1 -0
- package/dist/adapter/resources/webgpu-command-buffer.js +18 -0
- package/dist/adapter/resources/webgpu-command-buffer.js.map +1 -0
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +12 -5
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +28 -5
- package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +2 -2
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
- 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.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +3 -2
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +1 -0
- package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-pipeline-layout.d.ts +2 -2
- package/dist/adapter/resources/webgpu-pipeline-layout.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-pipeline-layout.js +5 -2
- package/dist/adapter/resources/webgpu-pipeline-layout.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +11 -6
- package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +5 -4
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +33 -20
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.js +1 -1
- package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.js +7 -8
- package/dist/adapter/resources/webgpu-shader.js.map +1 -1
- package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture-view.js +15 -10
- package/dist/adapter/resources/webgpu-texture-view.js.map +1 -1
- package/dist/adapter/resources/webgpu-texture.d.ts +4 -37
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +97 -126
- package/dist/adapter/resources/webgpu-texture.js.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.d.ts +2 -2
- package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js +2 -2
- package/dist/adapter/resources/webgpu-vertex-array.js.map +1 -1
- package/dist/adapter/webgpu-adapter.d.ts +2 -3
- package/dist/adapter/webgpu-adapter.d.ts.map +1 -1
- package/dist/adapter/webgpu-adapter.js +54 -43
- package/dist/adapter/webgpu-adapter.js.map +1 -1
- package/dist/adapter/webgpu-canvas-context.d.ts +7 -15
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +50 -72
- package/dist/adapter/webgpu-canvas-context.js.map +1 -1
- package/dist/adapter/webgpu-device.d.ts +16 -27
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +48 -65
- package/dist/adapter/webgpu-device.js.map +1 -1
- package/dist/dist.dev.js +1919 -1520
- package/dist/dist.min.js +6 -5
- package/dist/index.cjs +1749 -1397
- package/dist/index.cjs.map +4 -4
- package/package.json +3 -3
- package/src/adapter/helpers/get-bind-group.ts +31 -11
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +5 -5
- package/src/adapter/helpers/webgpu-parameters.ts +114 -102
- package/src/adapter/resources/webgpu-buffer.ts +163 -102
- package/src/adapter/resources/webgpu-command-buffer.ts +24 -0
- package/src/adapter/resources/webgpu-command-encoder.ts +34 -4
- package/src/adapter/resources/webgpu-compute-pass.ts +1 -1
- package/src/adapter/resources/webgpu-compute-pipeline.ts +2 -2
- package/src/adapter/resources/webgpu-external-texture.ts +2 -2
- package/src/adapter/resources/webgpu-framebuffer.ts +3 -2
- package/src/adapter/resources/webgpu-pipeline-layout.ts +8 -3
- package/src/adapter/resources/webgpu-render-pass.ts +11 -6
- package/src/adapter/resources/webgpu-render-pipeline.ts +39 -24
- package/src/adapter/resources/webgpu-sampler.ts +1 -1
- package/src/adapter/resources/webgpu-shader.ts +11 -8
- package/src/adapter/resources/webgpu-texture-view.ts +14 -8
- package/src/adapter/resources/webgpu-texture.ts +106 -186
- package/src/adapter/resources/webgpu-vertex-array.ts +2 -2
- package/src/adapter/webgpu-adapter.ts +72 -58
- package/src/adapter/webgpu-canvas-context.ts +62 -82
- package/src/adapter/webgpu-device.ts +66 -105
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import { Texture } from '@luma.gl/core';
|
|
1
|
+
import { Texture, log } from '@luma.gl/core';
|
|
2
2
|
import { getWebGPUTextureFormat } from "../helpers/convert-texture-format.js";
|
|
3
3
|
import { WebGPUSampler } from "./webgpu-sampler.js";
|
|
4
4
|
import { WebGPUTextureView } from "./webgpu-texture-view.js";
|
|
5
|
-
const BASE_DIMENSIONS = {
|
|
6
|
-
'1d': '1d',
|
|
7
|
-
'2d': '2d',
|
|
8
|
-
'2d-array': '2d',
|
|
9
|
-
cube: '2d',
|
|
10
|
-
'cube-array': '2d',
|
|
11
|
-
'3d': '3d'
|
|
12
|
-
};
|
|
13
5
|
export class WebGPUTexture extends Texture {
|
|
14
6
|
device;
|
|
15
7
|
handle;
|
|
@@ -18,144 +10,123 @@ export class WebGPUTexture extends Texture {
|
|
|
18
10
|
constructor(device, props) {
|
|
19
11
|
super(device, props);
|
|
20
12
|
this.device = device;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (props.data) {
|
|
24
|
-
propsWithData.data = props.data;
|
|
13
|
+
if (this.dimension === 'cube') {
|
|
14
|
+
this.depth = 6;
|
|
25
15
|
}
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
16
|
+
this.device.pushErrorScope('out-of-memory');
|
|
17
|
+
this.device.pushErrorScope('validation');
|
|
18
|
+
this.handle =
|
|
19
|
+
this.props.handle ||
|
|
20
|
+
this.device.handle.createTexture({
|
|
21
|
+
label: this.id,
|
|
22
|
+
size: {
|
|
23
|
+
width: this.width,
|
|
24
|
+
height: this.height,
|
|
25
|
+
depthOrArrayLayers: this.depth
|
|
26
|
+
},
|
|
27
|
+
usage: this.props.usage || Texture.TEXTURE | Texture.COPY_DST,
|
|
28
|
+
dimension: this.baseDimension,
|
|
29
|
+
format: getWebGPUTextureFormat(this.format),
|
|
30
|
+
mipLevelCount: this.mipLevels,
|
|
31
|
+
sampleCount: this.props.samples
|
|
32
|
+
});
|
|
33
|
+
this.device.popErrorScope((error) => {
|
|
34
|
+
this.device.reportError(new Error(`${this} constructor: ${error.message}`), this)();
|
|
35
|
+
this.device.debug();
|
|
36
|
+
});
|
|
37
|
+
this.device.popErrorScope((error) => {
|
|
38
|
+
this.device.reportError(new Error(`${this} out of memory: ${error.message}`), this)();
|
|
39
|
+
this.device.debug();
|
|
40
|
+
});
|
|
41
|
+
// Update props if external handle was supplied - used mainly by CanvasContext.getDefaultFramebuffer()
|
|
42
|
+
// TODO - Read all properties directly from the supplied handle?
|
|
43
|
+
if (this.props.handle) {
|
|
44
|
+
this.handle.label ||= this.id;
|
|
45
|
+
this.width = this.handle.width;
|
|
46
|
+
this.height = this.handle.height;
|
|
47
47
|
}
|
|
48
|
-
this.width = this.handle.width;
|
|
49
|
-
this.height = this.handle.height;
|
|
50
|
-
// Why not just read all properties directly from the texture
|
|
51
|
-
// this.depthOrArrayLayers = this.handle.depthOrArrayLayers;
|
|
52
|
-
// this.mipLevelCount = this.handle.mipLevelCount;
|
|
53
|
-
// this.sampleCount = this.handle.sampleCount;
|
|
54
|
-
// this.dimension = this.handle.dimension;
|
|
55
|
-
// this.format = this.handle.format;
|
|
56
|
-
// this.usage = this.handle.usage;
|
|
57
|
-
// Create a default sampler. This mimics the WebGL1 API where sampler props are stored on the texture
|
|
58
|
-
// this.setSampler(props.sampler);
|
|
59
48
|
this.sampler =
|
|
60
49
|
props.sampler instanceof WebGPUSampler
|
|
61
50
|
? props.sampler
|
|
62
51
|
: new WebGPUSampler(this.device, props.sampler || {});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.view = new WebGPUTextureView(this.device, { ...this.props, texture: this });
|
|
67
|
-
// format: this.props.format,
|
|
68
|
-
// dimension: this.props.dimension,
|
|
69
|
-
// aspect = "all";
|
|
70
|
-
// baseMipLevel: 0;
|
|
71
|
-
// mipLevelCount;
|
|
72
|
-
// baseArrayLayer = 0;
|
|
73
|
-
// arrayLayerCount;
|
|
74
|
-
}
|
|
75
|
-
createHandle() {
|
|
76
|
-
// Deduce size from data - TODO this is a hack
|
|
77
|
-
// @ts-expect-error
|
|
78
|
-
const width = this.props.width || this.props.data?.width || 1;
|
|
79
|
-
// @ts-expect-error
|
|
80
|
-
const height = this.props.height || this.props.data?.height || 1;
|
|
81
|
-
return this.device.handle.createTexture({
|
|
82
|
-
label: this.id,
|
|
83
|
-
size: {
|
|
84
|
-
width,
|
|
85
|
-
height,
|
|
86
|
-
depthOrArrayLayers: this.depth
|
|
87
|
-
},
|
|
88
|
-
usage: this.props.usage || Texture.TEXTURE | Texture.COPY_DST,
|
|
89
|
-
dimension: BASE_DIMENSIONS[this.dimension],
|
|
90
|
-
format: getWebGPUTextureFormat(this.format),
|
|
52
|
+
this.view = new WebGPUTextureView(this.device, {
|
|
53
|
+
...this.props,
|
|
54
|
+
texture: this,
|
|
91
55
|
mipLevelCount: this.mipLevels,
|
|
92
|
-
|
|
56
|
+
// Note: arrayLayerCount controls the view of array textures, but does not apply to 3d texture depths
|
|
57
|
+
arrayLayerCount: this.dimension !== '3d' ? this.depth : 1
|
|
93
58
|
});
|
|
59
|
+
// Set initial data
|
|
60
|
+
// Texture base class strips out the data prop from this.props, so we need to handle it here
|
|
61
|
+
this._initializeData(props.data);
|
|
94
62
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Set default sampler
|
|
101
|
-
* Accept a sampler instance or set of props;
|
|
102
|
-
*/
|
|
103
|
-
setSampler(sampler) {
|
|
104
|
-
this.sampler =
|
|
105
|
-
sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
setTexture1DData(data) {
|
|
109
|
-
throw new Error('not implemented');
|
|
110
|
-
}
|
|
111
|
-
setTexture2DData(lodData, depth, target) {
|
|
112
|
-
throw new Error('not implemented');
|
|
113
|
-
}
|
|
114
|
-
setTexture3DData(lodData, depth, target) {
|
|
115
|
-
throw new Error('not implemented');
|
|
116
|
-
}
|
|
117
|
-
setTextureCubeData(data, depth) {
|
|
118
|
-
throw new Error('not implemented');
|
|
119
|
-
}
|
|
120
|
-
setTextureArrayData(data) {
|
|
121
|
-
throw new Error('not implemented');
|
|
63
|
+
destroy() {
|
|
64
|
+
this.handle?.destroy();
|
|
65
|
+
// @ts-expect-error readonly
|
|
66
|
+
this.handle = null;
|
|
122
67
|
}
|
|
123
|
-
|
|
124
|
-
|
|
68
|
+
createView(props) {
|
|
69
|
+
return new WebGPUTextureView(this.device, { ...props, texture: this });
|
|
125
70
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
71
|
+
copyImageData(options_) {
|
|
72
|
+
const { width, height, depth } = this;
|
|
73
|
+
const options = this._normalizeCopyImageDataOptions(options_);
|
|
74
|
+
this.device.pushErrorScope('validation');
|
|
75
|
+
this.device.handle.queue.writeTexture(
|
|
76
|
+
// destination: GPUImageCopyTexture
|
|
77
|
+
{
|
|
78
|
+
// texture subresource
|
|
79
|
+
texture: this.handle,
|
|
80
|
+
mipLevel: options.mipLevel,
|
|
81
|
+
aspect: options.aspect,
|
|
82
|
+
// origin to write to
|
|
83
|
+
origin: [options.x, options.y, options.z]
|
|
84
|
+
},
|
|
85
|
+
// data
|
|
86
|
+
options.data,
|
|
87
|
+
// dataLayout: GPUImageDataLayout
|
|
88
|
+
{
|
|
89
|
+
offset: options.byteOffset,
|
|
90
|
+
bytesPerRow: options.bytesPerRow,
|
|
91
|
+
rowsPerImage: options.rowsPerImage
|
|
92
|
+
},
|
|
93
|
+
// size: GPUExtent3D - extents of the content to write
|
|
94
|
+
[width, height, depth]);
|
|
95
|
+
this.device.popErrorScope((error) => {
|
|
96
|
+
this.device.reportError(new Error(`copyImageData: ${error.message}`), this)();
|
|
97
|
+
this.device.debug();
|
|
98
|
+
});
|
|
134
99
|
}
|
|
135
|
-
copyExternalImage(
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
const { image, sourceX, sourceY, width, height, depth, mipLevel, x, y, z, aspect, colorSpace, premultipliedAlpha, flipY } = opts;
|
|
139
|
-
// TODO - max out width
|
|
100
|
+
copyExternalImage(options_) {
|
|
101
|
+
const options = this._normalizeCopyExternalImageOptions(options_);
|
|
102
|
+
this.device.pushErrorScope('validation');
|
|
140
103
|
this.device.handle.queue.copyExternalImageToTexture(
|
|
141
104
|
// source: GPUImageCopyExternalImage
|
|
142
105
|
{
|
|
143
|
-
source: image,
|
|
144
|
-
origin: [sourceX, sourceY],
|
|
145
|
-
flipY
|
|
106
|
+
source: options.image,
|
|
107
|
+
origin: [options.sourceX, options.sourceY],
|
|
108
|
+
flipY: options.flipY
|
|
146
109
|
},
|
|
147
110
|
// destination: GPUImageCopyTextureTagged
|
|
148
111
|
{
|
|
149
112
|
texture: this.handle,
|
|
150
|
-
origin: [x, y,
|
|
151
|
-
mipLevel,
|
|
152
|
-
aspect,
|
|
153
|
-
colorSpace,
|
|
154
|
-
premultipliedAlpha
|
|
113
|
+
origin: [options.x, options.y, 0], // options.depth],
|
|
114
|
+
mipLevel: options.mipLevel,
|
|
115
|
+
aspect: options.aspect,
|
|
116
|
+
colorSpace: options.colorSpace,
|
|
117
|
+
premultipliedAlpha: options.premultipliedAlpha
|
|
155
118
|
},
|
|
156
119
|
// copySize: GPUExtent3D
|
|
157
|
-
[width, height,
|
|
158
|
-
|
|
120
|
+
[options.width, options.height, 1]);
|
|
121
|
+
this.device.popErrorScope((error) => {
|
|
122
|
+
this.device.reportError(new Error(`copyExternalImage: ${error.message}`), this)();
|
|
123
|
+
this.device.debug();
|
|
124
|
+
});
|
|
125
|
+
// TODO - should these be clipped to the texture size minus x,y,z?
|
|
126
|
+
return { width: options.width, height: options.height };
|
|
127
|
+
}
|
|
128
|
+
generateMipmapsWebGL() {
|
|
129
|
+
log.warn(`${this}: generateMipmaps not supported in WebGPU`)();
|
|
159
130
|
}
|
|
160
131
|
}
|
|
161
132
|
//# sourceMappingURL=webgpu-texture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-texture.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-texture.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,OAAO,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAC,sBAAsB,EAAC,6CAA0C;AAEzE,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAC/C,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AAExD,MAAM,OAAO,aAAc,SAAQ,OAAO;IAC/B,MAAM,CAAe;IACrB,MAAM,CAAa;IAC5B,OAAO,CAAgB;IACvB,IAAI,CAAoB;IAExB,YAAY,MAAoB,EAAE,KAAmB;QACnD,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,IAAI,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;YAC9B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,CA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A0B;QACjD,oCAAoC;QACpC;YACE,MAAM,EAAE,OAAO,CAAC,KAAK;YACrB,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB;QACD,yCAAyC;QACzC;YACE,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,kBAAkB;YACrD,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;SAC/C;QACD,wBAAwB;QACxB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CACnC,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,KAAe,EAAE,EAAE;YAC5C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;YAClF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,kEAAkE;QAClE,OAAO,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAC,CAAC;IACxD,CAAC;IAEQ,oBAAoB;QAC3B,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,2CAA2C,CAAC,EAAE,CAAC;IACjE,CAAC;CAsEF"}
|
|
@@ -5,8 +5,8 @@ import { WebGPUDevice } from "../webgpu-device.js";
|
|
|
5
5
|
export declare class WebGPUVertexArray extends VertexArray {
|
|
6
6
|
get [Symbol.toStringTag](): string;
|
|
7
7
|
readonly device: WebGPUDevice;
|
|
8
|
-
/** Vertex Array is a helper class under WebGPU */
|
|
9
|
-
readonly handle:
|
|
8
|
+
/** Vertex Array is just a helper class under WebGPU */
|
|
9
|
+
readonly handle: null;
|
|
10
10
|
constructor(device: WebGPUDevice, props: VertexArrayProps);
|
|
11
11
|
destroy(): void;
|
|
12
12
|
/**
|
|
@@ -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,iBAAkB,SAAQ,WAAW;IAChD,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,
|
|
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,iBAAkB,SAAQ,WAAW;IAChD,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,MAAM,OAAQ;gBAGX,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAKhD,OAAO,IAAI,IAAI;IAExB;;;OAGG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAK3C,oGAAoG;IACpG,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAS1C,gBAAgB,CACvB,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI;IA2BE,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAQxD;;;OAGG;IACH,MAAM,CAAC,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAGjE"}
|
|
@@ -9,8 +9,8 @@ export class WebGPUVertexArray extends VertexArray {
|
|
|
9
9
|
return 'WebGPUVertexArray';
|
|
10
10
|
}
|
|
11
11
|
device;
|
|
12
|
-
/** Vertex Array is a helper class under WebGPU */
|
|
13
|
-
handle;
|
|
12
|
+
/** Vertex Array is just a helper class under WebGPU */
|
|
13
|
+
handle = null;
|
|
14
14
|
// Create a VertexArray
|
|
15
15
|
constructor(device, props) {
|
|
16
16
|
super(device, props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-vertex-array.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-vertex-array.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,WAAW,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAOzC,gCAAgC;AAChC,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAChD,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC/B,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAEQ,MAAM,CAAe;IAC9B,
|
|
1
|
+
{"version":3,"file":"webgpu-vertex-array.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-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EAAE,MAAM;YACzB,+CAA+C;YAC/C,iBAAiB,EAAE,SAAS,CAC7B,CAAC;QACJ,CAAC;QACD,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,mBAAmB,EAAE,QAAQ,EAAE,EAAE,CAAC;YACvE,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAiB,CAAC;YAC/D,IAAI,YAAY,EAAE,MAAM,EAAE,CAAC;gBACzB,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,yBAAyB,QAAQ,EAAE,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC;gBACzE,gBAAgB,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QACD,oFAAoF;IACtF,CAAC;IAEQ,iBAAiB,CAAC,UAAsB;QAC/C,qCAAqC;QACrC,mFAAmF;QACnF,4EAA4E;IAC9E,CAAC;IAED,qBAAqB;IAErB;;;OAGG;IACH,MAAM,CAAC,gCAAgC,CAAC,MAAc;QACpD,OAAO,UAAU,EAAE,KAAK,QAAQ,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Adapter, DeviceProps } from '@luma.gl/core';
|
|
2
|
-
import { WebGPUDevice } from "./webgpu-device.js";
|
|
2
|
+
import type { WebGPUDevice } from "./webgpu-device.js";
|
|
3
3
|
export declare class WebGPUAdapter extends Adapter {
|
|
4
4
|
/** type of device's created by this adapter */
|
|
5
5
|
readonly type = "webgpu";
|
|
6
|
-
constructor();
|
|
7
|
-
/** Check if WebGPU is available */
|
|
8
6
|
isSupported(): boolean;
|
|
7
|
+
isDeviceHandle(handle: unknown): boolean;
|
|
9
8
|
create(props: DeviceProps): Promise<WebGPUDevice>;
|
|
10
9
|
attach(handle: GPUDevice): Promise<WebGPUDevice>;
|
|
11
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-adapter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,OAAO,EAAE,WAAW,EAAM,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAC,YAAY,EAAC,2BAAwB;AAElD,qBAAa,aAAc,SAAQ,OAAO;IACxC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,YAAkC;IAE/C,WAAW,IAAI,OAAO;IAKtB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;IAalC,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAmEjD,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;CAGvD;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
|
|
@@ -1,63 +1,74 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import { WebGPUDevice } from "./webgpu-device.js";
|
|
4
|
+
// prettier-ignore
|
|
6
5
|
// / <reference types="@webgpu/types" />
|
|
6
|
+
import { Adapter, log } from '@luma.gl/core';
|
|
7
7
|
export class WebGPUAdapter extends Adapter {
|
|
8
8
|
/** type of device's created by this adapter */
|
|
9
9
|
type = 'webgpu';
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
// @ts-ignore For backwards compatibility luma.registerDevices
|
|
13
|
-
WebGPUDevice.adapter = this;
|
|
14
|
-
}
|
|
15
|
-
/** Check if WebGPU is available */
|
|
16
10
|
isSupported() {
|
|
11
|
+
// Check if WebGPU is available
|
|
17
12
|
return Boolean(typeof navigator !== 'undefined' && navigator.gpu);
|
|
18
13
|
}
|
|
14
|
+
isDeviceHandle(handle) {
|
|
15
|
+
if (typeof GPUDevice !== 'undefined' && handle instanceof GPUDevice) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
// TODO - WebGPU does not yet seem to have a stable in-browser API, so we "sniff" for members instead
|
|
19
|
+
if (handle?.queue) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
19
24
|
async create(props) {
|
|
20
25
|
if (!navigator.gpu) {
|
|
21
|
-
throw new Error('WebGPU not available.
|
|
26
|
+
throw new Error('WebGPU not available. Recent Chrome browsers should work.');
|
|
22
27
|
}
|
|
23
28
|
log.groupCollapsed(1, 'WebGPUDevice created')();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
try {
|
|
30
|
+
const adapter = await navigator.gpu.requestAdapter({
|
|
31
|
+
powerPreference: 'high-performance'
|
|
32
|
+
// forceSoftware: false
|
|
33
|
+
});
|
|
34
|
+
if (!adapter) {
|
|
35
|
+
throw new Error('Failed to request WebGPU adapter');
|
|
36
|
+
}
|
|
37
|
+
// Note: adapter.requestAdapterInfo() has been replaced with adapter.info. Fall back in case adapter.info is not available
|
|
38
|
+
const adapterInfo = adapter.info ||
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
(await adapter.requestAdapterInfo?.());
|
|
41
|
+
log.probe(2, 'Adapter available', adapterInfo)();
|
|
42
|
+
const requiredFeatures = [];
|
|
43
|
+
const requiredLimits = {};
|
|
44
|
+
if (props._requestMaxLimits) {
|
|
45
|
+
// Require all features
|
|
46
|
+
requiredFeatures.push(...Array.from(adapter.features));
|
|
47
|
+
// Require all limits
|
|
48
|
+
// Filter out chrome specific keys (avoid crash)
|
|
49
|
+
const limits = Object.keys(adapter.limits).filter(key => !['minSubgroupSize', 'maxSubgroupSize'].includes(key));
|
|
50
|
+
for (const key of limits) {
|
|
51
|
+
const limit = key;
|
|
52
|
+
const value = adapter.limits[limit];
|
|
53
|
+
if (typeof value === 'number') {
|
|
54
|
+
requiredLimits[limit] = value;
|
|
55
|
+
}
|
|
48
56
|
}
|
|
49
57
|
}
|
|
58
|
+
const gpuDevice = await adapter.requestDevice({
|
|
59
|
+
requiredFeatures,
|
|
60
|
+
requiredLimits
|
|
61
|
+
});
|
|
62
|
+
log.probe(1, 'GPUDevice available')();
|
|
63
|
+
const { WebGPUDevice } = await import('./webgpu-device');
|
|
64
|
+
const device = new WebGPUDevice(props, gpuDevice, adapter, adapterInfo);
|
|
65
|
+
log.probe(1, 'Device created. For more info, set chrome://flags/#enable-webgpu-developer-features')();
|
|
66
|
+
log.table(1, device.info)();
|
|
67
|
+
return device;
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
log.groupEnd(1)();
|
|
50
71
|
}
|
|
51
|
-
const gpuDevice = await adapter.requestDevice({
|
|
52
|
-
requiredFeatures,
|
|
53
|
-
requiredLimits
|
|
54
|
-
});
|
|
55
|
-
log.probe(1, 'GPUDevice available')();
|
|
56
|
-
const device = new WebGPUDevice(props, gpuDevice, adapter, adapterInfo);
|
|
57
|
-
log.probe(1, 'Device created. For more info, set chrome://flags/#enable-webgpu-developer-features')();
|
|
58
|
-
log.table(1, device.info)();
|
|
59
|
-
log.groupEnd(1)();
|
|
60
|
-
return device;
|
|
61
72
|
}
|
|
62
73
|
async attach(handle) {
|
|
63
74
|
throw new Error('WebGPUAdapter.attach() not implemented');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-adapter.js","sourceRoot":"","sources":["../../src/adapter/webgpu-adapter.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,OAAO,EAAe,GAAG,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"webgpu-adapter.js","sourceRoot":"","sources":["../../src/adapter/webgpu-adapter.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,kBAAkB;AAClB,wCAAwC;AAExC,OAAO,EAAC,OAAO,EAAe,GAAG,EAAC,MAAM,eAAe,CAAC;AAGxD,MAAM,OAAO,aAAc,SAAQ,OAAO;IACxC,+CAA+C;IACtC,IAAI,GAAyB,QAAQ,CAAC;IAE/C,WAAW;QACT,+BAA+B;QAC/B,OAAO,OAAO,CAAC,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IAED,cAAc,CAAC,MAAe;QAC5B,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,MAAM,YAAY,SAAS,EAAE,CAAC;YACpE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,qGAAqG;QACrG,IAAK,MAAc,EAAE,KAAK,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAkB;QAC7B,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAC/E,CAAC;QAED,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,sBAAsB,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;gBACjD,eAAe,EAAE,kBAAkB;gBACnC,uBAAuB;aACxB,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,I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AAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAEvD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YAExE,GAAG,CAAC,KAAK,CACP,CAAC,EACD,qFAAqF,CACtF,EAAE,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAE5B,OAAO,MAAM,CAAC;QAChB,CAAC;gBAAS,CAAC;YACT,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAiB;QAC5B,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;CACF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextureFormatDepthStencil, CanvasContextProps } from '@luma.gl/core';
|
|
2
2
|
import { CanvasContext } from '@luma.gl/core';
|
|
3
3
|
import { WebGPUDevice } from "./webgpu-device.js";
|
|
4
4
|
import { WebGPUFramebuffer } from "./resources/webgpu-framebuffer.js";
|
|
@@ -10,28 +10,20 @@ import { WebGPUTexture } from "./resources/webgpu-texture.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class WebGPUCanvasContext extends CanvasContext {
|
|
12
12
|
readonly device: WebGPUDevice;
|
|
13
|
-
readonly
|
|
14
|
-
/** Format of returned textures: "bgra8unorm", "rgba8unorm", "rgba16float". */
|
|
15
|
-
readonly format: TextureFormat;
|
|
16
|
-
/** Default stencil format for depth textures */
|
|
17
|
-
readonly depthStencilFormat: TextureFormat;
|
|
13
|
+
readonly handle: GPUCanvasContext;
|
|
18
14
|
private depthStencilAttachment;
|
|
19
15
|
get [Symbol.toStringTag](): string;
|
|
20
16
|
constructor(device: WebGPUDevice, adapter: GPUAdapter, props: CanvasContextProps);
|
|
21
17
|
/** Destroy any textures produced while configured and remove the context configuration. */
|
|
22
18
|
destroy(): void;
|
|
23
19
|
/** Update framebuffer with properly resized "swap chain" texture views */
|
|
24
|
-
getCurrentFramebuffer(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
width?: number;
|
|
29
|
-
height?: number;
|
|
30
|
-
useDevicePixels?: boolean | number;
|
|
31
|
-
}): void;
|
|
20
|
+
getCurrentFramebuffer(options?: {
|
|
21
|
+
depthStencilFormat?: TextureFormatDepthStencil | false;
|
|
22
|
+
}): WebGPUFramebuffer;
|
|
23
|
+
_updateDevice(): void;
|
|
32
24
|
/** Wrap the current canvas context texture in a luma.gl texture */
|
|
33
25
|
getCurrentTexture(): WebGPUTexture;
|
|
34
26
|
/** We build render targets on demand (i.e. not when size changes but when about to render) */
|
|
35
|
-
_createDepthStencilAttachment():
|
|
27
|
+
_createDepthStencilAttachment(depthStencilFormat: TextureFormatDepthStencil): WebGPUTexture;
|
|
36
28
|
}
|
|
37
29
|
//# 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":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-canvas-context.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,yBAAyB,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjF,OAAO,EAAC,aAAa,EAAe,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAC7C,OAAO,EAAC,iBAAiB,EAAC,0CAAuC;AACjE,OAAO,EAAC,aAAa,EAAC,sCAAmC;AAEzD;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC,OAAO,CAAC,sBAAsB,CAA8B;IAE5D,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;gBAEW,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB;IAehF,2FAA2F;IAClF,OAAO,IAAI,IAAI;IAKxB,0EAA0E;IAC1E,qBAAqB,CACnB,OAAO,GAAE;QAAC,kBAAkB,CAAC,EAAE,yBAAyB,GAAG,KAAK,CAAA;KAE/D,GACA,iBAAiB;IA8BpB,aAAa,IAAI,IAAI;IAkBrB,mEAAmE;IACnE,iBAAiB,IAAI,aAAa;IAWlC,8FAA8F;IAC9F,6BAA6B,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,aAAa;CAY5F"}
|