@luma.gl/webgpu 9.0.0-beta.5 → 9.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/adapter/helpers/accessor-to-format.js +4 -1
  2. package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
  3. package/dist/adapter/helpers/convert-texture-format.js +3 -0
  4. package/dist/adapter/helpers/generate-mipmaps.d.ts.map +1 -1
  5. package/dist/adapter/helpers/generate-mipmaps.js +22 -13
  6. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  7. package/dist/adapter/helpers/get-bind-group.js +3 -0
  8. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
  9. package/dist/adapter/helpers/get-vertex-buffer-layout.js +9 -2
  10. package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
  11. package/dist/adapter/helpers/webgpu-parameters.js +3 -0
  12. package/dist/adapter/resources/webgpu-buffer.d.ts +1 -1
  13. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  14. package/dist/adapter/resources/webgpu-buffer.js +16 -9
  15. package/dist/adapter/resources/webgpu-command-encoder.d.ts +7 -1
  16. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  17. package/dist/adapter/resources/webgpu-command-encoder.js +8 -0
  18. package/dist/adapter/resources/webgpu-compute-pass.d.ts +1 -1
  19. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  20. package/dist/adapter/resources/webgpu-compute-pass.js +21 -4
  21. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +1 -1
  22. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  23. package/dist/adapter/resources/webgpu-compute-pipeline.js +14 -10
  24. package/dist/adapter/resources/webgpu-external-texture.d.ts +2 -2
  25. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  26. package/dist/adapter/resources/webgpu-external-texture.js +12 -7
  27. package/dist/adapter/resources/webgpu-framebuffer.d.ts +1 -1
  28. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  29. package/dist/adapter/resources/webgpu-framebuffer.js +3 -0
  30. package/dist/adapter/resources/webgpu-query-set.d.ts +17 -0
  31. package/dist/adapter/resources/webgpu-query-set.d.ts.map +1 -0
  32. package/dist/adapter/resources/webgpu-query-set.js +25 -0
  33. package/dist/adapter/resources/webgpu-render-pass.d.ts +4 -2
  34. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  35. package/dist/adapter/resources/webgpu-render-pass.js +27 -9
  36. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +3 -4
  37. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  38. package/dist/adapter/resources/webgpu-render-pipeline.js +25 -33
  39. package/dist/adapter/resources/webgpu-sampler.d.ts +1 -1
  40. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  41. package/dist/adapter/resources/webgpu-shader.d.ts +1 -1
  42. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  43. package/dist/adapter/resources/webgpu-shader.js +4 -3
  44. package/dist/adapter/resources/webgpu-texture-view.d.ts +20 -0
  45. package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -0
  46. package/dist/adapter/resources/webgpu-texture-view.js +32 -0
  47. package/dist/adapter/resources/webgpu-texture.d.ts +5 -4
  48. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  49. package/dist/adapter/resources/webgpu-texture.js +18 -15
  50. package/dist/adapter/resources/webgpu-vertex-array.d.ts +7 -9
  51. package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
  52. package/dist/adapter/resources/webgpu-vertex-array.js +11 -13
  53. package/dist/adapter/webgpu-canvas-context.d.ts +3 -3
  54. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  55. package/dist/adapter/webgpu-canvas-context.js +6 -4
  56. package/dist/adapter/webgpu-device.d.ts +24 -21
  57. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  58. package/dist/adapter/webgpu-device.js +74 -57
  59. package/dist/dist.dev.js +248 -171
  60. package/dist/index.cjs +233 -161
  61. package/dist/index.cjs.map +4 -4
  62. package/dist/index.d.ts +5 -5
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +7 -6
  65. package/dist.min.js +1 -1
  66. package/package.json +2 -2
  67. package/src/adapter/helpers/accessor-to-format.ts +5 -1
  68. package/src/adapter/helpers/convert-texture-format.ts +4 -1
  69. package/src/adapter/helpers/generate-mipmaps.ts +37 -26
  70. package/src/adapter/helpers/get-bind-group.ts +8 -2
  71. package/src/adapter/helpers/get-vertex-buffer-layout.ts +12 -4
  72. package/src/adapter/helpers/webgpu-parameters.ts +79 -15
  73. package/src/adapter/resources/webgpu-buffer.ts +21 -10
  74. package/src/adapter/resources/webgpu-command-encoder.ts +24 -9
  75. package/src/adapter/resources/webgpu-compute-pass.ts +26 -8
  76. package/src/adapter/resources/webgpu-compute-pipeline.ts +15 -10
  77. package/src/adapter/resources/webgpu-external-texture.ts +12 -6
  78. package/src/adapter/resources/webgpu-framebuffer.ts +4 -0
  79. package/src/adapter/resources/webgpu-query-set.ts +35 -0
  80. package/src/adapter/resources/webgpu-render-pass.ts +37 -14
  81. package/src/adapter/resources/webgpu-render-pipeline.ts +30 -41
  82. package/src/adapter/resources/webgpu-sampler.ts +1 -1
  83. package/src/adapter/resources/webgpu-shader.ts +5 -4
  84. package/src/adapter/resources/webgpu-texture-view.ts +43 -0
  85. package/src/adapter/resources/webgpu-texture.ts +23 -19
  86. package/src/adapter/resources/webgpu-vertex-array.ts +25 -20
  87. package/src/adapter/webgpu-canvas-context.ts +8 -4
  88. package/src/adapter/webgpu-device.ts +90 -58
  89. package/src/index.ts +2 -1
  90. package/src/adapter/resources/webgpu-query.ts +0 -43
  91. package/src/adapter/webgpu-types.ts +0 -0
  92. package/src/glsl/glsllang.ts +0 -14
