@luma.gl/webgpu 9.0.0-alpha.16 → 9.0.0-alpha.19

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 (213) hide show
  1. package/dist/adapter/helpers/accessor-to-format.js +1 -100
  2. package/dist/adapter/helpers/accessor-to-format.js.map +1 -0
  3. package/dist/adapter/helpers/convert-texture-format.d.ts +1 -1
  4. package/dist/adapter/helpers/convert-texture-format.js +5 -5
  5. package/dist/adapter/helpers/convert-texture-format.js.map +1 -0
  6. package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
  7. package/dist/adapter/helpers/generate-mipmaps.js +85 -88
  8. package/dist/adapter/helpers/generate-mipmaps.js.map +1 -0
  9. package/dist/adapter/helpers/get-bind-group.d.ts +1 -1
  10. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  11. package/dist/adapter/helpers/get-bind-group.js +39 -54
  12. package/dist/adapter/helpers/get-bind-group.js.map +1 -0
  13. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +1 -1
  14. package/dist/adapter/helpers/get-vertex-buffer-layout.js +72 -97
  15. package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -0
  16. package/dist/adapter/helpers/webgpu-parameters.d.ts +1 -1
  17. package/dist/adapter/helpers/webgpu-parameters.js +125 -182
  18. package/dist/adapter/helpers/webgpu-parameters.js.map +1 -0
  19. package/dist/adapter/resources/webgpu-buffer.d.ts +2 -2
  20. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  21. package/dist/adapter/resources/webgpu-buffer.js +63 -57
  22. package/dist/adapter/resources/webgpu-buffer.js.map +1 -0
  23. package/dist/adapter/resources/webgpu-command-encoder.d.ts +2 -2
  24. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  25. package/dist/adapter/resources/webgpu-command-encoder.js +46 -47
  26. package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -0
  27. package/dist/adapter/resources/webgpu-compute-pass.d.ts +2 -2
  28. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  29. package/dist/adapter/resources/webgpu-compute-pass.js +41 -51
  30. package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -0
  31. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +2 -2
  32. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  33. package/dist/adapter/resources/webgpu-compute-pipeline.js +20 -22
  34. package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -0
  35. package/dist/adapter/resources/webgpu-external-texture.d.ts +2 -2
  36. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  37. package/dist/adapter/resources/webgpu-external-texture.js +20 -26
  38. package/dist/adapter/resources/webgpu-external-texture.js.map +1 -0
  39. package/dist/adapter/resources/webgpu-framebuffer.d.ts +2 -2
  40. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  41. package/dist/adapter/resources/webgpu-framebuffer.js +86 -89
  42. package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -0
  43. package/dist/adapter/resources/webgpu-query.js +1 -42
  44. package/dist/adapter/resources/webgpu-query.js.map +1 -0
  45. package/dist/adapter/resources/webgpu-render-pass.d.ts +2 -2
  46. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  47. package/dist/adapter/resources/webgpu-render-pass.js +70 -64
  48. package/dist/adapter/resources/webgpu-render-pass.js.map +1 -0
  49. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +2 -2
  50. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  51. package/dist/adapter/resources/webgpu-render-pipeline.js +118 -158
  52. package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -0
  53. package/dist/adapter/resources/webgpu-sampler.d.ts +3 -3
  54. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  55. package/dist/adapter/resources/webgpu-sampler.js +16 -16
  56. package/dist/adapter/resources/webgpu-sampler.js.map +1 -0
  57. package/dist/adapter/resources/webgpu-shader.d.ts +3 -3
  58. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  59. package/dist/adapter/resources/webgpu-shader.js +44 -47
  60. package/dist/adapter/resources/webgpu-shader.js.map +1 -0
  61. package/dist/adapter/resources/webgpu-texture.d.ts +3 -2
  62. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  63. package/dist/adapter/resources/webgpu-texture.js +87 -100
  64. package/dist/adapter/resources/webgpu-texture.js.map +1 -0
  65. package/dist/adapter/webgpu-canvas-context.d.ts +2 -2
  66. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  67. package/dist/adapter/webgpu-canvas-context.js +68 -77
  68. package/dist/adapter/webgpu-canvas-context.js.map +1 -0
  69. package/dist/adapter/webgpu-device.d.ts +2 -2
  70. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  71. package/dist/adapter/webgpu-device.js +194 -215
  72. package/dist/adapter/webgpu-device.js.map +1 -0
  73. package/dist/adapter/webgpu-types.js +2 -0
  74. package/dist/adapter/webgpu-types.js.map +1 -0
  75. package/dist/dist.dev.js +3061 -0
  76. package/dist/glsl/glsllang.js +6 -9
  77. package/dist/glsl/glsllang.js.map +1 -0
  78. package/dist/index.cjs +1442 -0
  79. package/dist/index.d.ts +1 -3
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +6 -10
  82. package/dist/index.js.map +1 -0
  83. package/dist.min.js +17 -0
  84. package/package.json +17 -8
  85. package/src/adapter/helpers/generate-mipmaps.ts +1 -1
  86. package/src/adapter/helpers/get-bind-group.ts +1 -1
  87. package/src/adapter/helpers/get-vertex-buffer-layout.ts +2 -2
  88. package/src/adapter/helpers/webgpu-parameters.ts +9 -9
  89. package/src/adapter/resources/webgpu-buffer.ts +1 -1
  90. package/src/adapter/resources/webgpu-command-encoder.ts +4 -4
  91. package/src/adapter/resources/webgpu-compute-pass.ts +1 -1
  92. package/src/adapter/resources/webgpu-compute-pipeline.ts +1 -1
  93. package/src/adapter/resources/webgpu-external-texture.ts +1 -1
  94. package/src/adapter/resources/webgpu-framebuffer.ts +6 -6
  95. package/src/adapter/resources/webgpu-query.ts +1 -1
  96. package/src/adapter/resources/webgpu-render-pass.ts +1 -1
  97. package/src/adapter/resources/webgpu-render-pipeline.ts +3 -3
  98. package/src/adapter/resources/webgpu-sampler.ts +1 -1
  99. package/src/adapter/resources/webgpu-shader.ts +3 -1
  100. package/src/adapter/resources/webgpu-texture.ts +1 -1
  101. package/src/adapter/webgpu-canvas-context.ts +1 -1
  102. package/src/adapter/webgpu-device.ts +3 -2
  103. package/src/index.ts +2 -5
  104. package/dist/bundle.d.ts +0 -2
  105. package/dist/bundle.d.ts.map +0 -1
  106. package/dist/bundle.js +0 -4
  107. package/dist/dist.js +0 -8051
  108. package/dist/dist.min.js +0 -1
  109. package/dist/es5/adapter/helpers/accessor-to-format.js +0 -2
  110. package/dist/es5/adapter/helpers/accessor-to-format.js.map +0 -1
  111. package/dist/es5/adapter/helpers/convert-texture-format.js +0 -13
  112. package/dist/es5/adapter/helpers/convert-texture-format.js.map +0 -1
  113. package/dist/es5/adapter/helpers/generate-mipmaps.js +0 -103
  114. package/dist/es5/adapter/helpers/generate-mipmaps.js.map +0 -1
  115. package/dist/es5/adapter/helpers/get-bind-group.js +0 -66
  116. package/dist/es5/adapter/helpers/get-bind-group.js.map +0 -1
  117. package/dist/es5/adapter/helpers/get-vertex-buffer-layout.js +0 -149
  118. package/dist/es5/adapter/helpers/get-vertex-buffer-layout.js.map +0 -1
  119. package/dist/es5/adapter/helpers/webgpu-parameters.js +0 -150
  120. package/dist/es5/adapter/helpers/webgpu-parameters.js.map +0 -1
  121. package/dist/es5/adapter/resources/webgpu-buffer.js +0 -131
  122. package/dist/es5/adapter/resources/webgpu-buffer.js.map +0 -1
  123. package/dist/es5/adapter/resources/webgpu-command-encoder.js +0 -90
  124. package/dist/es5/adapter/resources/webgpu-command-encoder.js.map +0 -1
  125. package/dist/es5/adapter/resources/webgpu-compute-pass.js +0 -85
  126. package/dist/es5/adapter/resources/webgpu-compute-pass.js.map +0 -1
  127. package/dist/es5/adapter/resources/webgpu-compute-pipeline.js +0 -48
  128. package/dist/es5/adapter/resources/webgpu-compute-pipeline.js.map +0 -1
  129. package/dist/es5/adapter/resources/webgpu-external-texture.js +0 -50
  130. package/dist/es5/adapter/resources/webgpu-external-texture.js.map +0 -1
  131. package/dist/es5/adapter/resources/webgpu-framebuffer.js +0 -126
  132. package/dist/es5/adapter/resources/webgpu-framebuffer.js.map +0 -1
  133. package/dist/es5/adapter/resources/webgpu-query.js +0 -2
  134. package/dist/es5/adapter/resources/webgpu-query.js.map +0 -1
  135. package/dist/es5/adapter/resources/webgpu-render-pass.js +0 -124
  136. package/dist/es5/adapter/resources/webgpu-render-pass.js.map +0 -1
  137. package/dist/es5/adapter/resources/webgpu-render-pipeline.js +0 -185
  138. package/dist/es5/adapter/resources/webgpu-render-pipeline.js.map +0 -1
  139. package/dist/es5/adapter/resources/webgpu-sampler.js +0 -45
  140. package/dist/es5/adapter/resources/webgpu-sampler.js.map +0 -1
  141. package/dist/es5/adapter/resources/webgpu-shader.js +0 -125
  142. package/dist/es5/adapter/resources/webgpu-shader.js.map +0 -1
  143. package/dist/es5/adapter/resources/webgpu-texture.js +0 -138
  144. package/dist/es5/adapter/resources/webgpu-texture.js.map +0 -1
  145. package/dist/es5/adapter/webgpu-canvas-context.js +0 -111
  146. package/dist/es5/adapter/webgpu-canvas-context.js.map +0 -1
  147. package/dist/es5/adapter/webgpu-device.js +0 -317
  148. package/dist/es5/adapter/webgpu-device.js.map +0 -1
  149. package/dist/es5/adapter/webgpu-types.js +0 -2
  150. package/dist/es5/adapter/webgpu-types.js.map +0 -1
  151. package/dist/es5/bundle.js +0 -6
  152. package/dist/es5/bundle.js.map +0 -1
  153. package/dist/es5/glsl/glsllang.js +0 -47
  154. package/dist/es5/glsl/glsllang.js.map +0 -1
  155. package/dist/es5/index.js +0 -44
  156. package/dist/es5/index.js.map +0 -1
  157. package/dist/es5/init.js +0 -7
  158. package/dist/es5/init.js.map +0 -1
  159. package/dist/esm/adapter/helpers/accessor-to-format.js +0 -2
  160. package/dist/esm/adapter/helpers/accessor-to-format.js.map +0 -1
  161. package/dist/esm/adapter/helpers/convert-texture-format.js +0 -7
  162. package/dist/esm/adapter/helpers/convert-texture-format.js.map +0 -1
  163. package/dist/esm/adapter/helpers/generate-mipmaps.js +0 -88
  164. package/dist/esm/adapter/helpers/generate-mipmaps.js.map +0 -1
  165. package/dist/esm/adapter/helpers/get-bind-group.js +0 -51
  166. package/dist/esm/adapter/helpers/get-bind-group.js.map +0 -1
  167. package/dist/esm/adapter/helpers/get-vertex-buffer-layout.js +0 -83
  168. package/dist/esm/adapter/helpers/get-vertex-buffer-layout.js.map +0 -1
  169. package/dist/esm/adapter/helpers/webgpu-parameters.js +0 -137
  170. package/dist/esm/adapter/helpers/webgpu-parameters.js.map +0 -1
  171. package/dist/esm/adapter/resources/webgpu-buffer.js +0 -70
  172. package/dist/esm/adapter/resources/webgpu-buffer.js.map +0 -1
  173. package/dist/esm/adapter/resources/webgpu-command-encoder.js +0 -49
  174. package/dist/esm/adapter/resources/webgpu-command-encoder.js.map +0 -1
  175. package/dist/esm/adapter/resources/webgpu-compute-pass.js +0 -44
  176. package/dist/esm/adapter/resources/webgpu-compute-pass.js.map +0 -1
  177. package/dist/esm/adapter/resources/webgpu-compute-pipeline.js +0 -23
  178. package/dist/esm/adapter/resources/webgpu-compute-pipeline.js.map +0 -1
  179. package/dist/esm/adapter/resources/webgpu-external-texture.js +0 -23
  180. package/dist/esm/adapter/resources/webgpu-external-texture.js.map +0 -1
  181. package/dist/esm/adapter/resources/webgpu-framebuffer.js +0 -93
  182. package/dist/esm/adapter/resources/webgpu-framebuffer.js.map +0 -1
  183. package/dist/esm/adapter/resources/webgpu-query.js +0 -2
  184. package/dist/esm/adapter/resources/webgpu-query.js.map +0 -1
  185. package/dist/esm/adapter/resources/webgpu-render-pass.js +0 -79
  186. package/dist/esm/adapter/resources/webgpu-render-pass.js.map +0 -1
  187. package/dist/esm/adapter/resources/webgpu-render-pipeline.js +0 -130
  188. package/dist/esm/adapter/resources/webgpu-render-pipeline.js.map +0 -1
  189. package/dist/esm/adapter/resources/webgpu-sampler.js +0 -20
  190. package/dist/esm/adapter/resources/webgpu-sampler.js.map +0 -1
  191. package/dist/esm/adapter/resources/webgpu-shader.js +0 -50
  192. package/dist/esm/adapter/resources/webgpu-shader.js.map +0 -1
  193. package/dist/esm/adapter/resources/webgpu-texture.js +0 -95
  194. package/dist/esm/adapter/resources/webgpu-texture.js.map +0 -1
  195. package/dist/esm/adapter/webgpu-canvas-context.js +0 -74
  196. package/dist/esm/adapter/webgpu-canvas-context.js.map +0 -1
  197. package/dist/esm/adapter/webgpu-device.js +0 -196
  198. package/dist/esm/adapter/webgpu-device.js.map +0 -1
  199. package/dist/esm/adapter/webgpu-types.js +0 -2
  200. package/dist/esm/adapter/webgpu-types.js.map +0 -1
  201. package/dist/esm/bundle.js +0 -4
  202. package/dist/esm/bundle.js.map +0 -1
  203. package/dist/esm/glsl/glsllang.js +0 -9
  204. package/dist/esm/glsl/glsllang.js.map +0 -1
  205. package/dist/esm/index.js +0 -8
  206. package/dist/esm/index.js.map +0 -1
  207. package/dist/esm/init.js +0 -4
  208. package/dist/esm/init.js.map +0 -1
  209. package/dist/init.d.ts +0 -2
  210. package/dist/init.d.ts.map +0 -1
  211. package/dist/init.js +0 -3
  212. package/src/bundle.ts +0 -4
  213. package/src/init.ts +0 -4
