@luma.gl/webgpu 9.0.17 → 9.1.0-alpha.10
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/convert-texture-format.d.ts +0 -1
- package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.d.ts +1 -2
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +5 -5
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +0 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +11 -7
- package/dist/adapter/helpers/webgpu-parameters.d.ts +0 -1
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +27 -12
- package/dist/adapter/resources/webgpu-buffer.d.ts +0 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +0 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +22 -5
- package/dist/adapter/resources/webgpu-compute-pass.d.ts +0 -1
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +1 -0
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +0 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +1 -1
- package/dist/adapter/resources/webgpu-external-texture.d.ts +0 -1
- package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.js +1 -0
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +3 -0
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +2 -0
- package/dist/adapter/resources/webgpu-query-set.d.ts +0 -1
- package/dist/adapter/resources/webgpu-query-set.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts +3 -3
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +8 -5
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +2 -3
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +11 -17
- package/dist/adapter/resources/webgpu-sampler.d.ts +0 -1
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.js +2 -0
- package/dist/adapter/resources/webgpu-shader.d.ts +0 -1
- package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture-view.d.ts +0 -1
- package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.d.ts +12 -5
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +46 -23
- package/dist/adapter/resources/webgpu-vertex-array.d.ts +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js +3 -1
- package/dist/adapter/webgpu-adapter.d.ts +13 -0
- package/dist/adapter/webgpu-adapter.d.ts.map +1 -0
- package/dist/adapter/webgpu-adapter.js +68 -0
- package/dist/adapter/webgpu-canvas-context.d.ts +2 -3
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.d.ts +1 -6
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +9 -47
- package/dist/dist.dev.js +190 -156
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +174 -115
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +4 -4
- package/src/adapter/helpers/get-bind-group.ts +6 -6
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +14 -8
- package/src/adapter/helpers/webgpu-parameters.ts +29 -12
- package/src/adapter/resources/webgpu-command-encoder.ts +25 -7
- package/src/adapter/resources/webgpu-compute-pass.ts +1 -0
- package/src/adapter/resources/webgpu-compute-pipeline.ts +1 -6
- package/src/adapter/resources/webgpu-external-texture.ts +1 -0
- package/src/adapter/resources/webgpu-framebuffer.ts +4 -0
- package/src/adapter/resources/webgpu-render-pass.ts +16 -10
- package/src/adapter/resources/webgpu-render-pipeline.ts +11 -23
- package/src/adapter/resources/webgpu-sampler.ts +3 -0
- package/src/adapter/resources/webgpu-texture-view.ts +15 -0
- package/src/adapter/resources/webgpu-texture.ts +88 -57
- package/src/adapter/resources/webgpu-vertex-array.ts +2 -1
- package/src/adapter/webgpu-adapter.ts +93 -0
- package/src/adapter/webgpu-canvas-context.ts +1 -1
- package/src/adapter/webgpu-device.ts +12 -64
- package/src/index.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-texture-format.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/convert-texture-format.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert-texture-format.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/convert-texture-format.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAE5C,mDAAmD;AACnD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAK9E"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="dist" />
|
|
2
1
|
import type { ComputeShaderLayout, BindingDeclaration, Binding } from '@luma.gl/core';
|
|
3
2
|
/**
|
|
4
3
|
* Create a WebGPU "bind group layout" from an array of luma.gl bindings
|
|
@@ -9,5 +8,5 @@ export declare function makeBindGroupLayout(device: GPUDevice, layout: GPUBindGr
|
|
|
9
8
|
* Create a WebGPU "bind group" from an array of luma.gl bindings
|
|
10
9
|
*/
|
|
11
10
|
export declare function getBindGroup(device: GPUDevice, bindGroupLayout: GPUBindGroupLayout, shaderLayout: ComputeShaderLayout, bindings: Record<string, Binding>): GPUBindGroup;
|
|
12
|
-
export declare function getShaderLayoutBinding(shaderLayout: ComputeShaderLayout, bindingName: string): BindingDeclaration;
|
|
11
|
+
export declare function getShaderLayoutBinding(shaderLayout: ComputeShaderLayout, bindingName: string): BindingDeclaration | null;
|
|
13
12
|
//# sourceMappingURL=get-bind-group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-bind-group.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-bind-group.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-bind-group.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-bind-group.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAMpF;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,OAAO,EAAE,GAClB,kBAAkB,CAMpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,EACjB,eAAe,EAAE,kBAAkB,EACnC,YAAY,EAAE,mBAAmB,EACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,YAAY,CAMd;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,mBAAmB,EACjC,WAAW,EAAE,MAAM,GAClB,kBAAkB,GAAG,IAAI,CAS3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { Buffer, Sampler, Texture, log
|
|
4
|
+
import { Buffer, Sampler, Texture, log } from '@luma.gl/core';
|
|
5
5
|
/**
|
|
6
6
|
* Create a WebGPU "bind group layout" from an array of luma.gl bindings
|
|
7
7
|
* @note bind groups can be automatically generated by WebGPU.
|
|
@@ -28,7 +28,7 @@ export function getShaderLayoutBinding(shaderLayout, bindingName) {
|
|
|
28
28
|
if (!bindingLayout) {
|
|
29
29
|
log.warn(`Binding ${bindingName} not set: Not found in shader layout.`)();
|
|
30
30
|
}
|
|
31
|
-
return bindingLayout;
|
|
31
|
+
return bindingLayout || null;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* @param bindings
|
|
@@ -49,20 +49,20 @@ function getBindGroupEntry(binding, index) {
|
|
|
49
49
|
return {
|
|
50
50
|
binding: index,
|
|
51
51
|
resource: {
|
|
52
|
-
buffer:
|
|
52
|
+
buffer: binding.handle
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
if (binding instanceof Sampler) {
|
|
57
57
|
return {
|
|
58
58
|
binding: index,
|
|
59
|
-
resource:
|
|
59
|
+
resource: binding.handle
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
else if (binding instanceof Texture) {
|
|
63
63
|
return {
|
|
64
64
|
binding: index,
|
|
65
|
-
resource:
|
|
65
|
+
resource: binding.handle.createView({ label: 'bind-group-auto-created' })
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
throw new Error('invalid binding');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-vertex-buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-vertex-buffer-layout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-vertex-buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-vertex-buffer-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAqC,MAAM,eAAe,CAAC;AAYlG;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,qBAAqB,EAAE,CAkFzB;AAED,wBAAgB,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BxB"}
|
|
@@ -27,21 +27,25 @@ export function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
|
27
27
|
// TODO verify that all stepModes for one buffer are the same
|
|
28
28
|
let stepMode = 'vertex';
|
|
29
29
|
let byteStride = 0;
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
const format = mapping.format;
|
|
30
32
|
// interleaved mapping {..., attributes: [{...}, ...]}
|
|
31
33
|
if (mapping.attributes) {
|
|
32
34
|
// const arrayStride = mapping.byteStride; TODO
|
|
33
35
|
for (const attributeMapping of mapping.attributes) {
|
|
34
36
|
const attributeName = attributeMapping.attribute;
|
|
35
37
|
const attributeLayout = findAttributeLayout(shaderLayout, attributeName, usedAttributes);
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
const location = attributeLayout?.location;
|
|
36
40
|
stepMode =
|
|
37
|
-
attributeLayout
|
|
38
|
-
(attributeLayout
|
|
41
|
+
attributeLayout?.stepMode ||
|
|
42
|
+
(attributeLayout?.name.startsWith('instance') ? 'instance' : 'vertex');
|
|
39
43
|
vertexAttributes.push({
|
|
40
44
|
format: getWebGPUVertexFormat(attributeMapping.format || mapping.format),
|
|
41
45
|
offset: attributeMapping.byteOffset,
|
|
42
|
-
shaderLocation:
|
|
46
|
+
shaderLocation: location
|
|
43
47
|
});
|
|
44
|
-
byteStride += decodeVertexFormat(
|
|
48
|
+
byteStride += decodeVertexFormat(format).byteLength;
|
|
45
49
|
}
|
|
46
50
|
// non-interleaved mapping (just set offset and stride)
|
|
47
51
|
}
|
|
@@ -50,12 +54,12 @@ export function getVertexBufferLayout(shaderLayout, bufferLayout) {
|
|
|
50
54
|
if (!attributeLayout) {
|
|
51
55
|
continue; // eslint-disable-line no-continue
|
|
52
56
|
}
|
|
53
|
-
byteStride = decodeVertexFormat(
|
|
57
|
+
byteStride = decodeVertexFormat(format).byteLength;
|
|
54
58
|
stepMode =
|
|
55
59
|
attributeLayout.stepMode ||
|
|
56
60
|
(attributeLayout.name.startsWith('instance') ? 'instance' : 'vertex');
|
|
57
61
|
vertexAttributes.push({
|
|
58
|
-
format: getWebGPUVertexFormat(
|
|
62
|
+
format: getWebGPUVertexFormat(format),
|
|
59
63
|
// We only support 0 offset for non-interleaved buffer layouts
|
|
60
64
|
offset: 0,
|
|
61
65
|
shaderLocation: attributeLayout.location
|
|
@@ -94,7 +98,7 @@ export function getBufferSlots(shaderLayout, bufferLayout) {
|
|
|
94
98
|
for (const mapping of bufferLayout) {
|
|
95
99
|
// interleaved mapping {..., attributes: [{...}, ...]}
|
|
96
100
|
if ('attributes' in mapping) {
|
|
97
|
-
for (const interleaved of mapping.attributes) {
|
|
101
|
+
for (const interleaved of mapping.attributes || []) {
|
|
98
102
|
usedAttributes.add(interleaved.attribute);
|
|
99
103
|
}
|
|
100
104
|
// non-interleaved mapping (just set offset and stride)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AA2BzC;;;GAGG;AAEH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,QAAQ,CAsN9D,CAAC;AAgCF,wBAAgB,yCAAyC,CACvD,kBAAkB,EAAE,2BAA2B,EAC/C,UAAU,GAAE,UAAe,GAC1B,IAAI,CAIN"}
|
|
@@ -13,6 +13,16 @@ function addDepthStencil(descriptor) {
|
|
|
13
13
|
};
|
|
14
14
|
return descriptor.depthStencil;
|
|
15
15
|
}
|
|
16
|
+
function addDepthStencilFront(descriptor) {
|
|
17
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
return depthStencil.stencilFront;
|
|
20
|
+
}
|
|
21
|
+
function addDepthStencilBack(descriptor) {
|
|
22
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
return depthStencil.stencilBack;
|
|
25
|
+
}
|
|
16
26
|
/**
|
|
17
27
|
* Supports for luma.gl's flat parameter space
|
|
18
28
|
* Populates the corresponding sub-objects in a GPURenderPipelineDescriptor
|
|
@@ -63,24 +73,28 @@ export const PARAMETER_TABLE = {
|
|
|
63
73
|
depthStencil.stencilWriteMask = value;
|
|
64
74
|
},
|
|
65
75
|
stencilCompare: (parameter, value, descriptor) => {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
const stencilFront = addDepthStencilFront(descriptor);
|
|
77
|
+
const stencilBack = addDepthStencilBack(descriptor);
|
|
78
|
+
stencilFront.compare = value;
|
|
79
|
+
stencilBack.compare = value;
|
|
69
80
|
},
|
|
70
81
|
stencilPassOperation: (parameter, value, descriptor) => {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
const stencilFront = addDepthStencilFront(descriptor);
|
|
83
|
+
const stencilBack = addDepthStencilBack(descriptor);
|
|
84
|
+
stencilFront.passOp = value;
|
|
85
|
+
stencilBack.passOp = value;
|
|
74
86
|
},
|
|
75
87
|
stencilFailOperation: (parameter, value, descriptor) => {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
const stencilFront = addDepthStencilFront(descriptor);
|
|
89
|
+
const stencilBack = addDepthStencilBack(descriptor);
|
|
90
|
+
stencilFront.failOp = value;
|
|
91
|
+
stencilBack.failOp = value;
|
|
79
92
|
},
|
|
80
93
|
stencilDepthFailOperation: (parameter, value, descriptor) => {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
const stencilFront = addDepthStencilFront(descriptor);
|
|
95
|
+
const stencilBack = addDepthStencilBack(descriptor);
|
|
96
|
+
stencilFront.depthFailOp = value;
|
|
97
|
+
stencilBack.depthFailOp = value;
|
|
84
98
|
},
|
|
85
99
|
// MULTISAMPLE
|
|
86
100
|
sampleCount: (parameter, value, descriptor) => {
|
|
@@ -186,6 +200,7 @@ function setParameters(pipelineDescriptor, parameters) {
|
|
|
186
200
|
}
|
|
187
201
|
}
|
|
188
202
|
function addColorState(descriptor) {
|
|
203
|
+
// @ts-ignore
|
|
189
204
|
descriptor.fragment.targets = descriptor.fragment?.targets || [];
|
|
190
205
|
if (!Array.isArray(descriptor.fragment?.targets)) {
|
|
191
206
|
throw new Error('colorstate');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AAMnD,qBAAa,YAAa,SAAQ,MAAM;IACtC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW;IA8B3C,OAAO,IAAI,IAAI;IAOf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,SAAI;IAUrC,SAAS,CACtB,UAAU,GAAE,MAAU,EACtB,UAAU,GAAE,MAAwB,GACnC,OAAO,CAAC,UAAU,CAAC;IAsBtB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IAQtD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,cAAc,CAAC,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;IAI9D,KAAK,IAAI,IAAI;CAGd;AA4CD;;;;;;;;EAQE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACnF,OAAO,KAAK,EAAC,2BAA2B,EAAE,0BAA0B,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAG9C,OAAO,EAAC,cAAc,EAAC,8BAA2B;AAElD,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;IAYnD,OAAO,IAAI,IAAI;IAExB,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,gBAAgB;IAOjD,kBAAkB,CAAC,OAAO,EAC1B;QACE,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,IAAI;IAYR,mBAAmB,CAAC,OAAO,EAC3B;QACE,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QAErB,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;QAE/C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9C,GAAG,IAAI;IAyBR,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAW9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAWvD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAIrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAI5C,eAAe,CACtB,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,GACA,IAAI;CAWR"}
|
|
@@ -41,10 +41,10 @@ export class WebGPUCommandEncoder extends CommandEncoder {
|
|
|
41
41
|
origin: options.origin ?? {}
|
|
42
42
|
// aspect: options.aspect
|
|
43
43
|
}, {
|
|
44
|
-
//
|
|
45
|
-
width: options.extent[0],
|
|
46
|
-
height: options.extent[1],
|
|
47
|
-
depthOrArrayLayers: options.extent[2]
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
width: options.extent?.[0],
|
|
46
|
+
height: options.extent?.[1],
|
|
47
|
+
depthOrArrayLayers: options.extent?.[2]
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
copyTextureToBuffer(options) {
|
|
@@ -79,6 +79,23 @@ export class WebGPUCommandEncoder extends CommandEncoder {
|
|
|
79
79
|
resolveQuerySet(querySet, destination, options) {
|
|
80
80
|
const webgpuQuerySet = querySet;
|
|
81
81
|
const webgpuBuffer = destination;
|
|
82
|
-
this.handle.resolveQuerySet(webgpuQuerySet.handle, options
|
|
82
|
+
this.handle.resolveQuerySet(webgpuQuerySet.handle, options?.firstQuery || 0, options?.queryCount || querySet.props.count - (options?.firstQuery || 0), webgpuBuffer.handle, options?.destinationOffset || 0);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
/*
|
|
86
|
+
// setDataFromTypedArray(data): this {
|
|
87
|
+
// const textureDataBuffer = this.device.handle.createBuffer({
|
|
88
|
+
// size: data.byteLength,
|
|
89
|
+
// usage: Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
90
|
+
// mappedAtCreation: true
|
|
91
|
+
// });
|
|
92
|
+
// new Uint8Array(textureDataBuffer.getMappedRange()).set(data);
|
|
93
|
+
// textureDataBuffer.unmap();
|
|
94
|
+
|
|
95
|
+
// this.setBuffer(textureDataBuffer);
|
|
96
|
+
|
|
97
|
+
// textureDataBuffer.destroy();
|
|
98
|
+
// return this;
|
|
99
|
+
// }
|
|
100
|
+
|
|
101
|
+
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAE9C,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAGhE,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAEvC,eAAe,EAAE,qBAAqB,GAAG,IAAI,CAAQ;gBAEzC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAyBzD,8CAA8C;IACrC,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAO5C;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;;;OAMG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,kBAAkB,GAAE,MAAU,GAAG,IAAI;IAK9E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAIrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAG7C"}
|
|
@@ -44,6 +44,7 @@ export class WebGPUComputePass extends ComputePass {
|
|
|
44
44
|
* TODO - still some API confusion - does this method go here or on the pipeline?
|
|
45
45
|
*/
|
|
46
46
|
setBindings(bindings) {
|
|
47
|
+
// @ts-expect-error
|
|
47
48
|
const bindGroup = this._webgpuPipeline._getBindGroup();
|
|
48
49
|
this.handle.setBindGroup(0, bindGroup);
|
|
49
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAK9C,4DAA4D;AAC5D,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAE3B,4CAA4C;IAC5C,OAAO,CAAC,gBAAgB,CAAmC;IAC3D,OAAO,CAAC,UAAU,CAA6B;IAC/C,4CAA4C;IAC5C,OAAO,CAAC,SAAS,CAA+B;gBAEpC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAmB7D;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIpD,iDAAiD;IACjD,aAAa;CAWd"}
|
|
@@ -43,7 +43,7 @@ export class WebGPUComputePipeline extends ComputePipeline {
|
|
|
43
43
|
// Set up the bindings
|
|
44
44
|
this._bindGroup =
|
|
45
45
|
this._bindGroup ||
|
|
46
|
-
getBindGroup(this.device.handle, this._bindGroupLayout, this.
|
|
46
|
+
getBindGroup(this.device.handle, this._bindGroupLayout, this.shaderLayout, this._bindings);
|
|
47
47
|
return this._bindGroup;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AACnD,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAE/C;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,OAAO,EAAE,aAAa,CAAC;gBAEX,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAapD,OAAO,IAAI,IAAI;IAQxB,0BAA0B;IAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAMlD"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { FramebufferProps } from '@luma.gl/core';
|
|
2
2
|
import { Framebuffer } from '@luma.gl/core';
|
|
3
3
|
import { WebGPUDevice } from "../webgpu-device.js";
|
|
4
|
+
import { WebGPUTextureView } from "../resources/webgpu-texture-view.js";
|
|
4
5
|
/**
|
|
5
6
|
* Create new textures with correct size for all attachments.
|
|
6
7
|
* @note resize() destroys existing textures (if size has changed).
|
|
7
8
|
*/
|
|
8
9
|
export declare class WebGPUFramebuffer extends Framebuffer {
|
|
9
10
|
readonly device: WebGPUDevice;
|
|
11
|
+
colorAttachments: WebGPUTextureView[];
|
|
12
|
+
depthStencilAttachment: WebGPUTextureView | null;
|
|
10
13
|
constructor(device: WebGPUDevice, props: FramebufferProps);
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=webgpu-framebuffer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,4BAAyB;
|
|
1
|
+
{"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAC9C,OAAO,EAAC,iBAAiB,EAAC,4CAAyC;AAEnE;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,gBAAgB,EAAE,iBAAiB,EAAE,CAAM;IAC3C,sBAAsB,EAAE,iBAAiB,GAAG,IAAI,CAAQ;gBAE5C,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CAO1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-query-set.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-query-set.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-query-set.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-query-set.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAE9C,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;gBAEjB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa;IAY7C,OAAO,IAAI,IAAI;CAKzB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import type { RenderPassProps, RenderPassParameters, Binding, Framebuffer } from '@luma.gl/core';
|
|
1
|
+
import type { RenderPassProps, RenderPassParameters, Binding } from '@luma.gl/core';
|
|
3
2
|
import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/core';
|
|
4
3
|
import { WebGPUDevice } from "../webgpu-device.js";
|
|
5
4
|
import { WebGPURenderPipeline } from "./webgpu-render-pipeline.js";
|
|
5
|
+
import { WebGPUFramebuffer } from "./webgpu-framebuffer.js";
|
|
6
6
|
export declare class WebGPURenderPass extends RenderPass {
|
|
7
7
|
readonly device: WebGPUDevice;
|
|
8
8
|
readonly handle: GPURenderPassEncoder;
|
|
@@ -36,6 +36,6 @@ export declare class WebGPURenderPass extends RenderPass {
|
|
|
36
36
|
* Partial render pass descriptor. Used by WebGPURenderPass.
|
|
37
37
|
* @returns attachments fields of a renderpass descriptor.
|
|
38
38
|
*/
|
|
39
|
-
protected getRenderPassDescriptor(framebuffer:
|
|
39
|
+
protected getRenderPassDescriptor(framebuffer: WebGPUFramebuffer): GPURenderPassDescriptor;
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=webgpu-render-pass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAClF,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAM,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAG9C,OAAO,EAAC,oBAAoB,EAAC,oCAAiC;AAE9D,OAAO,EAAC,iBAAiB,EAAC,gCAA6B;AAEvD,qBAAa,gBAAiB,SAAQ,UAAU;IAC9C,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;IAmCpD,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;IAI5C,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAG7C,iBAAiB,IAAI,IAAI;IAQzB;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,iBAAiB,GAAG,uBAAuB;CA2C3F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { RenderPass,
|
|
4
|
+
import { RenderPass, log } from '@luma.gl/core';
|
|
5
5
|
export class WebGPURenderPass extends RenderPass {
|
|
6
6
|
device;
|
|
7
7
|
handle;
|
|
@@ -10,7 +10,7 @@ export class WebGPURenderPass extends RenderPass {
|
|
|
10
10
|
constructor(device, props = {}) {
|
|
11
11
|
super(device, props);
|
|
12
12
|
this.device = device;
|
|
13
|
-
const framebuffer = props.framebuffer || device.
|
|
13
|
+
const framebuffer = props.framebuffer || device.getCanvasContext().getCurrentFramebuffer();
|
|
14
14
|
const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);
|
|
15
15
|
const webgpuQuerySet = props.timestampQuerySet;
|
|
16
16
|
if (webgpuQuerySet) {
|
|
@@ -26,6 +26,9 @@ export class WebGPURenderPass extends RenderPass {
|
|
|
26
26
|
}
|
|
27
27
|
: undefined;
|
|
28
28
|
}
|
|
29
|
+
if (!device.commandEncoder) {
|
|
30
|
+
throw new Error('commandEncoder not available');
|
|
31
|
+
}
|
|
29
32
|
this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
|
|
30
33
|
this.handle.label = this.props.id;
|
|
31
34
|
log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();
|
|
@@ -37,7 +40,7 @@ export class WebGPURenderPass extends RenderPass {
|
|
|
37
40
|
this.handle.end();
|
|
38
41
|
}
|
|
39
42
|
setPipeline(pipeline) {
|
|
40
|
-
this.pipeline =
|
|
43
|
+
this.pipeline = pipeline;
|
|
41
44
|
this.handle.setPipeline(this.pipeline.handle);
|
|
42
45
|
}
|
|
43
46
|
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
@@ -49,10 +52,10 @@ export class WebGPURenderPass extends RenderPass {
|
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
setIndexBuffer(buffer, indexFormat, offset = 0, size) {
|
|
52
|
-
this.handle.setIndexBuffer(
|
|
55
|
+
this.handle.setIndexBuffer(buffer.handle, indexFormat, offset, size);
|
|
53
56
|
}
|
|
54
57
|
setVertexBuffer(slot, buffer, offset = 0) {
|
|
55
|
-
this.handle.setVertexBuffer(slot,
|
|
58
|
+
this.handle.setVertexBuffer(slot, buffer.handle, offset);
|
|
56
59
|
}
|
|
57
60
|
draw(options) {
|
|
58
61
|
if (options.indexCount) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="dist" />
|
|
2
1
|
import type { Binding, RenderPass, VertexArray } from '@luma.gl/core';
|
|
3
2
|
import { RenderPipeline, RenderPipelineProps } from '@luma.gl/core';
|
|
4
3
|
import type { WebGPUDevice } from "../webgpu-device.js";
|
|
@@ -33,7 +32,7 @@ export declare class WebGPURenderPipeline extends RenderPipeline {
|
|
|
33
32
|
baseVertex?: number;
|
|
34
33
|
}): boolean;
|
|
35
34
|
/** Return a bind group created by setBindings */
|
|
36
|
-
_getBindGroup(): GPUBindGroup;
|
|
35
|
+
_getBindGroup(): GPUBindGroup | null;
|
|
37
36
|
/**
|
|
38
37
|
* Populate the complex WebGPU GPURenderPipelineDescriptor
|
|
39
38
|
*/
|
|
@@ -49,7 +48,7 @@ _setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {
|
|
|
49
48
|
for (let i = 0; i < buffers.length; ++i) {
|
|
50
49
|
const buffer = cast<WebGPUBuffer>(buffers[i]);
|
|
51
50
|
if (!buffer) {
|
|
52
|
-
const attribute = this.
|
|
51
|
+
const attribute = this.shaderLayout.attributes.find(
|
|
53
52
|
(attribute) => attribute.location === i
|
|
54
53
|
);
|
|
55
54
|
throw new Error(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAM,MAAM,eAAe,CAAC;AASvE,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AAEnD,OAAO,KAAK,EAAC,YAAY,EAAC,2BAAwB;AAKlD,2DAA2D;AAC3D,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;IAE1B,EAAE,EAAE,YAAY,CAAC;IACjB,EAAE,EAAE,YAAY,GAAG,IAAI,CAAQ;IAE/B,4CAA4C;IAC5C,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,gBAAgB,CAAmC;IAC3D,OAAO,CAAC,UAAU,CAA6B;gBAEnC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,mBAAmB;IAmBnD,OAAO,IAAI,IAAI;IAMxB;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIpD,kDAAkD;IAClD,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,UAAU,CAAC;QACvB,WAAW,EAAE,WAAW,CAAC;QACzB,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,OAAO;IAuCX,iDAAiD;IACjD,aAAa;IAiBb;;OAEG;IACH,SAAS,CAAC,4BAA4B;CAmCvC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// luma.gl MIT license
|
|
2
|
-
import { RenderPipeline,
|
|
2
|
+
import { RenderPipeline, log } from '@luma.gl/core';
|
|
3
3
|
import { applyParametersToRenderPipelineDescriptor } from "../helpers/webgpu-parameters.js";
|
|
4
4
|
import { getWebGPUTextureFormat } from "../helpers/convert-texture-format.js";
|
|
5
5
|
import { getBindGroup } from "../helpers/get-bind-group.js";
|
|
@@ -27,12 +27,13 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
27
27
|
this.handle = this.device.handle.createRenderPipeline(descriptor);
|
|
28
28
|
}
|
|
29
29
|
this.handle.label = this.props.id;
|
|
30
|
-
this.vs =
|
|
31
|
-
this.fs =
|
|
30
|
+
this.vs = props.vs;
|
|
31
|
+
this.fs = props.fs;
|
|
32
32
|
this._bindings = { ...this.props.bindings };
|
|
33
33
|
}
|
|
34
34
|
destroy() {
|
|
35
35
|
// WebGPURenderPipeline has no destroy method.
|
|
36
|
+
// @ts-expect-error
|
|
36
37
|
this.handle = null;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
@@ -69,7 +70,7 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
69
70
|
}
|
|
70
71
|
/** Return a bind group created by setBindings */
|
|
71
72
|
_getBindGroup() {
|
|
72
|
-
if (this.
|
|
73
|
+
if (this.shaderLayout.bindings.length === 0) {
|
|
73
74
|
return null;
|
|
74
75
|
}
|
|
75
76
|
// Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group
|
|
@@ -78,7 +79,7 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
78
79
|
// TODO what if bindings change? We need to rebuild the bind group!
|
|
79
80
|
this._bindGroup =
|
|
80
81
|
this._bindGroup ||
|
|
81
|
-
getBindGroup(this.device.handle, this._bindGroupLayout, this.
|
|
82
|
+
getBindGroup(this.device.handle, this._bindGroupLayout, this.shaderLayout, this._bindings);
|
|
82
83
|
return this._bindGroup;
|
|
83
84
|
}
|
|
84
85
|
/**
|
|
@@ -87,28 +88,21 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
87
88
|
_getRenderPipelineDescriptor() {
|
|
88
89
|
// Set up the vertex stage
|
|
89
90
|
const vertex = {
|
|
90
|
-
module:
|
|
91
|
+
module: this.props.vs.handle,
|
|
91
92
|
entryPoint: this.props.vertexEntryPoint || 'main',
|
|
92
|
-
buffers: getVertexBufferLayout(this.
|
|
93
|
+
buffers: getVertexBufferLayout(this.shaderLayout, this.props.bufferLayout)
|
|
93
94
|
};
|
|
94
95
|
// Set up the fragment stage
|
|
95
96
|
const fragment = {
|
|
96
|
-
module:
|
|
97
|
+
module: this.props.fs.handle,
|
|
97
98
|
entryPoint: this.props.fragmentEntryPoint || 'main',
|
|
98
99
|
targets: [
|
|
99
100
|
{
|
|
100
101
|
// TODO exclamation mark hack!
|
|
101
|
-
format: getWebGPUTextureFormat(this.device
|
|
102
|
+
format: getWebGPUTextureFormat(this.device.getCanvasContext().format)
|
|
102
103
|
}
|
|
103
104
|
]
|
|
104
105
|
};
|
|
105
|
-
// WebGPU has more restrictive topology support than WebGL
|
|
106
|
-
switch (this.props.topology) {
|
|
107
|
-
case 'triangle-fan-webgl':
|
|
108
|
-
case 'line-loop-webgl':
|
|
109
|
-
throw new Error(`WebGPU does not support primitive topology ${this.props.topology}`);
|
|
110
|
-
default:
|
|
111
|
-
}
|
|
112
106
|
// Create a partially populated descriptor
|
|
113
107
|
const descriptor = {
|
|
114
108
|
vertex,
|
|
@@ -133,7 +127,7 @@ _setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {
|
|
|
133
127
|
for (let i = 0; i < buffers.length; ++i) {
|
|
134
128
|
const buffer = cast<WebGPUBuffer>(buffers[i]);
|
|
135
129
|
if (!buffer) {
|
|
136
|
-
const attribute = this.
|
|
130
|
+
const attribute = this.shaderLayout.attributes.find(
|
|
137
131
|
(attribute) => attribute.location === i
|
|
138
132
|
);
|
|
139
133
|
throw new Error(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-sampler.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-sampler.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AAEnD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,kBAAkB;IAclD,OAAO,IAAI,IAAI;CAMzB"}
|