@luma.gl/webgpu 9.0.11 → 9.1.0-alpha.2

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.
Files changed (58) hide show
  1. package/LICENSE +34 -0
  2. package/dist/adapter/helpers/get-bind-group.d.ts +1 -1
  3. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  4. package/dist/adapter/helpers/get-bind-group.js +5 -5
  5. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
  6. package/dist/adapter/helpers/get-vertex-buffer-layout.js +11 -7
  7. package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
  8. package/dist/adapter/helpers/webgpu-parameters.js +27 -12
  9. package/dist/adapter/resources/webgpu-command-encoder.js +5 -5
  10. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  11. package/dist/adapter/resources/webgpu-compute-pass.js +1 -0
  12. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  13. package/dist/adapter/resources/webgpu-compute-pipeline.js +1 -1
  14. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  15. package/dist/adapter/resources/webgpu-external-texture.js +1 -0
  16. package/dist/adapter/resources/webgpu-framebuffer.d.ts +3 -0
  17. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  18. package/dist/adapter/resources/webgpu-framebuffer.js +2 -0
  19. package/dist/adapter/resources/webgpu-render-pass.d.ts +3 -2
  20. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  21. package/dist/adapter/resources/webgpu-render-pass.js +8 -5
  22. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +2 -2
  23. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  24. package/dist/adapter/resources/webgpu-render-pipeline.js +11 -17
  25. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  26. package/dist/adapter/resources/webgpu-sampler.js +2 -0
  27. package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -1
  28. package/dist/adapter/resources/webgpu-texture.d.ts +10 -1
  29. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  30. package/dist/adapter/resources/webgpu-texture.js +29 -10
  31. package/dist/adapter/resources/webgpu-vertex-array.d.ts +1 -1
  32. package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
  33. package/dist/adapter/resources/webgpu-vertex-array.js +3 -1
  34. package/dist/adapter/webgpu-canvas-context.d.ts +2 -2
  35. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  36. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  37. package/dist/adapter/webgpu-device.js +18 -6
  38. package/dist/dist.dev.js +114 -87
  39. package/dist/dist.min.js +1 -1
  40. package/dist/index.cjs +99 -54
  41. package/dist/index.cjs.map +2 -2
  42. package/package.json +4 -4
  43. package/src/adapter/helpers/get-bind-group.ts +6 -6
  44. package/src/adapter/helpers/get-vertex-buffer-layout.ts +14 -8
  45. package/src/adapter/helpers/webgpu-parameters.ts +29 -12
  46. package/src/adapter/resources/webgpu-command-encoder.ts +7 -7
  47. package/src/adapter/resources/webgpu-compute-pass.ts +1 -0
  48. package/src/adapter/resources/webgpu-compute-pipeline.ts +1 -6
  49. package/src/adapter/resources/webgpu-external-texture.ts +1 -0
  50. package/src/adapter/resources/webgpu-framebuffer.ts +4 -0
  51. package/src/adapter/resources/webgpu-render-pass.ts +16 -10
  52. package/src/adapter/resources/webgpu-render-pipeline.ts +11 -23
  53. package/src/adapter/resources/webgpu-sampler.ts +3 -0
  54. package/src/adapter/resources/webgpu-texture-view.ts +15 -0
  55. package/src/adapter/resources/webgpu-texture.ts +55 -11
  56. package/src/adapter/resources/webgpu-vertex-array.ts +2 -1
  57. package/src/adapter/webgpu-canvas-context.ts +1 -1
  58. package/src/adapter/webgpu-device.ts +23 -6
package/LICENSE ADDED
@@ -0,0 +1,34 @@
1
+ luma.gl is provided under the MIT license
2
+
3
+ Copyright (c) 2020 vis.gl contributors
4
+
5
+ This software includes parts initially developed by Uber and open sourced under MIT license.
6
+ Copyright (c) 2015 Uber Technologies, Inc.
7
+
8
+ This software includes parts of PhiloGL (https://github.com/philogb/philogl)
9
+ under MIT license. PhiloGL parts Copyright © 2013 Sencha Labs.
10
+
11
+ This software includes adaptations of some postprocessing code from
12
+ THREE.js (https://github.com/mrdoob/three.js/) under MIT license.
13
+ THREE.js parts Copyright © 2010-2018 three.js authors.
14
+
15
+ Additional attribution given in specific source files.
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in
25
+ all copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33
+ THE SOFTWARE.
34
+
@@ -9,5 +9,5 @@ export declare function makeBindGroupLayout(device: GPUDevice, layout: GPUBindGr
9
9
  * Create a WebGPU "bind group" from an array of luma.gl bindings
10
10
  */
11
11
  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;
12
+ export declare function getShaderLayoutBinding(shaderLayout: ComputeShaderLayout, bindingName: string): BindingDeclaration | null;
13
13
  //# 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":";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,CASpB"}
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, cast } from '@luma.gl/core';
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: cast(binding).handle
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: cast(binding).handle
59
+ resource: binding.handle
60
60
  };
61
61
  }