@@ -1,3 +1,6 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  /*
2
5
  import {assert} from '@luma.gl/core';
3
6
 
@@ -97,4 +100,4 @@ export function mapAccessorToWebGPUFormat(accessor) {
97
100
  }
98
101
  throw new Error('illegal accessor');
99
102
  }
100
- */
103
+ */
@@ -1 +1 @@
1
- {"version":3,"file":"convert-texture-format.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/convert-texture-format.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAE5C,mDAAmD;AACnD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAK9E"}
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,3 +1,6 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  /** Ensure a texture format is WebGPU compatible */
2
5
  export function getWebGPUTextureFormat(format) {
3
6
  if (format.includes('webgl')) {
@@ -1 +1 @@
1
- {"version":3,"file":"generate-mipmaps.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/generate-mipmaps.ts"],"names":[],"mappings":";AAuBA,oDAAoD;AACpD,qBAAa,qBAAqB;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,cAAc,EAAE,iBAAiB,CAAC;gBAEtB,MAAM,EAAE,SAAS,EAAE,OAAO,KAAA;IAyBtC,wBAAwB,CAAC,WAAW,EAAE,WAAW;CAoDlD"}
1
+ {"version":3,"file":"generate-mipmaps.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/generate-mipmaps.ts"],"names":[],"mappings":";AA0BA,oDAAoD;AACpD,qBAAa,qBAAqB;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,cAAc,EAAE,iBAAiB,CAAC;gBAEtB,MAAM,EAAE,SAAS,EAAE,OAAO,KAAA;IA2BtC,wBAAwB,CAAC,WAAW,EAAE,WAAW;CA0DlD"}
@@ -1,4 +1,6 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
2
4
  // Forked from Kangz/mipmapper.js under MIT license Copyright 2020 Brandon Jones
3
5
  // https://gist.github.com/Kangz/782d5f1ae502daf53910a13f55db2f83
4
6
  // @ts-nocheck this is written against outdated WebGPU API, needs an update pass
@@ -39,16 +41,18 @@ export class WebGPUMipmapGenerator {
39
41
  entryPoint: 'main'
40
42
  },
41
43
  primitiveTopology: 'triangle-strip',
42
- colorStates: [{
43
- format: 'rgba8unorm',
44
- }]
44
+ colorStates: [
45
+ {
46
+ format: 'rgba8unorm'
47
+ }
48
+ ]
45
49
  });
46
50
  }
