@luma.gl/webgpu 9.0.0-beta.4 → 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 (120) hide show
  1. package/dist/adapter/helpers/accessor-to-format.js +102 -1
  2. package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
  3. package/dist/adapter/helpers/convert-texture-format.js +8 -5
  4. package/dist/adapter/helpers/generate-mipmaps.d.ts.map +1 -1
  5. package/dist/adapter/helpers/generate-mipmaps.js +85 -82
  6. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  7. package/dist/adapter/helpers/get-bind-group.js +57 -41
  8. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
  9. package/dist/adapter/helpers/get-vertex-buffer-layout.js +117 -80
  10. package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
  11. package/dist/adapter/helpers/webgpu-parameters.js +185 -125
  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 +117 -62
  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 +81 -49
  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 +71 -41
  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 +28 -19
  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 +33 -18
  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 +14 -7
  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-query.js +42 -1
  34. package/dist/adapter/resources/webgpu-render-pass.d.ts +4 -2
  35. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  36. package/dist/adapter/resources/webgpu-render-pass.js +133 -105
  37. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +3 -4
  38. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  39. package/dist/adapter/resources/webgpu-render-pipeline.js +137 -80
  40. package/dist/adapter/resources/webgpu-sampler.d.ts +1 -1
  41. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  42. package/dist/adapter/resources/webgpu-sampler.js +18 -15
  43. package/dist/adapter/resources/webgpu-shader.d.ts +1 -1
  44. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  45. package/dist/adapter/resources/webgpu-shader.js +56 -45
  46. package/dist/adapter/resources/webgpu-texture-view.d.ts +20 -0
  47. package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -0
  48. package/dist/adapter/resources/webgpu-texture-view.js +32 -0
  49. package/dist/adapter/resources/webgpu-texture.d.ts +5 -4
  50. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  51. package/dist/adapter/resources/webgpu-texture.js +130 -107
  52. package/dist/adapter/resources/webgpu-vertex-array.d.ts +7 -6
  53. package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
  54. package/dist/adapter/resources/webgpu-vertex-array.js +60 -39
  55. package/dist/adapter/webgpu-canvas-context.d.ts +3 -3
  56. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  57. package/dist/adapter/webgpu-canvas-context.js +100 -67
  58. package/dist/adapter/webgpu-device.d.ts +24 -21
  59. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  60. package/dist/adapter/webgpu-device.js +264 -220
  61. package/dist/adapter/webgpu-types.js +0 -2
  62. package/dist/dist.dev.js +782 -2222
  63. package/dist/glsl/glsllang.js +9 -6
  64. package/dist/index.cjs +279 -388
  65. package/dist/index.cjs.map +7 -0
  66. package/dist/index.d.ts +5 -5
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +5 -1
  69. package/dist.min.js +1 -22
  70. package/package.json +9 -7
  71. package/src/adapter/helpers/accessor-to-format.ts +5 -1
  72. package/src/adapter/helpers/convert-texture-format.ts +4 -1
  73. package/src/adapter/helpers/generate-mipmaps.ts +37 -26
  74. package/src/adapter/helpers/get-bind-group.ts +8 -2
  75. package/src/adapter/helpers/get-vertex-buffer-layout.ts +12 -4
  76. package/src/adapter/helpers/webgpu-parameters.ts +79 -15
  77. package/src/adapter/resources/webgpu-buffer.ts +21 -10
  78. package/src/adapter/resources/webgpu-command-encoder.ts +24 -9
  79. package/src/adapter/resources/webgpu-compute-pass.ts +26 -8
  80. package/src/adapter/resources/webgpu-compute-pipeline.ts +15 -10
  81. package/src/adapter/resources/webgpu-external-texture.ts +12 -6
  82. package/src/adapter/resources/webgpu-framebuffer.ts +4 -0
  83. package/src/adapter/resources/webgpu-query-set.ts +35 -0
  84. package/src/adapter/resources/webgpu-render-pass.ts +37 -14
  85. package/src/adapter/resources/webgpu-render-pipeline.ts +30 -41
  86. package/src/adapter/resources/webgpu-sampler.ts +1 -1
  87. package/src/adapter/resources/webgpu-shader.ts +5 -4
  88. package/src/adapter/resources/webgpu-texture-view.ts +43 -0
  89. package/src/adapter/resources/webgpu-texture.ts +23 -19
  90. package/src/adapter/resources/webgpu-vertex-array.ts +25 -17
  91. package/src/adapter/webgpu-canvas-context.ts +8 -3
  92. package/src/adapter/webgpu-device.ts +100 -88
  93. package/src/index.ts +2 -1
  94. package/dist/adapter/helpers/accessor-to-format.js.map +0 -1
  95. package/dist/adapter/helpers/convert-texture-format.js.map +0 -1
  96. package/dist/adapter/helpers/generate-mipmaps.js.map +0 -1
  97. package/dist/adapter/helpers/get-bind-group.js.map +0 -1
  98. package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +0 -1
  99. package/dist/adapter/helpers/webgpu-parameters.js.map +0 -1
  100. package/dist/adapter/resources/webgpu-buffer.js.map +0 -1
  101. package/dist/adapter/resources/webgpu-command-encoder.js.map +0 -1
  102. package/dist/adapter/resources/webgpu-compute-pass.js.map +0 -1
  103. package/dist/adapter/resources/webgpu-compute-pipeline.js.map +0 -1
  104. package/dist/adapter/resources/webgpu-external-texture.js.map +0 -1
  105. package/dist/adapter/resources/webgpu-framebuffer.js.map +0 -1
  106. package/dist/adapter/resources/webgpu-query.js.map +0 -1
  107. package/dist/adapter/resources/webgpu-render-pass.js.map +0 -1
  108. package/dist/adapter/resources/webgpu-render-pipeline.js.map +0 -1
  109. package/dist/adapter/resources/webgpu-sampler.js.map +0 -1
  110. package/dist/adapter/resources/webgpu-shader.js.map +0 -1
  111. package/dist/adapter/resources/webgpu-texture.js.map +0 -1
  112. package/dist/adapter/resources/webgpu-vertex-array.js.map +0 -1
  113. package/dist/adapter/webgpu-canvas-context.js.map +0 -1
  114. package/dist/adapter/webgpu-device.js.map +0 -1
  115. package/dist/adapter/webgpu-types.js.map +0 -1
  116. package/dist/glsl/glsllang.js.map +0 -1
  117. package/dist/index.js.map +0 -1
  118. package/src/adapter/resources/webgpu-query.ts +0 -43
  119. package/src/adapter/webgpu-types.ts +0 -0
  120. package/src/glsl/glsllang.ts +0 -14