62
62
  else if (binding instanceof Texture) {
63
63
  return {
64
64
  binding: index,
65
- resource: cast(binding).handle.createView({ label: 'bind-group-auto-created' })
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":";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,CA4EzB;AAED,wBAAgB,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BxB"}
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.stepMode ||
38
- (attributeLayout.name.startsWith('instance') ? 'instance' : 'vertex');
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: attributeLayout.location
46
+ shaderLocation: location
43
47
  });
44
- byteStride += decodeVertexFormat(mapping.format).byteLength;
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(mapping.format).byteLength;
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(mapping.format),
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":";AAIA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAezC;;;GAGG;AAEH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,QAAQ,CAkN9D,CAAC;AAgCF,wBAAgB,yCAAyC,CACvD,kBAAkB,EAAE,2BAA2B,EAC/C,UAAU,GAAE,UAAe,GAC1B,IAAI,CAIN"}
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 depthStencil = addDepthStencil(descriptor);
67
- depthStencil.stencilFront.compare = value;
68
- depthStencil.stencilBack.compare = value;
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 depthStencil = addDepthStencil(descriptor);
72
- depthStencil.stencilFront.passOp = value;
73
- depthStencil.stencilBack.passOp = value;
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 depthStencil = addDepthStencil(descriptor);
77
- depthStencil.stencilFront.failOp = value;
78
- depthStencil.stencilBack.failOp = value;
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 depthStencil = addDepthStencil(descriptor);
82
- depthStencil.stencilFront.depthFailOp = value;
83
- depthStencil.stencilBack.depthFailOp = value;
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');
@@ -41,10 +41,10 @@ export class WebGPUCommandEncoder extends CommandEncoder {
41
41
  origin: options.origin ?? {}
42
42
  // aspect: options.aspect
43
43
  }, {
44
- // TODO exclamation mark hack
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,6 @@ 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.firstQuery || 0, options.queryCount || querySet.props.count - (options.firstQuery || 0), webgpuBuffer.handle, options.destinationOffset || 0);
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
  }
@@ -1 +1 @@
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;IAKtC;;;;;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"}
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":";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;CAgBd"}
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.props.shaderLayout, this._bindings);
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":";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;IAYpD,OAAO,IAAI,IAAI;IAQxB,0BAA0B;IAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAMlD"}
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"}
@@ -20,6 +20,7 @@ export class WebGPUExternalTexture extends ExternalTexture {
20
20
  source: props.source,
21
21
  colorSpace: props.colorSpace
22
22
  });
23
+ // @ts-expect-error
23
24
  this.sampler = null;
24
25
  }
