@luma.gl/webgpu 9.0.0-beta.5 → 9.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/helpers/accessor-to-format.js +4 -1
- package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
- package/dist/adapter/helpers/convert-texture-format.js +3 -0
- package/dist/adapter/helpers/generate-mipmaps.d.ts.map +1 -1
- package/dist/adapter/helpers/generate-mipmaps.js +22 -13
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +3 -0
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +9 -2
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +3 -0
- package/dist/adapter/resources/webgpu-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js +16 -9
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +7 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +8 -0
- package/dist/adapter/resources/webgpu-compute-pass.d.ts +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +21 -4
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +14 -10
- 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 +12 -7
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +3 -0
- package/dist/adapter/resources/webgpu-query-set.d.ts +17 -0
- package/dist/adapter/resources/webgpu-query-set.d.ts.map +1 -0
- package/dist/adapter/resources/webgpu-query-set.js +25 -0
- package/dist/adapter/resources/webgpu-render-pass.d.ts +4 -2
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +27 -9
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +3 -4
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +25 -33
- package/dist/adapter/resources/webgpu-sampler.d.ts +1 -1
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.js +4 -3
- package/dist/adapter/resources/webgpu-texture-view.d.ts +20 -0
- package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/webgpu-texture-view.js +32 -0
- package/dist/adapter/resources/webgpu-texture.d.ts +5 -4
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +18 -15
- package/dist/adapter/resources/webgpu-vertex-array.d.ts +7 -9
- package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js +11 -13
- package/dist/adapter/webgpu-canvas-context.d.ts +3 -3
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +6 -4
- package/dist/adapter/webgpu-device.d.ts +24 -21
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +74 -57
- package/dist/dist.dev.js +248 -171
- package/dist/index.cjs +233 -161
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist.min.js +1 -1
- package/package.json +2 -2
- package/src/adapter/helpers/accessor-to-format.ts +5 -1
- package/src/adapter/helpers/convert-texture-format.ts +4 -1
- package/src/adapter/helpers/generate-mipmaps.ts +37 -26
- package/src/adapter/helpers/get-bind-group.ts +8 -2
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +12 -4
- package/src/adapter/helpers/webgpu-parameters.ts +79 -15
- package/src/adapter/resources/webgpu-buffer.ts +21 -10
- package/src/adapter/resources/webgpu-command-encoder.ts +24 -9
- package/src/adapter/resources/webgpu-compute-pass.ts +26 -8
- package/src/adapter/resources/webgpu-compute-pipeline.ts +15 -10
- package/src/adapter/resources/webgpu-external-texture.ts +12 -6
- package/src/adapter/resources/webgpu-framebuffer.ts +4 -0
- package/src/adapter/resources/webgpu-query-set.ts +35 -0
- package/src/adapter/resources/webgpu-render-pass.ts +37 -14
- package/src/adapter/resources/webgpu-render-pipeline.ts +30 -41
- package/src/adapter/resources/webgpu-sampler.ts +1 -1
- package/src/adapter/resources/webgpu-shader.ts +5 -4
- package/src/adapter/resources/webgpu-texture-view.ts +43 -0
- package/src/adapter/resources/webgpu-texture.ts +23 -19
- package/src/adapter/resources/webgpu-vertex-array.ts +25 -20
- package/src/adapter/webgpu-canvas-context.ts +8 -4
- package/src/adapter/webgpu-device.ts +90 -58
- package/src/index.ts +2 -1
- package/src/adapter/resources/webgpu-query.ts +0 -43
- package/src/adapter/webgpu-types.ts +0 -0
- package/src/glsl/glsllang.ts +0 -14
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@ __export(dist_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(dist_exports);
|
|
34
34
|
|
|
35
35
|
// dist/adapter/webgpu-device.js
|
|
36
|
-
var
|
|
36
|
+
var import_core17 = require("@luma.gl/core");
|
|
37
37
|
|
|
38
38
|
// dist/adapter/resources/webgpu-buffer.js
|
|
39
39
|
var import_core = require("@luma.gl/core");
|
|
@@ -73,7 +73,10 @@ var WebGPUBuffer = class extends import_core.Buffer {
|
|
|
73
73
|
this.device.handle.queue.writeBuffer(this.handle, byteOffset, data.buffer, data.byteOffset, data.byteLength);
|
|
74
74
|
}
|
|
75
75
|
async readAsync(byteOffset = 0, byteLength = this.byteLength) {
|
|
76
|
-
const tempBuffer = new WebGPUBuffer(this.device, {
|
|
76
|
+
const tempBuffer = new WebGPUBuffer(this.device, {
|
|
77
|
+
usage: import_core.Buffer.MAP_READ | import_core.Buffer.COPY_DST,
|
|
78
|
+
byteLength
|
|
79
|
+
});
|
|
77
80
|
const commandEncoder = this.device.handle.createCommandEncoder();
|
|
78
81
|
commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);
|
|
79
82
|
this.device.handle.queue.submit([commandEncoder.finish()]);
|
|
@@ -100,7 +103,7 @@ var WebGPUBuffer = class extends import_core.Buffer {
|
|
|
100
103
|
};
|
|
101
104
|
|
|
102
105
|
// dist/adapter/resources/webgpu-texture.js
|
|
103
|
-
var
|
|
106
|
+
var import_core4 = require("@luma.gl/core");
|
|
104
107
|
|
|
105
108
|
// dist/adapter/helpers/convert-texture-format.js
|
|
106
109
|
function getWebGPUTextureFormat(format) {
|
|
@@ -129,22 +132,50 @@ var WebGPUSampler = class extends import_core2.Sampler {
|
|
|
129
132
|
}
|
|
130
133
|
};
|
|
131
134
|
|
|
135
|
+
// dist/adapter/resources/webgpu-texture-view.js
|
|
136
|
+
var import_core3 = require("@luma.gl/core");
|
|
137
|
+
var WebGPUTextureView = class extends import_core3.TextureView {
|
|
138
|
+
device;
|
|
139
|
+
handle;
|
|
140
|
+
texture;
|
|
141
|
+
constructor(device, props) {
|
|
142
|
+
super(device, props);
|
|
143
|
+
this.device = device;
|
|
144
|
+
this.texture = props.texture;
|
|
145
|
+
this.handle = this.handle || this.texture.handle.createView({
|
|
146
|
+
format: props.format || this.texture.format,
|
|
147
|
+
dimension: props.dimension || this.texture.dimension,
|
|
148
|
+
aspect: props.aspect,
|
|
149
|
+
baseMipLevel: props.baseMipLevel,
|
|
150
|
+
mipLevelCount: props.mipLevelCount,
|
|
151
|
+
// GPUIntegerCoordinate;
|
|
152
|
+
baseArrayLayer: props.baseArrayLayer,
|
|
153
|
+
// GPUIntegerCoordinate;
|
|
154
|
+
arrayLayerCount: props.arrayLayerCount
|
|
155
|
+
// GPUIntegerCoordinate;
|
|
156
|
+
});
|
|
157
|
+
this.handle.label = this.props.id;
|
|
158
|
+
}
|
|
159
|
+
destroy() {
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
132
163
|
// dist/adapter/resources/webgpu-texture.js
|
|
133
164
|
var BASE_DIMENSIONS = {
|
|
134
165
|
"1d": "1d",
|
|
135
166
|
"2d": "2d",
|
|
136
167
|
"2d-array": "2d",
|
|
137
|
-
|
|
168
|
+
cube: "2d",
|
|
138
169
|
"cube-array": "2d",
|
|
139
170
|
"3d": "3d"
|
|
140
171
|
};
|
|
141
|
-
var WebGPUTexture = class extends
|
|
172
|
+
var WebGPUTexture = class extends import_core4.Texture {
|
|
142
173
|
device;
|
|
143
174
|
handle;
|
|
144
|
-
view;
|
|
145
|
-
sampler;
|
|
146
175
|
height = 1;
|
|
147
176
|
width = 1;
|
|
177
|
+
sampler;
|
|
178
|
+
view;
|
|
148
179
|
// static async createFromImageURL(src, usage = 0) {
|
|
149
180
|
// const img = document.createElement('img');
|
|
150
181
|
// img.src = src;
|
|
@@ -172,7 +203,7 @@ var WebGPUTexture = class extends import_core3.Texture {
|
|
|
172
203
|
this.width = this.handle.width;
|
|
173
204
|
this.height = this.handle.height;
|
|
174
205
|
this.sampler = props.sampler instanceof WebGPUSampler ? props.sampler : new WebGPUSampler(this.device, props.sampler);
|
|
175
|
-
this.view = this.
|
|
206
|
+
this.view = new WebGPUTextureView(this.device, { ...this.props, texture: this });
|
|
176
207
|
}
|
|
177
208
|
createHandle() {
|
|
178
209
|
var _a, _b;
|
|
@@ -225,15 +256,11 @@ var WebGPUTexture = class extends import_core3.Texture {
|
|
|
225
256
|
premultipliedAlpha
|
|
226
257
|
},
|
|
227
258
|
// copySize: GPUExtent3D
|
|
228
|
-
[
|
|
229
|
-
width,
|
|
230
|
-
height,
|
|
231
|
-
depth
|
|
232
|
-
]
|
|
259
|
+
[width, height, depth]
|
|
233
260
|
);
|
|
234
261
|
return { width, height };
|
|
235
262
|
}
|
|
236
|
-
// WebGPU specific
|
|
263
|
+
// WebGPU specific
|
|
237
264
|
/** TODO - intention is to expose TextureViews in the public API */
|
|
238
265
|
createView() {
|
|
239
266
|
return this.handle.createView({ label: this.id });
|
|
@@ -241,8 +268,8 @@ var WebGPUTexture = class extends import_core3.Texture {
|
|
|
241
268
|
};
|
|
242
269
|
|
|
243
270
|
// dist/adapter/resources/webgpu-external-texture.js
|
|
244
|
-
var
|
|
245
|
-
var WebGPUExternalTexture = class extends
|
|
271
|
+
var import_core5 = require("@luma.gl/core");
|
|
272
|
+
var WebGPUExternalTexture = class extends import_core5.ExternalTexture {
|
|
246
273
|
device;
|
|
247
274
|
handle;
|
|
248
275
|
sampler;
|
|
@@ -265,8 +292,8 @@ var WebGPUExternalTexture = class extends import_core4.ExternalTexture {
|
|
|
265
292
|
};
|
|
266
293
|
|
|
267
294
|
// dist/adapter/resources/webgpu-shader.js
|
|
268
|
-
var
|
|
269
|
-
var WebGPUShader = class extends
|
|
295
|
+
var import_core6 = require("@luma.gl/core");
|
|
296
|
+
var WebGPUShader = class extends import_core6.Shader {
|
|
270
297
|
device;
|
|
271
298
|
handle;
|
|
272
299
|
constructor(device, props) {
|
|
@@ -282,7 +309,7 @@ var WebGPUShader = class extends import_core5.Shader {
|
|
|
282
309
|
if (error) {
|
|
283
310
|
this.debugShader();
|
|
284
311
|
const shaderLog = await this.getCompilationInfo();
|
|
285
|
-
|
|
312
|
+
import_core6.log.error(`Shader compilation error: ${error.message}`, shaderLog)();
|
|
286
313
|
throw new Error(`Shader compilation error: ${error.message}`);
|
|
287
314
|
}
|
|
288
315
|
}
|
|
@@ -316,7 +343,7 @@ var WebGPUShader = class extends import_core5.Shader {
|
|
|
316
343
|
};
|
|
317
344
|
|
|
318
345
|
// dist/adapter/resources/webgpu-render-pipeline.js
|
|
319
|
-
var
|
|
346
|
+
var import_core9 = require("@luma.gl/core");
|
|
320
347
|
|
|
321
348
|
// dist/adapter/helpers/webgpu-parameters.js
|
|
322
349
|
function addDepthStencil(descriptor) {
|
|
@@ -504,7 +531,7 @@ function addColorState(descriptor) {
|
|
|
504
531
|
}
|
|
505
532
|
|
|
506
533
|
// dist/adapter/helpers/get-bind-group.js
|
|
507
|
-
var
|
|
534
|
+
var import_core7 = require("@luma.gl/core");
|
|
508
535
|
function getBindGroup(device, bindGroupLayout, shaderLayout, bindings) {
|
|
509
536
|
const entries = getBindGroupEntries(bindings, shaderLayout);
|
|
510
537
|
return device.createBindGroup({
|
|
@@ -515,7 +542,7 @@ function getBindGroup(device, bindGroupLayout, shaderLayout, bindings) {
|
|
|
515
542
|
function getShaderLayoutBinding(shaderLayout, bindingName) {
|
|
516
543
|
const bindingLayout = shaderLayout.bindings.find((binding) => binding.name === bindingName || `${binding.name}uniforms` === bindingName.toLocaleLowerCase());
|
|
517
544
|
if (!bindingLayout) {
|
|
518
|
-
|
|
545
|
+
import_core7.log.warn(`Binding ${bindingName} not set: Not found in shader layout.`)();
|
|
519
546
|
}
|
|
520
547
|
return bindingLayout;
|
|
521
548
|
}
|
|
@@ -530,30 +557,30 @@ function getBindGroupEntries(bindings, shaderLayout) {
|
|
|
530
557
|
return entries;
|
|
531
558
|
}
|
|
532
559
|
function getBindGroupEntry(binding, index) {
|
|
533
|
-
if (binding instanceof
|
|
560
|
+
if (binding instanceof import_core7.Buffer) {
|
|
534
561
|
return {
|
|
535
562
|
binding: index,
|
|
536
563
|
resource: {
|
|
537
|
-
buffer: (0,
|
|
564
|
+
buffer: (0, import_core7.cast)(binding).handle
|
|
538
565
|
}
|
|
539
566
|
};
|
|
540
567
|
}
|
|
541
|
-
if (binding instanceof
|
|
568
|
+
if (binding instanceof import_core7.Sampler) {
|
|
542
569
|
return {
|
|
543
570
|
binding: index,
|
|
544
|
-
resource: (0,
|
|
571
|
+
resource: (0, import_core7.cast)(binding).handle
|
|
545
572
|
};
|
|
546
|
-
} else if (binding instanceof
|
|
573
|
+
} else if (binding instanceof import_core7.Texture) {
|
|
547
574
|
return {
|
|
548
575
|
binding: index,
|
|
549
|
-
resource: (0,
|
|
576
|
+
resource: (0, import_core7.cast)(binding).handle.createView({ label: "bind-group-auto-created" })
|
|
550
577
|
};
|
|
551
578
|
}
|
|
552
579
|
throw new Error("invalid binding");
|
|
553
580
|
}
|
|
554
581
|
|
|
555
582
|
// dist/adapter/helpers/get-vertex-buffer-layout.js
|
|
556
|
-
var
|
|
583
|
+
var import_core8 = require("@luma.gl/core");
|
|
557
584
|
function getWebGPUVertexFormat(format) {
|
|
558
585
|
if (format.endsWith("-webgl")) {
|
|
559
586
|
throw new Error(`WebGPU does not support vertex format ${format}`);
|
|
@@ -577,14 +604,14 @@ function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
|
577
604
|
offset: attributeMapping.byteOffset,
|
|
578
605
|
shaderLocation: attributeLayout.location
|
|
579
606
|
});
|
|
580
|
-
byteStride += (0,
|
|
607
|
+
byteStride += (0, import_core8.decodeVertexFormat)(mapping.format).byteLength;
|
|
581
608
|
}
|
|
582
609
|
} else {
|
|
583
610
|
const attributeLayout = findAttributeLayout(shaderLayout, mapping.name, usedAttributes);
|
|
584
611
|
if (!attributeLayout) {
|
|
585
612
|
continue;
|
|
586
613
|
}
|
|
587
|
-
byteStride = (0,
|
|
614
|
+
byteStride = (0, import_core8.decodeVertexFormat)(mapping.format).byteLength;
|
|
588
615
|
stepMode = attributeLayout.stepMode || (attributeLayout.name.startsWith("instance") ? "instance" : "vertex");
|
|
589
616
|
vertexAttributes.push({
|
|
590
617
|
format: getWebGPUVertexFormat(mapping.format),
|
|
@@ -602,7 +629,7 @@ function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
|
602
629
|
for (const attribute of shaderLayout.attributes) {
|
|
603
630
|
if (!usedAttributes.has(attribute.name)) {
|
|
604
631
|
vertexBufferLayouts.push({
|
|
605
|
-
arrayStride: (0,
|
|
632
|
+
arrayStride: (0, import_core8.decodeVertexFormat)("float32x3").byteLength,
|
|
606
633
|
stepMode: attribute.stepMode || (attribute.name.startsWith("instance") ? "instance" : "vertex"),
|
|
607
634
|
attributes: [
|
|
608
635
|
{
|
|
@@ -619,7 +646,7 @@ function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
|
619
646
|
function findAttributeLayout(shaderLayout, name, attributeNames) {
|
|
620
647
|
const attribute = shaderLayout.attributes.find((attribute2) => attribute2.name === name);
|
|
621
648
|
if (!attribute) {
|
|
622
|
-
|
|
649
|
+
import_core8.log.warn(`Unknown attribute ${name}`)();
|
|
623
650
|
return null;
|
|
624
651
|
}
|
|
625
652
|
if (attributeNames.has(name)) {
|
|
@@ -630,7 +657,7 @@ function findAttributeLayout(shaderLayout, name, attributeNames) {
|
|
|
630
657
|
}
|
|
631
658
|
|
|
632
659
|
// dist/adapter/resources/webgpu-render-pipeline.js
|
|
633
|
-
var WebGPURenderPipeline = class extends
|
|
660
|
+
var WebGPURenderPipeline = class extends import_core9.RenderPipeline {
|
|
634
661
|
device;
|
|
635
662
|
handle;
|
|
636
663
|
vs;
|
|
@@ -648,53 +675,43 @@ var WebGPURenderPipeline = class extends import_core8.RenderPipeline {
|
|
|
648
675
|
this.handle = this.props.handle;
|
|
649
676
|
if (!this.handle) {
|
|
650
677
|
const descriptor = this._getRenderPipelineDescriptor();
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
678
|
+
import_core9.log.groupCollapsed(1, `new WebGPURenderPipeline(${this.id})`)();
|
|
679
|
+
import_core9.log.probe(1, JSON.stringify(descriptor, null, 2))();
|
|
680
|
+
import_core9.log.groupEnd(1)();
|
|
654
681
|
this.handle = this.device.handle.createRenderPipeline(descriptor);
|
|
655
682
|
}
|
|
656
683
|
this.handle.label = this.props.id;
|
|
657
|
-
this.vs = (0,
|
|
658
|
-
this.fs = (0,
|
|
684
|
+
this.vs = (0, import_core9.cast)(props.vs);
|
|
685
|
+
this.fs = (0, import_core9.cast)(props.fs);
|
|
659
686
|
}
|
|
660
687
|
destroy() {
|
|
661
688
|
}
|
|
662
689
|
// setIndexBuffer(indexBuffer: Buffer): void {
|
|
663
690
|
// this._indexBuffer = cast<WebGPUBuffer>(indexBuffer);
|
|
664
691
|
// }
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
// }
|
|
683
|
-
}
|
|
684
|
-
*/
|
|
685
|
-
// setConstantAttributes(attributes: Record<string, TypedArray>): void {
|
|
686
|
-
// throw new Error('not implemented');
|
|
692
|
+
// setAttributes(attributes: Record<string, Buffer>): void {
|
|
693
|
+
// for (const [name, buffer] of Object.entries(attributes)) {
|
|
694
|
+
// const bufferIndex = this._bufferSlots[name];
|
|
695
|
+
// if (bufferIndex >= 0) {
|
|
696
|
+
// this._buffers[bufferIndex] = buffer;
|
|
697
|
+
// } else {
|
|
698
|
+
// throw new Error(
|
|
699
|
+
// `Setting attribute '${name}' not listed in shader layout for program ${this.id}`
|
|
700
|
+
// );
|
|
701
|
+
// }
|
|
702
|
+
// }
|
|
703
|
+
// // for (let i = 0; i < this._bufferSlots.length; ++i) {
|
|
704
|
+
// // const bufferName = this._bufferSlots[i];
|
|
705
|
+
// // if (attributes[bufferName]) {
|
|
706
|
+
// // this.handle
|
|
707
|
+
// // }
|
|
708
|
+
// // }
|
|
687
709
|
// }
|
|
688
710
|
setBindings(bindings) {
|
|
689
711
|
Object.assign(this.props.bindings, bindings);
|
|
690
712
|
}
|
|
691
|
-
setUniforms(uniforms) {
|
|
692
|
-
if (!(0, import_core8.isObjectEmpty)(uniforms)) {
|
|
693
|
-
throw new Error("WebGPU does not support uniforms");
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
713
|
draw(options) {
|
|
697
|
-
const webgpuRenderPass = (0,
|
|
714
|
+
const webgpuRenderPass = (0, import_core9.cast)(options.renderPass) || this.device.getDefaultRenderPass();
|
|
698
715
|
webgpuRenderPass.handle.setPipeline(this.handle);
|
|
699
716
|
const bindGroup = this._getBindGroup();
|
|
700
717
|
if (bindGroup) {
|
|
@@ -728,14 +745,14 @@ var WebGPURenderPipeline = class extends import_core8.RenderPipeline {
|
|
|
728
745
|
_getRenderPipelineDescriptor() {
|
|
729
746
|
var _a, _b;
|
|
730
747
|
const vertex = {
|
|
731
|
-
module: (0,
|
|
748
|
+
module: (0, import_core9.cast)(this.props.vs).handle,
|
|
732
749
|
entryPoint: this.props.vsEntryPoint || "main",
|
|
733
750
|
buffers: getVertexBufferLayout(this.props.shaderLayout, this.props.bufferLayout)
|
|
734
751
|
};
|
|
735
752
|
let fragment;
|
|
736
753
|
if (this.props.fs) {
|
|
737
754
|
fragment = {
|
|
738
|
-
module: (0,
|
|
755
|
+
module: (0, import_core9.cast)(this.props.fs).handle,
|
|
739
756
|
entryPoint: this.props.fsEntryPoint || "main",
|
|
740
757
|
targets: [
|
|
741
758
|
{
|
|
@@ -765,8 +782,8 @@ var WebGPURenderPipeline = class extends import_core8.RenderPipeline {
|
|
|
765
782
|
};
|
|
766
783
|
|
|
767
784
|
// dist/adapter/resources/webgpu-compute-pipeline.js
|
|
768
|
-
var
|
|
769
|
-
var WebGPUComputePipeline = class extends
|
|
785
|
+
var import_core10 = require("@luma.gl/core");
|
|
786
|
+
var WebGPUComputePipeline = class extends import_core10.ComputePipeline {
|
|
770
787
|
device;
|
|
771
788
|
handle;
|
|
772
789
|
constructor(device, props) {
|
|
@@ -790,8 +807,8 @@ var WebGPUComputePipeline = class extends import_core9.ComputePipeline {
|
|
|
790
807
|
};
|
|
791
808
|
|
|
792
809
|
// dist/adapter/resources/webgpu-render-pass.js
|
|
793
|
-
var
|
|
794
|
-
var WebGPURenderPass = class extends
|
|
810
|
+
var import_core11 = require("@luma.gl/core");
|
|
811
|
+
var WebGPURenderPass = class extends import_core11.RenderPass {
|
|
795
812
|
device;
|
|
796
813
|
handle;
|
|
797
814
|
/** Active pipeline */
|
|
@@ -801,11 +818,23 @@ var WebGPURenderPass = class extends import_core10.RenderPass {
|
|
|
801
818
|
this.device = device;
|
|
802
819
|
const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer();
|
|
803
820
|
const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
821
|
+
const webgpuQuerySet = props.timestampQuerySet;
|
|
822
|
+
if (webgpuQuerySet) {
|
|
823
|
+
renderPassDescriptor.occlusionQuerySet = webgpuQuerySet.handle;
|
|
824
|
+
}
|
|
825
|
+
if (device.features.has("timestamp-query")) {
|
|
826
|
+
const webgpuQuerySet2 = props.timestampQuerySet;
|
|
827
|
+
renderPassDescriptor.timestampWrites = webgpuQuerySet2 ? {
|
|
828
|
+
querySet: webgpuQuerySet2.handle,
|
|
829
|
+
beginningOfPassWriteIndex: props.beginTimestampIndex,
|
|
830
|
+
endOfPassWriteIndex: props.endTimestampIndex
|
|
831
|
+
} : void 0;
|
|
832
|
+
}
|
|
807
833
|
this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
|
|
808
834
|
this.handle.label = this.props.id;
|
|
835
|
+
import_core11.log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();
|
|
836
|
+
import_core11.log.probe(3, JSON.stringify(renderPassDescriptor, null, 2))();
|
|
837
|
+
import_core11.log.groupEnd(3)();
|
|
809
838
|
}
|
|
810
839
|
destroy() {
|
|
811
840
|
}
|
|
@@ -813,7 +842,7 @@ var WebGPURenderPass = class extends import_core10.RenderPass {
|
|
|
813
842
|
this.handle.end();
|
|
814
843
|
}
|
|
815
844
|
setPipeline(pipeline) {
|
|
816
|
-
this.pipeline = (0,
|
|
845
|
+
this.pipeline = (0, import_core11.cast)(pipeline);
|
|
817
846
|
this.handle.setPipeline(this.pipeline.handle);
|
|
818
847
|
}
|
|
819
848
|
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
@@ -826,10 +855,10 @@ var WebGPURenderPass = class extends import_core10.RenderPass {
|
|
|
826
855
|
}
|
|
827
856
|
}
|
|
828
857
|
setIndexBuffer(buffer, indexFormat, offset = 0, size) {
|
|
829
|
-
this.handle.setIndexBuffer((0,
|
|
858
|
+
this.handle.setIndexBuffer((0, import_core11.cast)(buffer).handle, indexFormat, offset, size);
|
|
830
859
|
}
|
|
831
860
|
setVertexBuffer(slot, buffer, offset = 0) {
|
|
832
|
-
this.handle.setVertexBuffer(slot, (0,
|
|
861
|
+
this.handle.setVertexBuffer(slot, (0, import_core11.cast)(buffer).handle, offset);
|
|
833
862
|
}
|
|
834
863
|
draw(options) {
|
|
835
864
|
if (options.indexCount) {
|
|
@@ -864,11 +893,12 @@ var WebGPURenderPass = class extends import_core10.RenderPass {
|
|
|
864
893
|
insertDebugMarker(markerLabel) {
|
|
865
894
|
this.handle.insertDebugMarker(markerLabel);
|
|
866
895
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
896
|
+
beginOcclusionQuery(queryIndex) {
|
|
897
|
+
this.handle.beginOcclusionQuery(queryIndex);
|
|
898
|
+
}
|
|
899
|
+
endOcclusionQuery() {
|
|
900
|
+
this.handle.endOcclusionQuery();
|
|
901
|
+
}
|
|
872
902
|
// executeBundles(bundles: Iterable<GPURenderBundle>): void;
|
|
873
903
|
// INTERNAL
|
|
874
904
|
/**
|
|
@@ -885,11 +915,11 @@ var WebGPURenderPass = class extends import_core10.RenderPass {
|
|
|
885
915
|
colorClearValue: this.props.clearColor || [0, 0, 0, 0],
|
|
886
916
|
storeOp: this.props.discard ? "discard" : "store",
|
|
887
917
|
// ...colorAttachment,
|
|
888
|
-
view: colorAttachment.
|
|
918
|
+
view: colorAttachment.handle
|
|
889
919
|
}));
|
|
890
920
|
if (framebuffer.depthStencilAttachment) {
|
|
891
921
|
renderPassDescriptor.depthStencilAttachment = {
|
|
892
|
-
view: framebuffer.depthStencilAttachment.
|
|
922
|
+
view: framebuffer.depthStencilAttachment.handle
|
|
893
923
|
};
|
|
894
924
|
const { depthStencilAttachment } = renderPassDescriptor;
|
|
895
925
|
if (this.props.depthReadOnly) {
|
|
@@ -912,8 +942,8 @@ var WebGPURenderPass = class extends import_core10.RenderPass {
|
|
|
912
942
|
};
|
|
913
943
|
|
|
914
944
|
// dist/adapter/resources/webgpu-compute-pass.js
|
|
915
|
-
var
|
|
916
|
-
var WebGPUComputePass = class extends
|
|
945
|
+
var import_core12 = require("@luma.gl/core");
|
|
946
|
+
var WebGPUComputePass = class extends import_core12.ComputePass {
|
|
917
947
|
device;
|
|
918
948
|
handle;
|
|
919
949
|
_bindGroupLayout = null;
|
|
@@ -921,9 +951,20 @@ var WebGPUComputePass = class extends import_core11.ComputePass {
|
|
|
921
951
|
var _a;
|
|
922
952
|
super(device, props);
|
|
923
953
|
this.device = device;
|
|
954
|
+
let timestampWrites;
|
|
955
|
+
if (device.features.has("timestamp-query")) {
|
|
956
|
+
const webgpuQuerySet = props.timestampQuerySet;
|
|
957
|
+
if (webgpuQuerySet) {
|
|
958
|
+
timestampWrites = {
|
|
959
|
+
querySet: webgpuQuerySet.handle,
|
|
960
|
+
beginningOfPassWriteIndex: props.beginTimestampIndex,
|
|
961
|
+
endOfPassWriteIndex: props.endTimestampIndex
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
}
|
|
924
965
|
this.handle = this.props.handle || ((_a = device.commandEncoder) == null ? void 0 : _a.beginComputePass({
|
|
925
|
-
label: this.props.id
|
|
926
|
-
|
|
966
|
+
label: this.props.id,
|
|
967
|
+
timestampWrites
|
|
927
968
|
}));
|
|
928
969
|
}
|
|
929
970
|
/** @note no WebGPU destroy method, just gc */
|
|
@@ -971,22 +1012,15 @@ var WebGPUComputePass = class extends import_core11.ComputePass {
|
|
|
971
1012
|
};
|
|
972
1013
|
|
|
973
1014
|
// dist/adapter/resources/webgpu-vertex-array.js
|
|
974
|
-
var
|
|
1015
|
+
var import_core13 = require("@luma.gl/core");
|
|
975
1016
|
var import_env = require("@probe.gl/env");
|
|
976
|
-
var WebGPUVertexArray = class extends
|
|
1017
|
+
var WebGPUVertexArray = class extends import_core13.VertexArray {
|
|
977
1018
|
get [Symbol.toStringTag]() {
|
|
978
1019
|
return "WebGPUVertexArray";
|
|
979
1020
|
}
|
|
980
1021
|
device;
|
|
981
1022
|
/** Vertex Array is a helper class under WebGPU */
|
|
982
1023
|
handle;
|
|
983
|
-
/**
|
|
984
|
-
* Attribute 0 can not be disable on most desktop OpenGL based browsers
|
|
985
|
-
* TODO is this even an issue for WebGPU?
|
|
986
|
-
*/
|
|
987
|
-
static isConstantAttributeZeroSupported(device) {
|
|
988
|
-
return (0, import_env.getBrowser)() === "Chrome";
|
|
989
|
-
}
|
|
990
1024
|
// Create a VertexArray
|
|
991
1025
|
constructor(device, props) {
|
|
992
1026
|
super(device, props);
|
|
@@ -1005,35 +1039,39 @@ var WebGPUVertexArray = class extends import_core12.VertexArray {
|
|
|
1005
1039
|
setBuffer(bufferSlot, buffer) {
|
|
1006
1040
|
this.attributes[bufferSlot] = buffer;
|
|
1007
1041
|
}
|
|
1008
|
-
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
1009
|
-
setConstant(location, value) {
|
|
1010
|
-
import_core12.log.warn(`${this.id} constant attributes not supported on WebGPU`);
|
|
1011
|
-
}
|
|
1012
1042
|
bindBeforeRender(renderPass, firstIndex, indexCount) {
|
|
1013
1043
|
const webgpuRenderPass = renderPass;
|
|
1014
1044
|
const webgpuIndexBuffer = this.indexBuffer;
|
|
1015
1045
|
if (webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.handle) {
|
|
1016
|
-
|
|
1046
|
+
import_core13.log.warn("setting index buffer", webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.handle, webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.indexType)();
|
|
1017
1047
|
webgpuRenderPass.handle.setIndexBuffer(webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.handle, webgpuIndexBuffer == null ? void 0 : webgpuIndexBuffer.indexType);
|
|
1018
1048
|
}
|
|
1019
1049
|
for (let location = 0; location < this.maxVertexAttributes; location++) {
|
|
1020
1050
|
const webgpuBuffer = this.attributes[location];
|
|
1021
1051
|
if (webgpuBuffer == null ? void 0 : webgpuBuffer.handle) {
|
|
1022
|
-
|
|
1052
|
+
import_core13.log.warn(`setting vertex buffer ${location}`, webgpuBuffer == null ? void 0 : webgpuBuffer.handle)();
|
|
1023
1053
|
webgpuRenderPass.handle.setVertexBuffer(location, webgpuBuffer == null ? void 0 : webgpuBuffer.handle);
|
|
1024
1054
|
}
|
|
1025
1055
|
}
|
|
1026
1056
|
}
|
|
1027
1057
|
unbindAfterRender(renderPass) {
|
|
1028
1058
|
}
|
|
1059
|
+
// DEPRECATED METHODS
|
|
1060
|
+
/**
|
|
1061
|
+
* @deprecated is this even an issue for WebGPU?
|
|
1062
|
+
* Attribute 0 can not be disable on most desktop OpenGL based browsers
|
|
1063
|
+
*/
|
|
1064
|
+
static isConstantAttributeZeroSupported(device) {
|
|
1065
|
+
return (0, import_env.getBrowser)() === "Chrome";
|
|
1066
|
+
}
|
|
1029
1067
|
};
|
|
1030
1068
|
|
|
1031
1069
|
// dist/adapter/webgpu-canvas-context.js
|
|
1032
|
-
var
|
|
1070
|
+
var import_core15 = require("@luma.gl/core");
|
|
1033
1071
|
|
|
1034
1072
|
// dist/adapter/resources/webgpu-framebuffer.js
|
|
1035
|
-
var
|
|
1036
|
-
var WebGPUFramebuffer = class extends
|
|
1073
|
+
var import_core14 = require("@luma.gl/core");
|
|
1074
|
+
var WebGPUFramebuffer = class extends import_core14.Framebuffer {
|
|
1037
1075
|
device;
|
|
1038
1076
|
constructor(device, props) {
|
|
1039
1077
|
super(device, props);
|
|
@@ -1043,11 +1081,10 @@ var WebGPUFramebuffer = class extends import_core13.Framebuffer {
|
|
|
1043
1081
|
};
|
|
1044
1082
|
|
|
1045
1083
|
// dist/adapter/webgpu-canvas-context.js
|
|
1046
|
-
var WebGPUCanvasContext = class extends
|
|
1084
|
+
var WebGPUCanvasContext = class extends import_core15.CanvasContext {
|
|
1047
1085
|
device;
|
|
1048
1086
|
gpuCanvasContext;
|
|
1049
1087
|
/** Format of returned textures: "bgra8unorm", "rgba8unorm", "rgba16float". */
|
|
1050
|
-
// @ts-ignore - TODO - fix this
|
|
1051
1088
|
format = navigator.gpu.getPreferredCanvasFormat();
|
|
1052
1089
|
/** Default stencil format for depth textures */
|
|
1053
1090
|
depthStencilFormat = "depth24plus";
|
|
@@ -1096,7 +1133,7 @@ var WebGPUCanvasContext = class extends import_core14.CanvasContext {
|
|
|
1096
1133
|
colorSpace: this.props.colorSpace,
|
|
1097
1134
|
alphaMode: this.props.alphaMode
|
|
1098
1135
|
});
|
|
1099
|
-
|
|
1136
|
+
import_core15.log.log(1, `Resized to ${this.width}x${this.height}px`)();
|
|
1100
1137
|
}
|
|
1101
1138
|
}
|
|
1102
1139
|
resize(options) {
|
|
@@ -1124,16 +1161,41 @@ var WebGPUCanvasContext = class extends import_core14.CanvasContext {
|
|
|
1124
1161
|
}
|
|
1125
1162
|
};
|
|
1126
1163
|
|
|
1164
|
+
// dist/adapter/resources/webgpu-query-set.js
|
|
1165
|
+
var import_core16 = require("@luma.gl/core");
|
|
1166
|
+
var WebGPUQuerySet = class extends import_core16.QuerySet {
|
|
1167
|
+
device;
|
|
1168
|
+
handle;
|
|
1169
|
+
constructor(device, props) {
|
|
1170
|
+
super(device, props);
|
|
1171
|
+
this.device = device;
|
|
1172
|
+
this.handle = this.props.handle || this.device.handle.createQuerySet({
|
|
1173
|
+
type: this.props.type,
|
|
1174
|
+
count: this.props.count
|
|
1175
|
+
});
|
|
1176
|
+
this.handle.label = this.props.id;
|
|
1177
|
+
}
|
|
1178
|
+
destroy() {
|
|
1179
|
+
this.handle.destroy();
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1127
1183
|
// dist/adapter/webgpu-device.js
|
|
1128
|
-
var _WebGPUDevice = class extends
|
|
1184
|
+
var _WebGPUDevice = class extends import_core17.Device {
|
|
1185
|
+
/** The underlying WebGPU device */
|
|
1129
1186
|
handle;
|
|
1187
|
+
/* The underlying WebGPU adapter */
|
|
1130
1188
|
adapter;
|
|
1189
|
+
/* The underlying WebGPU adapter's info */
|
|
1190
|
+
adapterInfo;
|
|
1191
|
+
features;
|
|
1192
|
+
info;
|
|
1193
|
+
limits;
|
|
1131
1194
|
lost;
|
|
1132
1195
|
canvasContext = null;
|
|
1196
|
+
_isLost = false;
|
|
1133
1197
|
commandEncoder = null;
|
|
1134
1198
|
renderPass = null;
|
|
1135
|
-
_info;
|
|
1136
|
-
_isLost = false;
|
|
1137
1199
|
/** Check if WebGPU is available */
|
|
1138
1200
|
static isSupported() {
|
|
1139
1201
|
return Boolean(typeof navigator !== "undefined" && navigator.gpu);
|
|
@@ -1142,7 +1204,7 @@ var _WebGPUDevice = class extends import_core15.Device {
|
|
|
1142
1204
|
if (!navigator.gpu) {
|
|
1143
1205
|
throw new Error("WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu");
|
|
1144
1206
|
}
|
|
1145
|
-
|
|
1207
|
+
import_core17.log.groupCollapsed(1, "WebGPUDevice created")();
|
|
1146
1208
|
const adapter = await navigator.gpu.requestAdapter({
|
|
1147
1209
|
powerPreference: "high-performance"
|
|
1148
1210
|
// forceSoftware: false
|
|
@@ -1151,47 +1213,40 @@ var _WebGPUDevice = class extends import_core15.Device {
|
|
|
1151
1213
|
throw new Error("Failed to request WebGPU adapter");
|
|
1152
1214
|
}
|
|
1153
1215
|
const adapterInfo = await adapter.requestAdapterInfo();
|
|
1154
|
-
|
|
1216
|
+
import_core17.log.probe(2, "Adapter available", adapterInfo)();
|
|
1217
|
+
const requiredFeatures = [];
|
|
1218
|
+
const requiredLimits = {};
|
|
1219
|
+
if (props.requestMaximalLimits) {
|
|
1220
|
+
requiredFeatures.push(...Array.from(adapter.features));
|
|
1221
|
+
for (const key in adapter.limits) {
|
|
1222
|
+
requiredLimits[key] = adapter.limits[key];
|
|
1223
|
+
}
|
|
1224
|
+
delete requiredLimits.minSubgroupSize;
|
|
1225
|
+
delete requiredLimits.maxSubgroupSize;
|
|
1226
|
+
}
|
|
1155
1227
|
const gpuDevice = await adapter.requestDevice({
|
|
1156
|
-
requiredFeatures
|
|
1157
|
-
|
|
1158
|
-
// requiredLimits: adapter.limits
|
|
1228
|
+
requiredFeatures,
|
|
1229
|
+
requiredLimits
|
|
1159
1230
|
});
|
|
1160
|
-
|
|
1231
|
+
import_core17.log.probe(1, "GPUDevice available")();
|
|
1161
1232
|
if (typeof props.canvas === "string") {
|
|
1162
|
-
await
|
|
1163
|
-
|
|
1233
|
+
await import_core17.CanvasContext.pageLoaded;
|
|
1234
|
+
import_core17.log.probe(1, "DOM is loaded")();
|
|
1164
1235
|
}
|
|
1165
1236
|
const device = new _WebGPUDevice(gpuDevice, adapter, adapterInfo, props);
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1237
|
+
import_core17.log.probe(1, "Device created. For more info, set chrome://flags/#enable-webgpu-developer-features")();
|
|
1238
|
+
import_core17.log.table(1, device.info)();
|
|
1239
|
+
import_core17.log.groupEnd(1)();
|
|
1169
1240
|
return device;
|
|
1170
1241
|
}
|
|
1171
1242
|
constructor(device, adapter, adapterInfo, props) {
|
|
1172
|
-
super({ ...props, id: props.id || (0,
|
|
1243
|
+
super({ ...props, id: props.id || (0, import_core17.uid)("webgpu-device") });
|
|
1173
1244
|
this.handle = device;
|
|
1174
1245
|
this.adapter = adapter;
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
const gpu = vendor === "apple" ? "apple" : "unknown";
|
|
1180
|
-
const gpuArchitecture = adapterInfo.architecture || "unknown";
|
|
1181
|
-
const gpuBackend = adapterInfo.backend || "unknown";
|
|
1182
|
-
const gpuType = (adapterInfo.type || "").split(" ")[0].toLowerCase() || "unknown";
|
|
1183
|
-
this._info = {
|
|
1184
|
-
type: "webgpu",
|
|
1185
|
-
vendor,
|
|
1186
|
-
renderer,
|
|
1187
|
-
version,
|
|
1188
|
-
gpu,
|
|
1189
|
-
gpuType,
|
|
1190
|
-
gpuBackend,
|
|
1191
|
-
gpuArchitecture,
|
|
1192
|
-
shadingLanguage: "wgsl",
|
|
1193
|
-
shadingLanguageVersion: 100
|
|
1194
|
-
};
|
|
1246
|
+
this.adapterInfo = adapterInfo;
|
|
1247
|
+
this.info = this._getInfo();
|
|
1248
|
+
this.features = this._getFeatures();
|
|
1249
|
+
this.limits = this.handle.limits;
|
|
1195
1250
|
this.lost = new Promise(async (resolve) => {
|
|
1196
1251
|
const lostInfo = await this.handle.lost;
|
|
1197
1252
|
this._isLost = true;
|
|
@@ -1203,7 +1258,6 @@ var _WebGPUDevice = class extends import_core15.Device {
|
|
|
1203
1258
|
width: props.width,
|
|
1204
1259
|
container: props.container
|
|
1205
1260
|
});
|
|
1206
|
-
this.features = this._getFeatures();
|
|
1207
1261
|
}
|
|
1208
1262
|
// TODO
|
|
1209
1263
|
// Load the glslang module now so that it is available synchronously when compiling shaders
|
|
@@ -1212,13 +1266,6 @@ var _WebGPUDevice = class extends import_core15.Device {
|
|
|
1212
1266
|
destroy() {
|
|
1213
1267
|
this.handle.destroy();
|
|
1214
1268
|
}
|
|
1215
|
-
get info() {
|
|
1216
|
-
return this._info;
|
|
1217
|
-
}
|
|
1218
|
-
features;
|
|
1219
|
-
get limits() {
|
|
1220
|
-
return this.handle.limits;
|
|
1221
|
-
}
|
|
1222
1269
|
isTextureFormatSupported(format) {
|
|
1223
1270
|
return !format.includes("webgl");
|
|
1224
1271
|
}
|
|
@@ -1280,6 +1327,9 @@ var _WebGPUDevice = class extends import_core15.Device {
|
|
|
1280
1327
|
createTransformFeedback(props) {
|
|
1281
1328
|
throw new Error("Transform feedback not supported in WebGPU");
|
|
1282
1329
|
}
|
|
1330
|
+
createQuerySet(props) {
|
|
1331
|
+
return new WebGPUQuerySet(this, props);
|
|
1332
|
+
}
|
|
1283
1333
|
createCanvasContext(props) {
|
|
1284
1334
|
return new WebGPUCanvasContext(this, this.adapter, props);
|
|
1285
1335
|
}
|
|
@@ -1300,6 +1350,29 @@ var _WebGPUDevice = class extends import_core15.Device {
|
|
|
1300
1350
|
}
|
|
1301
1351
|
this.commandEncoder = null;
|
|
1302
1352
|
}
|
|
1353
|
+
// PRIVATE METHODS
|
|
1354
|
+
_getInfo() {
|
|
1355
|
+
const [driver, driverVersion] = (this.adapterInfo.driver || "").split(" Version ");
|
|
1356
|
+
const vendor = this.adapterInfo.vendor || this.adapter.__brand || "unknown";
|
|
1357
|
+
const renderer = driver || "";
|
|
1358
|
+
const version = driverVersion || "";
|
|
1359
|
+
const gpu = vendor === "apple" ? "apple" : "unknown";
|
|
1360
|
+
const gpuArchitecture = this.adapterInfo.architecture || "unknown";
|
|
1361
|
+
const gpuBackend = this.adapterInfo.backend || "unknown";
|
|
1362
|
+
const gpuType = (this.adapterInfo.type || "").split(" ")[0].toLowerCase() || "unknown";
|
|
1363
|
+
return {
|
|
1364
|
+
type: "webgpu",
|
|
1365
|
+
vendor,
|
|
1366
|
+
renderer,
|
|
1367
|
+
version,
|
|
1368
|
+
gpu,
|
|
1369
|
+
gpuType,
|
|
1370
|
+
gpuBackend,
|
|
1371
|
+
gpuArchitecture,
|
|
1372
|
+
shadingLanguage: "wgsl",
|
|
1373
|
+
shadingLanguageVersion: 100
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1303
1376
|
_getFeatures() {
|
|
1304
1377
|
const features = new Set(this.handle.features);
|
|
1305
1378
|
if (features.has("depth-clamping")) {
|
|
@@ -1310,19 +1383,18 @@ var _WebGPUDevice = class extends import_core15.Device {
|
|
|
1310
1383
|
features.add("texture-compression-bc5-webgl");
|
|
1311
1384
|
}
|
|
1312
1385
|
const WEBGPU_ALWAYS_FEATURES = [
|
|
1313
|
-
"webgpu",
|
|
1314
|
-
"wgsl",
|
|
1315
1386
|
"timer-query-webgl",
|
|
1316
|
-
"
|
|
1317
|
-
"float16-filterable-linear-webgl",
|
|
1318
|
-
"texture-filterable-anisotropic-webgl",
|
|
1387
|
+
"compilation-status-async-webgl",
|
|
1319
1388
|
"float32-renderable-webgl",
|
|
1320
|
-
"float16-renderable-webgl"
|
|
1389
|
+
"float16-renderable-webgl",
|
|
1390
|
+
"norm16-renderable-webgl",
|
|
1391
|
+
"texture-filterable-anisotropic-webgl",
|
|
1392
|
+
"shader-noperspective-interpolation-webgl"
|
|
1321
1393
|
];
|
|
1322
1394
|
for (const feature of WEBGPU_ALWAYS_FEATURES) {
|
|
1323
1395
|
features.add(feature);
|
|
1324
1396
|
}
|
|
1325
|
-
return features;
|
|
1397
|
+
return new import_core17.DeviceFeatures(Array.from(features));
|
|
1326
1398
|
}
|
|
1327
1399
|
copyExternalImageToTexture(options) {
|
|
1328
1400
|
var _a;
|