@@ -1,64 +1,70 @@
1
- // WEBGPU Buffer implementation
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import { Buffer } from '@luma.gl/api';
3
3
  function getByteLength(props) {
4
- return props.byteLength || props.data?.byteLength || 0;
4
+ var _props$data;
5
+ return props.byteLength || ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.byteLength) || 0;
5
6
  }
6
7
  export default class WebGPUBuffer extends Buffer {
7
- constructor(device, props) {
8
- super(device, props);
9
- this.device = device;
10
- this.byteLength = getByteLength(props);
11
- const mapBuffer = Boolean(props.data);
12
- this.handle = this.props.handle || this.device.handle.createBuffer({
13
- size: this.byteLength,
14
- // usage defaults to vertex
15
- usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),
16
- mappedAtCreation: this.props.mappedAtCreation || mapBuffer,
17
- label: this.props.id
18
- });
19
- if (props.data) {
20
- this._writeMapped(props.data);
21
- // this.handle.writeAsync({data: props.data, map: false, unmap: false});
22
- }
23
- if (mapBuffer && !props.mappedAtCreation) {
24
- this.handle.unmap();
25
- }
8
+ constructor(device, props) {
9
+ super(device, props);
10
+ _defineProperty(this, "device", void 0);
11
+ _defineProperty(this, "handle", void 0);
12
+ _defineProperty(this, "byteLength", void 0);
13
+ this.device = device;
14
+ this.byteLength = getByteLength(props);
15
+ const mapBuffer = Boolean(props.data);
16
+ this.handle = this.props.handle || this.device.handle.createBuffer({
17
+ size: this.byteLength,
18
+ usage: this.props.usage || GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
19
+ mappedAtCreation: this.props.mappedAtCreation || mapBuffer,
20
+ label: this.props.id
21
+ });
22
+ if (props.data) {
23
+ this._writeMapped(props.data);
26
24
  }
27
- destroy() {
28
- this.handle.destroy();
29
- }
30
- // WebGPU provides multiple ways to write a buffer...
31
- write(data, byteOffset = 0) {
32
- this.device.handle.queue.writeBuffer(this.handle, byteOffset, data.buffer, data.byteOffset, data.byteLength);
33
- }
34
- async readAsync(byteOffset = 0, byteLength = this.byteLength) {
35
- // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer
36
- const tempBuffer = new WebGPUBuffer(this.device, { usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength });
37
- // Now do a GPU-side copy into the temp buffer we can actually read.
38
- // TODO - we are spinning up an independent command queue here, what does this mean
39
- const commandEncoder = this.device.handle.createCommandEncoder();
40
- commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);
41
- this.device.handle.queue.submit([commandEncoder.finish()]);
42
- // Map the temp buffer and read the data.
43
- await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);
44
- const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);
45
- tempBuffer.handle.unmap();
46
- tempBuffer.destroy();
47
- return arrayBuffer;
48
- }
49
- _writeMapped(typedArray) {
50
- const arrayBuffer = this.handle.getMappedRange();
51
- // @ts-expect-error
52
- new typedArray.constructor(arrayBuffer).set(typedArray);
53
- }
54
- // WEBGPU API
55
- mapAsync(mode, offset = 0, size) {
56
- return this.handle.mapAsync(mode, offset, size);
57
- }
58
- getMappedRange(offset = 0, size) {
59
- return this.handle.getMappedRange(offset, size);
60
- }
61
- unmap() {
62
- this.handle.unmap();
25
+ if (mapBuffer && !props.mappedAtCreation) {
26
+ this.handle.unmap();
63
27
  }
28
+ }
29
+ destroy() {
30
+ this.handle.destroy();
31
+ }
32
+ write(data) {
33
+ let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
34
+ this.device.handle.queue.writeBuffer(this.handle, byteOffset, data.buffer, data.byteOffset, data.byteLength);
35
+ }
36
+ async readAsync() {
37
+ let byteOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
38
+ let byteLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.byteLength;
39
+ const tempBuffer = new WebGPUBuffer(this.device, {
40
+ usage: Buffer.MAP_READ | Buffer.COPY_DST,
41
+ byteLength
42
+ });
43
+ const commandEncoder = this.device.handle.createCommandEncoder();
44
+ commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);
45
+ this.device.handle.queue.submit([commandEncoder.finish()]);
46
+ await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);
47
+ const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);
48
+ tempBuffer.handle.unmap();
49
+ tempBuffer.destroy();
50
+ return arrayBuffer;
51
+ }
52
+ _writeMapped(typedArray) {
53
+ const arrayBuffer = this.handle.getMappedRange();
54
+ new typedArray.constructor(arrayBuffer).set(typedArray);
55
+ }
56
+ mapAsync(mode) {
57
+ let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
58
+ let size = arguments.length > 2 ? arguments[2] : undefined;
59
+ return this.handle.mapAsync(mode, offset, size);
60
+ }
61
+ getMappedRange() {
62
+ let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
63
+ let size = arguments.length > 1 ? arguments[1] : undefined;
64
+ return this.handle.getMappedRange(offset, size);
65
+ }
66
+ unmap() {
67
+ this.handle.unmap();
68
+ }
64
69
  }
