@luma.gl/webgpu 9.0.0-alpha.14 → 9.0.0-alpha.16
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 +100 -1
- package/dist/adapter/helpers/convert-texture-format.js +5 -6
- package/dist/adapter/helpers/generate-mipmaps.js +88 -92
- package/dist/adapter/helpers/get-bind-group.js +54 -48
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +97 -84
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +181 -129
- package/dist/adapter/resources/webgpu-buffer.js +57 -73
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +47 -63
- 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 +51 -55
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +22 -24
- package/dist/adapter/resources/webgpu-external-texture.js +26 -27
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +89 -103
- package/dist/adapter/resources/webgpu-query.js +42 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +64 -89
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +158 -154
- 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-sampler.js +16 -22
- 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 +47 -58
- package/dist/adapter/resources/webgpu-texture.d.ts +0 -1
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +100 -103
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +77 -90
- package/dist/adapter/webgpu-device.js +215 -242
- package/dist/adapter/webgpu-types.js +0 -2
- package/dist/bundle.js +1 -2
- package/dist/dist.js +8051 -0
- package/dist/dist.min.js +1 -0
- package/dist/es5/adapter/helpers/accessor-to-format.js +2 -0
- package/dist/es5/adapter/helpers/accessor-to-format.js.map +1 -0
- package/dist/es5/adapter/helpers/convert-texture-format.js +13 -0
- package/dist/es5/adapter/helpers/convert-texture-format.js.map +1 -0
- package/dist/es5/adapter/helpers/generate-mipmaps.js +103 -0
- package/dist/es5/adapter/helpers/generate-mipmaps.js.map +1 -0
- package/dist/es5/adapter/helpers/get-bind-group.js +66 -0
- package/dist/es5/adapter/helpers/get-bind-group.js.map +1 -0
- package/dist/es5/adapter/helpers/get-vertex-buffer-layout.js +149 -0
- package/dist/es5/adapter/helpers/get-vertex-buffer-layout.js.map +1 -0
- package/dist/es5/adapter/helpers/webgpu-parameters.js +150 -0
- package/dist/es5/adapter/helpers/webgpu-parameters.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-buffer.js +131 -0
- package/dist/es5/adapter/resources/webgpu-buffer.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-command-encoder.js +90 -0
- package/dist/es5/adapter/resources/webgpu-command-encoder.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-compute-pass.js +85 -0
- package/dist/es5/adapter/resources/webgpu-compute-pass.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-compute-pipeline.js +48 -0
- package/dist/es5/adapter/resources/webgpu-compute-pipeline.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-external-texture.js +50 -0
- package/dist/es5/adapter/resources/webgpu-external-texture.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-framebuffer.js +126 -0
- package/dist/es5/adapter/resources/webgpu-framebuffer.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-query.js +2 -0
- package/dist/es5/adapter/resources/webgpu-query.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-render-pass.js +124 -0
- package/dist/es5/adapter/resources/webgpu-render-pass.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-render-pipeline.js +185 -0
- package/dist/es5/adapter/resources/webgpu-render-pipeline.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-sampler.js +45 -0
- package/dist/es5/adapter/resources/webgpu-sampler.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-shader.js +125 -0
- package/dist/es5/adapter/resources/webgpu-shader.js.map +1 -0
- package/dist/es5/adapter/resources/webgpu-texture.js +138 -0
- package/dist/es5/adapter/resources/webgpu-texture.js.map +1 -0
- package/dist/es5/adapter/webgpu-canvas-context.js +111 -0
- package/dist/es5/adapter/webgpu-canvas-context.js.map +1 -0
- package/dist/es5/adapter/webgpu-device.js +317 -0
- package/dist/es5/adapter/webgpu-device.js.map +1 -0
- package/dist/es5/adapter/webgpu-types.js +2 -0
- package/dist/es5/adapter/webgpu-types.js.map +1 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/glsl/glsllang.js +47 -0
- package/dist/es5/glsl/glsllang.js.map +1 -0
- package/dist/es5/index.js +44 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/init.js +7 -0
- package/dist/es5/init.js.map +1 -0
- package/dist/esm/adapter/helpers/accessor-to-format.js +2 -0
- package/dist/esm/adapter/helpers/accessor-to-format.js.map +1 -0
- package/dist/esm/adapter/helpers/convert-texture-format.js +7 -0
- package/dist/esm/adapter/helpers/convert-texture-format.js.map +1 -0
- package/dist/esm/adapter/helpers/generate-mipmaps.js +88 -0
- package/dist/esm/adapter/helpers/generate-mipmaps.js.map +1 -0
- package/dist/esm/adapter/helpers/get-bind-group.js +51 -0
- package/dist/esm/adapter/helpers/get-bind-group.js.map +1 -0
- package/dist/esm/adapter/helpers/get-vertex-buffer-layout.js +83 -0
- package/dist/esm/adapter/helpers/get-vertex-buffer-layout.js.map +1 -0
- package/dist/esm/adapter/helpers/webgpu-parameters.js +137 -0
- package/dist/esm/adapter/helpers/webgpu-parameters.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-buffer.js +70 -0
- package/dist/esm/adapter/resources/webgpu-buffer.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-command-encoder.js +49 -0
- package/dist/esm/adapter/resources/webgpu-command-encoder.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-compute-pass.js +44 -0
- package/dist/esm/adapter/resources/webgpu-compute-pass.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-compute-pipeline.js +23 -0
- package/dist/esm/adapter/resources/webgpu-compute-pipeline.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-external-texture.js +23 -0
- package/dist/esm/adapter/resources/webgpu-external-texture.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-framebuffer.js +93 -0
- package/dist/esm/adapter/resources/webgpu-framebuffer.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-query.js +2 -0
- package/dist/esm/adapter/resources/webgpu-query.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-render-pass.js +79 -0
- package/dist/esm/adapter/resources/webgpu-render-pass.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-render-pipeline.js +130 -0
- package/dist/esm/adapter/resources/webgpu-render-pipeline.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-sampler.js +20 -0
- package/dist/esm/adapter/resources/webgpu-sampler.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-shader.js +50 -0
- package/dist/esm/adapter/resources/webgpu-shader.js.map +1 -0
- package/dist/esm/adapter/resources/webgpu-texture.js +95 -0
- package/dist/esm/adapter/resources/webgpu-texture.js.map +1 -0
- package/dist/esm/adapter/webgpu-canvas-context.js +74 -0
- package/dist/esm/adapter/webgpu-canvas-context.js.map +1 -0
- package/dist/esm/adapter/webgpu-device.js +196 -0
- package/dist/esm/adapter/webgpu-device.js.map +1 -0
- package/dist/esm/adapter/webgpu-types.js +2 -0
- package/dist/esm/adapter/webgpu-types.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/glsl/glsllang.js +9 -0
- package/dist/esm/glsl/glsllang.js.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/init.js +4 -0
- package/dist/esm/init.js.map +1 -0
- package/dist/glsl/glsllang.js +9 -7
- package/dist/index.js +8 -6
- package/dist/init.js +1 -2
- package/package.json +8 -8
- package/src/adapter/helpers/webgpu-parameters.ts +7 -2
- package/src/adapter/resources/webgpu-command-encoder.ts +2 -1
- package/src/adapter/resources/webgpu-compute-pass.ts +4 -4
- package/src/adapter/resources/webgpu-compute-pipeline.ts +2 -1
- package/src/adapter/resources/webgpu-framebuffer.ts +3 -2
- package/src/adapter/resources/webgpu-render-pass.ts +2 -2
- package/src/adapter/resources/webgpu-render-pipeline.ts +2 -1
- package/src/adapter/resources/webgpu-shader.ts +1 -1
- package/src/adapter/webgpu-canvas-context.ts +3 -2
- package/src/adapter/webgpu-device.ts +2 -2
- package/dist/adapter/helpers/accessor-to-format.js.map +0 -1
- package/dist/adapter/helpers/convert-texture-format.js.map +0 -1
- package/dist/adapter/helpers/generate-mipmaps.js.map +0 -1
- package/dist/adapter/helpers/get-bind-group.js.map +0 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +0 -1
- package/dist/adapter/helpers/webgpu-parameters.js.map +0 -1
- package/dist/adapter/resources/webgpu-buffer.js.map +0 -1
- package/dist/adapter/resources/webgpu-command-encoder.js.map +0 -1
- package/dist/adapter/resources/webgpu-compute-pass.js.map +0 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgpu-external-texture.js.map +0 -1
- package/dist/adapter/resources/webgpu-framebuffer.js.map +0 -1
- package/dist/adapter/resources/webgpu-query.js.map +0 -1
- package/dist/adapter/resources/webgpu-render-pass.js.map +0 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgpu-sampler.js.map +0 -1
- package/dist/adapter/resources/webgpu-shader.js.map +0 -1
- package/dist/adapter/resources/webgpu-texture.js.map +0 -1
- package/dist/adapter/webgpu-canvas-context.js.map +0 -1
- package/dist/adapter/webgpu-device.js.map +0 -1
- package/dist/adapter/webgpu-types.js.map +0 -1
- package/dist/bundle.js.map +0 -1
- package/dist/glsl/glsllang.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.js.map +0 -1
|
@@ -1,58 +1,54 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import { ComputePass, cast } from '@luma.gl/api';
|
|
3
2
|
export default class WebGPUComputePass extends ComputePass {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
3
|
+
constructor(device, props) {
|
|
4
|
+
super(device, props);
|
|
5
|
+
this._bindGroupLayout = null;
|
|
6
|
+
this.device = device;
|
|
7
|
+
this.handle = this.props.handle || device.commandEncoder?.beginComputePass({
|
|
8
|
+
label: this.props.id,
|
|
9
|
+
// timestampWrites?: GPUComputePassTimestampWrites;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** @note no WebGPU destroy method, just gc */
|
|
13
|
+
destroy() { }
|
|
14
|
+
end() {
|
|
15
|
+
this.handle.end();
|
|
16
|
+
}
|
|
17
|
+
setPipeline(pipeline) {
|
|
18
|
+
const wgpuPipeline = cast(pipeline);
|
|
19
|
+
this.handle.setPipeline(wgpuPipeline.handle);
|
|
20
|
+
this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
|
|
21
|
+
}
|
|
22
|
+
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
23
|
+
setBindings(bindings) {
|
|
24
|
+
throw new Error('fix me');
|
|
25
|
+
// const bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.bindings);
|
|
26
|
+
// this.handle.setBindGroup(0, bindGroup);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Dispatch work to be performed with the current ComputePipeline.
|
|
30
|
+
* @param x X dimension of the grid of workgroups to dispatch.
|
|
31
|
+
* @param y Y dimension of the grid of workgroups to dispatch.
|
|
32
|
+
* @param z Z dimension of the grid of workgroups to dispatch.
|
|
33
|
+
*/
|
|
34
|
+
dispatch(x, y, z) {
|
|
35
|
+
this.handle.dispatchWorkgroups(x, y, z);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Dispatch work to be performed with the current ComputePipeline.
|
|
39
|
+
* @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()
|
|
40
|
+
* @param indirectOffset
|
|
41
|
+
*/
|
|
42
|
+
dispatchIndirect(indirectBuffer, indirectOffset = 0) {
|
|
43
|
+
this.handle.dispatchWorkgroupsIndirect(cast(indirectBuffer).handle, indirectOffset);
|
|
44
|
+
}
|
|
45
|
+
pushDebugGroup(groupLabel) {
|
|
46
|
+
this.handle.pushDebugGroup(groupLabel);
|
|
47
|
+
}
|
|
48
|
+
popDebugGroup() {
|
|
49
|
+
this.handle.popDebugGroup();
|
|
50
|
+
}
|
|
51
|
+
insertDebugMarker(markerLabel) {
|
|
52
|
+
this.handle.insertDebugMarker(markerLabel);
|
|
53
|
+
}
|
|
57
54
|
}
|
|
58
|
-
//# sourceMappingURL=webgpu-compute-pass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAO,MAAM,cAAc,CAAC;AAEzE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAK5C,4DAA4D;AAC5D,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAO,MAAM,cAAc,CAAC;AAEzE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAK5C,4DAA4D;AAC5D,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAgB7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
// prettier-ignore
|
|
2
2
|
import { ComputePipeline, cast } from '@luma.gl/api';
|
|
3
|
+
// COMPUTE PIPELINE
|
|
4
|
+
/** Creates a new compute pipeline when parameters change */
|
|
3
5
|
export default class WebGPUComputePipeline extends ComputePipeline {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return this.handle.getBindGroupLayout(0);
|
|
24
|
-
}
|
|
25
|
-
|
|
6
|
+
constructor(device, props) {
|
|
7
|
+
super(device, props);
|
|
8
|
+
this.device = device;
|
|
9
|
+
const module = cast(this.props.cs).handle;
|
|
10
|
+
this.handle = this.props.handle || this.device.handle.createComputePipeline({
|
|
11
|
+
label: this.props.id,
|
|
12
|
+
compute: {
|
|
13
|
+
module,
|
|
14
|
+
entryPoint: this.props.csEntryPoint,
|
|
15
|
+
// constants: this.props.csConstants
|
|
16
|
+
},
|
|
17
|
+
layout: 'auto'
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** For internal use in render passes */
|
|
21
|
+
_getBindGroupLayout() {
|
|
22
|
+
// TODO: Cache?
|
|
23
|
+
return this.handle.getBindGroupLayout(0);
|
|
24
|
+
}
|
|
26
25
|
}
|
|
27
|
-
//# sourceMappingURL=webgpu-compute-pipeline.js.map
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
// luma.gl, MIT license
|
|
2
2
|
import { ExternalTexture } from '@luma.gl/api';
|
|
3
|
-
import WebGPUSampler from './webgpu-sampler';
|
|
3
|
+
import WebGPUSampler from './webgpu-sampler.js';
|
|
4
|
+
/**
|
|
5
|
+
* Cheap, temporary texture view for videos
|
|
6
|
+
* Only valid within same callback, destroyed automatically as a microtask.
|
|
7
|
+
*/
|
|
4
8
|
export default class WebGPUExternalTexture extends ExternalTexture {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
|
|
9
|
+
constructor(device, props) {
|
|
10
|
+
super(device, props);
|
|
11
|
+
this.device = device;
|
|
12
|
+
this.handle = this.props.handle || this.device.handle.importExternalTexture({
|
|
13
|
+
source: props.source,
|
|
14
|
+
colorSpace: props.colorSpace
|
|
15
|
+
});
|
|
16
|
+
this.sampler = null;
|
|
17
|
+
}
|
|
18
|
+
destroy() {
|
|
19
|
+
// External textures are destroyed automatically,
|
|
20
|
+
// as a microtask, instead of manually or upon garbage collection like other resources.
|
|
21
|
+
// this.handle.destroy();
|
|
22
|
+
}
|
|
23
|
+
/** Set default sampler */
|
|
24
|
+
setSampler(sampler) {
|
|
25
|
+
// We can accept a sampler instance or set of props;
|
|
26
|
+
this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=webgpu-external-texture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAU,MAAM,cAAc,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,gBAAgB,EAAE,aAAa,EAAE,CAAM;IACvC,sBAAsB,EAAE,aAAa,GAAG,IAAI,CAAQ;IAEpD,+DAA+D;IAC/D,oBAAoB,EAAE;QACpB,gBAAgB,EAAE,4BAA4B,EAAE,CAAC;QACjD,sBAAsB,CAAC,EAAE,mCAAmC,CAAC;KAC9D,CAEC;gBAEU,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAU,MAAM,cAAc,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,gBAAgB,EAAE,aAAa,EAAE,CAAM;IACvC,sBAAsB,EAAE,aAAa,GAAG,IAAI,CAAQ;IAEpD,+DAA+D;IAC/D,oBAAoB,EAAE;QACpB,gBAAgB,EAAE,4BAA4B,EAAE,CAAC;QACjD,sBAAsB,CAAC,EAAE,mCAAmC,CAAC;KAC9D,CAEC;gBAEU,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAiCzD,mCAAmC;IACnC,OAAO,CAAC,yBAAyB;IAkBjC,OAAO,CAAC,kBAAkB;IAkB1B;;;OAGG;IACF,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAiBnE"}
|
|
@@ -1,110 +1,96 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import { Framebuffer, Texture } from '@luma.gl/api';
|
|
3
|
-
import
|
|
2
|
+
// import WebGPUCanvasContext from '../webgpu-canvas-context.js';
|
|
3
|
+
import WEBGPUTexture from './webgpu-texture.js';
|
|
4
|
+
// const DEFAULT_DEPTH_STENCIL_FORMAT: DepthStencilTextureFormat = 'depth24plus';
|
|
5
|
+
// const MAX_COLOR_ATTACHMENTS = 8;
|
|
6
|
+
/**
|
|
7
|
+
* Create new textures with correct size for all attachments.
|
|
8
|
+
* @note resize() destroys existing textures (if size has changed).
|
|
9
|
+
*/
|
|
4
10
|
export default class WebGPUFramebuffer extends Framebuffer {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
constructor(device, props) {
|
|
12
|
+
super(device, props);
|
|
13
|
+
this.colorAttachments = [];
|
|
14
|
+
this.depthStencilAttachment = null;
|
|
15
|
+
/** Partial render pass descriptor. Used by WebGPURenderPass */
|
|
16
|
+
this.renderPassDescriptor = {
|
|
17
|
+
colorAttachments: []
|
|
18
|
+
};
|
|
19
|
+
this.device = device;
|
|
20
|
+
if (props.depthStencilAttachment) {
|
|
21
|
+
this.depthStencilAttachment = this.createDepthStencilTexture(props);
|
|
22
|
+
}
|
|
23
|
+
if (props.colorAttachments) {
|
|
24
|
+
this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));
|
|
25
|
+
}
|
|
26
|
+
if (this.depthStencilAttachment) {
|
|
27
|
+
this.renderPassDescriptor.depthStencilAttachment = {
|
|
28
|
+
view: this.depthStencilAttachment.handle.createView(),
|
|
29
|
+
// Add default clear values
|
|
30
|
+
depthClearValue: 1.0,
|
|
31
|
+
depthStoreOp: 'store',
|
|
32
|
+
stencilClearValue: 0,
|
|
33
|
+
stencilStoreOp: 'store',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (this.colorAttachments.length > 0) {
|
|
37
|
+
this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({
|
|
38
|
+
view: colorAttachment.handle.createView(),
|
|
39
|
+
loadOp: 'clear',
|
|
40
|
+
loadValue: [0.0, 0.0, 0.0, 0.0],
|
|
41
|
+
storeOp: 'store'
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
22
44
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
/** Create depth stencil texture */
|
|
46
|
+
createDepthStencilTexture(props) {
|
|
47
|
+
if (props.depthStencilAttachment instanceof WEBGPUTexture) {
|
|
48
|
+
return props.depthStencilAttachment;
|
|
49
|
+
}
|
|
50
|
+
if (typeof props.depthStencilAttachment === 'string') {
|
|
51
|
+
return this.device._createTexture({
|
|
52
|
+
id: 'depth-stencil-attachment',
|
|
53
|
+
format: props.depthStencilAttachment,
|
|
54
|
+
width: props.width,
|
|
55
|
+
height: props.height,
|
|
56
|
+
usage: Texture.RENDER_ATTACHMENT
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
throw new Error('type');
|
|
26
60
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
61
|
+
createColorTexture(props, texture) {
|
|
62
|
+
if (texture instanceof WEBGPUTexture) {
|
|
63
|
+
return texture;
|
|
64
|
+
}
|
|
65
|
+
if (typeof texture === 'string') {
|
|
66
|
+
return this.device._createTexture({
|
|
67
|
+
id: 'color-attachment',
|
|
68
|
+
format: texture,
|
|
69
|
+
width: props.width,
|
|
70
|
+
height: props.height,
|
|
71
|
+
usage: Texture.RENDER_ATTACHMENT
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
throw new Error('type');
|
|
36
75
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Create new textures with correct size for all attachments.
|
|
78
|
+
* @note destroys existing textures.
|
|
79
|
+
*/
|
|
80
|
+
_resizeAttachments(width, height) {
|
|
81
|
+
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
82
|
+
if (this.colorAttachments[i]) {
|
|
83
|
+
const resizedTexture = this.device._createTexture({ ...this.colorAttachments[i].props, width, height });
|
|
84
|
+
this.colorAttachments[i].destroy();
|
|
85
|
+
this.colorAttachments[i] = resizedTexture;
|
|
86
|
+
this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (this.depthStencilAttachment) {
|
|
90
|
+
const resizedTexture = this.device._createTexture({ ...this.depthStencilAttachment.props, width, height });
|
|
91
|
+
this.depthStencilAttachment.destroy();
|
|
92
|
+
this.depthStencilAttachment = resizedTexture;
|
|
93
|
+
this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();
|
|
94
|
+
}
|
|
44
95
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
createDepthStencilTexture(props) {
|
|
48
|
-
if (props.depthStencilAttachment instanceof WEBGPUTexture) {
|
|
49
|
-
return props.depthStencilAttachment;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (typeof props.depthStencilAttachment === 'string') {
|
|
53
|
-
return this.device._createTexture({
|
|
54
|
-
id: 'depth-stencil-attachment',
|
|
55
|
-
format: props.depthStencilAttachment,
|
|
56
|
-
width: props.width,
|
|
57
|
-
height: props.height,
|
|
58
|
-
usage: Texture.RENDER_ATTACHMENT
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
throw new Error('type');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
createColorTexture(props, texture) {
|
|
66
|
-
if (texture instanceof WEBGPUTexture) {
|
|
67
|
-
return texture;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (typeof texture === 'string') {
|
|
71
|
-
return this.device._createTexture({
|
|
72
|
-
id: 'color-attachment',
|
|
73
|
-
format: texture,
|
|
74
|
-
width: props.width,
|
|
75
|
-
height: props.height,
|
|
76
|
-
usage: Texture.RENDER_ATTACHMENT
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
throw new Error('type');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
_resizeAttachments(width, height) {
|
|
84
|
-
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
85
|
-
if (this.colorAttachments[i]) {
|
|
86
|
-
const resizedTexture = this.device._createTexture({ ...this.colorAttachments[i].props,
|
|
87
|
-
width,
|
|
88
|
-
height
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
this.colorAttachments[i].destroy();
|
|
92
|
-
this.colorAttachments[i] = resizedTexture;
|
|
93
|
-
this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (this.depthStencilAttachment) {
|
|
98
|
-
const resizedTexture = this.device._createTexture({ ...this.depthStencilAttachment.props,
|
|
99
|
-
width,
|
|
100
|
-
height
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
this.depthStencilAttachment.destroy();
|
|
104
|
-
this.depthStencilAttachment = resizedTexture;
|
|
105
|
-
this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
96
|
}
|
|
110
|
-
//# sourceMappingURL=webgpu-framebuffer.js.map
|
|
@@ -1,2 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
import {Resource, Query, QueryProps} from '@luma.gl/api';
|
|
3
|
+
import WebGPUDevice from '../webgpu-device.js';
|
|
1
4
|
|
|
2
|
-
|
|
5
|
+
export type WebGPUQueryProps = QueryProps & {
|
|
6
|
+
handle?: any;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const DEFAULT_QUERY_PROPS: Required<WebGPUQueryProps> = {
|
|
10
|
+
id: undefined,
|
|
11
|
+
handle: undefined,
|
|
12
|
+
userData: undefined,
|
|
13
|
+
type: 'timestamp',
|
|
14
|
+
count: 1,
|
|
15
|
+
pipelineStatistics: []
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Immutable
|
|
20
|
+
*
|
|
21
|
+
class WebGPUQuery extends Resource<WebGPUQueryProps> implements Query {
|
|
22
|
+
readonly device: WebGPUDevice;
|
|
23
|
+
readonly handle: GPUQuerySet;
|
|
24
|
+
|
|
25
|
+
constructor(device: WebGPUDevice, props: WebGPUQueryProps) {
|
|
26
|
+
super(device, props, DEFAULT_QUERY_PROPS);
|
|
27
|
+
this.handle = this.props.handle as GPUQuerySet || this.createHandle();
|
|
28
|
+
this.handle.label = this.props.id;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected createHandle() {
|
|
32
|
+
return this.device.handle.createQuerySet({
|
|
33
|
+
type: this.props.type,
|
|
34
|
+
count: this.props.count,
|
|
35
|
+
pipelineStatistics: this.props.pipelineStatistics
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override destroy(): void {
|
|
40
|
+
this.handle.destroy();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
*/
|
|
@@ -10,7 +10,7 @@ export default class WebGPURenderPass extends RenderPass {
|
|
|
10
10
|
pipeline: WebGPURenderPipeline | null;
|
|
11
11
|
constructor(device: WebGPUDevice, props?: RenderPassProps);
|
|
12
12
|
destroy(): void;
|
|
13
|
-
|
|
13
|
+
end(): void;
|
|
14
14
|
setPipeline(pipeline: RenderPipeline): void;
|
|
15
15
|
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
16
16
|
setBindings(bindings: Record<string, Binding>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AACjF,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAO,MAAM,cAAc,CAAC;AACtE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU;IACtD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAEtC,sBAAsB;IACtB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAQ;gBAEjC,MAAM,EAAE,YAAY,EAAE,KAAK,GAAE,eAAoB;IAUpD,OAAO,IAAI,IAAI;IAExB,
|
|
1
|
+
{"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AACjF,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAO,MAAM,cAAc,CAAC;AACtE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU;IACtD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAEtC,sBAAsB;IACtB,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAQ;gBAEjC,MAAM,EAAE,YAAY,EAAE,KAAK,GAAE,eAAoB;IAUpD,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAK3C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAQpD,cAAc,CACZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,cAAc,EAC3B,MAAM,GAAE,MAAU,EAClB,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI;IAIP,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,IAAI;IAIvE,IAAI,CAAC,OAAO,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI;IAmBR,YAAY,IAAI,IAAI;IAKpB,aAAa,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAwBrD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAW7C"}
|
|
@@ -1,98 +1,73 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import { RenderPass, cast } from '@luma.gl/api';
|
|
3
2
|
export default class WebGPURenderPass extends RenderPass {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer();
|
|
15
|
-
const renderPassDescriptor = framebuffer.renderPassDescriptor;
|
|
16
|
-
this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
|
|
17
|
-
this.handle.label = this.props.id;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
destroy() {}
|
|
21
|
-
|
|
22
|
-
endPass() {
|
|
23
|
-
this.handle.endPass();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
setPipeline(pipeline) {
|
|
27
|
-
this.pipeline = cast(pipeline);
|
|
28
|
-
this.handle.setPipeline(this.pipeline.handle);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
setBindings(bindings) {
|
|
32
|
-
var _this$pipeline, _this$pipeline2;
|
|
33
|
-
|
|
34
|
-
(_this$pipeline = this.pipeline) === null || _this$pipeline === void 0 ? void 0 : _this$pipeline.setBindings(bindings);
|
|
35
|
-
const bindGroup = (_this$pipeline2 = this.pipeline) === null || _this$pipeline2 === void 0 ? void 0 : _this$pipeline2._getBindGroup();
|
|
36
|
-
|
|
37
|
-
if (bindGroup) {
|
|
38
|
-
this.handle.setBindGroup(0, bindGroup);
|
|
3
|
+
constructor(device, props = {}) {
|
|
4
|
+
super(device, props);
|
|
5
|
+
/** Active pipeline */
|
|
6
|
+
this.pipeline = null;
|
|
7
|
+
this.device = device;
|
|
8
|
+
const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer();
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
const renderPassDescriptor = framebuffer.renderPassDescriptor;
|
|
11
|
+
this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
|
|
12
|
+
this.handle.label = this.props.id;
|
|
39
13
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.handle.setIndexBuffer(cast(buffer).handle, indexFormat, offset, size);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
setVertexBuffer(slot, buffer, offset = 0) {
|
|
47
|
-
this.handle.setVertexBuffer(slot, cast(buffer).handle, offset);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
draw(options) {
|
|
51
|
-
if (options.indexCount) {
|
|
52
|
-
this.handle.drawIndexed(options.indexCount, options.instanceCount, options.firstIndex, options.baseVertex, options.firstInstance);
|
|
53
|
-
} else {
|
|
54
|
-
this.handle.draw(options.vertexCount || 0, options.instanceCount, options.firstIndex, options.firstInstance);
|
|
14
|
+
destroy() { }
|
|
15
|
+
end() {
|
|
16
|
+
this.handle.end();
|
|
55
17
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
setParameters(parameters) {
|
|
61
|
-
const {
|
|
62
|
-
blendConstant,
|
|
63
|
-
stencilReference,
|
|
64
|
-
scissorRect,
|
|
65
|
-
viewport
|
|
66
|
-
} = parameters;
|
|
67
|
-
|
|
68
|
-
if (blendConstant) {
|
|
69
|
-
this.handle.setBlendConstant(blendConstant);
|
|
18
|
+
setPipeline(pipeline) {
|
|
19
|
+
this.pipeline = cast(pipeline);
|
|
20
|
+
this.handle.setPipeline(this.pipeline.handle);
|
|
70
21
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
22
|
+
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
23
|
+
setBindings(bindings) {
|
|
24
|
+
this.pipeline?.setBindings(bindings);
|
|
25
|
+
const bindGroup = this.pipeline?._getBindGroup();
|
|
26
|
+
if (bindGroup) {
|
|
27
|
+
this.handle.setBindGroup(0, bindGroup);
|
|
28
|
+
}
|
|
74
29
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.handle.setScissorRect(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);
|
|
30
|
+
setIndexBuffer(buffer, indexFormat, offset = 0, size) {
|
|
31
|
+
this.handle.setIndexBuffer(cast(buffer).handle, indexFormat, offset, size);
|
|
78
32
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
33
|
+
setVertexBuffer(slot, buffer, offset = 0) {
|
|
34
|
+
this.handle.setVertexBuffer(slot, cast(buffer).handle, offset);
|
|
35
|
+
}
|
|
36
|
+
draw(options) {
|
|
37
|
+
if (options.indexCount) {
|
|
38
|
+
this.handle.drawIndexed(options.indexCount, options.instanceCount, options.firstIndex, options.baseVertex, options.firstInstance);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.handle.draw(options.vertexCount || 0, options.instanceCount, options.firstIndex, options.firstInstance);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
drawIndirect() {
|
|
45
|
+
// drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;
|
|
46
|
+
// drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;
|
|
47
|
+
}
|
|
48
|
+
setParameters(parameters) {
|
|
49
|
+
const { blendConstant, stencilReference, scissorRect, viewport } = parameters;
|
|
50
|
+
if (blendConstant) {
|
|
51
|
+
this.handle.setBlendConstant(blendConstant);
|
|
52
|
+
}
|
|
53
|
+
if (stencilReference) {
|
|
54
|
+
this.handle.setStencilReference(stencilReference);
|
|
55
|
+
}
|
|
56
|
+
if (scissorRect) {
|
|
57
|
+
this.handle.setScissorRect(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);
|
|
58
|
+
}
|
|
59
|
+
// TODO - explain how 3 dimensions vs 2 in WebGL works.
|
|
60
|
+
if (viewport) {
|
|
61
|
+
this.handle.setViewport(viewport[0], viewport[1], viewport[2], viewport[3], viewport[4], viewport[5]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
pushDebugGroup(groupLabel) {
|
|
65
|
+
this.handle.pushDebugGroup(groupLabel);
|
|
66
|
+
}
|
|
67
|
+
popDebugGroup() {
|
|
68
|
+
this.handle.popDebugGroup();
|
|
69
|
+
}
|
|
70
|
+
insertDebugMarker(markerLabel) {
|
|
71
|
+
this.handle.insertDebugMarker(markerLabel);
|
|
82
72
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
pushDebugGroup(groupLabel) {
|
|
86
|
-
this.handle.pushDebugGroup(groupLabel);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
popDebugGroup() {
|
|
90
|
-
this.handle.popDebugGroup();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
insertDebugMarker(markerLabel) {
|
|
94
|
-
this.handle.insertDebugMarker(markerLabel);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
73
|
}
|
|
98
|
-
//# sourceMappingURL=webgpu-render-pass.js.map
|