@luma.gl/webgpu 9.3.0-alpha.4 → 9.3.0-alpha.8
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/cpu-hotspot-profiler.d.ts +54 -0
- package/dist/adapter/helpers/cpu-hotspot-profiler.d.ts.map +1 -0
- package/dist/adapter/helpers/cpu-hotspot-profiler.js +26 -0
- package/dist/adapter/helpers/cpu-hotspot-profiler.js.map +1 -0
- package/dist/adapter/helpers/generate-mipmaps-webgpu.d.ts +7 -0
- package/dist/adapter/helpers/generate-mipmaps-webgpu.d.ts.map +1 -0
- package/dist/adapter/helpers/generate-mipmaps-webgpu.js +490 -0
- package/dist/adapter/helpers/generate-mipmaps-webgpu.js.map +1 -0
- package/dist/adapter/helpers/get-bind-group.d.ts +4 -6
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +31 -30
- package/dist/adapter/helpers/get-bind-group.js.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +3 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +17 -12
- 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 +1 -0
- package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js +19 -3
- package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-command-buffer.js +1 -1
- package/dist/adapter/resources/webgpu-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +7 -16
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +89 -32
- package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.d.ts +3 -3
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +30 -12
- package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +7 -9
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +30 -17
- package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-fence.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-fence.js +9 -1
- package/dist/adapter/resources/webgpu-fence.js.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +6 -0
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +16 -0
- package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-pipeline-layout.d.ts +1 -1
- package/dist/adapter/resources/webgpu-pipeline-layout.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-pipeline-layout.js +10 -16
- package/dist/adapter/resources/webgpu-pipeline-layout.js.map +1 -1
- package/dist/adapter/resources/webgpu-query-set.d.ts +33 -4
- package/dist/adapter/resources/webgpu-query-set.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-query-set.js +145 -4
- package/dist/adapter/resources/webgpu-query-set.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts +6 -3
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +78 -34
- package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +14 -10
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +56 -35
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.js +4 -0
- 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 +17 -1
- package/dist/adapter/resources/webgpu-shader.js.map +1 -1
- package/dist/adapter/resources/webgpu-texture-view.d.ts +6 -0
- package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture-view.js +47 -11
- package/dist/adapter/resources/webgpu-texture-view.js.map +1 -1
- package/dist/adapter/resources/webgpu-texture.d.ts +18 -5
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +148 -97
- package/dist/adapter/resources/webgpu-texture.js.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js.map +1 -1
- package/dist/adapter/webgpu-canvas-context.d.ts +2 -0
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +78 -19
- package/dist/adapter/webgpu-canvas-context.js.map +1 -1
- package/dist/adapter/webgpu-device.d.ts +10 -2
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +159 -13
- package/dist/adapter/webgpu-device.js.map +1 -1
- package/dist/adapter/webgpu-presentation-context.d.ts +25 -0
- package/dist/adapter/webgpu-presentation-context.d.ts.map +1 -0
- package/dist/adapter/webgpu-presentation-context.js +144 -0
- package/dist/adapter/webgpu-presentation-context.js.map +1 -0
- package/dist/dist.dev.js +3180 -1849
- package/dist/dist.min.js +168 -9
- package/dist/index.cjs +1640 -405
- package/dist/index.cjs.map +4 -4
- package/dist/wgsl/get-shader-layout-wgsl.d.ts.map +1 -1
- package/dist/wgsl/get-shader-layout-wgsl.js +8 -0
- package/dist/wgsl/get-shader-layout-wgsl.js.map +1 -1
- package/package.json +5 -5
- package/src/adapter/helpers/cpu-hotspot-profiler.ts +70 -0
- package/src/adapter/helpers/generate-mipmaps-webgpu.ts +583 -0
- package/src/adapter/helpers/get-bind-group.ts +42 -49
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +31 -12
- package/src/adapter/helpers/webgpu-parameters.ts +2 -0
- package/src/adapter/resources/webgpu-buffer.ts +18 -3
- package/src/adapter/resources/webgpu-command-buffer.ts +1 -1
- package/src/adapter/resources/webgpu-command-encoder.ts +129 -50
- package/src/adapter/resources/webgpu-compute-pass.ts +48 -13
- package/src/adapter/resources/webgpu-compute-pipeline.ts +49 -18
- package/src/adapter/resources/webgpu-fence.ts +11 -3
- package/src/adapter/resources/webgpu-framebuffer.ts +21 -0
- package/src/adapter/resources/webgpu-pipeline-layout.ts +16 -14
- package/src/adapter/resources/webgpu-query-set.ts +185 -9
- package/src/adapter/resources/webgpu-render-pass.ts +92 -40
- package/src/adapter/resources/webgpu-render-pipeline.ts +83 -44
- package/src/adapter/resources/webgpu-sampler.ts +5 -0
- package/src/adapter/resources/webgpu-shader.ts +16 -1
- package/src/adapter/resources/webgpu-texture-view.ts +51 -11
- package/src/adapter/resources/webgpu-texture.ts +198 -132
- package/src/adapter/resources/webgpu-vertex-array.ts +1 -1
- package/src/adapter/webgpu-canvas-context.ts +91 -26
- package/src/adapter/webgpu-device.ts +212 -17
- package/src/adapter/webgpu-presentation-context.ts +180 -0
- package/src/wgsl/get-shader-layout-wgsl.ts +9 -0
- package/dist/adapter/helpers/accessor-to-format.d.ts +0 -1
- package/dist/adapter/helpers/accessor-to-format.d.ts.map +0 -1
- package/dist/adapter/helpers/accessor-to-format.js +0 -105
- package/dist/adapter/helpers/accessor-to-format.js.map +0 -1
- package/src/adapter/helpers/accessor-to-format.ts +0 -104
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
|
-
import {
|
|
2
|
+
import { Texture, log, textureFormatDecoder } from '@luma.gl/core';
|
|
3
3
|
import { getWebGPUTextureFormat } from "../helpers/convert-texture-format.js";
|
|
4
4
|
import { WebGPUSampler } from "./webgpu-sampler.js";
|
|
5
5
|
import { WebGPUTextureView } from "./webgpu-texture-view.js";
|
|
@@ -9,9 +9,21 @@ export class WebGPUTexture extends Texture {
|
|
|
9
9
|
handle;
|
|
10
10
|
sampler;
|
|
11
11
|
view;
|
|
12
|
+
_allocatedByteLength = 0;
|
|
12
13
|
constructor(device, props) {
|
|
13
|
-
|
|
14
|
+
// WebGPU buffer copies use 256-byte row alignment. queue.writeTexture() can use tightly packed rows.
|
|
15
|
+
super(device, props, { byteAlignment: 256 });
|
|
14
16
|
this.device = device;
|
|
17
|
+
if (props.sampler instanceof WebGPUSampler) {
|
|
18
|
+
this.sampler = props.sampler;
|
|
19
|
+
}
|
|
20
|
+
else if (props.sampler === undefined) {
|
|
21
|
+
this.sampler = this.device.getDefaultSampler();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.sampler = new WebGPUSampler(this.device, props.sampler || {});
|
|
25
|
+
this.attachResource(this.sampler);
|
|
26
|
+
}
|
|
15
27
|
this.device.pushErrorScope('out-of-memory');
|
|
16
28
|
this.device.pushErrorScope('validation');
|
|
17
29
|
this.handle =
|
|
@@ -37,8 +49,6 @@ export class WebGPUTexture extends Texture {
|
|
|
37
49
|
this.device.reportError(new Error(`${this} out of memory: ${error.message}`), this)();
|
|
38
50
|
this.device.debug();
|
|
39
51
|
});
|
|
40
|
-
// Update props if external handle was supplied - used mainly by CanvasContext.getDefaultFramebuffer()
|
|
41
|
-
// TODO - Read all properties directly from the supplied handle?
|
|
42
52
|
if (this.props.handle) {
|
|
43
53
|
this.handle.label ||= this.id;
|
|
44
54
|
// @ts-expect-error readonly
|
|
@@ -46,10 +56,6 @@ export class WebGPUTexture extends Texture {
|
|
|
46
56
|
// @ts-expect-error readonly
|
|
47
57
|
this.height = this.handle.height;
|
|
48
58
|
}
|
|
49
|
-
this.sampler =
|
|
50
|
-
props.sampler instanceof WebGPUSampler
|
|
51
|
-
? props.sampler
|
|
52
|
-
: new WebGPUSampler(this.device, props.sampler || {});
|
|
53
59
|
this.view = new WebGPUTextureView(this.device, {
|
|
54
60
|
...this.props,
|
|
55
61
|
texture: this,
|
|
@@ -57,12 +63,30 @@ export class WebGPUTexture extends Texture {
|
|
|
57
63
|
// Note: arrayLayerCount controls the view of array textures, but does not apply to 3d texture depths
|
|
58
64
|
arrayLayerCount: this.dimension !== '3d' ? this.depth : 1
|
|
59
65
|
});
|
|
66
|
+
this.attachResource(this.view);
|
|
60
67
|
// Set initial data
|
|
61
68
|
// Texture base class strips out the data prop from this.props, so we need to handle it here
|
|
62
69
|
this._initializeData(props.data);
|
|
70
|
+
this._allocatedByteLength = this.getAllocatedByteLength();
|
|
71
|
+
if (!this.props.handle) {
|
|
72
|
+
this.trackAllocatedMemory(this._allocatedByteLength, 'Texture');
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.trackReferencedMemory(this._allocatedByteLength, 'Texture');
|
|
76
|
+
}
|
|
63
77
|
}
|
|
64
78
|
destroy() {
|
|
65
|
-
this.
|
|
79
|
+
if (this.destroyed) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!this.props.handle && this.handle) {
|
|
83
|
+
this.trackDeallocatedMemory('Texture');
|
|
84
|
+
this.handle.destroy();
|
|
85
|
+
}
|
|
86
|
+
else if (this.handle) {
|
|
87
|
+
this.trackDeallocatedReferencedMemory('Texture');
|
|
88
|
+
}
|
|
89
|
+
this.destroyResource();
|
|
66
90
|
// @ts-expect-error readonly
|
|
67
91
|
this.handle = null;
|
|
68
92
|
}
|
|
@@ -98,35 +122,6 @@ export class WebGPUTexture extends Texture {
|
|
|
98
122
|
// TODO - should these be clipped to the texture size minus x,y,z?
|
|
99
123
|
return { width: options.width, height: options.height };
|
|
100
124
|
}
|
|
101
|
-
copyImageData(options_) {
|
|
102
|
-
const { width, height, depth } = this;
|
|
103
|
-
const options = this._normalizeCopyImageDataOptions(options_);
|
|
104
|
-
this.device.pushErrorScope('validation');
|
|
105
|
-
this.device.handle.queue.writeTexture(
|
|
106
|
-
// destination: GPUImageCopyTexture
|
|
107
|
-
{
|
|
108
|
-
// texture subresource
|
|
109
|
-
texture: this.handle,
|
|
110
|
-
mipLevel: options.mipLevel,
|
|
111
|
-
aspect: options.aspect,
|
|
112
|
-
// origin to write to
|
|
113
|
-
origin: [options.x, options.y, options.z]
|
|
114
|
-
},
|
|
115
|
-
// data
|
|
116
|
-
options.data,
|
|
117
|
-
// dataLayout: GPUImageDataLayout
|
|
118
|
-
{
|
|
119
|
-
offset: options.byteOffset,
|
|
120
|
-
bytesPerRow: options.bytesPerRow,
|
|
121
|
-
rowsPerImage: options.rowsPerImage
|
|
122
|
-
},
|
|
123
|
-
// size: GPUExtent3D - extents of the content to write
|
|
124
|
-
[width, height, depth]);
|
|
125
|
-
this.device.popErrorScope((error) => {
|
|
126
|
-
this.device.reportError(new Error(`copyImageData: ${error.message}`), this)();
|
|
127
|
-
this.device.debug();
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
125
|
generateMipmapsWebGL() {
|
|
131
126
|
log.warn(`${this}: generateMipmaps not supported in WebGPU`)();
|
|
132
127
|
}
|
|
@@ -138,71 +133,63 @@ export class WebGPUTexture extends Texture {
|
|
|
138
133
|
};
|
|
139
134
|
}
|
|
140
135
|
readBuffer(options = {}, buffer) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// Record commands to copy from the texture to the buffer.
|
|
136
|
+
if (!buffer) {
|
|
137
|
+
throw new Error(`${this} readBuffer requires a destination buffer`);
|
|
138
|
+
}
|
|
139
|
+
const { x, y, z, width, height, depthOrArrayLayers, mipLevel, aspect } = this._getSupportedColorReadOptions(options);
|
|
140
|
+
const byteOffset = options.byteOffset ?? 0;
|
|
141
|
+
const layout = this.computeMemoryLayout({ width, height, depthOrArrayLayers, mipLevel });
|
|
142
|
+
const { byteLength } = layout;
|
|
143
|
+
if (buffer.byteLength < byteOffset + byteLength) {
|
|
144
|
+
throw new Error(`${this} readBuffer target is too small (${buffer.byteLength} < ${byteOffset + byteLength})`);
|
|
145
|
+
}
|
|
152
146
|
const gpuDevice = this.device.handle;
|
|
153
147
|
this.device.pushErrorScope('validation');
|
|
154
148
|
const commandEncoder = gpuDevice.createCommandEncoder();
|
|
155
|
-
|
|
156
|
-
// source
|
|
157
|
-
{
|
|
158
|
-
texture: this.handle,
|
|
159
|
-
origin: { x, y, z },
|
|
160
|
-
// origin: [options.x, options.y, 0], // options.depth],
|
|
161
|
-
mipLevel,
|
|
162
|
-
aspect
|
|
163
|
-
// colorSpace: options.colorSpace,
|
|
164
|
-
// premultipliedAlpha: options.premultipliedAlpha
|
|
165
|
-
},
|
|
166
|
-
// destination
|
|
167
|
-
{
|
|
168
|
-
buffer: gpuReadBuffer,
|
|
169
|
-
offset: 0,
|
|
170
|
-
bytesPerRow,
|
|
171
|
-
rowsPerImage
|
|
172
|
-
},
|
|
173
|
-
// copy size
|
|
174
|
-
{
|
|
175
|
-
width,
|
|
176
|
-
height,
|
|
177
|
-
depthOrArrayLayers
|
|
178
|
-
});
|
|
179
|
-
// Submit the command.
|
|
149
|
+
this.copyToBuffer(commandEncoder, { x, y, z, width, height, depthOrArrayLayers, mipLevel, aspect, byteOffset }, buffer);
|
|
180
150
|
const commandBuffer = commandEncoder.finish();
|
|
181
151
|
this.device.handle.queue.submit([commandBuffer]);
|
|
182
152
|
this.device.popErrorScope((error) => {
|
|
183
153
|
this.device.reportError(new Error(`${this} readBuffer: ${error.message}`), this)();
|
|
184
154
|
this.device.debug();
|
|
185
155
|
});
|
|
186
|
-
return
|
|
156
|
+
return buffer;
|
|
187
157
|
}
|
|
188
158
|
async readDataAsync(options = {}) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
159
|
+
throw new Error(`${this} readDataAsync is deprecated; use readBuffer() with an explicit destination buffer or DynamicTexture.readAsync()`);
|
|
160
|
+
}
|
|
161
|
+
copyToBuffer(commandEncoder, options = {}, buffer) {
|
|
162
|
+
const { byteOffset = 0, bytesPerRow: requestedBytesPerRow, rowsPerImage: requestedRowsPerImage, ...textureReadOptions } = options;
|
|
163
|
+
const { x, y, z, width, height, depthOrArrayLayers, mipLevel, aspect } = this._getSupportedColorReadOptions(textureReadOptions);
|
|
164
|
+
const layout = this.computeMemoryLayout({ width, height, depthOrArrayLayers, mipLevel });
|
|
165
|
+
const effectiveBytesPerRow = requestedBytesPerRow ?? layout.bytesPerRow;
|
|
166
|
+
const effectiveRowsPerImage = requestedRowsPerImage ?? layout.rowsPerImage;
|
|
167
|
+
const webgpuBuffer = buffer;
|
|
168
|
+
commandEncoder.copyTextureToBuffer({
|
|
169
|
+
texture: this.handle,
|
|
170
|
+
origin: { x, y, z },
|
|
171
|
+
mipLevel,
|
|
172
|
+
aspect
|
|
173
|
+
}, {
|
|
174
|
+
buffer: webgpuBuffer.handle,
|
|
175
|
+
offset: byteOffset,
|
|
176
|
+
bytesPerRow: effectiveBytesPerRow,
|
|
177
|
+
rowsPerImage: effectiveRowsPerImage
|
|
178
|
+
}, {
|
|
179
|
+
width,
|
|
180
|
+
height,
|
|
181
|
+
depthOrArrayLayers
|
|
182
|
+
});
|
|
193
183
|
}
|
|
194
|
-
writeBuffer(buffer,
|
|
195
|
-
const
|
|
196
|
-
const
|
|
197
|
-
// Get the data on the CPU.
|
|
198
|
-
// await buffer.mapAndReadAsync();
|
|
199
|
-
const { bytesPerRow, rowsPerImage } = layout;
|
|
184
|
+
writeBuffer(buffer, options_ = {}) {
|
|
185
|
+
const options = this._normalizeTextureWriteOptions(options_);
|
|
186
|
+
const { x, y, z, width, height, depthOrArrayLayers, mipLevel, aspect, byteOffset, bytesPerRow, rowsPerImage } = options;
|
|
200
187
|
const gpuDevice = this.device.handle;
|
|
201
188
|
this.device.pushErrorScope('validation');
|
|
202
189
|
const commandEncoder = gpuDevice.createCommandEncoder();
|
|
203
190
|
commandEncoder.copyBufferToTexture({
|
|
204
191
|
buffer: buffer.handle,
|
|
205
|
-
offset:
|
|
192
|
+
offset: byteOffset,
|
|
206
193
|
bytesPerRow,
|
|
207
194
|
rowsPerImage
|
|
208
195
|
}, {
|
|
@@ -218,32 +205,96 @@ export class WebGPUTexture extends Texture {
|
|
|
218
205
|
this.device.debug();
|
|
219
206
|
});
|
|
220
207
|
}
|
|
221
|
-
writeData(data,
|
|
208
|
+
writeData(data, options_ = {}) {
|
|
222
209
|
const device = this.device;
|
|
223
|
-
const
|
|
224
|
-
const
|
|
210
|
+
const options = this._normalizeTextureWriteOptions(options_);
|
|
211
|
+
const { x, y, z, width, height, depthOrArrayLayers, mipLevel, aspect, byteOffset } = options;
|
|
212
|
+
const source = data;
|
|
213
|
+
const formatInfo = this.device.getTextureFormatInfo(this.format);
|
|
214
|
+
// queue.writeTexture() defaults to tightly packed rows, unlike WebGPU buffer copy paths.
|
|
215
|
+
const packedSourceLayout = textureFormatDecoder.computeMemoryLayout({
|
|
225
216
|
format: this.format,
|
|
226
|
-
width
|
|
227
|
-
height
|
|
228
|
-
depth:
|
|
229
|
-
byteAlignment:
|
|
217
|
+
width,
|
|
218
|
+
height,
|
|
219
|
+
depth: depthOrArrayLayers,
|
|
220
|
+
byteAlignment: 1
|
|
230
221
|
});
|
|
231
|
-
const
|
|
222
|
+
const bytesPerRow = options_.bytesPerRow ?? packedSourceLayout.bytesPerRow;
|
|
223
|
+
const rowsPerImage = options_.rowsPerImage ?? packedSourceLayout.rowsPerImage;
|
|
224
|
+
let copyWidth = width;
|
|
225
|
+
let copyHeight = height;
|
|
226
|
+
if (formatInfo.compressed) {
|
|
227
|
+
const blockWidth = formatInfo.blockWidth || 1;
|
|
228
|
+
const blockHeight = formatInfo.blockHeight || 1;
|
|
229
|
+
copyWidth = Math.ceil(width / blockWidth) * blockWidth;
|
|
230
|
+
copyHeight = Math.ceil(height / blockHeight) * blockHeight;
|
|
231
|
+
}
|
|
232
232
|
this.device.pushErrorScope('validation');
|
|
233
233
|
device.handle.queue.writeTexture({
|
|
234
234
|
texture: this.handle,
|
|
235
235
|
mipLevel,
|
|
236
236
|
aspect,
|
|
237
237
|
origin: { x, y, z }
|
|
238
|
-
},
|
|
239
|
-
offset:
|
|
238
|
+
}, source, {
|
|
239
|
+
offset: byteOffset,
|
|
240
240
|
bytesPerRow,
|
|
241
241
|
rowsPerImage
|
|
242
|
-
}, { width, height, depthOrArrayLayers });
|
|
242
|
+
}, { width: copyWidth, height: copyHeight, depthOrArrayLayers });
|
|
243
243
|
this.device.popErrorScope((error) => {
|
|
244
244
|
this.device.reportError(new Error(`${this} writeData: ${error.message}`), this)();
|
|
245
245
|
this.device.debug();
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Internal-only hook for the cached CanvasContext/PresentationContext swapchain path.
|
|
250
|
+
* Rebinds this handle-backed texture wrapper to the current per-frame canvas texture
|
|
251
|
+
* without allocating a new luma.gl Texture or TextureView wrapper.
|
|
252
|
+
*/
|
|
253
|
+
_reinitialize(handle, props) {
|
|
254
|
+
const nextWidth = props?.width ?? handle.width ?? this.width;
|
|
255
|
+
const nextHeight = props?.height ?? handle.height ?? this.height;
|
|
256
|
+
const nextDepth = props?.depth ?? this.depth;
|
|
257
|
+
const nextFormat = props?.format ?? this.format;
|
|
258
|
+
const allocationMayHaveChanged = nextWidth !== this.width ||
|
|
259
|
+
nextHeight !== this.height ||
|
|
260
|
+
nextDepth !== this.depth ||
|
|
261
|
+
nextFormat !== this.format;
|
|
262
|
+
handle.label ||= this.id;
|
|
263
|
+
// @ts-expect-error readonly
|
|
264
|
+
this.handle = handle;
|
|
265
|
+
// @ts-expect-error readonly
|
|
266
|
+
this.width = nextWidth;
|
|
267
|
+
// @ts-expect-error readonly
|
|
268
|
+
this.height = nextHeight;
|
|
269
|
+
if (props?.depth !== undefined) {
|
|
270
|
+
// @ts-expect-error readonly
|
|
271
|
+
this.depth = nextDepth;
|
|
272
|
+
}
|
|
273
|
+
if (props?.format !== undefined) {
|
|
274
|
+
// @ts-expect-error readonly
|
|
275
|
+
this.format = nextFormat;
|
|
276
|
+
}
|
|
277
|
+
this.props.handle = handle;
|
|
278
|
+
if (props?.width !== undefined) {
|
|
279
|
+
this.props.width = props.width;
|
|
280
|
+
}
|
|
281
|
+
if (props?.height !== undefined) {
|
|
282
|
+
this.props.height = props.height;
|
|
283
|
+
}
|
|
284
|
+
if (props?.depth !== undefined) {
|
|
285
|
+
this.props.depth = props.depth;
|
|
286
|
+
}
|
|
287
|
+
if (props?.format !== undefined) {
|
|
288
|
+
this.props.format = props.format;
|
|
289
|
+
}
|
|
290
|
+
if (allocationMayHaveChanged) {
|
|
291
|
+
const nextAllocation = this.getAllocatedByteLength();
|
|
292
|
+
if (nextAllocation !== this._allocatedByteLength) {
|
|
293
|
+
this._allocatedByteLength = nextAllocation;
|
|
294
|
+
this.trackReferencedMemory(nextAllocation, 'Texture');
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
this.view._reinitialize(this);
|
|
298
|
+
}
|
|
248
299
|
}
|
|
249
300
|
//# sourceMappingURL=webgpu-texture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-texture.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,OAAO,EAQL,MAAM,EACN,OAAO,EACP,GAAG,EACH,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,sBAAsB,EAAC,6CAA0C;AAEzE,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAC/C,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AAExD,iEAAiE;AACjE,MAAM,OAAO,aAAc,S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VertexArray extends VertexArray {
|
|
8
8
|
get [Symbol.toStringTag]() {
|
|
9
|
-
return '
|
|
9
|
+
return 'VertexArray';
|
|
10
10
|
}
|
|
11
11
|
device;
|
|
12
12
|
/** Vertex Array is just a helper class under WebGPU */
|
|
@@ -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,
|
|
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,aAAa,CAAC;IACvB,CAAC;IAEQ,MAAM,CAAe;IAC9B,uDAAuD;IAC9C,MAAM,GAAG,IAAI,CAAC;IAEvB,uBAAuB;IACvB,YAAY,MAAoB,EAAE,KAAuB;QACvD,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEQ,OAAO,KAAU,CAAC;IAE3B;;;OAGG;IACH,cAAc,CAAC,MAAqB;QAClC,8FAA8F;QAC9F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IAC9E,CAAC;IAED,qBAAqB;IAErB;;;OAGG;IACH,MAAM,CAAC,gCAAgC,CAAC,MAAc;QACpD,OAAO,UAAU,EAAE,KAAK,QAAQ,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -11,7 +11,9 @@ import { WebGPUTexture } from "./resources/webgpu-texture.js";
|
|
|
11
11
|
export declare class WebGPUCanvasContext extends CanvasContext {
|
|
12
12
|
readonly device: WebGPUDevice;
|
|
13
13
|
readonly handle: GPUCanvasContext;
|
|
14
|
+
private colorAttachment;
|
|
14
15
|
private depthStencilAttachment;
|
|
16
|
+
private framebuffer;
|
|
15
17
|
get [Symbol.toStringTag](): string;
|
|
16
18
|
constructor(device: WebGPUDevice, adapter: GPUAdapter, props: CanvasContextProps);
|
|
17
19
|
/** Destroy any textures produced while configured and remove the context configuration. */
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAGzD;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAA8B;IAC5D,OAAO,CAAC,WAAW,CAAkC;IAErD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;gBAEW,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB;IAgBhF,2FAA2F;IAClF,OAAO,IAAI,IAAI;IAmBxB,8DAA8D;IAC9D,gBAAgB,IAAI,IAAI;IAmBxB,0EAA0E;IAC1E,sBAAsB,CACpB,OAAO,GAAE;QAAC,kBAAkB,CAAC,EAAE,yBAAyB,GAAG,KAAK,CAAA;KAE/D,GACA,iBAAiB;IAqDpB,mEAAmE;IACnE,kBAAkB,IAAI,aAAa;IA6BnC,8FAA8F;IAC9F,6BAA6B,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,aAAa;CAkB5F"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { CanvasContext, Texture, log } from '@luma.gl/core';
|
|
5
5
|
import { WebGPUFramebuffer } from "./resources/webgpu-framebuffer.js";
|
|
6
|
+
import { getCpuHotspotProfiler, getTimestamp } from "./helpers/cpu-hotspot-profiler.js";
|
|
6
7
|
/**
|
|
7
8
|
* Holds a WebGPU Canvas Context
|
|
8
9
|
* The primary job of the CanvasContext is to generate textures for rendering into the current canvas
|
|
@@ -11,7 +12,9 @@ import { WebGPUFramebuffer } from "./resources/webgpu-framebuffer.js";
|
|
|
11
12
|
export class WebGPUCanvasContext extends CanvasContext {
|
|
12
13
|
device;
|
|
13
14
|
handle;
|
|
15
|
+
colorAttachment = null;
|
|
14
16
|
depthStencilAttachment = null;
|
|
17
|
+
framebuffer = null;
|
|
15
18
|
get [Symbol.toStringTag]() {
|
|
16
19
|
return 'WebGPUCanvasContext';
|
|
17
20
|
}
|
|
@@ -26,9 +29,22 @@ export class WebGPUCanvasContext extends CanvasContext {
|
|
|
26
29
|
// Base class constructor cannot access derived methods/fields, so we need to call these functions in the subclass constructor
|
|
27
30
|
this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
|
|
28
31
|
this._configureDevice();
|
|
32
|
+
this._startObservers();
|
|
29
33
|
}
|
|
30
34
|
/** Destroy any textures produced while configured and remove the context configuration. */
|
|
31
35
|
destroy() {
|
|
36
|
+
if (this.framebuffer) {
|
|
37
|
+
this.framebuffer.destroy();
|
|
38
|
+
this.framebuffer = null;
|
|
39
|
+
}
|
|
40
|
+
if (this.colorAttachment) {
|
|
41
|
+
this.colorAttachment.destroy();
|
|
42
|
+
this.colorAttachment = null;
|
|
43
|
+
}
|
|
44
|
+
if (this.depthStencilAttachment) {
|
|
45
|
+
this.depthStencilAttachment.destroy();
|
|
46
|
+
this.depthStencilAttachment = null;
|
|
47
|
+
}
|
|
32
48
|
this.handle.unconfigure();
|
|
33
49
|
super.destroy();
|
|
34
50
|
}
|
|
@@ -48,45 +64,88 @@ export class WebGPUCanvasContext extends CanvasContext {
|
|
|
48
64
|
colorSpace: this.props.colorSpace,
|
|
49
65
|
alphaMode: this.props.alphaMode
|
|
50
66
|
});
|
|
67
|
+
this._createDepthStencilAttachment(this.device.preferredDepthFormat);
|
|
51
68
|
}
|
|
52
69
|
/** Update framebuffer with properly resized "swap chain" texture views */
|
|
53
70
|
_getCurrentFramebuffer(options = {
|
|
54
71
|
depthStencilFormat: 'depth24plus'
|
|
55
72
|
}) {
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
this.drawingBufferWidth = currentColorAttachment.width;
|
|
63
|
-
this.drawingBufferHeight = currentColorAttachment.height;
|
|
64
|
-
log.log(1, `${this}: Resized to compensate for initial canvas size mismatch ${oldWidth}x${oldHeight} => ${this.drawingBufferWidth}x${this.drawingBufferHeight}px`)();
|
|
73
|
+
const profiler = getCpuHotspotProfiler(this.device);
|
|
74
|
+
const startTime = profiler ? getTimestamp() : 0;
|
|
75
|
+
if (profiler) {
|
|
76
|
+
profiler.framebufferAcquireCount = (profiler.framebufferAcquireCount || 0) + 1;
|
|
77
|
+
profiler.activeDefaultFramebufferAcquireDepth =
|
|
78
|
+
(profiler.activeDefaultFramebufferAcquireDepth || 0) + 1;
|
|
65
79
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
80
|
+
try {
|
|
81
|
+
// Wrap the current canvas context texture in a luma.gl texture
|
|
82
|
+
const currentColorAttachment = this._getCurrentTexture();
|
|
83
|
+
// TODO - temporary debug code
|
|
84
|
+
if (currentColorAttachment.width !== this.drawingBufferWidth ||
|
|
85
|
+
currentColorAttachment.height !== this.drawingBufferHeight) {
|
|
86
|
+
const [oldWidth, oldHeight] = this.getDrawingBufferSize();
|
|
87
|
+
this.drawingBufferWidth = currentColorAttachment.width;
|
|
88
|
+
this.drawingBufferHeight = currentColorAttachment.height;
|
|
89
|
+
log.log(1, `${this}: Resized to compensate for initial canvas size mismatch ${oldWidth}x${oldHeight} => ${this.drawingBufferWidth}x${this.drawingBufferHeight}px`)();
|
|
90
|
+
}
|
|
91
|
+
// Resize the depth stencil attachment
|
|
92
|
+
if (options?.depthStencilFormat) {
|
|
93
|
+
this._createDepthStencilAttachment(options?.depthStencilFormat);
|
|
94
|
+
}
|
|
95
|
+
this.framebuffer ||= new WebGPUFramebuffer(this.device, {
|
|
96
|
+
id: `${this.id}#framebuffer`,
|
|
97
|
+
colorAttachments: [currentColorAttachment],
|
|
98
|
+
depthStencilAttachment: null
|
|
99
|
+
});
|
|
100
|
+
this.framebuffer._reinitialize(currentColorAttachment.view, options?.depthStencilFormat ? this.depthStencilAttachment?.view || null : null);
|
|
101
|
+
return this.framebuffer;
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
if (profiler) {
|
|
105
|
+
profiler.activeDefaultFramebufferAcquireDepth =
|
|
106
|
+
(profiler.activeDefaultFramebufferAcquireDepth || 1) - 1;
|
|
107
|
+
profiler.framebufferAcquireTimeMs =
|
|
108
|
+
(profiler.framebufferAcquireTimeMs || 0) + (getTimestamp() - startTime);
|
|
109
|
+
}
|
|
69
110
|
}
|
|
70
|
-
return new WebGPUFramebuffer(this.device, {
|
|
71
|
-
colorAttachments: [currentColorAttachment],
|
|
72
|
-
depthStencilAttachment: this.depthStencilAttachment
|
|
73
|
-
});
|
|
74
111
|
}
|
|
75
112
|
// PRIMARY METHODS
|
|
76
113
|
/** Wrap the current canvas context texture in a luma.gl texture */
|
|
77
114
|
_getCurrentTexture() {
|
|
115
|
+
const profiler = getCpuHotspotProfiler(this.device);
|
|
116
|
+
const currentTextureStartTime = profiler ? getTimestamp() : 0;
|
|
78
117
|
const handle = this.handle.getCurrentTexture();
|
|
79
|
-
|
|
80
|
-
|
|
118
|
+
if (profiler) {
|
|
119
|
+
profiler.currentTextureAcquireCount = (profiler.currentTextureAcquireCount || 0) + 1;
|
|
120
|
+
profiler.currentTextureAcquireTimeMs =
|
|
121
|
+
(profiler.currentTextureAcquireTimeMs || 0) + (getTimestamp() - currentTextureStartTime);
|
|
122
|
+
}
|
|
123
|
+
if (!this.colorAttachment) {
|
|
124
|
+
this.colorAttachment = this.device.createTexture({
|
|
125
|
+
id: `${this.id}#color-texture`,
|
|
126
|
+
handle,
|
|
127
|
+
format: this.device.preferredColorFormat,
|
|
128
|
+
width: handle.width,
|
|
129
|
+
height: handle.height
|
|
130
|
+
});
|
|
131
|
+
return this.colorAttachment;
|
|
132
|
+
}
|
|
133
|
+
this.colorAttachment._reinitialize(handle, {
|
|
81
134
|
handle,
|
|
82
135
|
format: this.device.preferredColorFormat,
|
|
83
136
|
width: handle.width,
|
|
84
137
|
height: handle.height
|
|
85
138
|
});
|
|
139
|
+
return this.colorAttachment;
|
|
86
140
|
}
|
|
87
141
|
/** We build render targets on demand (i.e. not when size changes but when about to render) */
|
|
88
142
|
_createDepthStencilAttachment(depthStencilFormat) {
|
|
89
|
-
|
|
143
|
+
const needsNewDepthStencilAttachment = !this.depthStencilAttachment ||
|
|
144
|
+
this.depthStencilAttachment.width !== this.drawingBufferWidth ||
|
|
145
|
+
this.depthStencilAttachment.height !== this.drawingBufferHeight ||
|
|
146
|
+
this.depthStencilAttachment.format !== depthStencilFormat;
|
|
147
|
+
if (needsNewDepthStencilAttachment) {
|
|
148
|
+
this.depthStencilAttachment?.destroy();
|
|
90
149
|
this.depthStencilAttachment = this.device.createTexture({
|
|
91
150
|
id: `${this.id}#depth-stencil-texture`,
|
|
92
151
|
usage: Texture.RENDER_ATTACHMENT,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-canvas-context.js","sourceRoot":"","sources":["../../src/adapter/webgpu-canvas-context.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAMpC,OAAO,EAAC,aAAa,EAAE,OAAO,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAC,iBAAiB,EAAC,0CAAuC;
|
|
1
|
+
{"version":3,"file":"webgpu-canvas-context.js","sourceRoot":"","sources":["../../src/adapter/webgpu-canvas-context.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAMpC,OAAO,EAAC,aAAa,EAAE,OAAO,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAC,iBAAiB,EAAC,0CAAuC;AAEjE,OAAO,EAAC,qBAAqB,EAAE,YAAY,EAAC,0CAAuC;AAEnF;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAC3C,MAAM,CAAe;IACrB,MAAM,CAAmB;IAE1B,eAAe,GAAyB,IAAI,CAAC;IAC7C,sBAAsB,GAAyB,IAAI,CAAC;IACpD,WAAW,GAA6B,IAA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AAC;IAED,8FAA8F;IAC9F,6BAA6B,CAAC,kBAA6C;QACzE,MAAM,8BAA8B,GAClC,CAAC,IAAI,CAAC,sBAAsB;YAC5B,IAAI,CAAC,sBAAsB,CAAC,KAAK,KAAK,IAAI,CAAC,kBAAkB;YAC7D,IAAI,CAAC,sBAAsB,CAAC,MAAM,KAAK,IAAI,CAAC,mBAAmB;YAC/D,IAAI,CAAC,sBAAsB,CAAC,MAAM,KAAK,kBAAkB,CAAC;QAC5D,IAAI,8BAA8B,EAAE,CAAC;YACnC,IAAI,CAAC,sBAAsB,EAAE,OAAO,EAAE,CAAC;YACvC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;gBACtD,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,wBAAwB;gBACtC,KAAK,EAAE,OAAO,CAAC,iBAAiB;gBAChC,MAAM,EAAE,kBAAkB;gBAC1B,KAAK,EAAE,IAAI,CAAC,kBAAkB;gBAC9B,MAAM,EAAE,IAAI,CAAC,mBAAmB;aACjC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,sBAAuB,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeviceInfo, DeviceLimits, DeviceTextureFormatCapabilities, VertexFormat, CanvasContextProps, BufferProps, SamplerProps, ShaderProps, TextureProps, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipelineProps, VertexArrayProps, TransformFeedback, TransformFeedbackProps, QuerySet, QuerySetProps, DeviceProps, CommandEncoderProps, PipelineLayoutProps } from '@luma.gl/core';
|
|
1
|
+
import type { Bindings, ComputePipeline, ComputeShaderLayout, DeviceInfo, DeviceLimits, DeviceTextureFormatCapabilities, VertexFormat, CanvasContextProps, PresentationContextProps, PresentationContext, BufferProps, SamplerProps, ShaderProps, TextureProps, Texture, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipelineProps, VertexArrayProps, TransformFeedback, TransformFeedbackProps, QuerySet, QuerySetProps, DeviceProps, CommandEncoderProps, PipelineLayoutProps, RenderPipeline, ShaderLayout } from '@luma.gl/core';
|
|
2
2
|
import { Device, DeviceFeatures } from '@luma.gl/core';
|
|
3
3
|
import { WebGPUBuffer } from "./resources/webgpu-buffer.js";
|
|
4
4
|
import { WebGPUTexture } from "./resources/webgpu-texture.js";
|
|
@@ -33,19 +33,21 @@ export declare class WebGPUDevice extends Device {
|
|
|
33
33
|
}>;
|
|
34
34
|
canvasContext: WebGPUCanvasContext | null;
|
|
35
35
|
private _isLost;
|
|
36
|
+
private _defaultSampler;
|
|
36
37
|
commandEncoder: WebGPUCommandEncoder;
|
|
37
38
|
get [Symbol.toStringTag](): string;
|
|
38
39
|
toString(): string;
|
|
39
40
|
constructor(props: DeviceProps, device: GPUDevice, adapter: GPUAdapter, adapterInfo: GPUAdapterInfo);
|
|
40
41
|
destroy(): void;
|
|
41
42
|
get isLost(): boolean;
|
|
42
|
-
getShaderLayout(source: string):
|
|
43
|
+
getShaderLayout(source: string): ShaderLayout;
|
|
43
44
|
isVertexFormatSupported(format: VertexFormat): boolean;
|
|
44
45
|
createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WebGPUBuffer;
|
|
45
46
|
createTexture(props: TextureProps): WebGPUTexture;
|
|
46
47
|
createExternalTexture(props: ExternalTextureProps): WebGPUExternalTexture;
|
|
47
48
|
createShader(props: ShaderProps): WebGPUShader;
|
|
48
49
|
createSampler(props: SamplerProps): WebGPUSampler;
|
|
50
|
+
getDefaultSampler(): WebGPUSampler;
|
|
49
51
|
createRenderPipeline(props: RenderPipelineProps): WebGPURenderPipeline;
|
|
50
52
|
createFramebuffer(props: FramebufferProps): WebGPUFramebuffer;
|
|
51
53
|
createComputePipeline(props: ComputePipelineProps): WebGPUComputePipeline;
|
|
@@ -55,11 +57,17 @@ export declare class WebGPUDevice extends Device {
|
|
|
55
57
|
createQuerySet(props: QuerySetProps): QuerySet;
|
|
56
58
|
createFence(): WebGPUFence;
|
|
57
59
|
createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext;
|
|
60
|
+
createPresentationContext(props?: PresentationContextProps): PresentationContext;
|
|
58
61
|
createPipelineLayout(props: PipelineLayoutProps): WebGPUPipelineLayout;
|
|
62
|
+
generateMipmapsWebGPU(texture: Texture): void;
|
|
63
|
+
_createBindGroupLayoutWebGPU(pipeline: RenderPipeline | ComputePipeline, group: number): GPUBindGroupLayout;
|
|
64
|
+
_createBindGroupWebGPU(bindGroupLayout: unknown, shaderLayout: ShaderLayout | ComputeShaderLayout, bindings: Bindings, group: number): GPUBindGroup | null;
|
|
59
65
|
submit(commandBuffer?: WebGPUCommandBuffer): void;
|
|
66
|
+
private _finalizeDefaultCommandEncoderForSubmit;
|
|
60
67
|
pushErrorScope(scope: 'validation' | 'out-of-memory'): void;
|
|
61
68
|
popErrorScope(handler: (error: GPUError) => void): void;
|
|
62
69
|
protected _getInfo(): DeviceInfo;
|
|
70
|
+
shouldIgnoreDroppedInstanceError(error: unknown, operation?: string): boolean;
|
|
63
71
|
protected _getFeatures(): DeviceFeatures;
|
|
64
72
|
_getDeviceSpecificTextureFormatCapabilities(capabilities: DeviceTextureFormatCapabilities): DeviceTextureFormatCapabilities;
|
|
65
73
|
}
|