47
51
  generateMipmappedTexture(imageBitmap) {
48
52
  const textureSize = {
49
53
  width: imageBitmap.width,
50
54
  height: imageBitmap.height,
51
- depth: 1,
55
+ depth: 1
52
56
  };
53
57
  const mipLevelCount = Math.floor(Math.log2(Math.max(imageBitmap.width, imageBitmap.height))) + 1;
54
58
  // Populate the top level of the srcTexture with the imageBitmap.
@@ -62,26 +66,31 @@ export class WebGPUMipmapGenerator {
62
66
  const commandEncoder = this.device.createCommandEncoder({});
63
67
  for (let i = 1; i < mipLevelCount; ++i) {
64
68
  const passEncoder = commandEncoder.beginRenderPass({
65
- colorAttachments: [{
69
+ colorAttachments: [
70
+ {
66
71
  attachment: texture.createView({
67
72
  baseMipLevel: i,
68
73
  mipLevelCount: 1
69
74
  }),
70
- loadValue: { r: 1.0, g: 0.0, b: 0.0, a: 0.0 },
71
- }],
75
+ loadValue: { r: 1.0, g: 0.0, b: 0.0, a: 0.0 }
76
+ }
77
+ ]
72
78
  });
73
79
  const bindGroup = this.device.createBindGroup({
74
80
  layout: this.mipmapPipeline.getBindGroupLayout(0),
75
- bindings: [{
81
+ bindings: [
82
+ {
76
83
  binding: 0,
77
- resource: this.mipmapSampler,
78
- }, {
84
+ resource: this.mipmapSampler
85
+ },
86
+ {
79
87
  binding: 1,
80
88
  resource: texture.createView({
81
89
  baseMipLevel: i - 1,
82
90
  mipLevelCount: 1
83
- }),
84
- }],
91
+ })
92
+ }
93
+ ]
85
94
  });
86
95
  passEncoder.setPipeline(this.mipmapPipeline);
87
96
  passEncoder.setBindGroup(0, bindGroup);
@@ -1 +1 @@
1
- {"version":3,"file":"get-bind-group.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-bind-group.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAC,YAAY,EAAE,kBAAkB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAM7E;;;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,YAAY,EAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,YAAY,CAMd;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,GAClB,kBAAkB,CAMpB"}
1
+ {"version":3,"file":"get-bind-group.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-bind-group.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAC,YAAY,EAAE,kBAAkB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAM7E;;;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,YAAY,EAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,YAAY,CAMd;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,GAClB,kBAAkB,CASpB"}
@@ -1,3 +1,6 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { Buffer, Sampler, Texture, log, cast } from '@luma.gl/core';
2
5
  /**
3
6
  * Create a WebGPU "bind group layout" from an array of luma.gl bindings
@@ -1 +1 @@
1
- {"version":3,"file":"get-vertex-buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-vertex-buffer-layout.ts"],"names":[],"mappings":";AACA,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,CAuEzB;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,CA4EzB;AAED,wBAAgB,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BxB"}
@@ -1,3 +1,6 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { log, decodeVertexFormat } from '@luma.gl/core';
2
5
  // import {getAttributeInfosFromLayouts} from '@luma.gl/core';
3
6
  /** Throw error on any WebGL-only vertex formats */
@@ -30,7 +33,9 @@ export function getVertexBufferLayout(shaderLayout, bufferLayout) {
30
33
  for (const attributeMapping of mapping.attributes) {
31
34
  const attributeName = attributeMapping.attribute;
32
35
  const attributeLayout = findAttributeLayout(shaderLayout, attributeName, usedAttributes);
33
- stepMode = attributeLayout.stepMode || (attributeLayout.name.startsWith('instance') ? 'instance' : 'vertex');
36
+ stepMode =
37
+ attributeLayout.stepMode ||
38
+ (attributeLayout.name.startsWith('instance') ? 'instance' : 'vertex');
34
39
  vertexAttributes.push({
35
40
  format: getWebGPUVertexFormat(attributeMapping.format || mapping.format),
36
41
  offset: attributeMapping.byteOffset,
@@ -46,7 +51,9 @@ export function getVertexBufferLayout(shaderLayout, bufferLayout) {
46
51
  continue; // eslint-disable-line no-continue
47
52
  }
48
53
  byteStride = decodeVertexFormat(mapping.format).byteLength;
49
- stepMode = attributeLayout.stepMode || (attributeLayout.name.startsWith('instance') ? 'instance' : 'vertex');
54
+ stepMode =
55
+ attributeLayout.stepMode ||
56
+ (attributeLayout.name.startsWith('instance') ? 'instance' : 'vertex');
50
57
  vertexAttributes.push({
51
58
  format: getWebGPUVertexFormat(mapping.format),
52
59
  // We only support 0 offset for non-interleaved buffer layouts
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAezC;;;GAGG;AAEH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,QAAQ,CAsJ9D,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;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,3 +1,6 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  function addDepthStencil(descriptor) {
2
5
  descriptor.depthStencil = descriptor.depthStencil || {
3
6
  // required, set something
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { Buffer, BufferProps } from '@luma.gl/core';
3
- import type { WebGPUDevice } from '../webgpu-device';
3
+ import type { WebGPUDevice } from "../webgpu-device.js";
4
4
  export declare class WebGPUBuffer extends Buffer {
5
5
  readonly device: WebGPUDevice;
6
6
  readonly handle: GPUBuffer;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAMnD,qBAAa,YAAa,SAA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AE,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,4 +1,6 @@
1
- // WEBGPU Buffer implementation
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
2
4
  import { Buffer } from '@luma.gl/core';
3
5
  function getByteLength(props) {
4
6
  return props.byteLength || props.data?.byteLength || 0;
@@ -14,13 +16,15 @@ export class WebGPUBuffer extends Buffer {
14
16
  const mapBuffer = Boolean(props.data);
15
17
  // WebGPU buffers must be aligned to 4 bytes
16
18
  const size = Math.ceil(this.byteLength / 4) * 4;
17
- this.handle = this.props.handle || this.device.handle.createBuffer({
18
- size,
19
- // usage defaults to vertex
20
- usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),
21
- mappedAtCreation: this.props.mappedAtCreation || mapBuffer,
22
- label: this.props.id
23
- });
19
+ this.handle =
20
+ this.props.handle ||
21
+ this.device.handle.createBuffer({
22
+ size,
23
+ // usage defaults to vertex
24
+ usage: this.props.usage || GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
25
+ mappedAtCreation: this.props.mappedAtCreation || mapBuffer,
26
+ label: this.props.id
27
+ });
24
28
  if (props.data) {
25
29
  this._writeMapped(props.data);
26
30
  // this.handle.writeAsync({data: props.data, map: false, unmap: false});
@@ -38,7 +42,10 @@ export class WebGPUBuffer extends Buffer {
38
42
  }
39
43
  async readAsync(byteOffset = 0, byteLength = this.byteLength) {
40
44
  // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer
41
- const tempBuffer = new WebGPUBuffer(this.device, { usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength });
45
+ const tempBuffer = new WebGPUBuffer(this.device, {
46
+ usage: Buffer.MAP_READ | Buffer.COPY_DST,
47
+ byteLength
48
+ });
42
49
  // Now do a GPU-side copy into the temp buffer we can actually read.
43
50
  // TODO - we are spinning up an independent command queue here, what does this mean
44
51
  const commandEncoder = this.device.handle.createCommandEncoder();
@@ -1,7 +1,8 @@
1
1
  /// <reference types="dist" />
2
2
  import { CommandEncoder, CommandEncoderProps, Buffer, Texture } from '@luma.gl/core';
3
3
  import type { CopyTextureToTextureOptions, CopyTextureToBufferOptions } from '@luma.gl/core';
4
- import { WebGPUDevice } from '../webgpu-device';
4
+ import { WebGPUDevice } from "../webgpu-device.js";
5
+ import { WebGPUQuerySet } from "./webgpu-query-set.js";
5
6
  export declare class WebGPUCommandEncoder extends CommandEncoder {
6
7
  readonly device: WebGPUDevice;
7
8
  readonly handle: GPUCommandEncoder;
@@ -33,5 +34,10 @@ export declare class WebGPUCommandEncoder extends CommandEncoder {
33
34
  pushDebugGroup(groupLabel: string): void;
34
35
  popDebugGroup(): void;
35
36
  insertDebugMarker(markerLabel: string): void;
37
+ resolveQuerySet(querySet: WebGPUQuerySet, destination: Buffer, options?: {
38
+ firstQuery?: number;
39
+ queryCount?: number;
40
+ destinationOffset?: number;
41
+ }): void;
36
42
  }
37
43
  //# sourceMappingURL=webgpu-command-encoder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACnF,OAAO,KAAK,EAAC,2BAA2B,EAAE,0BAA0B,EAAC,MAAM,eAAe,CAA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,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"}
@@ -1,3 +1,6 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { CommandEncoder } from '@luma.gl/core';
2
5
  export class WebGPUCommandEncoder extends CommandEncoder {
3
6
  device;
@@ -73,4 +76,9 @@ export class WebGPUCommandEncoder extends CommandEncoder {
73
76
  insertDebugMarker(markerLabel) {
74
77
  this.handle.insertDebugMarker(markerLabel);
75
78
  }
79
+ resolveQuerySet(querySet, destination, options) {
80
+ const webgpuQuerySet = querySet;
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);
83
+ }
76
84
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/core';
3
- import { WebGPUDevice } from '../webgpu-device';
3
+ import { WebGPUDevice } from "../webgpu-device.js";
4
4
  export declare class WebGPUComputePass extends ComputePass {
5
5
  readonly device: WebGPUDevice;
6
6
  readonly handle: GPUComputePassEncoder;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAK9C,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,GAAG,IAAI,CAAQ;gBAEvC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAUzD,8CAA8C;IACrC,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAM5C,2EAA2E;IAC3E,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;;;;OAIG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,GAAE,MAAU,GAAG,IAAI;IAK1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAO7C"}
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;AAM9C,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,GAAG,IAAI,CAAQ;gBAEvC,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;IAM5C,2EAA2E;IAC3E,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;;;;OAIG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,GAAE,MAAU,GAAG,IAAI;IAK1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAIrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAG7C"}
@@ -1,3 +1,6 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { ComputePass } from '@luma.gl/core';
2
5
  export class WebGPUComputePass extends ComputePass {
3
6
  device;
@@ -6,10 +9,24 @@ export class WebGPUComputePass extends ComputePass {
6
9
  constructor(device, props) {
7
10
  super(device, props);
8
11
  this.device = device;
9
- this.handle = this.props.handle || device.commandEncoder?.beginComputePass({
10
- label: this.props.id,
11
- // timestampWrites?: GPUComputePassTimestampWrites;
12
- });
12
+ // Set up queries
13
+ let timestampWrites;
14
+ if (device.features.has('timestamp-query')) {
15
+ const webgpuQuerySet = props.timestampQuerySet;
16
+ if (webgpuQuerySet) {
17
+ timestampWrites = {
18
+ querySet: webgpuQuerySet.handle,
19
+ beginningOfPassWriteIndex: props.beginTimestampIndex,
20
+ endOfPassWriteIndex: props.endTimestampIndex
21
+ };
22
+ }
23
+ }
24
+ this.handle =
25
+ this.props.handle ||
26
+ device.commandEncoder?.beginComputePass({
27
+ label: this.props.id,
28
+ timestampWrites
29
+ });
13
30
  }
14
31
  /** @note no WebGPU destroy method, just gc */
15
32
  destroy() { }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="dist" />
2
2
  import { ComputePipeline, ComputePipelineProps } from '@luma.gl/core';
3
- import { WebGPUDevice } from '../webgpu-device';
3
+ import { WebGPUDevice } from "../webgpu-device.js";
4
4
  /** Creates a new compute pipeline when parameters change */
5
5
  export declare class WebGPUComputePipeline extends ComputePipeline {
6
6
  device: WebGPUDevice;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAK9C,4DAA4D;AAC5D,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAgB7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
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,EAAC,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAK9C,4DAA4D;AAC5D,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAkB7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
@@ -1,4 +1,6 @@
1
- // prettier-ignore
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
2
4
  import { ComputePipeline } from '@luma.gl/core';
3
5
  // COMPUTE PIPELINE
4
6
  /** Creates a new compute pipeline when parameters change */
@@ -9,15 +11,17 @@ export class WebGPUComputePipeline extends ComputePipeline {
9
11
  super(device, props);
10
12
  this.device = device;
11
13
  const webgpuShader = this.props.cs;
12
- this.handle = this.props.handle || this.device.handle.createComputePipeline({
13
- label: this.props.id,
14
- compute: {
15
- module: webgpuShader.handle,
16
- entryPoint: this.props.csEntryPoint,
17
- // constants: this.props.csConstants
18
- },
19
- layout: 'auto'
20
- });
14
+ this.handle =
15
+ this.props.handle ||
16
+ this.device.handle.createComputePipeline({
17
+ label: this.props.id,
18
+ compute: {
19
+ module: webgpuShader.handle,
20
+ entryPoint: this.props.csEntryPoint
21
+ // constants: this.props.csConstants
22
+ },
23
+ layout: 'auto'
24
+ });
21
25
  }
22
26
  /** For internal use in render passes */
23
27
  _getBindGroupLayout() {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="dist" />
2
2
  import { ExternalTexture, ExternalTextureProps, Sampler, SamplerProps } from '@luma.gl/core';
3
- import type { WebGPUDevice } from '../webgpu-device';
4
- import { WebGPUSampler } from './webgpu-sampler';
3
+ import type { WebGPUDevice } from "../webgpu-device.js";
4
+ import { WebGPUSampler } from "./webgpu-sampler.js";
5
5
  /**
6
6
  * Cheap, temporary texture view for videos
7
7
  * Only valid within same callback, destroyed automatically as a microtask.
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;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;IAUpD,OAAO,IAAI,IAAI;IAMxB,0BAA0B;IAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAKlD"}
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;IAMxB,0BAA0B;IAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAMlD"}
@@ -1,6 +1,8 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
2
4
  import { ExternalTexture } from '@luma.gl/core';
3
- import { WebGPUSampler } from './webgpu-sampler';
5
+ import { WebGPUSampler } from "./webgpu-sampler.js";
4
6
  /**
5
7
  * Cheap, temporary texture view for videos
6
8
  * Only valid within same callback, destroyed automatically as a microtask.
@@ -12,10 +14,12 @@ export class WebGPUExternalTexture extends ExternalTexture {
12
14
  constructor(device, props) {
13
15
  super(device, props);
14
16
  this.device = device;
15
- this.handle = this.props.handle || this.device.handle.importExternalTexture({
16
- source: props.source,
17
- colorSpace: props.colorSpace
18
- });
17
+ this.handle =
18
+ this.props.handle ||
19
+ this.device.handle.importExternalTexture({
20
+ source: props.source,
21
+ colorSpace: props.colorSpace
22
+ });
19
23
  this.sampler = null;
20
24
  }
21
25
  destroy() {
@@ -26,7 +30,8 @@ export class WebGPUExternalTexture extends ExternalTexture {
26
30
  /** Set default sampler */
27
31
  setSampler(sampler) {
28
32
  // We can accept a sampler instance or set of props;
29
- this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
33
+ this.sampler =
34
+ sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
30
35
  return this;
31
36
  }
32
37
  }
@@ -1,6 +1,6 @@
1
1
  import type { FramebufferProps } from '@luma.gl/core';
2
2
  import { Framebuffer } from '@luma.gl/core';
3
- import { WebGPUDevice } from '../webgpu-device';
3
+ import { WebGPUDevice } from "../webgpu-device.js";
4
4
  /**
5
5
  * Create new textures with correct size for all attachments.
6
6
  * @note resize() destroys existing textures (if size has changed).
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;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;AAE9C;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;gBAElB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CAO1D"}
@@ -1,3 +1,6 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { Framebuffer } from '@luma.gl/core';
2
5
  /**
3
6
  * Create new textures with correct size for all attachments.
@@ -0,0 +1,17 @@
1
+ /// <reference types="dist" />
2
+ import { QuerySet, QuerySetProps } from '@luma.gl/core';
3
+ import { WebGPUDevice } from "../webgpu-device.js";
4
+ export type QuerySetProps2 = {
5
+ type: 'occlusion' | 'timestamp';
6
+ count: number;
7
+ };
8
+ /**
9
+ * Immutable
10
+ */
11
+ export declare class WebGPUQuerySet extends QuerySet {
12
+ readonly device: WebGPUDevice;
13
+ readonly handle: GPUQuerySet;
14
+ constructor(device: WebGPUDevice, props: QuerySetProps);
15
+ destroy(): void;
16
+ }
17
+ //# sourceMappingURL=webgpu-query-set.d.ts.map
@@ -0,0 +1 @@
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;CAGzB"}
@@ -0,0 +1,25 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { QuerySet } from '@luma.gl/core';
5
+ /**
6
+ * Immutable
7
+ */
8
+ export class WebGPUQuerySet extends QuerySet {
9
+ device;
10
+ handle;
11
+ constructor(device, props) {
12
+ super(device, props);
13
+ this.device = device;
14
+ this.handle =
15
+ this.props.handle ||
16
+ this.device.handle.createQuerySet({
17
+ type: this.props.type,
18
+ count: this.props.count
19
+ });
20
+ this.handle.label = this.props.id;
21
+ }
22
+ destroy() {
23
+ this.handle.destroy();
24
+ }
25
+ }
@@ -1,8 +1,8 @@
1
1
  /// <reference types="dist" />
2
2
  import type { RenderPassProps, RenderPassParameters, Binding, Framebuffer } from '@luma.gl/core';
3
3
  import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/core';
4
- import { WebGPUDevice } from '../webgpu-device';
5
- import { WebGPURenderPipeline } from './webgpu-render-pipeline';
4
+ import { WebGPUDevice } from "../webgpu-device.js";
5
+ import { WebGPURenderPipeline } from "./webgpu-render-pipeline.js";
6
6
  export declare class WebGPURenderPass extends RenderPass {
7
7
  readonly device: WebGPUDevice;
8
8
  readonly handle: GPURenderPassEncoder;
@@ -30,6 +30,8 @@ export declare class WebGPURenderPass extends RenderPass {
30
30
  pushDebugGroup(groupLabel: string): void;
31
31
  popDebugGroup(): void;
32
32
  insertDebugMarker(markerLabel: string): void;
33
+ beginOcclusionQuery(queryIndex: number): void;
34
+ endOcclusionQuery(): void;
33
35
  /**
34
36
  * Partial render pass descriptor. Used by WebGPURenderPass.
35
37
  * @returns attachments fields of a renderpass descriptor.
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAY,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAI9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAE9D,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;IAYpD,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,eA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cast, log } from '@luma.gl/core';
2
5
  export class WebGPURenderPass extends RenderPass {
3
6
  device;
@@ -9,11 +12,25 @@ export class WebGPURenderPass extends RenderPass {
9
12
  this.device = device;
10
13
  const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer();
11
14
  const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);
15
+ const webgpuQuerySet = props.timestampQuerySet;
16
+ if (webgpuQuerySet) {
17
+ renderPassDescriptor.occlusionQuerySet = webgpuQuerySet.handle;
18
+ }
19
+ if (device.features.has('timestamp-query')) {
20
+ const webgpuQuerySet = props.timestampQuerySet;
21
+ renderPassDescriptor.timestampWrites = webgpuQuerySet
22
+ ? {
23
+ querySet: webgpuQuerySet.handle,
24
+ beginningOfPassWriteIndex: props.beginTimestampIndex,
25
+ endOfPassWriteIndex: props.endTimestampIndex
26
+ }
27
+ : undefined;
28
+ }
29
+ this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
30
+ this.handle.label = this.props.id;
12
31
  log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();
13
32
  log.probe(3, JSON.stringify(renderPassDescriptor, null, 2))();
14
33
  log.groupEnd(3)();
15
- this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
16
- this.handle.label = this.props.id;
17
34
  }
18
35
  destroy() { }
19
36
  end() {
@@ -74,11 +91,12 @@ export class WebGPURenderPass extends RenderPass {
74
91
  insertDebugMarker(markerLabel) {
75
92
  this.handle.insertDebugMarker(markerLabel);
76
93
  }
77
- // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;
78
- // beginOcclusionQuery(queryIndex: number): void;
79
- // endOcclusionQuery(): void;
80
- // beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;
81
- // endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;
94
+ beginOcclusionQuery(queryIndex) {
95
+ this.handle.beginOcclusionQuery(queryIndex);
96
+ }
97
+ endOcclusionQuery() {
98
+ this.handle.endOcclusionQuery();
99
+ }
82
100
  // executeBundles(bundles: Iterable<GPURenderBundle>): void;
83
101
  // INTERNAL
84
102
  /**
@@ -95,11 +113,11 @@ export class WebGPURenderPass extends RenderPass {
95
113
  colorClearValue: this.props.clearColor || [0, 0, 0, 0],
96
114
  storeOp: this.props.discard ? 'discard' : 'store',
97
115
  // ...colorAttachment,
98
- view: colorAttachment.createView()
116
+ view: colorAttachment.handle
99
117
  }));
100
118
  if (framebuffer.depthStencilAttachment) {
101
119
  renderPassDescriptor.depthStencilAttachment = {
102
- view: framebuffer.depthStencilAttachment.createView()
120
+ view: framebuffer.depthStencilAttachment.handle
103
121
  };
104
122
  const { depthStencilAttachment } = renderPassDescriptor;
105
123
  // DEPTH