@@ -1,52 +1,84 @@
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
- constructor(device, props) {
4
- super(device, props);
5
- this.device = void 0;
6
- this.handle = void 0;
7
- this.device = device;
8
- this.handle = props.handle || this.device.handle.createCommandEncoder({});
9
- this.handle.label = this.props.id;
10
- }
11
- destroy() {}
12
- finish(options) {
13
- return this.finish(options);
14
- }
15
- copyBufferToBuffer(options) {
16
- var _options$sourceOffset, _options$destinationO, _options$size;
17
- const webgpuSourceBuffer = options.source;
18
- const WebGPUDestinationBuffer = options.destination;
19
- this.handle.copyBufferToBuffer(webgpuSourceBuffer.handle, (_options$sourceOffset = options.sourceOffset) !== null && _options$sourceOffset !== void 0 ? _options$sourceOffset : 0, WebGPUDestinationBuffer.handle, (_options$destinationO = options.destinationOffset) !== null && _options$destinationO !== void 0 ? _options$destinationO : 0, (_options$size = options.size) !== null && _options$size !== void 0 ? _options$size : 0);
20
- }
21
- copyBufferToTexture(options) {
22
- var _options$offset, _options$mipLevel, _options$origin;
23
- const webgpuSourceBuffer = options.source;
24
- const WebGPUDestinationTexture = options.destination;
25
- this.handle.copyBufferToTexture({
26
- buffer: webgpuSourceBuffer.handle,
27
- offset: (_options$offset = options.offset) !== null && _options$offset !== void 0 ? _options$offset : 0,
28
- bytesPerRow: options.bytesPerRow,
29
- rowsPerImage: options.rowsPerImage
30
- }, {
31
- texture: WebGPUDestinationTexture.handle,
32
- mipLevel: (_options$mipLevel = options.mipLevel) !== null && _options$mipLevel !== void 0 ? _options$mipLevel : 0,
33
- origin: (_options$origin = options.origin) !== null && _options$origin !== void 0 ? _options$origin : {}
34
- }, {
35
- width: options.extent[0],
36
- height: options.extent[1],
37
- depthOrArrayLayers: options.extent[2]
38
- });
39
- }
40
- copyTextureToBuffer(options) {}
41
- copyTextureToTexture(options) {}
42
- pushDebugGroup(groupLabel) {
43
- this.handle.pushDebugGroup(groupLabel);
44
- }
45
- popDebugGroup() {
46
- this.handle.popDebugGroup();
47
- }
48
- insertDebugMarker(markerLabel) {
49
- this.handle.insertDebugMarker(markerLabel);
50
- }
6
+ device;
7
+ handle;
8
+ constructor(device, props) {
9
+ super(device, props);
10
+ this.device = device;
11
+ this.handle =
12
+ props.handle ||
13
+ this.device.handle.createCommandEncoder({
14
+ // TODO was this removed in standard?
15
+ // measureExecutionTime: this.props.measureExecutionTime
16
+ });
17
+ this.handle.label = this.props.id;
18
+ }
19
+ destroy() { }
20
+ finish(options) {
21
+ return this.finish(options);
22
+ }
23
+ // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;
24
+ // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;
25
+ copyBufferToBuffer(options) {
26
+ const webgpuSourceBuffer = options.source;
27
+ const WebGPUDestinationBuffer = options.destination;
28
+ this.handle.copyBufferToBuffer(webgpuSourceBuffer.handle, options.sourceOffset ?? 0, WebGPUDestinationBuffer.handle, options.destinationOffset ?? 0, options.size ?? 0);
29
+ }
30
+ copyBufferToTexture(options) {
31
+ const webgpuSourceBuffer = options.source;
32
+ const WebGPUDestinationTexture = options.destination;
33
+ this.handle.copyBufferToTexture({
34
+ buffer: webgpuSourceBuffer.handle,
35
+ offset: options.offset ?? 0,
36
+ bytesPerRow: options.bytesPerRow,
37
+ rowsPerImage: options.rowsPerImage
38
+ }, {
39
+ texture: WebGPUDestinationTexture.handle,
40
+ mipLevel: options.mipLevel ?? 0,
41
+ origin: options.origin ?? {}
42
+ // aspect: options.aspect
43
+ }, {
44
+ // TODO exclamation mark hack
45
+ width: options.extent[0],
46
+ height: options.extent[1],
47
+ depthOrArrayLayers: options.extent[2]
48
+ });
49
+ }
50
+ copyTextureToBuffer(options) {
51
+ // this.handle.copyTextureToBuffer(
52
+ // // source
53
+ // {},
54
+ // // destination
55
+ // {},
56
+ // // copySize
57
+ // {}
58
+ // );
59
+ }
60
+ copyTextureToTexture(options) {
61
+ // this.handle.copyTextureToTexture(
62
+ // // source
63
+ // {},
64
+ // // destination
65
+ // {},
66
+ // // copySize
67
+ // {}
68
+ // );
69
+ }
70
+ pushDebugGroup(groupLabel) {
71
+ this.handle.pushDebugGroup(groupLabel);
72
+ }
73
+ popDebugGroup() {
74
+ this.handle.popDebugGroup();
75
+ }
76
+ insertDebugMarker(markerLabel) {
77
+ this.handle.insertDebugMarker(markerLabel);
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
+ }
51
84
  }
