@luma.gl/webgpu 9.3.0-alpha.6 → 9.3.0-alpha.9
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/get-bind-group.d.ts +3 -6
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +11 -14
- 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-command-encoder.d.ts +3 -13
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +68 -29
- 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 +17 -7
- 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 +26 -29
- 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-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-render-pass.d.ts +4 -4
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +10 -10
- package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +10 -9
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +48 -38
- package/dist/adapter/resources/webgpu-render-pipeline.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.d.ts +8 -1
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +35 -43
- package/dist/adapter/resources/webgpu-texture.js.map +1 -1
- package/dist/adapter/webgpu-device.d.ts +6 -2
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +60 -18
- package/dist/adapter/webgpu-device.js.map +1 -1
- package/dist/dist.dev.js +508 -311
- package/dist/dist.min.js +13 -13
- package/dist/index.cjs +439 -319
- 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 +3 -3
- package/src/adapter/helpers/get-bind-group.ts +18 -27
- 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-command-encoder.ts +99 -46
- package/src/adapter/resources/webgpu-compute-pass.ts +35 -8
- package/src/adapter/resources/webgpu-compute-pipeline.ts +43 -30
- package/src/adapter/resources/webgpu-fence.ts +11 -3
- package/src/adapter/resources/webgpu-pipeline-layout.ts +16 -14
- package/src/adapter/resources/webgpu-render-pass.ts +18 -14
- package/src/adapter/resources/webgpu-render-pipeline.ts +68 -46
- package/src/adapter/resources/webgpu-shader.ts +16 -1
- package/src/adapter/resources/webgpu-texture.ts +61 -44
- package/src/adapter/webgpu-device.ts +101 -25
- 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,21 +1,19 @@
|
|
|
1
|
-
import { ComputePipeline, ComputePipelineProps,
|
|
1
|
+
import { ComputePipeline, ComputePipelineProps, Bindings, BindingsByGroup } from '@luma.gl/core';
|
|
2
2
|
import { WebGPUDevice } from "../webgpu-device.js";
|
|
3
3
|
/** Creates a new compute pipeline when parameters change */
|
|
4
4
|
export declare class WebGPUComputePipeline extends ComputePipeline {
|
|
5
5
|
readonly device: WebGPUDevice;
|
|
6
6
|
readonly handle: GPUComputePipeline;
|
|
7
|
-
|
|
8
|
-
private
|
|
9
|
-
private _bindGroup;
|
|
10
|
-
/** For internal use to create BindGroups */
|
|
11
|
-
private _bindings;
|
|
7
|
+
private _bindingsByGroup;
|
|
8
|
+
private _bindGroupCacheKeysByGroup;
|
|
12
9
|
constructor(device: WebGPUDevice, props: ComputePipelineProps);
|
|
13
10
|
/**
|
|
14
11
|
* @todo Use renderpass.setBindings() ?
|
|
15
12
|
* @todo Do we want to expose BindGroups in the API and remove this?
|
|
16
13
|
*/
|
|
17
|
-
setBindings(bindings:
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
setBindings(bindings: Bindings | BindingsByGroup): void;
|
|
15
|
+
_getBindGroups(bindings?: Bindings | BindingsByGroup, bindGroupCacheKeys?: Partial<Record<number, object>>): Partial<Record<number, unknown>>;
|
|
16
|
+
_getBindingsByGroupWebGPU(): BindingsByGroup;
|
|
17
|
+
_getBindGroupCacheKeysWebGPU(): Partial<Record<number, object>>;
|
|
20
18
|
}
|
|
21
19
|
//# sourceMappingURL=webgpu-compute-pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,eAAe,EAGhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAO9C,4DAA4D;AAC5D,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAEpC,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,0BAA0B,CAAkC;gBAExD,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAsB7D;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI;IAoBvD,cAAc,CACZ,QAAQ,CAAC,EAAE,QAAQ,GAAG,eAAe,EACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACnD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IASnC,yBAAyB,IAAI,eAAe;IAI5C,4BAA4B,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAGhE"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { ComputePipeline } from '@luma.gl/core';
|
|
5
|
-
|
|
6
|
-
const EMPTY_BINDINGS = {};
|
|
4
|
+
import { ComputePipeline, _getDefaultBindGroupFactory, normalizeBindingsByGroup } from '@luma.gl/core';
|
|
5
|
+
const EMPTY_BIND_GROUPS = {};
|
|
7
6
|
// COMPUTE PIPELINE
|
|
8
7
|
/** Creates a new compute pipeline when parameters change */
|
|
9
8
|
export class WebGPUComputePipeline extends ComputePipeline {
|
|
10
9
|
device;
|
|
11
10
|
handle;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_bindGroup = null;
|
|
15
|
-
/** For internal use to create BindGroups */
|
|
16
|
-
_bindings;
|
|
11
|
+
_bindingsByGroup;
|
|
12
|
+
_bindGroupCacheKeysByGroup;
|
|
17
13
|
constructor(device, props) {
|
|
18
14
|
super(device, props);
|
|
19
15
|
this.device = device;
|
|
@@ -29,38 +25,39 @@ export class WebGPUComputePipeline extends ComputePipeline {
|
|
|
29
25
|
},
|
|
30
26
|
layout: 'auto'
|
|
31
27
|
});
|
|
32
|
-
this.
|
|
28
|
+
this._bindingsByGroup = EMPTY_BIND_GROUPS;
|
|
29
|
+
this._bindGroupCacheKeysByGroup = {};
|
|
33
30
|
}
|
|
34
31
|
/**
|
|
35
32
|
* @todo Use renderpass.setBindings() ?
|
|
36
33
|
* @todo Do we want to expose BindGroups in the API and remove this?
|
|
37
34
|
*/
|
|
38
35
|
setBindings(bindings) {
|
|
39
|
-
|
|
40
|
-
for (const [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
const nextBindingsByGroup = normalizeBindingsByGroup(this.shaderLayout, bindings);
|
|
37
|
+
for (const [groupKey, groupBindings] of Object.entries(nextBindingsByGroup)) {
|
|
38
|
+
const group = Number(groupKey);
|
|
39
|
+
for (const [name, binding] of Object.entries(groupBindings || {})) {
|
|
40
|
+
const currentGroupBindings = this._bindingsByGroup[group] || {};
|
|
41
|
+
if (currentGroupBindings[name] !== binding) {
|
|
42
|
+
if (!this._bindingsByGroup[group] ||
|
|
43
|
+
this._bindingsByGroup[group] === currentGroupBindings) {
|
|
44
|
+
this._bindingsByGroup[group] = { ...currentGroupBindings };
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
this._bindingsByGroup[group][name] = binding;
|
|
47
|
+
this._bindGroupCacheKeysByGroup[group] = {};
|
|
47
48
|
}
|
|
48
|
-
this._bindings[name] = binding;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
if (bindingsChanged) {
|
|
52
|
-
this._bindGroup = null;
|
|
53
|
-
}
|
|
54
51
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return this.
|
|
52
|
+
_getBindGroups(bindings, bindGroupCacheKeys) {
|
|
53
|
+
const hasExplicitBindings = Boolean(bindings);
|
|
54
|
+
return _getDefaultBindGroupFactory(this.device).getBindGroups(this, hasExplicitBindings ? bindings : this._bindingsByGroup, hasExplicitBindings ? bindGroupCacheKeys : this._bindGroupCacheKeysByGroup);
|
|
55
|
+
}
|
|
56
|
+
_getBindingsByGroupWebGPU() {
|
|
57
|
+
return this._bindingsByGroup;
|
|
58
|
+
}
|
|
59
|
+
_getBindGroupCacheKeysWebGPU() {
|
|
60
|
+
return this._bindGroupCacheKeysByGroup;
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
63
|
//# sourceMappingURL=webgpu-compute-pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pipeline.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pipeline.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EACL,eAAe,EAIf,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAIvB,MAAM,iBAAiB,GAAoB,EAAE,CAAC;AAE9C,mBAAmB;AAEnB,4DAA4D;AAC5D,MAAM,OAAO,qBAAsB,SAAQ,eAAe;IAC/C,MAAM,CAAe;IACrB,MAAM,CAAqB;IAE5B,gBAAgB,CAAkB;IAClC,0BAA0B,CAAkC;IAEpE,YAAY,MAAoB,EAAE,KAA2B;QAC3D,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAsB,CAAC;QAEvD,IAAI,CAAC,MAAM;YACT,IAAI,CAAC,KAAK,CAAC,MAAM;gBACjB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC;oBACvC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;oBACpB,OAAO,EAAE;wBACP,MAAM,EAAE,YAAY,CAAC,MAAM;wBAC3B,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;wBACjC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;qBAChC;oBACD,MAAM,EAAE,MAAM;iBACf,CAAC,CAAC;QAEL,IAAI,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;QAC1C,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,QAAoC;QAC9C,MAAM,mBAAmB,GAAG,wBAAwB,CAAC,IAAI,C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,CAAC;IAED,yBAAyB;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,4BAA4B;QAC1B,OAAO,IAAI,CAAC,0BAA0B,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-fence.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-fence.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,EAAE,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAE9C,6DAA6D;AAC7D,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAQ;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,YAAY,EAAE,KAAK,GAAE,UAAe;
|
|
1
|
+
{"version":3,"file":"webgpu-fence.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-fence.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,EAAE,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAE9C,6DAA6D;AAC7D,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAQ;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,YAAY,EAAE,KAAK,GAAE,UAAe;IAgBxD,UAAU,IAAI,OAAO;IAIZ,OAAO,IAAI,IAAI;CAGzB"}
|
|
@@ -11,8 +11,16 @@ export class WebGPUFence extends Fence {
|
|
|
11
11
|
constructor(device, props = {}) {
|
|
12
12
|
super(device, {});
|
|
13
13
|
this.device = device;
|
|
14
|
-
this.signaled = device.handle.queue
|
|
14
|
+
this.signaled = device.handle.queue
|
|
15
|
+
.onSubmittedWorkDone()
|
|
16
|
+
.then(() => {
|
|
15
17
|
this._signaled = true;
|
|
18
|
+
})
|
|
19
|
+
.catch(error => {
|
|
20
|
+
if (this.device.shouldIgnoreDroppedInstanceError(error)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
throw error;
|
|
16
24
|
});
|
|
17
25
|
}
|
|
18
26
|
isSignaled() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-fence.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-fence.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,KAAK,EAAkB,MAAM,eAAe,CAAC;AAGrD,6DAA6D;AAC7D,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,MAAM,CAAe;IACrB,MAAM,GAAS,IAAI,CAAC;IACpB,QAAQ,CAAgB;IACzB,SAAS,GAAG,KAAK,CAAC;IAE1B,YAAY,MAAoB,EAAE,QAAoB,EAAE;QACtD,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"webgpu-fence.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-fence.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,KAAK,EAAkB,MAAM,eAAe,CAAC;AAGrD,6DAA6D;AAC7D,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,MAAM,CAAe;IACrB,MAAM,GAAS,IAAI,CAAC;IACpB,QAAQ,CAAgB;IACzB,SAAS,GAAG,KAAK,CAAC;IAE1B,YAAY,MAAoB,EAAE,QAAoB,EAAE;QACtD,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK;aAChC,mBAAmB,EAAE;aACrB,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC,CAAC;aACD,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,IAAI,CAAC,MAAM,CAAC,gCAAgC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxD,OAAO;YACT,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEQ,OAAO;QACd,sCAAsC;IACxC,CAAC;CACF"}
|
|
@@ -5,6 +5,6 @@ export declare class WebGPUPipelineLayout extends PipelineLayout {
|
|
|
5
5
|
readonly handle: GPUPipelineLayout;
|
|
6
6
|
constructor(device: WebGPUDevice, props: PipelineLayoutProps);
|
|
7
7
|
destroy(): void;
|
|
8
|
-
protected
|
|
8
|
+
protected mapShaderLayoutToBindGroupEntriesByGroup(): GPUBindGroupLayoutEntry[][];
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=webgpu-pipeline-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-pipeline-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-pipeline-layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,cAAc,EACd,mBAAmB,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAE9C,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAEvB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"webgpu-pipeline-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-pipeline-layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,cAAc,EACd,mBAAmB,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAE9C,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAEvB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,mBAAmB;IAkBnD,OAAO,IAAI,IAAI;IAMxB,SAAS,CAAC,wCAAwC,IAAI,uBAAuB,EAAE,EAAE;CAoFlF"}
|
|
@@ -8,18 +8,13 @@ export class WebGPUPipelineLayout extends PipelineLayout {
|
|
|
8
8
|
constructor(device, props) {
|
|
9
9
|
super(device, props);
|
|
10
10
|
this.device = device;
|
|
11
|
-
const
|
|
11
|
+
const bindGroupEntriesByGroup = this.mapShaderLayoutToBindGroupEntriesByGroup();
|
|
12
12
|
this.handle = this.device.handle.createPipelineLayout({
|
|
13
13
|
label: props?.id ?? 'unnamed-pipeline-layout',
|
|
14
|
-
bindGroupLayouts:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.device.handle.createBindGroupLayout({
|
|
19
|
-
label: 'bind-group-layout',
|
|
20
|
-
entries: bindGroupEntries
|
|
21
|
-
})
|
|
22
|
-
]
|
|
14
|
+
bindGroupLayouts: bindGroupEntriesByGroup.map((entries, group) => this.device.handle.createBindGroupLayout({
|
|
15
|
+
label: `bind-group-layout-${group}`,
|
|
16
|
+
entries
|
|
17
|
+
}))
|
|
23
18
|
});
|
|
24
19
|
}
|
|
25
20
|
destroy() {
|
|
@@ -27,10 +22,9 @@ export class WebGPUPipelineLayout extends PipelineLayout {
|
|
|
27
22
|
// @ts-expect-error
|
|
28
23
|
this.handle = null;
|
|
29
24
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const bindGroupEntries = [];
|
|
25
|
+
mapShaderLayoutToBindGroupEntriesByGroup() {
|
|
26
|
+
const maxGroup = this.props.shaderLayout.bindings.reduce((highestGroup, binding) => Math.max(highestGroup, binding.group), -1);
|
|
27
|
+
const bindGroupEntriesByGroup = Array.from({ length: maxGroup + 1 }, () => []);
|
|
34
28
|
for (const binding of this.props.shaderLayout.bindings) {
|
|
35
29
|
const bindingTypeInfo = {};
|
|
36
30
|
switch (binding.type) {
|
|
@@ -88,13 +82,13 @@ export class WebGPUPipelineLayout extends PipelineLayout {
|
|
|
88
82
|
}
|
|
89
83
|
}
|
|
90
84
|
const VISIBILITY_ALL = GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE;
|
|
91
|
-
|
|
85
|
+
bindGroupEntriesByGroup[binding.group].push({
|
|
92
86
|
binding: binding.location,
|
|
93
87
|
visibility: binding.visibility || VISIBILITY_ALL,
|
|
94
88
|
...bindingTypeInfo
|
|
95
89
|
});
|
|
96
90
|
}
|
|
97
|
-
return
|
|
91
|
+
return bindGroupEntriesByGroup;
|
|
98
92
|
}
|
|
99
93
|
}
|
|
100
94
|
const isStorageTextureBindingLayout = (maybe) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-pipeline-layout.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-pipeline-layout.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EACL,GAAG,EACH,cAAc,EAIf,MAAM,eAAe,CAAC;AAGvB,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IAC7C,MAAM,CAAe;IACrB,MAAM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ACJ,CAAC;yBAAM,CAAC;wBACN,eAAe,CAAC,MAAM,GAAG;4BACvB,IAAI,EAAE,SAAS;4BACf,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;4BAC1C,cAAc,EAAE,OAAO,CAAC,cAAc;yBACvC,CAAC;oBACJ,CAAC;oBACD,MAAM;gBACR,CAAC;gBAED,KAAK,SAAS,CAAC,CAAC,CAAC;oBACf,eAAe,CAAC,OAAO,GAAG;wBACxB,YAAY,EAAE,OAAO,CAAC,YAAY;wBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;wBAC9B,aAAa,EAAE,OAAO,CAAC,aAAa;qBACrC,CAAC;oBACF,MAAM;gBACR,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACR,GAAG,CAAC,IAAI,CAAC,0DAA0D,CAAC,EAAE,CAAC;gBACzE,CAAC;YACH,CAAC;YAED,MAAM,cAAc,GAClB,cAAc,CAAC,MAAM,GAAG,cAAc,CAAC,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC;YAE3E,uBAAuB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;gBAC1C,OAAO,EAAE,OAAO,CAAC,QAAQ;gBACzB,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,cAAc;gBAChD,GAAG,eAAe;aACnB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,uBAAuB,CAAC;IACjC,CAAC;CACF;AAED,MAAM,6BAA6B,GAAG,CACpC,KAA+D,EACzB,EAAE;IACxC,OAAQ,KAAqC,CAAC,MAAM,KAAK,SAAS,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RenderPassProps, RenderPassParameters,
|
|
1
|
+
import type { RenderPassProps, RenderPassParameters, Bindings, BindingsByGroup } from '@luma.gl/core';
|
|
2
2
|
import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/core';
|
|
3
3
|
import { WebGPUDevice } from "../webgpu-device.js";
|
|
4
4
|
import { WebGPURenderPipeline } from "./webgpu-render-pipeline.js";
|
|
@@ -10,13 +10,13 @@ export declare class WebGPURenderPass extends RenderPass {
|
|
|
10
10
|
/** Active pipeline */
|
|
11
11
|
pipeline: WebGPURenderPipeline | null;
|
|
12
12
|
/** Latest bindings applied to this pass */
|
|
13
|
-
bindings:
|
|
14
|
-
constructor(device: WebGPUDevice, props?: RenderPassProps);
|
|
13
|
+
bindings: Bindings | BindingsByGroup;
|
|
14
|
+
constructor(device: WebGPUDevice, props?: RenderPassProps, commandEncoder?: GPUCommandEncoder);
|
|
15
15
|
destroy(): void;
|
|
16
16
|
end(): void;
|
|
17
17
|
setPipeline(pipeline: RenderPipeline): void;
|
|
18
18
|
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
19
|
-
setBindings(bindings:
|
|
19
|
+
setBindings(bindings: Bindings | BindingsByGroup): void;
|
|
20
20
|
setIndexBuffer(buffer: Buffer, indexFormat: GPUIndexFormat, offset?: number, size?: number): void;
|
|
21
21
|
setVertexBuffer(slot: number, buffer: Buffer, offset?: number): void;
|
|
22
22
|
draw(options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,QAAQ,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AACpG,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAmC,MAAM,eAAe,CAAC;AACnG,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAG9C,OAAO,EAAC,oBAAoB,EAAC,oCAAiC;AAE9D,OAAO,EAAC,i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GxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAI5C,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAG7C,iBAAiB,IAAI,IAAI;IAQzB;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,iBAAiB,GAAG,uBAAuB;CAqD3F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { RenderPass, log } from '@luma.gl/core';
|
|
4
|
+
import { RenderPass, _getDefaultBindGroupFactory, log } from '@luma.gl/core';
|
|
5
5
|
import { getCpuHotspotProfiler, getTimestamp } from "../helpers/cpu-hotspot-profiler.js";
|
|
6
6
|
export class WebGPURenderPass extends RenderPass {
|
|
7
7
|
device;
|
|
@@ -11,7 +11,7 @@ export class WebGPURenderPass extends RenderPass {
|
|
|
11
11
|
pipeline = null;
|
|
12
12
|
/** Latest bindings applied to this pass */
|
|
13
13
|
bindings = {};
|
|
14
|
-
constructor(device, props = {}) {
|
|
14
|
+
constructor(device, props = {}, commandEncoder = device.commandEncoder.handle) {
|
|
15
15
|
super(device, props);
|
|
16
16
|
this.device = device;
|
|
17
17
|
const { props: renderPassProps } = this;
|
|
@@ -50,13 +50,9 @@ export class WebGPURenderPass extends RenderPass {
|
|
|
50
50
|
(profiler.renderPassDescriptorAssemblyTimeMs || 0) +
|
|
51
51
|
(getTimestamp() - descriptorAssemblyStartTime);
|
|
52
52
|
}
|
|
53
|
-
if (!device.commandEncoder) {
|
|
54
|
-
throw new Error('commandEncoder not available');
|
|
55
|
-
}
|
|
56
53
|
this.device.pushErrorScope('validation');
|
|
57
54
|
const beginRenderPassStartTime = profiler ? getTimestamp() : 0;
|
|
58
|
-
this.handle =
|
|
59
|
-
this.props.handle || device.commandEncoder.handle.beginRenderPass(renderPassDescriptor);
|
|
55
|
+
this.handle = this.props.handle || commandEncoder.beginRenderPass(renderPassDescriptor);
|
|
60
56
|
if (profiler) {
|
|
61
57
|
profiler.renderPassBeginCount = (profiler.renderPassBeginCount || 0) + 1;
|
|
62
58
|
profiler.renderPassBeginTimeMs =
|
|
@@ -101,9 +97,13 @@ export class WebGPURenderPass extends RenderPass {
|
|
|
101
97
|
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
102
98
|
setBindings(bindings) {
|
|
103
99
|
this.bindings = bindings;
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
const bindGroups = (this.pipeline &&
|
|
101
|
+
_getDefaultBindGroupFactory(this.device).getBindGroups(this.pipeline, bindings)) ||
|
|
102
|
+
{};
|
|
103
|
+
for (const [group, bindGroup] of Object.entries(bindGroups)) {
|
|
104
|
+
if (bindGroup) {
|
|
105
|
+
this.handle.setBindGroup(Number(group), bindGroup);
|
|
106
|
+
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
setIndexBuffer(buffer, indexFormat, offset = 0, size) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pass.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAS,UAAU,EAAkB,GAAG,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"webgpu-render-pass.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAS,UAAU,EAAkB,2BAA2B,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AAOnG,OAAO,EAAC,qBAAqB,EAAE,YAAY,EAAC,2CAAwC;AAEpF,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IACrC,MAAM,CAAe;IACrB,MAAM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S,YAAY,CAAC,KAAgC;IACpD,OAAO,EAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Bindings, BindingsByGroup, RenderPass, VertexArray } from '@luma.gl/core';
|
|
2
2
|
import { RenderPipeline, RenderPipelineProps } from '@luma.gl/core';
|
|
3
3
|
import type { WebGPUDevice } from "../webgpu-device.js";
|
|
4
4
|
import type { WebGPUShader } from "./webgpu-shader.js";
|
|
@@ -6,13 +6,12 @@ import type { WebGPUShader } from "./webgpu-shader.js";
|
|
|
6
6
|
export declare class WebGPURenderPipeline extends RenderPipeline {
|
|
7
7
|
readonly device: WebGPUDevice;
|
|
8
8
|
readonly handle: GPURenderPipeline;
|
|
9
|
+
readonly descriptor: GPURenderPipelineDescriptor | null;
|
|
9
10
|
readonly vs: WebGPUShader;
|
|
10
11
|
readonly fs: WebGPUShader | null;
|
|
11
12
|
/** Compatibility path for direct pipeline.setBindings() usage */
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
private _bindGroupLayout;
|
|
15
|
-
private _bindGroup;
|
|
13
|
+
private _bindingsByGroup;
|
|
14
|
+
private _bindGroupCacheKeysByGroup;
|
|
16
15
|
get [Symbol.toStringTag](): string;
|
|
17
16
|
constructor(device: WebGPUDevice, props: RenderPipelineProps);
|
|
18
17
|
destroy(): void;
|
|
@@ -20,7 +19,7 @@ export declare class WebGPURenderPipeline extends RenderPipeline {
|
|
|
20
19
|
* Compatibility shim for code paths that still set bindings on the pipeline.
|
|
21
20
|
* The shared-model path passes bindings per draw and does not rely on this state.
|
|
22
21
|
*/
|
|
23
|
-
setBindings(bindings:
|
|
22
|
+
setBindings(bindings: Bindings | BindingsByGroup): void;
|
|
24
23
|
/** @todo - should this be moved to renderpass? */
|
|
25
24
|
draw(options: {
|
|
26
25
|
renderPass: RenderPass;
|
|
@@ -32,11 +31,13 @@ export declare class WebGPURenderPipeline extends RenderPipeline {
|
|
|
32
31
|
firstIndex?: number;
|
|
33
32
|
firstInstance?: number;
|
|
34
33
|
baseVertex?: number;
|
|
35
|
-
bindings?:
|
|
34
|
+
bindings?: Bindings;
|
|
35
|
+
bindGroups?: BindingsByGroup;
|
|
36
|
+
_bindGroupCacheKeys?: Partial<Record<number, object>>;
|
|
36
37
|
uniforms?: Record<string, unknown>;
|
|
37
38
|
}): boolean;
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
_getBindingsByGroupWebGPU(): BindingsByGroup;
|
|
40
|
+
_getBindGroupCacheKeysWebGPU(): Partial<Record<number, object>>;
|
|
40
41
|
/**
|
|
41
42
|
* Populate the complex WebGPU GPURenderPipelineDescriptor
|
|
42
43
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"webgpu-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACtF,OAAO,EACL,cAAc,EACd,mBAAmB,EAIpB,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AAEnD,OAAO,KAAK,EAAC,YAAY,EAAC,2BAAwB;AAKlD,2DAA2D;AAC3D,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,iBA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCE"}
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
// luma.gl MIT license
|
|
2
|
-
import { RenderPipeline, log } from '@luma.gl/core';
|
|
2
|
+
import { RenderPipeline, _getDefaultBindGroupFactory, log, normalizeBindingsByGroup } from '@luma.gl/core';
|
|
3
3
|
import { applyParametersToRenderPipelineDescriptor } from "../helpers/webgpu-parameters.js";
|
|
4
4
|
import { getWebGPUTextureFormat } from "../helpers/convert-texture-format.js";
|
|
5
|
-
import { getBindGroup } from "../helpers/get-bind-group.js";
|
|
6
5
|
import { getVertexBufferLayout } from "../helpers/get-vertex-buffer-layout.js";
|
|
7
|
-
const EMPTY_BINDINGS = {};
|
|
8
6
|
// RENDER PIPELINE
|
|
9
7
|
/** Creates a new render pipeline when parameters change */
|
|
10
8
|
export class WebGPURenderPipeline extends RenderPipeline {
|
|
11
9
|
device;
|
|
12
10
|
handle;
|
|
11
|
+
descriptor;
|
|
13
12
|
vs;
|
|
14
13
|
fs = null;
|
|
15
14
|
/** Compatibility path for direct pipeline.setBindings() usage */
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
_bindGroupLayout = null;
|
|
19
|
-
_bindGroup = null;
|
|
15
|
+
_bindingsByGroup;
|
|
16
|
+
_bindGroupCacheKeysByGroup = {};
|
|
20
17
|
get [Symbol.toStringTag]() {
|
|
21
18
|
return 'WebGPURenderPipeline';
|
|
22
19
|
}
|
|
23
20
|
constructor(device, props) {
|
|
24
21
|
super(device, props);
|
|
25
22
|
this.device = device;
|
|
23
|
+
this.shaderLayout ||= this.device.getShaderLayout(props.vs.source) || {
|
|
24
|
+
attributes: [],
|
|
25
|
+
bindings: []
|
|
26
|
+
};
|
|
26
27
|
this.handle = this.props.handle;
|
|
28
|
+
let descriptor = null;
|
|
27
29
|
if (!this.handle) {
|
|
28
|
-
|
|
30
|
+
descriptor = this._getRenderPipelineDescriptor();
|
|
29
31
|
log.groupCollapsed(1, `new WebGPURenderPipeline(${this.id})`)();
|
|
30
32
|
log.probe(1, JSON.stringify(descriptor, null, 2))();
|
|
31
33
|
log.groupEnd(1)();
|
|
@@ -36,11 +38,14 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
36
38
|
this.device.debug();
|
|
37
39
|
});
|
|
38
40
|
}
|
|
41
|
+
this.descriptor = descriptor;
|
|
39
42
|
this.handle.label = this.props.id;
|
|
40
43
|
// Note: Often the same shader in WebGPU
|
|
41
44
|
this.vs = props.vs;
|
|
42
45
|
this.fs = props.fs;
|
|
43
|
-
this.
|
|
46
|
+
this._bindingsByGroup =
|
|
47
|
+
props.bindGroups || normalizeBindingsByGroup(this.shaderLayout, props.bindings);
|
|
48
|
+
this._bindGroupCacheKeysByGroup = createBindGroupCacheKeys(this._bindingsByGroup);
|
|
44
49
|
}
|
|
45
50
|
destroy() {
|
|
46
51
|
// WebGPURenderPipeline has no destroy method.
|
|
@@ -52,21 +57,21 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
52
57
|
* The shared-model path passes bindings per draw and does not rely on this state.
|
|
53
58
|
*/
|
|
54
59
|
setBindings(bindings) {
|
|
55
|
-
|
|
56
|
-
for (const [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
const nextBindingsByGroup = normalizeBindingsByGroup(this.shaderLayout, bindings);
|
|
61
|
+
for (const [groupKey, groupBindings] of Object.entries(nextBindingsByGroup)) {
|
|
62
|
+
const group = Number(groupKey);
|
|
63
|
+
for (const [name, binding] of Object.entries(groupBindings || {})) {
|
|
64
|
+
const currentGroupBindings = this._bindingsByGroup[group] || {};
|
|
65
|
+
if (currentGroupBindings[name] !== binding) {
|
|
66
|
+
if (!this._bindingsByGroup[group] ||
|
|
67
|
+
this._bindingsByGroup[group] === currentGroupBindings) {
|
|
68
|
+
this._bindingsByGroup[group] = { ...currentGroupBindings };
|
|
61
69
|
}
|
|
62
|
-
|
|
70
|
+
this._bindingsByGroup[group][name] = binding;
|
|
71
|
+
this._bindGroupCacheKeysByGroup[group] = {};
|
|
63
72
|
}
|
|
64
|
-
this._bindings[name] = binding;
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
if (bindingsChanged) {
|
|
68
|
-
this._bindGroup = null;
|
|
69
|
-
}
|
|
70
75
|
}
|
|
71
76
|
/** @todo - should this be moved to renderpass? */
|
|
72
77
|
draw(options) {
|
|
@@ -80,9 +85,12 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
80
85
|
this.device.debug();
|
|
81
86
|
});
|
|
82
87
|
// Set bindings (uniform buffers, textures etc)
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
const hasExplicitBindings = Boolean(options.bindGroups || options.bindings);
|
|
89
|
+
const bindGroups = _getDefaultBindGroupFactory(this.device).getBindGroups(this, hasExplicitBindings ? options.bindGroups || options.bindings : this._bindingsByGroup, hasExplicitBindings ? options._bindGroupCacheKeys : this._bindGroupCacheKeysByGroup);
|
|
90
|
+
for (const [group, bindGroup] of Object.entries(bindGroups)) {
|
|
91
|
+
if (bindGroup) {
|
|
92
|
+
webgpuRenderPass.handle.setBindGroup(Number(group), bindGroup);
|
|
93
|
+
}
|
|
86
94
|
}
|
|
87
95
|
// Set attributes
|
|
88
96
|
// Note: Rebinds constant attributes before each draw call
|
|
@@ -98,20 +106,11 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
98
106
|
options.vertexArray.unbindAfterRender(options.renderPass);
|
|
99
107
|
return true;
|
|
100
108
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group
|
|
107
|
-
this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);
|
|
108
|
-
if (bindings) {
|
|
109
|
-
return getBindGroup(this.device, this._bindGroupLayout, this.shaderLayout, bindings);
|
|
110
|
-
}
|
|
111
|
-
this._bindGroup =
|
|
112
|
-
this._bindGroup ||
|
|
113
|
-
getBindGroup(this.device, this._bindGroupLayout, this.shaderLayout, this._bindings);
|
|
114
|
-
return this._bindGroup;
|
|
109
|
+
_getBindingsByGroupWebGPU() {
|
|
110
|
+
return this._bindingsByGroup;
|
|
111
|
+
}
|
|
112
|
+
_getBindGroupCacheKeysWebGPU() {
|
|
113
|
+
return this._bindGroupCacheKeysByGroup;
|
|
115
114
|
}
|
|
116
115
|
/**
|
|
117
116
|
* Populate the complex WebGPU GPURenderPipelineDescriptor
|
|
@@ -121,7 +120,9 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
121
120
|
const vertex = {
|
|
122
121
|
module: this.props.vs.handle,
|
|
123
122
|
entryPoint: this.props.vertexEntryPoint || 'main',
|
|
124
|
-
buffers: getVertexBufferLayout(this.shaderLayout, this.props.bufferLayout
|
|
123
|
+
buffers: getVertexBufferLayout(this.shaderLayout, this.props.bufferLayout, {
|
|
124
|
+
pipelineId: this.id
|
|
125
|
+
})
|
|
125
126
|
};
|
|
126
127
|
// Populate color targets
|
|
127
128
|
// TODO - at the moment blend and write mask are only set on the first target
|
|
@@ -164,6 +165,15 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
164
165
|
return descriptor;
|
|
165
166
|
}
|
|
166
167
|
}
|
|
168
|
+
function createBindGroupCacheKeys(bindingsByGroup) {
|
|
169
|
+
const bindGroupCacheKeys = {};
|
|
170
|
+
for (const [groupKey, groupBindings] of Object.entries(bindingsByGroup)) {
|
|
171
|
+
if (groupBindings && Object.keys(groupBindings).length > 0) {
|
|
172
|
+
bindGroupCacheKeys[Number(groupKey)] = {};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return bindGroupCacheKeys;
|
|
176
|
+
}
|
|
167
177
|
/**
|
|
168
178
|
_setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {
|
|
169
179
|
if (this._indexBuffer) {
|