70
+ //# sourceMappingURL=webgpu-buffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","_defineProperty","mapBuffer","Boolean","handle","createBuffer","size","usage","GPUBufferUsage","VERTEX","COPY_DST","mappedAtCreation","label","id","_writeMapped","unmap","destroy","write","byteOffset","arguments","length","undefined","queue","writeBuffer","buffer","readAsync","tempBuffer","MAP_READ","commandEncoder","createCommandEncoder","copyBufferToBuffer","submit","finish","mapAsync","GPUMapMode","READ","arrayBuffer","getMappedRange","slice","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} from '@luma.gl/api';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport default class WebGPUBuffer extends Buffer {\n readonly device: WebGPUDevice;\n readonly handle: GPUBuffer;\n readonly byteLength: number;\n\n constructor(device: WebGPUDevice, props: BufferProps) {\n super(device, props);\n this.device = device;\n\n this.byteLength = getByteLength(props);\n const mapBuffer = Boolean(props.data);\n\n this.handle = this.props.handle || this.device.handle.createBuffer({\n size: this.byteLength,\n // usage defaults to vertex\n usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),\n mappedAtCreation: this.props.mappedAtCreation || mapBuffer,\n label: this.props.id\n });\n\n if (props.data) {\n this._writeMapped(props.data);\n // this.handle.writeAsync({data: props.data, map: false, unmap: false});\n }\n\n if (mapBuffer && !props.mappedAtCreation) {\n this.handle.unmap();\n }\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n\n // WebGPU provides multiple ways to write a buffer...\n override write(data: ArrayBufferView, byteOffset = 0) {\n this.device.handle.queue.writeBuffer(\n this.handle,\n byteOffset,\n data.buffer,\n data.byteOffset,\n data.byteLength\n );\n }\n\n override async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<ArrayBuffer> {\n // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer\n const tempBuffer = new WebGPUBuffer(this.device, {usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength});\n\n // Now do a GPU-side copy into the temp buffer we can actually read.\n // TODO - we are spinning up an independent command queue here, what does this mean\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);\n this.device.handle.queue.submit([commandEncoder.finish()]);\n\n // Map the temp buffer and read the data.\n await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);\n const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);\n tempBuffer.handle.unmap();\n tempBuffer.destroy();\n\n return arrayBuffer;\n }\n\n _writeMapped<TypedArray>(typedArray: TypedArray): void {\n const arrayBuffer = this.handle.getMappedRange();\n // @ts-expect-error\n new typedArray.constructor(arrayBuffer).set(typedArray);\n }\n\n // WEBGPU API\n\n mapAsync(mode: number, offset: number = 0, size?: number): Promise<void> {\n return this.handle.mapAsync(mode, offset, size);\n }\n\n getMappedRange(offset: number = 0, size?: number): ArrayBuffer {\n return this.handle.getMappedRange(offset, size);\n }\n\n unmap(): void {\n this.handle.unmap();\n }\n}\n"],"mappings":";AACA,SAAQA,MAAM,QAAoB,cAAc;AAGhD,SAASC,aAAaA,CAACC,KAAkB,EAAU;EAAA,IAAAC,WAAA;EACjD,OAAOD,KAAK,CAACE,UAAU,MAAAD,WAAA,GAAID,KAAK,CAACG,IAAI,cAAAF,WAAA,uBAAVA,WAAA,CAAYC,UAAU,KAAI,CAAC;AACxD;AAEA,eAAe,MAAME,YAAY,SAASN,MAAM,CAAC;EAK/CO,WAAWA,CAACC,MAAoB,EAAEN,KAAkB,EAAE;IACpD,KAAK,CAACM,MAAM,EAAEN,KAAK,CAAC;IAACO,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACD,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACJ,UAAU,GAAGH,aAAa,CAACC,KAAK,CAAC;IACtC,MAAMQ,SAAS,GAAGC,OAAO,CAACT,KAAK,CAACG,IAAI,CAAC;IAErC,IAAI,CAACO,MAAM,GAAG,IAAI,CAACV,KAAK,CAACU,MAAM,IAAI,IAAI,CAACJ,MAAM,CAACI,MAAM,CAACC,YAAY,CAAC;MACjEC,IAAI,EAAE,IAAI,CAACV,UAAU;MAErBW,KAAK,EAAE,IAAI,CAACb,KAAK,CAACa,KAAK,IAAKC,cAAc,CAACC,MAAM,GAAGD,cAAc,CAACE,QAAS;MAC5EC,gBAAgB,EAAE,IAAI,CAACjB,KAAK,CAACiB,gBAAgB,IAAIT,SAAS;MAC1DU,KAAK,EAAE,IAAI,CAAClB,KAAK,CAACmB;IACpB,CAAC,CAAC;IAEF,IAAInB,KAAK,CAACG,IAAI,EAAE;MACd,IAAI,CAACiB,YAAY,CAACpB,KAAK,CAACG,IAAI,CAAC;IAE/B;IAEA,IAAIK,SAAS,IAAI,CAACR,KAAK,CAACiB,gBAAgB,EAAE;MACxC,IAAI,CAACP,MAAM,CAACW,KAAK,EAAE;IACrB;EACF;EAESC,O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ACzE,MAAMwC,WAAW,GAAGV,UAAU,CAACtB,MAAM,CAACiC,cAAc,EAAE,CAACC,KAAK,CAAC,CAAC,CAAC;IAC/DZ,UAAU,CAACtB,MAAM,CAACW,KAAK,EAAE;IACzBW,UAAU,CAACV,OAAO,EAAE;IAEpB,OAAOoB,WAAW;EACpB;EAEAtB,YAAYA,CAAayB,UAAsB,EAAQ;IACrD,MAAMH,WAAW,GAAG,IAAI,CAAChC,MAAM,CAACiC,cAAc,EAAE;IAEhD,IAAIE,UAAU,CAACxC,WAAW,CAACqC,WAAW,CAAC,CAACI,GAAG,CAACD,UAAU,CAAC;EACzD;EAIAN,QAAQA,CAACQ,IAAY,EAAoD;IAAA,IAAlDC,MAAc,GAAAvB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEb,IAAa,GAAAa,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IACtD,OAAO,IAAI,CAACjB,MAAM,CAAC6B,QAAQ,CAACQ,IAAI,EAAEC,MAAM,EAAEpC,IAAI,CAAC;EACjD;EAEA+B,cAAcA,CAAA,EAAiD;IAAA,IAAhDK,MAAc,GAAAvB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEb,IAAa,GAAAa,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAC9C,OAAO,IAAI,CAACjB,MAAM,CAACiC,cAAc,CAACK,MAAM,EAAEpC,IAAI,CAAC;EACjD;EAEAS,KAAKA,CAAA,EAAS;IACZ,IAAI,CAACX,MAAM,CAACW,KAAK,EAAE;EACrB;AACF"}
@@ -1,6 +1,6 @@
1
- /// <reference types="@webgpu/types" />
1
+ /// <reference types="dist" />
2
2
  import { CommandEncoder, CommandEncoderProps, Buffer, Texture } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
