@luma.gl/webgpu 9.0.0-alpha.3 → 9.0.0-alpha.31
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 +2 -1
- package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
- package/dist/adapter/helpers/convert-texture-format.d.ts +2 -2
- package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
- package/dist/adapter/helpers/convert-texture-format.js +0 -1
- package/dist/adapter/helpers/convert-texture-format.js.map +1 -1
- package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
- package/dist/adapter/helpers/generate-mipmaps.js +1 -8
- package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
- package/dist/adapter/helpers/get-bind-group.d.ts +4 -4
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +7 -16
- package/dist/adapter/helpers/get-bind-group.js.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +5 -5
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +26 -34
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.d.ts +2 -2
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +50 -47
- package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts +4 -5
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js +13 -27
- package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +6 -15
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +9 -26
- package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.d.ts +6 -6
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +12 -24
- package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +4 -4
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +4 -8
- package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.d.ts +5 -5
- package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.js +3 -10
- package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +4 -21
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +3 -103
- package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-query.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts +12 -7
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +37 -32
- package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +11 -6
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +33 -48
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.d.ts +5 -5
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.js +9 -8
- package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts +7 -7
- package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.js +6 -19
- package/dist/adapter/resources/webgpu-shader.js.map +1 -1
- package/dist/adapter/resources/webgpu-texture.d.ts +15 -8
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +13 -22
- package/dist/adapter/resources/webgpu-texture.js.map +1 -1
- package/dist/adapter/webgpu-canvas-context.d.ts +8 -10
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +11 -32
- package/dist/adapter/webgpu-canvas-context.js.map +1 -1
- package/dist/adapter/webgpu-device.d.ts +35 -22
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +74 -73
- package/dist/adapter/webgpu-device.js.map +1 -1
- package/dist/adapter/webgpu-types.js.map +1 -1
- package/dist/dist.dev.js +3264 -0
- package/dist/glsl/glsllang.js +0 -1
- package/dist/glsl/glsllang.js.map +1 -1
- package/dist/index.cjs +1448 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist.min.js +17 -0
- package/package.json +18 -9
- package/src/adapter/helpers/accessor-to-format.ts +2 -2
- package/src/adapter/helpers/convert-texture-format.ts +1 -1
- package/src/adapter/helpers/generate-mipmaps.ts +1 -1
- package/src/adapter/helpers/get-bind-group.ts +22 -12
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +49 -29
- package/src/adapter/helpers/webgpu-parameters.ts +56 -47
- package/src/adapter/resources/webgpu-buffer.ts +6 -10
- package/src/adapter/resources/webgpu-command-encoder.ts +62 -41
- package/src/adapter/resources/webgpu-compute-pass.ts +13 -13
- package/src/adapter/resources/webgpu-compute-pipeline.ts +6 -5
- package/src/adapter/resources/webgpu-external-texture.ts +5 -5
- package/src/adapter/resources/webgpu-framebuffer.ts +8 -109
- package/src/adapter/resources/webgpu-query.ts +3 -3
- package/src/adapter/resources/webgpu-render-pass.ts +50 -17
- package/src/adapter/resources/webgpu-render-pipeline.ts +46 -22
- package/src/adapter/resources/webgpu-sampler.ts +12 -5
- package/src/adapter/resources/webgpu-shader.ts +11 -9
- package/src/adapter/resources/webgpu-texture.ts +15 -8
- package/src/adapter/webgpu-canvas-context.ts +20 -15
- package/src/adapter/webgpu-device.ts +136 -54
- package/src/index.ts +6 -9
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/dist/init.d.ts +0 -2
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -4
- package/dist/init.js.map +0 -1
- package/src/bundle.ts +0 -4
- package/src/init.ts +0 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
// / <reference types="@webgpu/types" />
|
|
2
3
|
|
|
3
4
|
import type {
|
|
4
5
|
DeviceProps,
|
|
@@ -9,6 +10,7 @@ import type {
|
|
|
9
10
|
BufferProps,
|
|
10
11
|
SamplerProps,
|
|
11
12
|
ShaderProps,
|
|
13
|
+
Texture,
|
|
12
14
|
TextureProps,
|
|
13
15
|
TextureFormat,
|
|
14
16
|
ExternalTextureProps,
|
|
@@ -16,32 +18,34 @@ import type {
|
|
|
16
18
|
RenderPipelineProps,
|
|
17
19
|
ComputePipelineProps,
|
|
18
20
|
RenderPassProps,
|
|
19
|
-
ComputePassProps
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
|
|
33
|
-
import
|
|
21
|
+
ComputePassProps,
|
|
22
|
+
// CommandEncoderProps
|
|
23
|
+
} from '@luma.gl/core';
|
|
24
|
+
import {Device, CanvasContext, log, uid} from '@luma.gl/core';
|
|
25
|
+
import {WebGPUBuffer} from './resources/webgpu-buffer';
|
|
26
|
+
import {WebGPUTexture} from './resources/webgpu-texture';
|
|
27
|
+
import {WebGPUExternalTexture} from './resources/webgpu-external-texture';
|
|
28
|
+
import {WebGPUSampler} from './resources/webgpu-sampler';
|
|
29
|
+
import {WebGPUShader} from './resources/webgpu-shader';
|
|
30
|
+
import {WebGPURenderPipeline} from './resources/webgpu-render-pipeline';
|
|
31
|
+
import {WebGPUFramebuffer} from './resources/webgpu-framebuffer';
|
|
32
|
+
import {WebGPUComputePipeline} from './resources/webgpu-compute-pipeline';
|
|
33
|
+
import {WebGPURenderPass} from './resources/webgpu-render-pass';
|
|
34
|
+
import {WebGPUComputePass} from './resources/webgpu-compute-pass';
|
|
35
|
+
// import {WebGPUCommandEncoder} from './resources/webgpu-command-encoder';
|
|
36
|
+
|
|
37
|
+
import {WebGPUCanvasContext} from './webgpu-canvas-context';
|
|
34
38
|
// import {loadGlslangModule} from '../glsl/glslang';
|
|
35
39
|
|
|
36
40
|
/** WebGPU Device implementation */
|
|
37
|
-
export
|
|
41
|
+
export class WebGPUDevice extends Device {
|
|
38
42
|
readonly handle: GPUDevice;
|
|
39
43
|
readonly adapter: GPUAdapter;
|
|
40
|
-
readonly lost: Promise<{reason: 'destroyed'
|
|
41
|
-
canvasContext: WebGPUCanvasContext |
|
|
44
|
+
readonly lost: Promise<{reason: 'destroyed'; message: string}>;
|
|
45
|
+
canvasContext: WebGPUCanvasContext | null = null;
|
|
42
46
|
|
|
43
|
-
commandEncoder: GPUCommandEncoder;
|
|
44
|
-
renderPass: WebGPURenderPass;
|
|
47
|
+
commandEncoder: GPUCommandEncoder | null = null;
|
|
48
|
+
renderPass: WebGPURenderPass | null = null;
|
|
45
49
|
|
|
46
50
|
private _info: DeviceInfo;
|
|
47
51
|
private _isLost: boolean = false;
|
|
@@ -55,42 +59,49 @@ export default class WebGPUDevice extends Device {
|
|
|
55
59
|
|
|
56
60
|
static async create(props: DeviceProps): Promise<WebGPUDevice> {
|
|
57
61
|
if (!navigator.gpu) {
|
|
58
|
-
throw new Error(
|
|
62
|
+
throw new Error(
|
|
63
|
+
'WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu'
|
|
64
|
+
);
|
|
59
65
|
}
|
|
60
66
|
log.groupCollapsed(1, 'WebGPUDevice created')();
|
|
61
67
|
const adapter = await navigator.gpu.requestAdapter({
|
|
62
|
-
powerPreference:
|
|
68
|
+
powerPreference: 'high-performance'
|
|
63
69
|
// forceSoftware: false
|
|
64
70
|
});
|
|
65
|
-
|
|
71
|
+
if (!adapter) {
|
|
72
|
+
throw new Error('Failed to request WebGPU adapter');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const adapterInfo = await adapter.requestAdapterInfo();
|
|
76
|
+
log.probe(1, 'Adapter available', adapterInfo)();
|
|
66
77
|
|
|
67
78
|
const gpuDevice = await adapter.requestDevice({
|
|
68
|
-
requiredFeatures: adapter.features as ReadonlySet<GPUFeatureName
|
|
79
|
+
requiredFeatures: adapter.features as ReadonlySet<GPUFeatureName>
|
|
69
80
|
// TODO ensure we obtain best limits
|
|
70
81
|
// requiredLimits: adapter.limits
|
|
71
82
|
});
|
|
72
|
-
log.probe(1,
|
|
83
|
+
log.probe(1, 'GPUDevice available')();
|
|
73
84
|
|
|
74
85
|
if (typeof props.canvas === 'string') {
|
|
75
86
|
await CanvasContext.pageLoaded;
|
|
76
|
-
log.probe(1,
|
|
87
|
+
log.probe(1, 'DOM is loaded')();
|
|
77
88
|
}
|
|
78
89
|
|
|
79
90
|
const device = new WebGPUDevice(gpuDevice, adapter, props);
|
|
80
|
-
log.probe(1,
|
|
91
|
+
log.probe(1, 'Device created', device.info)();
|
|
81
92
|
log.table(1, device.info)();
|
|
82
93
|
log.groupEnd(1)();
|
|
83
94
|
return device;
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
constructor(device: GPUDevice, adapter: GPUAdapter, props: DeviceProps) {
|
|
87
|
-
super(props);
|
|
98
|
+
super({...props, id: props.id || uid('webgpu-device')});
|
|
88
99
|
this.handle = device;
|
|
89
100
|
this.adapter = adapter;
|
|
90
101
|
|
|
91
102
|
this._info = {
|
|
92
103
|
type: 'webgpu',
|
|
93
|
-
vendor: this.adapter.
|
|
104
|
+
vendor: this.adapter.__brand,
|
|
94
105
|
renderer: '',
|
|
95
106
|
version: '',
|
|
96
107
|
gpu: 'unknown', // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',
|
|
@@ -103,9 +114,11 @@ export default class WebGPUDevice extends Device {
|
|
|
103
114
|
rendererMasked: ''
|
|
104
115
|
};
|
|
105
116
|
|
|
106
|
-
|
|
107
|
-
this.lost
|
|
117
|
+
// "Context" loss handling
|
|
118
|
+
this.lost = new Promise<{reason: 'destroyed'; message: string}>(async (resolve) => {
|
|
119
|
+
const lostInfo = await this.handle.lost;
|
|
108
120
|
this._isLost = true;
|
|
121
|
+
resolve({reason: 'destroyed', message: lostInfo.message});
|
|
109
122
|
});
|
|
110
123
|
|
|
111
124
|
// Note: WebGPU devices can be created without a canvas, for compute shader purposes
|
|
@@ -121,7 +134,7 @@ export default class WebGPUDevice extends Device {
|
|
|
121
134
|
// const {glsl = true} = props;
|
|
122
135
|
// this.glslang = glsl && await loadGlslangModule();
|
|
123
136
|
|
|
124
|
-
destroy() {
|
|
137
|
+
destroy(): void {
|
|
125
138
|
this.handle.destroy();
|
|
126
139
|
}
|
|
127
140
|
|
|
@@ -141,20 +154,21 @@ export default class WebGPUDevice extends Device {
|
|
|
141
154
|
|
|
142
155
|
/** @todo implement proper check? */
|
|
143
156
|
isTextureFormatFilterable(format: TextureFormat): boolean {
|
|
144
|
-
return this.isTextureFormatSupported(format);
|
|
157
|
+
return this.isTextureFormatSupported(format);
|
|
145
158
|
}
|
|
146
159
|
|
|
147
160
|
/** @todo implement proper check? */
|
|
148
161
|
isTextureFormatRenderable(format: TextureFormat): boolean {
|
|
149
|
-
return this.isTextureFormatSupported(format);
|
|
162
|
+
return this.isTextureFormatSupported(format);
|
|
150
163
|
}
|
|
151
164
|
|
|
152
165
|
get isLost(): boolean {
|
|
153
166
|
return this._isLost;
|
|
154
167
|
}
|
|
155
168
|
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WebGPUBuffer {
|
|
170
|
+
const newProps = this._getBufferProps(props);
|
|
171
|
+
return new WebGPUBuffer(this, newProps);
|
|
158
172
|
}
|
|
159
173
|
|
|
160
174
|
_createTexture(props: TextureProps): WebGPUTexture {
|
|
@@ -187,40 +201,48 @@ export default class WebGPUDevice extends Device {
|
|
|
187
201
|
|
|
188
202
|
// WebGPU specifics
|
|
189
203
|
|
|
190
|
-
/**
|
|
204
|
+
/**
|
|
191
205
|
* Allows a render pass to begin against a canvas context
|
|
192
206
|
* @todo need to support a "Framebuffer" equivalent (aka preconfigured RenderPassDescriptors?).
|
|
193
207
|
*/
|
|
194
|
-
beginRenderPass(props
|
|
208
|
+
beginRenderPass(props: RenderPassProps): WebGPURenderPass {
|
|
195
209
|
this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();
|
|
196
210
|
return new WebGPURenderPass(this, props);
|
|
197
211
|
}
|
|
198
212
|
|
|
199
|
-
beginComputePass(props
|
|
213
|
+
beginComputePass(props: ComputePassProps): WebGPUComputePass {
|
|
200
214
|
this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();
|
|
201
215
|
return new WebGPUComputePass(this, props);
|
|
202
216
|
}
|
|
203
217
|
|
|
204
|
-
|
|
218
|
+
// createCommandEncoder(props: CommandEncoderProps): WebGPUCommandEncoder {
|
|
219
|
+
// return new WebGPUCommandEncoder(this, props);
|
|
220
|
+
// }
|
|
221
|
+
|
|
222
|
+
createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext {
|
|
205
223
|
return new WebGPUCanvasContext(this, this.adapter, props);
|
|
206
224
|
}
|
|
207
225
|
|
|
208
|
-
/**
|
|
226
|
+
/**
|
|
209
227
|
* Gets default renderpass encoder.
|
|
210
|
-
* Creates a new encoder against default canvasContext if not already created
|
|
228
|
+
* Creates a new encoder against default canvasContext if not already created
|
|
211
229
|
* @note Called internally by Model.
|
|
212
230
|
*/
|
|
213
231
|
getDefaultRenderPass(): WebGPURenderPass {
|
|
214
|
-
this.renderPass =
|
|
215
|
-
|
|
216
|
-
|
|
232
|
+
this.renderPass =
|
|
233
|
+
this.renderPass ||
|
|
234
|
+
this.beginRenderPass({
|
|
235
|
+
framebuffer: this.canvasContext?.getCurrentFramebuffer()
|
|
236
|
+
});
|
|
217
237
|
return this.renderPass;
|
|
218
238
|
}
|
|
219
239
|
|
|
220
240
|
submit(): void {
|
|
221
|
-
this.renderPass
|
|
222
|
-
const commandBuffer = this.commandEncoder
|
|
223
|
-
|
|
241
|
+
this.renderPass?.end();
|
|
242
|
+
const commandBuffer = this.commandEncoder?.finish();
|
|
243
|
+
if (commandBuffer) {
|
|
244
|
+
this.handle.queue.submit([commandBuffer]);
|
|
245
|
+
}
|
|
224
246
|
this.commandEncoder = null;
|
|
225
247
|
this.renderPass = null;
|
|
226
248
|
}
|
|
@@ -253,24 +275,24 @@ export default class WebGPUDevice extends Device {
|
|
|
253
275
|
features.add('index-uint32-webgl1');
|
|
254
276
|
features.add('blend-minmax-webgl1');
|
|
255
277
|
features.add('texture-blend-float-webgl1');
|
|
256
|
-
|
|
278
|
+
|
|
257
279
|
// TEXTURES, RENDERBUFFERS
|
|
258
280
|
features.add('texture-formats-srgb-webgl1');
|
|
259
|
-
|
|
281
|
+
|
|
260
282
|
// TEXTURES
|
|
261
283
|
features.add('texture-formats-depth-webgl1');
|
|
262
284
|
features.add('texture-formats-float32-webgl1');
|
|
263
285
|
features.add('texture-formats-float16-webgl1');
|
|
264
|
-
|
|
286
|
+
|
|
265
287
|
features.add('texture-filter-linear-float32-webgl');
|
|
266
288
|
features.add('texture-filter-linear-float16-webgl');
|
|
267
289
|
features.add('texture-filter-anisotropic-webgl');
|
|
268
|
-
|
|
290
|
+
|
|
269
291
|
// FRAMEBUFFERS, TEXTURES AND RENDERBUFFERS
|
|
270
292
|
features.add('texture-renderable-rgba32float-webgl');
|
|
271
293
|
features.add('texture-renderable-float32-webgl');
|
|
272
294
|
features.add('texture-renderable-float16-webgl');
|
|
273
|
-
|
|
295
|
+
|
|
274
296
|
// GLSL extensions
|
|
275
297
|
features.add('glsl-frag-data');
|
|
276
298
|
features.add('glsl-frag-depth');
|
|
@@ -279,4 +301,64 @@ export default class WebGPUDevice extends Device {
|
|
|
279
301
|
|
|
280
302
|
return features;
|
|
281
303
|
}
|
|
304
|
+
|
|
305
|
+
copyExternalImageToTexture(options: {
|
|
306
|
+
texture: Texture;
|
|
307
|
+
mipLevel?: number;
|
|
308
|
+
aspect?: 'all' | 'stencil-only' | 'depth-only';
|
|
309
|
+
colorSpace?: 'display-p3' | 'srgb';
|
|
310
|
+
premultipliedAlpha?: boolean;
|
|
311
|
+
|
|
312
|
+
source: ImageBitmap | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;
|
|
313
|
+
sourceX?: number;
|
|
314
|
+
sourceY?: number;
|
|
315
|
+
|
|
316
|
+
width?: number;
|
|
317
|
+
height?: number;
|
|
318
|
+
depth?: number;
|
|
319
|
+
}): void {
|
|
320
|
+
const {
|
|
321
|
+
source,
|
|
322
|
+
sourceX = 0,
|
|
323
|
+
sourceY = 0,
|
|
324
|
+
|
|
325
|
+
texture,
|
|
326
|
+
mipLevel = 0,
|
|
327
|
+
aspect = 'all',
|
|
328
|
+
colorSpace = 'display-p3',
|
|
329
|
+
premultipliedAlpha = false,
|
|
330
|
+
// destinationX,
|
|
331
|
+
// destinationY,
|
|
332
|
+
// desitnationZ,
|
|
333
|
+
|
|
334
|
+
width = texture.width,
|
|
335
|
+
height = texture.height,
|
|
336
|
+
depth = 1
|
|
337
|
+
} = options;
|
|
338
|
+
|
|
339
|
+
const webGpuTexture = texture as WebGPUTexture;
|
|
340
|
+
|
|
341
|
+
this.handle?.queue.copyExternalImageToTexture(
|
|
342
|
+
// source: GPUImageCopyExternalImage
|
|
343
|
+
{
|
|
344
|
+
source,
|
|
345
|
+
origin: [sourceX, sourceY]
|
|
346
|
+
},
|
|
347
|
+
// destination: GPUImageCopyTextureTagged
|
|
348
|
+
{
|
|
349
|
+
texture: webGpuTexture.handle,
|
|
350
|
+
origin: [0, 0, 0], // [x, y, z],
|
|
351
|
+
mipLevel,
|
|
352
|
+
aspect,
|
|
353
|
+
colorSpace,
|
|
354
|
+
premultipliedAlpha
|
|
355
|
+
},
|
|
356
|
+
// copySize: GPUExtent3D
|
|
357
|
+
[
|
|
358
|
+
width,
|
|
359
|
+
height,
|
|
360
|
+
depth
|
|
361
|
+
]
|
|
362
|
+
)
|
|
363
|
+
}
|
|
282
364
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
// Initialize any global state
|
|
3
|
-
import '@luma.gl/api';
|
|
4
|
-
import './init'
|
|
1
|
+
// luma.gl, MIT license
|
|
5
2
|
|
|
6
3
|
// WEBGPU ADAPTER
|
|
7
|
-
export {
|
|
4
|
+
export {WebGPUDevice} from './adapter/webgpu-device';
|
|
8
5
|
|
|
9
6
|
// WEBGPU CLASSES (typically not accessed directly)
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
7
|
+
export {WebGPUBuffer} from './adapter/resources/webgpu-buffer';
|
|
8
|
+
export {WebGPUTexture} from './adapter/resources/webgpu-texture';
|
|
9
|
+
export {WebGPUSampler} from './adapter/resources/webgpu-sampler';
|
|
10
|
+
export {WebGPUShader} from './adapter/resources/webgpu-shader';
|
package/dist/bundle.d.ts
DELETED
package/dist/bundle.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,aAAa,KAAqB,CAAC"}
|
package/dist/bundle.js
DELETED
package/dist/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bundle.ts"],"names":["moduleExports","require","globalThis","luma","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,IAAX,GAAkBD,UAAU,CAACC,IAAX,IAAmB,EAArC;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,IAAzB,EAA+BH,aAA/B,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.luma = globalThis.luma || {};\nmodule.exports = Object.assign(globalThis.luma, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/init.d.ts
DELETED
package/dist/init.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":""}
|
package/dist/init.js
DELETED
package/dist/init.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/init.ts"],"names":["luma","WebGPUDevice","registerDevices"],"mappings":"AAAA,SAAQA,IAAR,QAAmB,cAAnB;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AAEAD,IAAI,CAACE,eAAL,CAAqB,CAACD,YAAD,CAArB","sourcesContent":["import {luma} from '@luma.gl/api';\nimport WebGPUDevice from './adapter/webgpu-device';\n\nluma.registerDevices([WebGPUDevice]);\n"],"file":"init.js"}
|
package/src/bundle.ts
DELETED
package/src/init.ts
DELETED