52
- //# sourceMappingURL=webgpu-command-encoder.js.map
@@ -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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,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,44 +1,74 @@
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
- constructor(device, props) {
4
- var _device$commandEncode;
5
- super(device, props);
6
- this.device = void 0;
7
- this.handle = void 0;
8
- this._bindGroupLayout = null;
9
- this.device = device;
10
- this.handle = this.props.handle || ((_device$commandEncode = device.commandEncoder) === null || _device$commandEncode === void 0 ? void 0 : _device$commandEncode.beginComputePass({
11
- label: this.props.id
12
- }));
13
- }
14
- destroy() {}
15
- end() {
16
- this.handle.end();
17
- }
18
- setPipeline(pipeline) {
19
- const wgpuPipeline = pipeline;
20
- this.handle.setPipeline(wgpuPipeline.handle);
21
- this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
22
- }
23
- setBindings(bindings) {
24
- throw new Error('fix me');
25
- }
26
- dispatch(x, y, z) {
27
- this.handle.dispatchWorkgroups(x, y, z);
28
- }
29
- dispatchIndirect(indirectBuffer) {
30
- let indirectOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
31
- const webgpuBuffer = indirectBuffer;
32
- this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectOffset);
33
- }
34
- pushDebugGroup(groupLabel) {
35
- this.handle.pushDebugGroup(groupLabel);
36
- }
37
- popDebugGroup() {
38
- this.handle.popDebugGroup();
39
- }
40
- insertDebugMarker(markerLabel) {
41
- this.handle.insertDebugMarker(markerLabel);
42
- }
6
+ device;
7
+ handle;
8
+ _bindGroupLayout = null;
9
+ constructor(device, props) {
10
+ super(device, props);
11
+ this.device = device;
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
+ });
30
+ }
31
+ /** @note no WebGPU destroy method, just gc */
32
+ destroy() { }
33
+ end() {
34
+ this.handle.end();
35
+ }
36
+ setPipeline(pipeline) {
37
+ const wgpuPipeline = pipeline;
38
+ this.handle.setPipeline(wgpuPipeline.handle);
39
+ this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
40
+ }
41
+ /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
42
+ setBindings(bindings) {
43
+ throw new Error('fix me');
44
+ // const bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.bindings);
45
+ // this.handle.setBindGroup(0, bindGroup);
46
+ }
47
+ /**
48
+ * Dispatch work to be performed with the current ComputePipeline.
49
+ * @param x X dimension of the grid of workgroups to dispatch.
50
+ * @param y Y dimension of the grid of workgroups to dispatch.
51
+ * @param z Z dimension of the grid of workgroups to dispatch.
52
+ */
53
+ dispatch(x, y, z) {
54
+ this.handle.dispatchWorkgroups(x, y, z);
55
+ }
56
+ /**
57
+ * Dispatch work to be performed with the current ComputePipeline.
58
+ * @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()
59
+ * @param indirectOffset
60
+ */
61
+ dispatchIndirect(indirectBuffer, indirectOffset = 0) {
62
+ const webgpuBuffer = indirectBuffer;
63
+ this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectOffset);
64
+ }
65
+ pushDebugGroup(groupLabel) {
66
+ this.handle.pushDebugGroup(groupLabel);
67
+ }
68
+ popDebugGroup() {
69
+ this.handle.popDebugGroup();
70
+ }
71
+ insertDebugMarker(markerLabel) {
72
+ this.handle.insertDebugMarker(markerLabel);
73
+ }
43
74
  }