4
  export default class WebGPUCommandEncoder extends CommandEncoder {
5
5
  readonly device: WebGPUDevice;
6
6
  readonly handle: GPUCommandEncoder;
@@ -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,EAAO,MAAM,cAAc,CAAC;AACxF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,cAAc;IAC9D,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAEvB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,mBAAmB;IAUnD,OAAO,IAAI,IAAI;IAExB,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,gBAAgB;IAOjD,kBAAkB,CAAC,OAAO,EAAE;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,GAAG,IAAI;IAUR,mBAAmB,CAAC,OAAO,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QAErB,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;QAE/C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,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M,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,GAAG,IAAI;IAUR,mBAAmB,CAAC,OAAO,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QAErB,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;QAE/C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KAC7C,GAAG,IAAI;IAuBR,mBAAmB,CAAC,OAAO,EAAE;QAC3B,MAAM,EAAE,mBAAmB,CAAC;QAC5B,WAAW,EAAE,kBAAkB,CAAC;QAChC,QAAQ,EAAE,WAAW,CAAA;KACtB,GAAG,IAAI;IAER,oBAAoB,CAAC,OAAO,EAAE;QAC5B,MAAM,EAAE,mBAAmB,CAAE;QAC7B,WAAW,EAAE,mBAAmB,CAAC;QACjC,QAAQ,EAAE,WAAW,CAAA;KACtB,GAAG,IAAI;IAEC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAIrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAatD"}
@@ -1,50 +1,49 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
2
  import { CommandEncoder, cast } from '@luma.gl/api';
2
3
  export default class WebGPUCommandEncoder extends CommandEncoder {
3
- constructor(device, props) {
4
- super(props);
5
- this.device = device;
6
- this.handle = props.handle || this.device.handle.createCommandEncoder({
7
- // TODO was this removed in standard?
8
- // measureExecutionTime: this.props.measureExecutionTime
9
- });
10
- this.handle.label = this.props.id;
11
- }
12
- destroy() { }
13
- finish(options) {
14
- return this.finish(options);
15
- }
16
- // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;
17
- // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;
18
- copyBufferToBuffer(options) {
19
- this.handle.copyBufferToBuffer(cast(options.source).handle, options.sourceOffset ?? 0, cast(options.destination).handle, options.destinationOffset ?? 0, options.size ?? 0);
20
- }
21
- copyBufferToTexture(options) {
22
- this.handle.copyBufferToTexture({
23
- buffer: cast(options.source).handle,
24
- offset: options.offset ?? 0,
25
- bytesPerRow: options.bytesPerRow,
26
- rowsPerImage: options.rowsPerImage,
27
- }, {
28
- texture: cast(options.destination).handle,
29
- mipLevel: options.mipLevel ?? 0,
30
- origin: options.origin ?? {},
31
- // aspect: options.aspect
32
- }, {
33
- // TODO exclamation mark hack
34
- width: options.extent[0],
35
- height: options.extent[1],
36
- depthOrArrayLayers: options.extent[2]
37
- });
38
- }
39
- copyTextureToBuffer(options) { }
40
- copyTextureToTexture(options) { }
41
- pushDebugGroup(groupLabel) {
42
- this.handle.pushDebugGroup(groupLabel);
43
- }
44
- popDebugGroup() {
45
- this.handle.popDebugGroup();
46
- }
47
- insertDebugMarker(markerLabel) {
48
- this.handle.insertDebugMarker(markerLabel);
49
- }
4
+ constructor(device, props) {
5
+ super(props);
6
+ _defineProperty(this, "device", void 0);
7
+ _defineProperty(this, "handle", void 0);
8
+ this.device = device;
9
+ this.handle = props.handle || this.device.handle.createCommandEncoder({});
10
+ this.handle.label = this.props.id;
11
+ }
12
+ destroy() {}
13
+ finish(options) {
14
+ return this.finish(options);
15
+ }
16
+ copyBufferToBuffer(options) {
17
+ var _options$sourceOffset, _options$destinationO, _options$size;
18
+ this.handle.copyBufferToBuffer(cast(options.source).handle, (_options$sourceOffset = options.sourceOffset) !== null && _options$sourceOffset !== void 0 ? _options$sourceOffset : 0, cast(options.destination).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);
19
+ }
20
+ copyBufferToTexture(options) {
21
+ var _options$offset, _options$mipLevel, _options$origin;
22
+ this.handle.copyBufferToTexture({
23
+ buffer: cast(options.source).handle,
24
+ offset: (_options$offset = options.offset) !== null && _options$offset !== void 0 ? _options$offset : 0,
25
+ bytesPerRow: options.bytesPerRow,
26
+ rowsPerImage: options.rowsPerImage
27
+ }, {
28
+ texture: cast(options.destination).handle,
29
+ mipLevel: (_options$mipLevel = options.mipLevel) !== null && _options$mipLevel !== void 0 ? _options$mipLevel : 0,
30
+ origin: (_options$origin = options.origin) !== null && _options$origin !== void 0 ? _options$origin : {}
31
+ }, {
32
+ width: options.extent[0],
33
+ height: options.extent[1],
34
+ depthOrArrayLayers: options.extent[2]
35
+ });
36
+ }
37
+ copyTextureToBuffer(options) {}
38
+ copyTextureToTexture(options) {}
39
+ pushDebugGroup(groupLabel) {
40
+ this.handle.pushDebugGroup(groupLabel);
41
+ }
42
+ popDebugGroup() {
43
+ this.handle.popDebugGroup();
44
+ }
45
+ insertDebugMarker(markerLabel) {
46
+ this.handle.insertDebugMarker(markerLabel);
47
+ }
50
48
  }
49
+ //# sourceMappingURL=webgpu-command-encoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu-command-encoder.js","names":["CommandEncoder","cast","WebGPUCommandEncoder","constructor","device","props","_defineProperty","handle","createCommandEncoder","label","id","destroy","finish","options","copyBufferToBuffer","_options$sourceOffset","_options$destinationO","_options$size","source","sourceOffset","destination","destinationOffset","size","copyBufferToTexture","_options$offset","_options$mipLevel","_options$origin","buffer","offset","bytesPerRow","rowsPerImage","texture","mipLevel","origin","width","extent","height","depthOrArrayLayers","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps, Buffer, Texture, cast} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\nimport WEBGPUBuffer from './webgpu-buffer';\nimport WebGPUTexture from './webgpu-texture';\n\nexport default class WebGPUCommandEncoder extends CommandEncoder {\n readonly device: WebGPUDevice;\n readonly handle: GPUCommandEncoder;\n\n constructor(device: WebGPUDevice, props: CommandEncoderProps) {\n super(props);\n this.device = device;\n this.handle = props.handle || this.device.handle.createCommandEncoder({\n // TODO was this removed in standard?\n // measureExecutionTime: this.props.measureExecutionTime\n });\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {}\n\n finish(options?: {id?: string}): GPUCommandBuffer {\n return this.finish(options);\n }\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n\n copyBufferToBuffer(options: {\n source: Buffer,\n sourceOffset?: number,\n destination: Buffer,\n destinationOffset?: number,\n size?: number\n }): void {\n this.handle.copyBufferToBuffer(\n cast<WEBGPUBuffer>(options.source).handle,\n options.sourceOffset ?? 0,\n cast<WEBGPUBuffer>(options.destination).handle,\n options.destinationOffset ?? 0,\n options.size ?? 0\n );\n }\n\n copyBufferToTexture(options: {\n source: Buffer,\n offset?: number,\n bytesPerRow: number,\n rowsPerImage: number,\n\n destination: Texture,\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only',\n\n origin?: number[] | [number, number, number],\n extent?: number[] | [number, number, number]\n }): void {\n this.handle.copyBufferToTexture(\n {\n buffer: cast<WEBGPUBuffer>(options.source).handle,\n offset: options.offset ?? 0,\n bytesPerRow: options.bytesPerRow,\n rowsPerImage: options.rowsPerImage,\n },\n {\n texture: cast<WebGPUTexture>(options.destination).handle,\n mipLevel: options.mipLevel ?? 0,\n origin: options.origin ?? {},\n // aspect: options.aspect\n },\n {\n // TODO exclamation mark hack\n width: options.extent[0],\n height: options.extent[1],\n depthOrArrayLayers: options.extent[2]\n }\n );\n }\n\n copyTextureToBuffer(options: {\n source: GPUImageCopyTexture,\n destination: GPUImageCopyBuffer,\n copySize: GPUExtent3D\n }): void {}\n\n copyTextureToTexture(options: {\n source: GPUImageCopyTexture ,\n destination: GPUImageCopyTexture,\n copySize: GPUExtent3D\n }): void {}\n\n override pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n\n override popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n\n override insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}"],"mappings":";AAAA,SAAQA,cAAc,EAAwCC,IAAI,QAAO,cAAc;AAKvF,eAAe,MAAMC,oBAAoB,SAASF,cAAc,CAAC;EAI/DG,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACb,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAGF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACG,MAAM,CAACC,oBAAoB,CAAC,CAGtE,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,CAACE,KAAK,GAAG,IAAI,CAACJ,KAAK,CAACK,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,MAAMA,CAACC,OAAuB,EAAoB;IAChD,OAAO,IAAI,CAACD,MAAM,CAACC,OAAO,CAAC;EAC7B;EAKAC,kBAAkBA,CAACD,OAMlB,EAAQ;IAAA,IAAAE,qBAAA,EAAAC,qBAAA,EAAAC,aAAA;IACP,IAAI,CAACV,MAAM,CAACO,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CAAC,CACF;EACH;EAEAG,mBAAmBA,CAACzB,OAInB,EAAQ,CAAC;EAEV0B,oBAAoBA,CAAC1B,OAIpB,EAAQ,CAAC;EAED2B,cAAcA,CAACC,UAAkB,EAAQ;IAChD,IAAI,CAAClC,MAAM,CAACiC,cAAc,CAACC,UAAU,CAAC;EACxC;EAESC,aAAaA,CAAA,EAAS;IAC7B,IAAI,CAACnC,MAAM,CAACmC,aAAa,EAAE;EAC7B;EAESC,iBAAiBA,CAACC,WAAmB,EAAQ;IACpD,IAAI,CAACrC,MAAM,CAACoC,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAWF"}
@@ -1,6 +1,6 @@
1
- /// <reference types="@webgpu/types" />
1
+ /// <reference types="dist" />
2
2
  import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
4
  export default 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,EAAO,MAAM,cAAc,CAAC;AACnG,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAK5C,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,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,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C,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;OAIG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,GAAE,MAAU,GAAG,IAAI;IAI1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAO7C"}
@@ -1,54 +1,44 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
2
  import { ComputePass, cast } from '@luma.gl/api';
2
3
  export default class WebGPUComputePass extends ComputePass {
3
- constructor(device, props) {
4
- super(device, props);
5
- this._bindGroupLayout = null;
6
- this.device = device;
7
- this.handle = this.props.handle || device.commandEncoder?.beginComputePass({
8
- label: this.props.id,
9
- // timestampWrites?: GPUComputePassTimestampWrites;
10
- });
11
- }
12
- /** @note no WebGPU destroy method, just gc */
13
- destroy() { }
14
- end() {
15
- this.handle.end();
16
- }
17
- setPipeline(pipeline) {
18
- const wgpuPipeline = cast(pipeline);
19
- this.handle.setPipeline(wgpuPipeline.handle);
20
- this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
21
- }
22
- /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
23
- setBindings(bindings) {
24
- throw new Error('fix me');
25
- // const bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.bindings);
26
- // this.handle.setBindGroup(0, bindGroup);
27
- }
28
- /**
29
- * Dispatch work to be performed with the current ComputePipeline.
30
- * @param x X dimension of the grid of workgroups to dispatch.
31
- * @param y Y dimension of the grid of workgroups to dispatch.
32
- * @param z Z dimension of the grid of workgroups to dispatch.
33
- */
34
- dispatch(x, y, z) {
35
- this.handle.dispatchWorkgroups(x, y, z);
36
- }
37
- /**
38
- * Dispatch work to be performed with the current ComputePipeline.
39
- * @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()
40
- * @param indirectOffset
41
- */
42
- dispatchIndirect(indirectBuffer, indirectOffset = 0) {
43
- this.handle.dispatchWorkgroupsIndirect(cast(indirectBuffer).handle, indirectOffset);
44
- }
45
- pushDebugGroup(groupLabel) {
46
- this.handle.pushDebugGroup(groupLabel);
47
- }
48
- popDebugGroup() {
49
- this.handle.popDebugGroup();
50
- }
51
- insertDebugMarker(markerLabel) {
52
- this.handle.insertDebugMarker(markerLabel);
53
- }
4
+ constructor(device, props) {
5
+ var _device$commandEncode;
6
+ super(device, props);
7
+ _defineProperty(this, "device", void 0);
8
+ _defineProperty(this, "handle", void 0);
9
+ _defineProperty(this, "_bindGroupLayout", null);
10
+ this.device = device;
11
+ this.handle = this.props.handle || ((_device$commandEncode = device.commandEncoder) === null || _device$commandEncode === void 0 ? void 0 : _device$commandEncode.beginComputePass({
12
+ label: this.props.id
13
+ }));
14
+ }
15
+ destroy() {}
16
+ end() {
17
+ this.handle.end();
18
+ }
19
+ setPipeline(pipeline) {
20
+ const wgpuPipeline = cast(pipeline);
21
+ this.handle.setPipeline(wgpuPipeline.handle);
22
+ this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
23
+ }
24
+ setBindings(bindings) {
25
+ throw new Error('fix me');
26
+ }
27
+ dispatch(x, y, z) {
28
+ this.handle.dispatchWorkgroups(x, y, z);
29
+ }
30
+ dispatchIndirect(indirectBuffer) {
31
+ let indirectOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
32
+ this.handle.dispatchWorkgroupsIndirect(cast(indirectBuffer).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
+ }
54
43
  }
44
+ //# sourceMappingURL=webgpu-compute-pass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu-compute-pass.js","names":["ComputePass","cast","WebGPUComputePass","constructor","device","props","_device$commandEncode","_defineProperty","handle","commandEncoder","beginComputePass","label","id","destroy","end","setPipeline","pipeline","wgpuPipeline","_bindGroupLayout","_getBindGroupLayout","setBindings","bindings","Error","dispatch","x","y","z","dispatchWorkgroups","dispatchIndirect","indirectBuffer","indirectOffset","arguments","length","undefined","dispatchWorkgroupsIndirect","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"sourcesContent":["import {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding, cast} from '@luma.gl/api';\nimport {WebGPUDevice} from '../webgpu-device';\nimport WebGPUBuffer from './webgpu-buffer';\n// import WebGPUCommandEncoder from './webgpu-command-encoder';\nimport WebGPUComputePipeline from './webgpu-compute-pipeline';\n\nexport default class WebGPUComputePass extends ComputePass {\n readonly device: WebGPUDevice;\n readonly handle: GPUComputePassEncoder;\n _bindGroupLayout: GPUBindGroupLayout | null = null;\n\n constructor(device: WebGPUDevice, props: ComputePassProps) {\n super(device, props);\n this.device = device;\n\n this.handle = this.props.handle || device.commandEncoder?.beginComputePass({\n label: this.props.id,\n // timestampWrites?: GPUComputePassTimestampWrites;\n });\n }\n\n /** @note no WebGPU destroy method, just gc */\n override destroy(): void {}\n\n end(): void {\n this.handle.end();\n }\n\n setPipeline(pipeline: ComputePipeline): void {\n const wgpuPipeline = cast<WebGPUComputePipeline>(pipeline);\n this.handle.setPipeline(wgpuPipeline.handle);\n this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();\n }\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n setBindings(bindings: Binding[]): void {\n throw new Error('fix me');\n // const bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.bindings);\n // this.handle.setBindGroup(0, bindGroup);\n }\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param x X dimension of the grid of workgroups to dispatch.\n * @param y Y dimension of the grid of workgroups to dispatch.\n * @param z Z dimension of the grid of workgroups to dispatch.\n */\n dispatch(x: number, y?: number, z?: number): void {\n this.handle.dispatchWorkgroups(x, y, z);\n }\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @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()\n * @param indirectOffset\n */\n dispatchIndirect(indirectBuffer: Buffer, indirectOffset: number = 0): void {\n this.handle.dispatchWorkgroupsIndirect(cast<WebGPUBuffer>(indirectBuffer).handle, indirectOffset);\n }\n\n pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n // beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n // endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n}\n"],"mappings":";AAAA,SAAQA,WAAW,EAAsDC,IAAI,QAAO,cAAc;AAMlG,eAAe,MAAMC,iBAAiB,SAASF,WAAW,CAAC;EAKzDG,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IAAA,IAAAC,qBAAA;IACzD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACE,eAAA;IAAAA,eAAA;IAAAA,eAAA,2BAHuB,IAAI;IAIhD,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACI,MAAM,GAAG,IAAI,CAACH,KAAK,CAACG,MAAM,MAAAF,qBAAA,GAAIF,MAAM,CAACK,cAAc,cAAAH,qBAAA,uBAArBA,qBAAA,CAAuBI,gBAAgB,CAAC;MACzEC,KAAK,EAAE,IAAI,CAACN,KAAK,CAACO;IAEpB,CAAC,CAAC;EACJ;EAGSC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,GAAGA,CAAA,EAAS;IACV,IAAI,CAACN,MAAM,CAACM,GAAG,EAAE;EACnB;EAEAC,WAAWA,CAACC,QAAyB,EAAQ;IAC3C,MAAMC,YAAY,GAAGhB,IAAI,CAAwBe,QAAQ,CAAC;IAC1D,IAAI,CAACR,MAAM,CAACO,WAAW,CAACE,YAAY,CAACT,MAAM,CAAC;IAC5C,IAAI,CAACU,gBAAgB,GAAGD,YAAY,CAACE,mBAAmB,EAAE;EAC5D;EAGAC,WAAWA,CAACC,QAAmB,EAAQ;IACrC,MAAM,IAAIC,KAAK,CAAC,QAAQ,CAAC;EAG3B;EAQAC,QAAQA,CAACC,CAAS,EAAEC,CAAU,EAAEC,CAAU,EAAQ;IAChD,IAAI,CAAClB,MAAM,CAACmB,kBAAkB,CAACH,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;EACzC;EAOAE,gBAAgBA,CAACC,cAAsB,EAAoC;IAAA,IAAlCC,cAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IACjE,IAAI,CAACvB,MAAM,CAAC0B,0BAA0B,CAACjC,IAAI,CAAe4B,cAAc,CAAC,CAACrB,MAAM,EAAEsB,cAAc,CAAC;EACnG;EAEAK,cAAcA,CAACC,UAAkB,EAAQ;IACvC,IAAI,CAAC5B,MAAM,CAAC2B,cAAc,CAACC,UAAU,CAAC;EACxC;EACAC,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC7B,MAAM,CAAC6B,aAAa,EAAE;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/B,MAAM,CAAC8B,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAKF"}
@@ -1,6 +1,6 @@
1
- /// <reference types="@webgpu/types" />
1
+ /// <reference types="dist" />
2
2
  import { ComputePipeline, ComputePipelineProps } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
4
  /** Creates a new compute pipeline when parameters change */
5
5
  export default 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,EAAO,MAAM,cAAc,CAAC;AAEzE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAK5C,4DAA4D;AAC5D,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,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":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAO,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAK9C,4DAA4D;AAC5D,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAgB7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
@@ -1,25 +1,23 @@
1
- // prettier-ignore
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import { ComputePipeline, cast } from '@luma.gl/api';
3
- // COMPUTE PIPELINE
4
- /** Creates a new compute pipeline when parameters change */
5
3
  export default class WebGPUComputePipeline extends ComputePipeline {
6
- constructor(device, props) {
7
- super(device, props);
8
- this.device = device;
9
- const module = cast(this.props.cs).handle;
10
- this.handle = this.props.handle || this.device.handle.createComputePipeline({
11
- label: this.props.id,
12
- compute: {
13
- module,
14
- entryPoint: this.props.csEntryPoint,
15
- // constants: this.props.csConstants
16
- },
17
- layout: 'auto'
18
- });
19
- }
20
- /** For internal use in render passes */
21
- _getBindGroupLayout() {
22
- // TODO: Cache?
23
- return this.handle.getBindGroupLayout(0);
24
- }
4
+ constructor(device, props) {
5
+ super(device, props);
6
+ _defineProperty(this, "device", void 0);
7
+ _defineProperty(this, "handle", void 0);
8
+ this.device = device;
9
+ const module = cast(this.props.cs).handle;
10
+ this.handle = this.props.handle || this.device.handle.createComputePipeline({
11
+ label: this.props.id,
12
+ compute: {
13
+ module,
14
+ entryPoint: this.props.csEntryPoint
15
+ },
16
+ layout: 'auto'
17
+ });
18
+ }
19
+ _getBindGroupLayout() {
20
+ return this.handle.getBindGroupLayout(0);
21
+ }
25
22
  }
23
+ //# sourceMappingURL=webgpu-compute-pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu-compute-pipeline.js","names":["ComputePipeline","cast","WebGPUComputePipeline","constructor","device","props","_defineProperty","module","cs","handle","createComputePipeline","label","id","compute","entryPoint","csEntryPoint","layout","_getBindGroupLayout","getBindGroupLayout"],"sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"sourcesContent":["// prettier-ignore\nimport {ComputePipeline, ComputePipelineProps, cast} from '@luma.gl/api';\n\nimport {WebGPUDevice} from '../webgpu-device';\nimport WebGPUShader from './webgpu-shader';\n\n// COMPUTE PIPELINE\n\n/** Creates a new compute pipeline when parameters change */\nexport default class WebGPUComputePipeline extends ComputePipeline {\n device: WebGPUDevice;\n handle: GPUComputePipeline;\n\n constructor(device: WebGPUDevice, props: ComputePipelineProps) {\n super(device, props);\n this.device = device;\n\n const module = cast<WebGPUShader>(this.props.cs).handle;\n this.handle = this.props.handle || this.device.handle.createComputePipeline({\n label: this.props.id,\n compute: {\n module,\n entryPoint: this.props.csEntryPoint,\n // constants: this.props.csConstants\n },\n layout: 'auto'\n });\n }\n\n /** For internal use in render passes */\n _getBindGroupLayout() {\n // TODO: Cache?\n return this.handle.getBindGroupLayout(0);\n }\n}\n"],"mappings":";AACA,SAAQA,eAAe,EAAwBC,IAAI,QAAO,cAAc;AAQxE,eAAe,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAIjEG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,MAAMG,MAAM,GAAGN,IAAI,CAAe,IAAI,CAACI,KAAK,CAACG,EAAE,CAAC,CAACC,MAAM;IACvD,IAAI,CAACA,MAAM,GAAG,IAAI,CAACJ,KAAK,CAACI,MAAM,IAAI,IAAI,CAACL,MAAM,CAACK,MAAM,CAACC,qBAAqB,CAAC;MAC1EC,KAAK,EAAE,IAAI,CAACN,KAAK,CAACO,EAAE;MACpBC,OAAO,EAAE;QACPN,MAAM;QACNO,UAAU,EAAE,IAAI,CAACT,KAAK,CAACU;MAEzB,CAAC;MACDC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;EAGAC,mBAAmBA,CAAA,EAAG;IAEpB,OAAO,IAAI,CAACR,MAAM,CAACS,kBAAkB,CAAC,CAAC,CAAC;EAC1C;AACF"}
@@ -1,6 +1,6 @@
1
- /// <reference types="@webgpu/types" />
1
+ /// <reference types="dist" />
2
2
  import { ExternalTexture, ExternalTextureProps, Sampler, SamplerProps } from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
3
+ import type { WebGPUDevice } from '../webgpu-device';
4
4
  import WebGPUSampler from './webgpu-sampler';
5
5
  /**
6
6
  * Cheap, temporary texture view for videos
@@ -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,cAAc,CAAC;AAC1F,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,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":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,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,29 +1,23 @@
1
- // luma.gl, MIT license
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import { ExternalTexture } from '@luma.gl/api';
3
- import WebGPUSampler from './webgpu-sampler.js';
4
- /**
5
- * Cheap, temporary texture view for videos
6
- * Only valid within same callback, destroyed automatically as a microtask.
7
- */
3
+ import WebGPUSampler from "./webgpu-sampler.js";
8
4
  export default class WebGPUExternalTexture extends ExternalTexture {
9
- constructor(device, props) {
10
- super(device, props);
11
- this.device = device;
12
- this.handle = this.props.handle || this.device.handle.importExternalTexture({
13
- source: props.source,
14
- colorSpace: props.colorSpace
15
- });
16
- this.sampler = null;
17
- }
18
- destroy() {
19
- // External textures are destroyed automatically,
20
- // as a microtask, instead of manually or upon garbage collection like other resources.
21
- // this.handle.destroy();
22
- }
23
- /** Set default sampler */
24
- setSampler(sampler) {
25
- // We can accept a sampler instance or set of props;
26
- this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
27
- return this;
28
- }
5
+ constructor(device, props) {
6
+ super(device, props);
7
+ _defineProperty(this, "device", void 0);
8
+ _defineProperty(this, "handle", void 0);
9
+ _defineProperty(this, "sampler", void 0);
10
+ this.device = device;
11
+ this.handle = this.props.handle || this.device.handle.importExternalTexture({
12
+ source: props.source,
13
+ colorSpace: props.colorSpace
14
+ });
15
+ this.sampler = null;
16
+ }
17
+ destroy() {}
18
+ setSampler(sampler) {
19
+ this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
20
+ return this;
21
+ }
29
22
  }
23
+ //# sourceMappingURL=webgpu-external-texture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu-external-texture.js","names":["ExternalTexture","WebGPUSampler","WebGPUExternalTexture","constructor","device","props","_defineProperty","handle","importExternalTexture","source","colorSpace","sampler","destroy","setSampler"],"sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {ExternalTexture, ExternalTextureProps, Sampler, SamplerProps} from '@luma.gl/api';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport WebGPUSampler from './webgpu-sampler';\n\n/**\n * Cheap, temporary texture view for videos\n * Only valid within same callback, destroyed automatically as a microtask.\n */\nexport default class WebGPUExternalTexture extends ExternalTexture {\n readonly device: WebGPUDevice;\n readonly handle: GPUExternalTexture;\n sampler: WebGPUSampler;\n\n constructor(device: WebGPUDevice, props: ExternalTextureProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle || this.device.handle.importExternalTexture({\n source: props.source,\n colorSpace: props.colorSpace\n });\n this.sampler = null;\n }\n\n override destroy(): void {\n // External textures are destroyed automatically,\n // as a microtask, instead of manually or upon garbage collection like other resources.\n // this.handle.destroy();\n }\n\n /** Set default sampler */\n setSampler(sampler: Sampler | SamplerProps): this {\n // We can accept a sampler instance or set of props;\n this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);\n return this;\n }\n}\n"],"mappings":";AACA,SAAQA,eAAe,QAAoD,cAAc;AAAC,OAEnFC,aAAa;AAMpB,eAAe,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAKjEG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACG,MAAM,CAACC,qBAAqB,CAAC;MAC1EC,MAAM,EAAEJ,KAAK,CAACI,MAAM;MACpBC,UAAU,EAAEL,KAAK,CAACK;IACpB,CAAC,CAAC;IACF,IAAI,CAACC,OAAO,GAAG,IAAI;EACrB;EAESC,OAAOA,CAAA,EAAS,CAIzB;EAGAC,UAAUA,CAACF,OAA+B,EAAQ;IAEhD,IAAI,CAACA,OAAO,GAAGA,OAAO,YAAYV,aAAa,GAAGU,OAAO,GAAG,IAAIV,aAAa,CAAC,IAAI,CAACG,MAAM,EAAEO,OAAO,CAAC;IACnG,OAAO,IAAI;EACb;AACF"}
@@ -1,7 +1,7 @@
1
- /// <reference types="@webgpu/types" />
1
+ /// <reference types="dist" />
2
2
  import type { FramebufferProps } from '@luma.gl/api';
3
3
  import { Framebuffer } from '@luma.gl/api';
4
- import WebGPUDevice from '../webgpu-device';
4
+ import { WebGPUDevice } from '../webgpu-device';
5
5
  import WebGPUTexture from './webgpu-texture';
6
6
  /**
7
7
  * Create new textures with correct size for all attachments.
@@ -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,EAAqB,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAU,MAAM,cAAc,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B,gBAAgB,EAAE,aAAa,EAAE,CAAM;IACvC,sBAAsB,EAAE,aAAa,GAAG,IAAI,CAAQ;IAEpD,+DAA+D;IAC/D,oBAAoB,EAAE;QACpB,gBAAgB,EAAE,4BAA4B,EAAE,CAAC;QACjD,sBAAsB,CAAC,EAAE,mCAAmC,CAAC;KAC9D,CAEC;gBAEU,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAiCzD,mCAAmC;IACnC,OAAO,CAAC,yBAAyB;IAkBjC,OAAO,CAAC,kBAAkB;IAkB1B;;;OAGG;IACF,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAiBnE"}
1
+ {"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":";AAAA,OAAO,KA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