25
26
  destroy() {
@@ -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;AAE9C;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;gBAElB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CAO1D"}
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"}
@@ -8,6 +8,8 @@ import { Framebuffer } from '@luma.gl/core';
8
8
  */
9
9
  export class WebGPUFramebuffer extends Framebuffer {
10
10
  device;
11
+ colorAttachments = [];
12
+ depthStencilAttachment = null;
11
13
  constructor(device, props) {
12
14
  super(device, props);
13
15
  this.device = device;
@@ -1,8 +1,9 @@
1
1
  /// <reference types="dist" />
2
- import type { RenderPassProps, RenderPassParameters, Binding, Framebuffer } from '@luma.gl/core';
2
+ import type { RenderPassProps, RenderPassParameters, Binding } from '@luma.gl/core';
3
3
  import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/core';
4
4
  import { WebGPUDevice } from "../webgpu-device.js";
5
5
  import { WebGPURenderPipeline } from "./webgpu-render-pipeline.js";
6
+ import { WebGPUFramebuffer } from "./webgpu-framebuffer.js";
6
7
  export declare class WebGPURenderPass extends RenderPass {
7
8
  readonly device: WebGPUDevice;
8
9
  readonly handle: GPURenderPassEncoder;
@@ -36,6 +37,6 @@ export declare class WebGPURenderPass extends RenderPass {
36
37
  * Partial render pass descriptor. Used by WebGPURenderPass.
37
38
  * @returns attachments fields of a renderpass descriptor.
38
39
  */
39
- protected getRenderPassDescriptor(framebuffer: Framebuffer): GPURenderPassDescriptor;
40
+ protected getRenderPassDescriptor(framebuffer: WebGPUFramebuffer): GPURenderPassDescriptor;
40
41
  }
41
42
  //# 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":";AAIA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAY,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAI9C,OAAO,EAAC,oBAAoB,EAAC,oCAAiC;AAG9D,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;IA6BpD,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,WA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core';
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.canvasContext.getCurrentFramebuffer();
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 = cast(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(cast(buffer).handle, indexFormat, offset, size);
55
+ this.handle.setIndexBuffer(buffer.handle, indexFormat, offset, size);
53
56
  }
54
57
  setVertexBuffer(slot, buffer, offset = 0) {
55
- this.handle.setVertexBuffer(slot, cast(buffer).handle, offset);
58
+ this.handle.setVertexBuffer(slot, buffer.handle, offset);
56
59
  }
57
60
  draw(options) {
58
61
  if (options.indexCount) {
@@ -33,7 +33,7 @@ export declare class WebGPURenderPipeline extends RenderPipeline {
33
33
  baseVertex?: number;
34
34
  }): boolean;
35
35
  /** Return a bind group created by setBindings */
36
- _getBindGroup(): GPUBindGroup;
36
+ _getBindGroup(): GPUBindGroup | null;
37
37
  /**
38
38
  * Populate the complex WebGPU GPURenderPipelineDescriptor
39
39
  */
@@ -49,7 +49,7 @@ _setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {
49
49
  for (let i = 0; i < buffers.length; ++i) {
50
50
  const buffer = cast<WebGPUBuffer>(buffers[i]);
51
51
  if (!buffer) {
52
- const attribute = this.props.shaderLayout.attributes.find(
52
+ const attribute = this.shaderLayout.attributes.find(
53
53
  (attribute) => attribute.location === i
54
54
  );
55
55
  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":";AAEA,OAAO,KAAK,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAY,MAAM,eAAe,CAAC;AAS7E,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;IAKxB;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,M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AAmB;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, cast, log } from '@luma.gl/core';
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 = cast(props.vs);
31
- this.fs = cast(props.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.props.shaderLayout.bindings.length === 0) {
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.props.shaderLayout, this._bindings);
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: cast(this.props.vs).handle,
91
+ module: this.props.vs.handle,
91
92
  entryPoint: this.props.vertexEntryPoint || 'main',
92
- buffers: getVertexBufferLayout(this.props.shaderLayout, this.props.bufferLayout)
93
+ buffers: getVertexBufferLayout(this.shaderLayout, this.props.bufferLayout)
93
94
  };
94
95
  // Set up the fragment stage
95
96
  const fragment = {
96
- module: cast(this.props.fs).handle,
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?.canvasContext?.format)
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.props.shaderLayout.attributes.find(
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":";AAAA,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"}
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"}
@@ -1,3 +1,5 @@
1
+ // luma.gl, MIT license
2
+ // Copyright (c) vis.gl contributors
1
3
  import { Sampler } from '@luma.gl/core';
2
4
  /**
3
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-texture-view.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture-view.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AACnD,OAAO,KAAK,EAAC,aAAa,EAAC,4BAAyB;AAEpD,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACtD,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBAEpB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,GAAG;QAAC,OAAO,EAAE,aAAa,CAAA;KAAC;IAmBjF,OAAO,IAAI,IAAI;CAMzB"}
1
+ {"version":3,"file":"webgpu-texture-view.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture-view.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AACnD,OAAO,KAAK,EAAC,aAAa,EAAC,4BAAyB;AAiBpD,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACtD,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBAEpB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,GAAG;QAAC,OAAO,EAAE,aAAa,CAAA;KAAC;IAmBjF,OAAO,IAAI,IAAI;CAMzB"}
@@ -1,5 +1,6 @@
1
1
  /// <reference types="dist" />
2
- import { Texture, TextureProps, TextureViewProps, Sampler, SamplerProps } from '@luma.gl/core';
2
+ import type { TextureProps, TextureViewProps, Sampler, SamplerProps, Texture1DData, Texture2DData, Texture3DData, TextureCubeData, TextureArrayData, TextureCubeArrayData } from '@luma.gl/core';
3
+ import { Texture } from '@luma.gl/core';
3
4
  import type { WebGPUDevice } from "../webgpu-device.js";
4
5
  import { WebGPUSampler } from "./webgpu-sampler.js";
5
6
  import { WebGPUTextureView } from "./webgpu-texture-view.js";
@@ -15,11 +16,19 @@ export declare class WebGPUTexture extends Texture {
15
16
  createView(props: TextureViewProps): WebGPUTextureView;
16
17
  protected initialize(props: TextureProps): void;
17
18
  protected createHandle(): GPUTexture;
19
+ /** @deprecated - intention is to use the createView public API */
20
+ createGPUTextureView(): GPUTextureView;
18
21
  /**
19
22
  * Set default sampler
20
23
  * Accept a sampler instance or set of props;
21
24
  */
22
25
  setSampler(sampler: Sampler | SamplerProps): this;
26
+ setTexture1DData(data: Texture1DData): void;
27
+ setTexture2DData(lodData: Texture2DData, depth?: number, target?: number): void;
28
+ setTexture3DData(lodData: Texture3DData, depth?: number, target?: number): void;
29
+ setTextureCubeData(data: TextureCubeData, depth?: number): void;
30
+ setTextureArrayData(data: TextureArrayData): void;
31
+ setTextureCubeArrayData(data: TextureCubeArrayData): void;
23
32
  setData(options: {
24
33
  data: any;
25
34
  }): {
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture.ts"],"names":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