44
- //# sourceMappingURL=webgpu-compute-pass.js.map
@@ -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,22 +1,31 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { ComputePipeline } from '@luma.gl/core';
5
+ // COMPUTE PIPELINE
6
+ /** Creates a new compute pipeline when parameters change */
2
7
  export class WebGPUComputePipeline extends ComputePipeline {
3
- constructor(device, props) {
4
- super(device, props);
5
- this.device = void 0;
6
- this.handle = void 0;
7
- this.device = device;
8
- const webgpuShader = this.props.cs;
9
- this.handle = this.props.handle || this.device.handle.createComputePipeline({
10
- label: this.props.id,
11
- compute: {
12
- module: webgpuShader.handle,
13
- entryPoint: this.props.csEntryPoint
14
- },
15
- layout: 'auto'
16
- });
17
- }
18
- _getBindGroupLayout() {
19
- return this.handle.getBindGroupLayout(0);
20
- }
8
+ device;
9
+ handle;
10
+ constructor(device, props) {
11
+ super(device, props);
12
+ this.device = device;
13
+ const webgpuShader = this.props.cs;
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
+ });
25
+ }
26
+ /** For internal use in render passes */
27
+ _getBindGroupLayout() {
28
+ // TODO: Cache?
29
+ return this.handle.getBindGroupLayout(0);
30
+ }
21
31
  }
22
- //# sourceMappingURL=webgpu-compute-pipeline.js.map
@@ -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,22 +1,37 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { ExternalTexture } from '@luma.gl/core';
2
5
  import { WebGPUSampler } from "./webgpu-sampler.js";
6
+ /**
7
+ * Cheap, temporary texture view for videos
8
+ * Only valid within same callback, destroyed automatically as a microtask.
9
+ */
3
10
  export class WebGPUExternalTexture extends ExternalTexture {
4
- constructor(device, props) {
5
- super(device, props);
6
- this.device = void 0;
7
- this.handle = void 0;
8
- this.sampler = void 0;
9
- this.device = device;
10
- this.handle = this.props.handle || this.device.handle.importExternalTexture({
11
- source: props.source,
12
- colorSpace: props.colorSpace
13
- });
14
- this.sampler = null;
15
- }
16
- destroy() {}
17
- setSampler(sampler) {
18
- this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
19
- return this;
20
- }
11
+ device;
12
+ handle;
13
+ sampler;
14
+ constructor(device, props) {
15
+ super(device, props);
16
+ this.device = device;
17
+ this.handle =
18
+ this.props.handle ||
19
+ this.device.handle.importExternalTexture({
20
+ source: props.source,
21
+ colorSpace: props.colorSpace
22
+ });
23
+ this.sampler = null;
24
+ }
25
+ destroy() {
26
+ // External textures are destroyed automatically,
27
+ // as a microtask, instead of manually or upon garbage collection like other resources.
28
+ // this.handle.destroy();
29
+ }
30
+ /** Set default sampler */
31
+ setSampler(sampler) {
32
+ // We can accept a sampler instance or set of props;
33
+ this.sampler =
34
+ sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
35
+ return this;
36
+ }
21
37
  }
22
- //# sourceMappingURL=webgpu-external-texture.js.map
@@ -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,10 +1,17 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { Framebuffer } from '@luma.gl/core';
5
+ /**
6
+ * Create new textures with correct size for all attachments.
7
+ * @note resize() destroys existing textures (if size has changed).
8
+ */
2
9
  export class WebGPUFramebuffer extends Framebuffer {
3
- constructor(device, props) {
4
- super(device, props);
5
- this.device = void 0;
6
- this.device = device;
7
- this.autoCreateAttachmentTextures();
8
- }
10
+ device;
11
+ constructor(device, props) {
12
+ super(device, props);
13
+ this.device = device;
14
+ // Auto create textures for attachments if needed
15
+ this.autoCreateAttachmentTextures();
16
+ }
9
17
  }
10
- //# sourceMappingURL=webgpu-framebuffer.js.map
@@ -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,2 +1,43 @@
1
+ /*
2
+ import {Resource, Query, QueryProps} from '@luma.gl/core';
3
+ import {WebGPUDevice} from '../webgpu-device';
1
4
 
2
- //# sourceMappingURL=webgpu-query.js.map
5
+ export type WebGPUQueryProps = QueryProps & {
6
+ handle?: any;
7
+ };
8
+
9
+ const DEFAULT_QUERY_PROPS: Required<WebGPUQueryProps> = {
10
+ id: undefined,
11
+ handle: undefined,
12
+ userData: undefined,
13
+ type: 'timestamp',
14
+ count: 1,
15
+ pipelineStatistics: []
16
+ };
17
+
18
+ /**
19
+ * Immutable
20
+ *
21
+ class WebGPUQuery extends Resource<WebGPUQueryProps> implements Query {
22
+ readonly device: WebGPUDevice;
23
+ readonly handle: GPUQuerySet;
24
+
25
+ constructor(device: WebGPUDevice, props: WebGPUQueryProps) {
26
+ super(device, props, DEFAULT_QUERY_PROPS);
27
+ this.handle = this.props.handle as GPUQuerySet || this.createHandle();
28
+ this.handle.label = this.props.id;
29
+ }
30
+
31
+ protected createHandle() {
32
+ return this.device.handle.createQuerySet({
33
+ type: this.props.type,
34
+ count: this.props.count,
35
+ pipelineStatistics: this.props.pipelineStatistics
36
+ });
37
+ }
38
+
39
+ override destroy(): void {
40
+ this.handle.destroy();
41
+ }
42
+ }
43
+ */
@@ -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,eAAe,CAAC,I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