@luma.gl/webgpu 9.0.0-alpha.4 → 9.0.0-alpha.41

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 (121) hide show
  1. package/LICENSE +3 -1
  2. package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
  3. package/dist/adapter/helpers/convert-texture-format.d.ts +2 -2
  4. package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
  5. package/dist/adapter/helpers/convert-texture-format.js +0 -1
  6. package/dist/adapter/helpers/convert-texture-format.js.map +1 -1
  7. package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
  8. package/dist/adapter/helpers/generate-mipmaps.js +19 -14
  9. package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
  10. package/dist/adapter/helpers/get-bind-group.d.ts +4 -4
  11. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  12. package/dist/adapter/helpers/get-bind-group.js +8 -17
  13. package/dist/adapter/helpers/get-bind-group.js.map +1 -1
  14. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +5 -5
  15. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
  16. package/dist/adapter/helpers/get-vertex-buffer-layout.js +33 -40
  17. package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
  18. package/dist/adapter/helpers/webgpu-parameters.d.ts +2 -2
  19. package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
  20. package/dist/adapter/helpers/webgpu-parameters.js +51 -48
  21. package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
  22. package/dist/adapter/resources/webgpu-buffer.d.ts +4 -5
  23. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  24. package/dist/adapter/resources/webgpu-buffer.js +18 -32
  25. package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
  26. package/dist/adapter/resources/webgpu-command-encoder.d.ts +6 -15
  27. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  28. package/dist/adapter/resources/webgpu-command-encoder.js +11 -29
  29. package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
  30. package/dist/adapter/resources/webgpu-compute-pass.d.ts +6 -6
  31. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  32. package/dist/adapter/resources/webgpu-compute-pass.js +14 -27
  33. package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
  34. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +4 -4
  35. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  36. package/dist/adapter/resources/webgpu-compute-pipeline.js +6 -11
  37. package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
  38. package/dist/adapter/resources/webgpu-external-texture.d.ts +5 -5
  39. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  40. package/dist/adapter/resources/webgpu-external-texture.js +6 -14
  41. package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
  42. package/dist/adapter/resources/webgpu-framebuffer.d.ts +4 -21
  43. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  44. package/dist/adapter/resources/webgpu-framebuffer.js +4 -105
  45. package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
  46. package/dist/adapter/resources/webgpu-query.js.map +1 -1
  47. package/dist/adapter/resources/webgpu-render-pass.d.ts +12 -7
  48. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  49. package/dist/adapter/resources/webgpu-render-pass.js +59 -36
  50. package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
  51. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +14 -10
  52. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  53. package/dist/adapter/resources/webgpu-render-pipeline.js +50 -67
  54. package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
  55. package/dist/adapter/resources/webgpu-sampler.d.ts +5 -5
  56. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  57. package/dist/adapter/resources/webgpu-sampler.js +11 -11
  58. package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
  59. package/dist/adapter/resources/webgpu-shader.d.ts +7 -7
  60. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  61. package/dist/adapter/resources/webgpu-shader.js +11 -25
  62. package/dist/adapter/resources/webgpu-shader.js.map +1 -1
  63. package/dist/adapter/resources/webgpu-texture.d.ts +15 -8
  64. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  65. package/dist/adapter/resources/webgpu-texture.js +17 -27
  66. package/dist/adapter/resources/webgpu-texture.js.map +1 -1
  67. package/dist/adapter/resources/webgpu-vertex-array.d.ts +26 -0
  68. package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -0
  69. package/dist/adapter/resources/webgpu-vertex-array.js +39 -0
  70. package/dist/adapter/resources/webgpu-vertex-array.js.map +1 -0
  71. package/dist/adapter/webgpu-canvas-context.d.ts +16 -12
  72. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  73. package/dist/adapter/webgpu-canvas-context.js +26 -47
  74. package/dist/adapter/webgpu-canvas-context.js.map +1 -1
  75. package/dist/adapter/webgpu-device.d.ts +38 -22
  76. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  77. package/dist/adapter/webgpu-device.js +87 -91
  78. package/dist/adapter/webgpu-device.js.map +1 -1
  79. package/dist/adapter/webgpu-types.js.map +1 -1
  80. package/dist/dist.dev.js +3587 -0
  81. package/dist/glsl/glsllang.js +0 -1
  82. package/dist/glsl/glsllang.js.map +1 -1
  83. package/dist/index.cjs +1520 -0
  84. package/dist/index.d.ts +5 -7
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +5 -7
  87. package/dist/index.js.map +1 -1
  88. package/dist.min.js +18 -0
  89. package/package.json +18 -9
  90. package/src/adapter/helpers/accessor-to-format.ts +2 -2
  91. package/src/adapter/helpers/convert-texture-format.ts +1 -1
  92. package/src/adapter/helpers/generate-mipmaps.ts +1 -1
  93. package/src/adapter/helpers/get-bind-group.ts +22 -12
  94. package/src/adapter/helpers/get-vertex-buffer-layout.ts +58 -34
  95. package/src/adapter/helpers/webgpu-parameters.ts +56 -47
  96. package/src/adapter/resources/webgpu-buffer.ts +10 -11
  97. package/src/adapter/resources/webgpu-command-encoder.ts +62 -41
  98. package/src/adapter/resources/webgpu-compute-pass.ts +13 -13
  99. package/src/adapter/resources/webgpu-compute-pipeline.ts +6 -5
  100. package/src/adapter/resources/webgpu-external-texture.ts +5 -5
  101. package/src/adapter/resources/webgpu-framebuffer.ts +8 -109
  102. package/src/adapter/resources/webgpu-query.ts +3 -3
  103. package/src/adapter/resources/webgpu-render-pass.ts +74 -18
  104. package/src/adapter/resources/webgpu-render-pipeline.ts +64 -39
  105. package/src/adapter/resources/webgpu-sampler.ts +12 -5
  106. package/src/adapter/resources/webgpu-shader.ts +13 -10
  107. package/src/adapter/resources/webgpu-texture.ts +22 -8
  108. package/src/adapter/resources/webgpu-vertex-array.ts +74 -0
  109. package/src/adapter/webgpu-canvas-context.ts +52 -27
  110. package/src/adapter/webgpu-device.ts +150 -60
  111. package/src/index.ts +7 -9
  112. package/dist/bundle.d.ts +0 -2
  113. package/dist/bundle.d.ts.map +0 -1
  114. package/dist/bundle.js +0 -5
  115. package/dist/bundle.js.map +0 -1
  116. package/dist/init.d.ts +0 -2
  117. package/dist/init.d.ts.map +0 -1
  118. package/dist/init.js +0 -4
  119. package/dist/init.js.map +0 -1
  120. package/src/bundle.ts +0 -4
  121. package/src/init.ts +0 -4
@@ -1,56 +1,43 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { ComputePass, cast } from '@luma.gl/api';
3
- export default class WebGPUComputePass extends ComputePass {
1
+ import { ComputePass, cast } from '@luma.gl/core';
2
+ export class WebGPUComputePass extends ComputePass {
4
3
  constructor(device, props) {
4
+ var _device$commandEncode;
5
5
  super(device, props);
6
-
7
- _defineProperty(this, "device", void 0);
8
-
9
- _defineProperty(this, "handle", void 0);
10
-
11
- _defineProperty(this, "_bindGroupLayout", void 0);
12
-
6
+ this.device = void 0;
7
+ this.handle = void 0;
8
+ this._bindGroupLayout = null;
13
9
  this.device = device;
14
- this.handle = this.props.handle || device.commandEncoder.beginComputePass({
10
+ this.handle = this.props.handle || ((_device$commandEncode = device.commandEncoder) === null || _device$commandEncode === void 0 ? void 0 : _device$commandEncode.beginComputePass({
15
11
  label: this.props.id
16
- });
12
+ }));
17
13
  }
18
-
19
14
  destroy() {}
20
-
21
- endPass() {
22
- this.handle.endPass();
15
+ end() {
16
+ this.handle.end();
23
17
  }
24
-
25
18
  setPipeline(pipeline) {
26
19
  const wgpuPipeline = cast(pipeline);
27
20
  this.handle.setPipeline(wgpuPipeline.handle);
28
21
  this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
29
22
  }
30
-
31
23
  setBindings(bindings) {
32
24
  throw new Error('fix me');
33
25
  }
34
-
35
26
  dispatch(x, y, z) {
36
- this.handle.dispatch(x, y, z);
27
+ this.handle.dispatchWorkgroups(x, y, z);
37
28
  }
38
-
39
- dispatchIndirect(indirectBuffer, indirectOffset = 0) {
40
- this.handle.dispatchIndirect(cast(indirectBuffer).handle, indirectOffset);
29
+ dispatchIndirect(indirectBuffer) {
30
+ let indirectOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
31
+ this.handle.dispatchWorkgroupsIndirect(cast(indirectBuffer).handle, indirectOffset);
41
32
  }
42
-
43
33
  pushDebugGroup(groupLabel) {
44
34
  this.handle.pushDebugGroup(groupLabel);
45
35
  }
46
-
47
36
  popDebugGroup() {
48
37
  this.handle.popDebugGroup();
49
38
  }
50
-
51
39
  insertDebugMarker(markerLabel) {
52
40
  this.handle.insertDebugMarker(markerLabel);
53
41
  }
54
-
55
42
  }
56
43
  //# sourceMappingURL=webgpu-compute-pass.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":["ComputePass","cast","WebGPUComputePass","constructor","device","props","handle","commandEncoder","beginComputePass","label","id","destroy","endPass","setPipeline","pipeline","wgpuPipeline","_bindGroupLayout","_getBindGroupLayout","setBindings","bindings","Error","dispatch","x","y","z","dispatchIndirect","indirectBuffer","indirectOffset","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"mappings":";AAAA,SAAQA,WAAR,EAAyEC,IAAzE,QAAoF,cAApF;AAMA,eAAe,MAAMC,iBAAN,SAAgCF,WAAhC,CAA4C;AAKzDG,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAvB,EAAgD;AACzD,UAAMD,MAAN,EAAcC,KAAd;;AADyD;;AAAA;;AAAA;;AAEzD,SAAKD,MAAL,GAAcA,MAAd;AAEA,SAAKE,MAAL,GAAc,KAAKD,KAAL,CAAWC,MAAX,IAAqBF,MAAM,CAACG,cAAP,CAAsBC,gBAAtB,CAAuC;AACxEC,MAAAA,KAAK,EAAE,KAAKJ,KAAL,CAAWK;AADsD,KAAvC,CAAnC;AAID;;AAGDC,EAAAA,OAAO,GAAG,CAAE;;AAEZC,EAAAA,OAAO,GAAS;AACd,SAAKN,MAAL,CAAYM,OAAZ;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAkC;AAC3C,UAAMC,YAAY,GAAGd,IAAI,CAAwBa,QAAxB,CAAzB;AACA,SAAKR,MAAL,CAAYO,WAAZ,CAAwBE,YAAY,CAACT,MAArC;AACA,SAAKU,gBAAL,GAAwBD,YAAY,CAACE,mBAAb,EAAxB;AACD;;AAGDC,EAAAA,WAAW,CAACC,QAAD,EAA4B;AACrC,UAAM,IAAIC,KAAJ,CAAU,QAAV,CAAN;AAGD;;AAQDC,EAAAA,QAAQ,CAACC,CAAD,EAAYC,CAAZ,EAAwBC,CAAxB,EAA0C;AAChD,SAAKlB,MAAL,CAAYe,QAAZ,CAAqBC,CAArB,EAAwBC,CAAxB,EAA2BC,CAA3B;AACD;;AAODC,EAAAA,gBAAgB,CAACC,cAAD,EAAyBC,cAAsB,GAAG,CAAlD,EAA2D;AACzE,SAAKrB,MAAL,CAAYmB,gBAAZ,CAA6BxB,IAAI,CAAeyB,cAAf,CAAJ,CAAmCpB,MAAhE,EAAwEqB,cAAxE;AACD;;AAEDC,EAAAA,cAAc,CAACC,UAAD,EAA2B;AACvC,SAAKvB,MAAL,CAAYsB,cAAZ,CAA2BC,UAA3B;AACD;;AACDC,EAAAA,aAAa,GAAS;AACpB,SAAKxB,MAAL,CAAYwB,aAAZ;AACD;;AACDC,EAAAA,iBAAiB,CAACC,WAAD,EAA4B;AAC3C,SAAK1B,MAAL,CAAYyB,iBAAZ,CAA8BC,WAA9B;AACD;;AA9DwD","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;\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 destroy() {}\n\n endPass(): void {\n this.handle.endPass();\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.dispatch(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.dispatchIndirect(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"],"file":"webgpu-compute-pass.js"}
1
+ {"version":3,"file":"webgpu-compute-pass.js","names":["ComputePass","cast","WebGPUComputePass","constructor","device","props","_device$commandEncode","handle","_bindGroupLayout","commandEncoder","beginComputePass","label","id","destroy","end","setPipeline","pipeline","wgpuPipeline","_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/core';\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 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,eAAe;AAMnG,OAAO,MAAMC,iBAAiB,SAASF,WAAW,CAAC;EAKjDG,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IAAA,IAAAC,qBAAA;IACzD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAAC,KALdD,MAAM;IAAA,KACNG,MAAM;IAAA,KACfC,gBAAgB,GAA8B,IAAI;IAIhD,IAAI,CAACJ,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACG,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,MAAAD,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,CAACP,MAAM,CAACO,GAAG,CAAC,CAAC;EACnB;EAEAC,WAAWA,CAACC,QAAyB,EAAQ;IAC3C,MAAMC,YAAY,GAAGhB,IAAI,CAAwBe,QAAQ,CAAC;IAC1D,IAAI,CAACT,MAAM,CAACQ,WAAW,CAACE,YAAY,CAACV,MAAM,CAAC;IAC5C,IAAI,CAACC,gBAAgB,GAAGS,YAAY,CAACC,mBAAmB,CAAC,CAAC;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,CAAChC,IAAI,CAAe2B,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,CAAC,CAAC;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/B,MAAM,CAAC8B,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAKF"}
@@ -1,8 +1,8 @@
1
- /// <reference types="@webgpu/types" />
2
- import { ComputePipeline, ComputePipelineProps } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
1
+ /// <reference types="dist" />
2
+ import { ComputePipeline, ComputePipelineProps } from '@luma.gl/core';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
4
  /** Creates a new compute pipeline when parameters change */
5
- export default class WebGPUComputePipeline extends ComputePipeline {
5
+ export declare class WebGPUComputePipeline extends ComputePipeline {
6
6
  device: WebGPUDevice;
7
7
  handle: GPUComputePipeline;
8
8
  constructor(device: WebGPUDevice, props: ComputePipelineProps);
@@ -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;IAe7D,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,eAAe,CAAC;AAE1E,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,13 +1,9 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { ComputePipeline, cast } from '@luma.gl/api';
3
- export default class WebGPUComputePipeline extends ComputePipeline {
1
+ import { ComputePipeline, cast } from '@luma.gl/core';
2
+ export class WebGPUComputePipeline extends ComputePipeline {
4
3
  constructor(device, props) {
5
4
  super(device, props);
6
-
7
- _defineProperty(this, "device", void 0);
8
-
9
- _defineProperty(this, "handle", void 0);
10
-
5
+ this.device = void 0;
6
+ this.handle = void 0;
11
7
  this.device = device;
12
8
  const module = cast(this.props.cs).handle;
13
9
  this.handle = this.props.handle || this.device.handle.createComputePipeline({
@@ -15,13 +11,12 @@ export default class WebGPUComputePipeline extends ComputePipeline {
15
11
  compute: {
16
12
  module,
17
13
  entryPoint: this.props.csEntryPoint
18
- }
14
+ },
15
+ layout: 'auto'
19
16
  });
20
17
  }
21
-
22
18
  _getBindGroupLayout() {
23
19
  return this.handle.getBindGroupLayout(0);
24
20
  }
25
-
26
21
  }
27
22
  //# sourceMappingURL=webgpu-compute-pipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":["ComputePipeline","cast","WebGPUComputePipeline","constructor","device","props","module","cs","handle","createComputePipeline","label","id","compute","entryPoint","csEntryPoint","_getBindGroupLayout","getBindGroupLayout"],"mappings":";AACA,SAAQA,eAAR,EAA+CC,IAA/C,QAA0D,cAA1D;AAQA,eAAe,MAAMC,qBAAN,SAAoCF,eAApC,CAAoD;AAIjEG,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAvB,EAAoD;AAC7D,UAAMD,MAAN,EAAcC,KAAd;;AAD6D;;AAAA;;AAE7D,SAAKD,MAAL,GAAcA,MAAd;AAEA,UAAME,MAAM,GAAGL,IAAI,CAAe,KAAKI,KAAL,CAAWE,EAA1B,CAAJ,CAAkCC,MAAjD;AACA,SAAKA,MAAL,GAAc,KAAKH,KAAL,CAAWG,MAAX,IAAqB,KAAKJ,MAAL,CAAYI,MAAZ,CAAmBC,qBAAnB,CAAyC;AAC1EC,MAAAA,KAAK,EAAE,KAAKL,KAAL,CAAWM,EADwD;AAE1EC,MAAAA,OAAO,EAAE;AACPN,QAAAA,MADO;AAEPO,QAAAA,UAAU,EAAE,KAAKR,KAAL,CAAWS;AAFhB;AAFiE,KAAzC,CAAnC;AAQD;;AAGDC,EAAAA,mBAAmB,GAAG;AAEpB,WAAO,KAAKP,MAAL,CAAYQ,kBAAZ,CAA+B,CAA/B,CAAP;AACD;;AAvBgE","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 });\n }\n\n /** For internal use in render passes */\n _getBindGroupLayout() {\n // TODO: Cache?\n return this.handle.getBindGroupLayout(0);\n }\n}\n"],"file":"webgpu-compute-pipeline.js"}
1
+ {"version":3,"file":"webgpu-compute-pipeline.js","names":["ComputePipeline","cast","WebGPUComputePipeline","constructor","device","props","handle","module","cs","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/core';\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 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,eAAe;AAQzE,OAAO,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAIzDG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAJvBD,MAAM;IAAA,KACNE,MAAM;IAIJ,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,MAAMG,MAAM,GAAGN,IAAI,CAAe,IAAI,CAACI,KAAK,CAACG,EAAE,CAAC,CAACF,MAAM;IACvD,IAAI,CAACA,MAAM,GAAG,IAAI,CAACD,KAAK,CAACC,MAAM,IAAI,IAAI,CAACF,MAAM,CAACE,MAAM,CAACG,qBAAqB,CAAC;MAC1EC,KAAK,EAAE,IAAI,CAACL,KAAK,CAACM,EAAE;MACpBC,OAAO,EAAE;QACPL,MAAM;QACNM,UAAU,EAAE,IAAI,CAACR,KAAK,CAACS;MAEzB,CAAC;MACDC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;EAGAC,mBAAmBA,CAAA,EAAG;IAEpB,OAAO,IAAI,CAACV,MAAM,CAACW,kBAAkB,CAAC,CAAC,CAAC;EAC1C;AACF"}
@@ -1,12 +1,12 @@
1
- /// <reference types="@webgpu/types" />
2
- import { ExternalTexture, ExternalTextureProps, Sampler, SamplerProps } from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
4
- import WebGPUSampler from './webgpu-sampler';
1
+ /// <reference types="dist" />
2
+ import { ExternalTexture, ExternalTextureProps, Sampler, SamplerProps } from '@luma.gl/core';
3
+ import type { WebGPUDevice } from '../webgpu-device';
4
+ import { WebGPUSampler } from './webgpu-sampler';
5
5
  /**
6
6
  * Cheap, temporary texture view for videos
7
7
  * Only valid within same callback, destroyed automatically as a microtask.
8
8
  */
9
- export default class WebGPUExternalTexture extends ExternalTexture {
9
+ export declare class WebGPUExternalTexture extends ExternalTexture {
10
10
  readonly device: WebGPUDevice;
11
11
  readonly handle: GPUExternalTexture;
12
12
  sampler: WebGPUSampler;
@@ -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;IAU7D,OAAO,IAAI,IAAI;IAMf,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,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,16 +1,11 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { ExternalTexture } from '@luma.gl/api';
3
- import WebGPUSampler from './webgpu-sampler';
4
- export default class WebGPUExternalTexture extends ExternalTexture {
1
+ import { ExternalTexture } from '@luma.gl/core';
2
+ import { WebGPUSampler } from "./webgpu-sampler.js";
3
+ export class WebGPUExternalTexture extends ExternalTexture {
5
4
  constructor(device, props) {
6
5
  super(device, props);
7
-
8
- _defineProperty(this, "device", void 0);
9
-
10
- _defineProperty(this, "handle", void 0);
11
-
12
- _defineProperty(this, "sampler", void 0);
13
-
6
+ this.device = void 0;
7
+ this.handle = void 0;
8
+ this.sampler = void 0;
14
9
  this.device = device;
15
10
  this.handle = this.props.handle || this.device.handle.importExternalTexture({
16
11
  source: props.source,
@@ -18,13 +13,10 @@ export default class WebGPUExternalTexture extends ExternalTexture {
18
13
  });
19
14
  this.sampler = null;
20
15
  }
21
-
22
16
  destroy() {}
23
-
24
17
  setSampler(sampler) {
25
18
  this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
26
19
  return this;
27
20
  }
28
-
29
21
  }
30
22
  //# sourceMappingURL=webgpu-external-texture.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":["ExternalTexture","WebGPUSampler","WebGPUExternalTexture","constructor","device","props","handle","importExternalTexture","source","colorSpace","sampler","destroy","setSampler"],"mappings":";AACA,SAAQA,eAAR,QAA2E,cAA3E;AAEA,OAAOC,aAAP,MAA0B,kBAA1B;AAMA,eAAe,MAAMC,qBAAN,SAAoCF,eAApC,CAAoD;AAKjEG,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAvB,EAAoD;AAC7D,UAAMD,MAAN,EAAcC,KAAd;;AAD6D;;AAAA;;AAAA;;AAE7D,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,MAAL,GAAc,KAAKD,KAAL,CAAWC,MAAX,IAAqB,KAAKF,MAAL,CAAYE,MAAZ,CAAmBC,qBAAnB,CAAyC;AAC1EC,MAAAA,MAAM,EAAEH,KAAK,CAACG,MAD4D;AAE1EC,MAAAA,UAAU,EAAEJ,KAAK,CAACI;AAFwD,KAAzC,CAAnC;AAIA,SAAKC,OAAL,GAAe,IAAf;AACD;;AAEDC,EAAAA,OAAO,GAAS,CAIf;;AAGDC,EAAAA,UAAU,CAACF,OAAD,EAAwC;AAEhD,SAAKA,OAAL,GAAeA,OAAO,YAAYT,aAAnB,GAAmCS,OAAnC,GAA6C,IAAIT,aAAJ,CAAkB,KAAKG,MAAvB,EAA+BM,OAA/B,CAA5D;AACA,WAAO,IAAP;AACD;;AA1BgE","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 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"],"file":"webgpu-external-texture.js"}
1
+ {"version":3,"file":"webgpu-external-texture.js","names":["ExternalTexture","WebGPUSampler","WebGPUExternalTexture","constructor","device","props","handle","sampler","importExternalTexture","source","colorSpace","destroy","setSampler"],"sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {ExternalTexture, ExternalTextureProps, Sampler, SamplerProps} from '@luma.gl/core';\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 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,eAAe;AAAC,SAEnFC,aAAa;AAMrB,OAAO,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAKzDG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KALdD,MAAM;IAAA,KACNE,MAAM;IAAA,KACfC,OAAO;IAIL,IAAI,CAACH,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,MAAM,GAAG,IAAI,CAACD,KAAK,CAACC,MAAM,IAAI,IAAI,CAACF,MAAM,CAACE,MAAM,CAACE,qBAAqB,CAAC;MAC1EC,MAAM,EAAEJ,KAAK,CAACI,MAAM;MACpBC,UAAU,EAAEL,KAAK,CAACK;IACpB,CAAC,CAAC;IACF,IAAI,CAACH,OAAO,GAAG,IAAI;EACrB;EAESI,OAAOA,CAAA,EAAS,CAIzB;EAGAC,UAAUA,CAACL,OAA+B,EAAQ;IAEhD,IAAI,CAACA,OAAO,GAAGA,OAAO,YAAYN,aAAa,GAAGM,OAAO,GAAG,IAAIN,aAAa,CAAC,IAAI,CAACG,MAAM,EAAEG,OAAO,CAAC;IACnG,OAAO,IAAI;EACb;AACF"}
@@ -1,29 +1,12 @@
1
- /// <reference types="@webgpu/types" />
2
- import type { FramebufferProps } from '@luma.gl/api';
3
- import { Framebuffer } from '@luma.gl/api';
4
- import WebGPUDevice from '../webgpu-device';
5
- import WebGPUTexture from './webgpu-texture';
1
+ import type { FramebufferProps } from '@luma.gl/core';
2
+ import { Framebuffer } from '@luma.gl/core';
3
+ import { WebGPUDevice } from '../webgpu-device';
6
4
  /**
7
5
  * Create new textures with correct size for all attachments.
8
6
  * @note resize() destroys existing textures (if size has changed).
9
7
  */
10
- export default class WebGPUFramebuffer extends Framebuffer {
8
+ export declare class WebGPUFramebuffer extends Framebuffer {
11
9
  readonly device: WebGPUDevice;
12
- colorAttachments: WebGPUTexture[];
13
- depthStencilAttachment: WebGPUTexture;
14
- /** Partial render pass descriptor. Used by WebGPURenderPass */
15
- renderPassDescriptor: {
16
- colorAttachments: GPURenderPassColorAttachment[];
17
- depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
18
- };
19
10
  constructor(device: WebGPUDevice, props: FramebufferProps);
20
- /** Create depth stencil texture */
21
- private createDepthStencilTexture;
22
- private createColorTexture;
23
- /**
24
- * Create new textures with correct size for all attachments.
25
- * @note destroys existing textures.
26
- */
27
- protected _resizeAttachments(width: number, height: number): void;
28
11
  }
29
12
  //# sourceMappingURL=webgpu-framebuffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":[],"mappings":";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,CAAC;IAEtC,+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;IAgCzD,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,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,111 +1,10 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { Framebuffer, Texture } from '@luma.gl/api';
3
- import WEBGPUTexture from './webgpu-texture';
4
- const MAX_COLOR_ATTACHMENTS = 8;
5
- export default class WebGPUFramebuffer extends Framebuffer {
1
+ import { Framebuffer } from '@luma.gl/core';
2
+ export class WebGPUFramebuffer extends Framebuffer {
6
3
  constructor(device, props) {
7
4
  super(device, props);
8
-
9
- _defineProperty(this, "device", void 0);
10
-
11
- _defineProperty(this, "colorAttachments", []);
12
-
13
- _defineProperty(this, "depthStencilAttachment", void 0);
14
-
15
- _defineProperty(this, "renderPassDescriptor", {
16
- colorAttachments: []
17
- });
18
-
5
+ this.device = void 0;
19
6
  this.device = device;
20
-
21
- if (props.depthStencilAttachment) {
22
- this.depthStencilAttachment = this.createDepthStencilTexture(props);
23
- }
24
-
25
- if (props.colorAttachments) {
26
- this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));
27
- }
28
-
29
- if (this.depthStencilAttachment) {
30
- this.renderPassDescriptor.depthStencilAttachment = {
31
- view: this.depthStencilAttachment.handle.createView(),
32
- depthLoadValue: 1.0,
33
- depthStoreOp: 'store',
34
- stencilLoadValue: 0,
35
- stencilStoreOp: 'store'
36
- };
37
- }
38
-
39
- if (this.colorAttachments.length > 0) {
40
- this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({
41
- view: colorAttachment.handle.createView(),
42
- loadValue: [0.0, 0.0, 0.0, 0.0],
43
- storeOp: 'store'
44
- }));
45
- }
7
+ this.autoCreateAttachmentTextures();
46
8
  }
47
-
48
- createDepthStencilTexture(props) {
49
- if (props.depthStencilAttachment instanceof WEBGPUTexture) {
50
- return props.depthStencilAttachment;
51
- }
52
-
53
- if (typeof props.depthStencilAttachment === 'string') {
54
- return this.device._createTexture({
55
- id: 'depth-stencil-attachment',
56
- format: props.depthStencilAttachment,
57
- width: props.width,
58
- height: props.height,
59
- usage: Texture.RENDER_ATTACHMENT
60
- });
61
- }
62
-
63
- throw new Error('type');
64
- }
65
-
66
- createColorTexture(props, texture) {
67
- if (texture instanceof WEBGPUTexture) {
68
- return texture;
69
- }
70
-
71
- if (typeof texture === 'string') {
72
- return this.device._createTexture({
73
- id: 'color-attachment',
74
- format: texture,
75
- width: props.width,
76
- height: props.height,
77
- usage: Texture.RENDER_ATTACHMENT
78
- });
79
- }
80
-
81
- throw new Error('type');
82
- }
83
-
84
- _resizeAttachments(width, height) {
85
- for (let i = 0; i < this.colorAttachments.length; ++i) {
86
- if (this.colorAttachments[i]) {
87
- const resizedTexture = this.device._createTexture({ ...this.colorAttachments[i].props,
88
- width,
89
- height
90
- });
91
-
92
- this.colorAttachments[i].destroy();
93
- this.colorAttachments[i] = resizedTexture;
94
- this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();
95
- }
96
- }
97
-
98
- if (this.depthStencilAttachment) {
99
- const resizedTexture = this.device._createTexture({ ...this.depthStencilAttachment.props,
100
- width,
101
- height
102
- });
103
-
104
- this.depthStencilAttachment.destroy();
105
- this.depthStencilAttachment = resizedTexture;
106
- this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();
107
- }
108
- }
109
-
110
9
  }
111
10
  //# sourceMappingURL=webgpu-framebuffer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"names":["Framebuffer","Texture","WEBGPUTexture","MAX_COLOR_ATTACHMENTS","WebGPUFramebuffer","constructor","device","props","colorAttachments","depthStencilAttachment","createDepthStencilTexture","map","colorAttachment","createColorTexture","renderPassDescriptor","view","handle","createView","depthLoadValue","depthStoreOp","stencilLoadValue","stencilStoreOp","length","loadValue","storeOp","_createTexture","id","format","width","height","usage","RENDER_ATTACHMENT","Error","texture","_resizeAttachments","i","resizedTexture","destroy"],"mappings":"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","sourcesContent":["import type {FramebufferProps, ColorTextureFormat} from '@luma.gl/api';\nimport {Framebuffer, Texture} from '@luma.gl/api';\nimport WebGPUDevice from '../webgpu-device';\n// import WebGPUCanvasContext from '../webgpu-canvas-context';\nimport WEBGPUTexture from './webgpu-texture';\nimport WebGPUTexture from './webgpu-texture';\n\n// const DEFAULT_DEPTH_STENCIL_FORMAT: DepthStencilTextureFormat = 'depth24plus';\n\nconst MAX_COLOR_ATTACHMENTS = 8;\n\n/**\n * Create new textures with correct size for all attachments. \n * @note resize() destroys existing textures (if size has changed). \n */\nexport default class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n colorAttachments: WebGPUTexture[] = [];\n depthStencilAttachment: WebGPUTexture;\n\n /** Partial render pass descriptor. Used by WebGPURenderPass */\n renderPassDescriptor: {\n colorAttachments: GPURenderPassColorAttachment[];\n depthStencilAttachment?: GPURenderPassDepthStencilAttachment;\n } = {\n colorAttachments: []\n };\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n if (props.depthStencilAttachment) {\n this.depthStencilAttachment = this.createDepthStencilTexture(props);\n }\n\n if (props.colorAttachments) {\n this.colorAttachments = props.colorAttachments.map(colorAttachment => this.createColorTexture(this.props, colorAttachment));\n }\n\n if (this.depthStencilAttachment) {\n this.renderPassDescriptor.depthStencilAttachment = {\n view: this.depthStencilAttachment.handle.createView(),\n // Add default clear values\n depthLoadValue: 1.0,\n depthStoreOp: 'store',\n stencilLoadValue: 0,\n stencilStoreOp: 'store',\n }\n }\n\n if (this.colorAttachments.length > 0) {\n this.renderPassDescriptor.colorAttachments = this.colorAttachments.map(colorAttachment => ({\n view: colorAttachment.handle.createView(),\n loadValue: [0.0, 0.0, 0.0, 0.0],\n storeOp: 'store'\n }));\n }\n }\n\n /** Create depth stencil texture */\n private createDepthStencilTexture(props: FramebufferProps): WEBGPUTexture {\n if (props.depthStencilAttachment instanceof WEBGPUTexture) {\n return props.depthStencilAttachment;\n }\n\n if (typeof props.depthStencilAttachment === 'string') {\n return this.device._createTexture({\n id: 'depth-stencil-attachment',\n format: props.depthStencilAttachment,\n width: props.width,\n height: props.height,\n usage: Texture.RENDER_ATTACHMENT\n });\n }\n\n throw new Error('type');\n }\n\n private createColorTexture(props: FramebufferProps, texture: Texture | ColorTextureFormat): WEBGPUTexture {\n if (texture instanceof WEBGPUTexture) {\n return texture;\n }\n\n if (typeof texture === 'string') {\n return this.device._createTexture({\n id: 'color-attachment',\n format: texture,\n width: props.width,\n height: props.height,\n usage: Texture.RENDER_ATTACHMENT\n });\n }\n\n throw new Error('type');\n }\n\n /**\n * Create new textures with correct size for all attachments.\n * @note destroys existing textures.\n */\n protected _resizeAttachments(width: number, height: number): void {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({...this.colorAttachments[i].props, width, height})\n this.colorAttachments[i].destroy();\n this.colorAttachments[i] = resizedTexture;\n this.renderPassDescriptor.colorAttachments[i].view = resizedTexture.handle.createView();\n }\n }\n\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({...this.depthStencilAttachment.props, width, height})\n this.depthStencilAttachment.destroy();\n this.depthStencilAttachment = resizedTexture;\n this.renderPassDescriptor.depthStencilAttachment.view = resizedTexture.handle.createView();\n }\n }\n}\n"],"file":"webgpu-framebuffer.js"}
1
+ {"version":3,"file":"webgpu-framebuffer.js","names":["Framebuffer","WebGPUFramebuffer","constructor","device","props","autoCreateAttachmentTextures"],"sources":["../../../src/adapter/resources/webgpu-framebuffer.ts"],"sourcesContent":["import type {FramebufferProps} from '@luma.gl/core';\nimport {Framebuffer} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n // Auto create textures for attachments if needed\n this.autoCreateAttachmentTextures();\n }\n}\n"],"mappings":"AACA,SAAQA,WAAW,QAAO,eAAe;AAOzC,OAAO,MAAMC,iBAAiB,SAASD,WAAW,CAAC;EAGjDE,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IACzD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAHdD,MAAM;IAIb,IAAI,CAACA,MAAM,GAAGA,MAAM;IAGpB,IAAI,CAACE,4BAA4B,CAAC,CAAC;EACrC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"webgpu-query.js"}
1
+ {"version":3,"file":"webgpu-query.js","names":[],"sources":["../../../src/adapter/resources/webgpu-query.ts"],"sourcesContent":["/*\nimport {Resource, Query, QueryProps} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUQueryProps = QueryProps & {\n handle?: any;\n};\n\nconst DEFAULT_QUERY_PROPS: Required<WebGPUQueryProps> = {\n id: undefined,\n handle: undefined,\n userData: undefined,\n type: 'timestamp',\n count: 1,\n pipelineStatistics: []\n};\n\n/**\n * Immutable\n *\nclass WebGPUQuery extends Resource<WebGPUQueryProps> implements Query {\n readonly device: WebGPUDevice;\n readonly handle: GPUQuerySet;\n\n constructor(device: WebGPUDevice, props: WebGPUQueryProps) {\n super(device, props, DEFAULT_QUERY_PROPS);\n this.handle = this.props.handle as GPUQuerySet || this.createHandle();\n this.handle.label = this.props.id;\n }\n\n protected createHandle() {\n return this.device.handle.createQuerySet({\n type: this.props.type,\n count: this.props.count,\n pipelineStatistics: this.props.pipelineStatistics\n });\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n}\n*/"],"mappings":""}
@@ -1,16 +1,16 @@
1
- /// <reference types="@webgpu/types" />
2
- import type { RenderPassProps, RenderPassParameters, Binding } from '@luma.gl/api';
3
- import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/api';
4
- import WebGPUDevice from '../webgpu-device';
5
- import WebGPURenderPipeline from './webgpu-render-pipeline';
6
- export default class WebGPURenderPass extends RenderPass {
1
+ /// <reference types="dist" />
2
+ import type { RenderPassProps, RenderPassParameters, Binding, Framebuffer } from '@luma.gl/core';
3
+ import { Buffer, RenderPass, RenderPipeline } from '@luma.gl/core';
4
+ import { WebGPUDevice } from '../webgpu-device';
5
+ import { WebGPURenderPipeline } from './webgpu-render-pipeline';
6
+ export declare class WebGPURenderPass extends RenderPass {
7
7
  readonly device: WebGPUDevice;
8
8
  readonly handle: GPURenderPassEncoder;
9
9
  /** Active pipeline */
10
10
  pipeline: WebGPURenderPipeline | null;
11
11
  constructor(device: WebGPUDevice, props?: RenderPassProps);
12
12
  destroy(): void;
13
- endPass(): void;
13
+ end(): void;
14
14
  setPipeline(pipeline: RenderPipeline): void;
15
15
  /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
16
16
  setBindings(bindings: Record<string, Binding>): void;
@@ -30,5 +30,10 @@ export default class WebGPURenderPass extends RenderPass {
30
30
  pushDebugGroup(groupLabel: string): void;
31
31
  popDebugGroup(): void;
32
32
  insertDebugMarker(markerLabel: string): void;
33
+ /**
34
+ * Partial render pass descriptor. Used by WebGPURenderPass.
35
+ * @returns attachments fields of a renderpass descriptor.
36
+ */
37
+ protected getRenderPassDescriptor(framebuffer: Framebuffer): GPURenderPassDescriptor;
33
38
  }
34
39
  //# sourceMappingURL=webgpu-render-pass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pass.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AACjF,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAY,MAAM,cAAc,CAAC;AAC3E,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAG5C,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU;IACtD,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;IAU7D,OAAO;IAEP,OAAO,IAAI,IAAI;IAIf,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAK3C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAKpD,cAAc,CACZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,cAAc,EAC3B,MAAM,GAAE,MAAU,EAClB,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI;IAIP,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,IAAI;IAIvE,IAAI,CAAC,OAAO,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI;IAmBR,YAAY,IAAI,IAAI;IAKpB,aAAa,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAwBrD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAW7C"}
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,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,IAAI;IAIvE,IAAI,CAAC,OAAO,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI;IAmBR,YAAY,IAAI,IAAI;IAKpB,aAAa,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAwBrD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAc5C;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,uBAAuB;CA2CrF"}
@@ -1,56 +1,53 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { RenderPass, cast } from '@luma.gl/api';
3
- export default class WebGPURenderPass extends RenderPass {
4
- constructor(device, props = {}) {
1
+ import { RenderPass, cast, log } from '@luma.gl/core';
2
+ export class WebGPURenderPass extends RenderPass {
3
+ constructor(device) {
4
+ let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5
5
  super(device, props);
6
-
7
- _defineProperty(this, "device", void 0);
8
-
9
- _defineProperty(this, "handle", void 0);
10
-
11
- _defineProperty(this, "pipeline", null);
12
-
6
+ this.device = void 0;
7
+ this.handle = void 0;
8
+ this.pipeline = null;
13
9
  this.device = device;
14
10
  const framebuffer = props.framebuffer || device.canvasContext.getCurrentFramebuffer();
15
- const renderPassDescriptor = framebuffer.renderPassDescriptor;
11
+ const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);
12
+ log.groupCollapsed(1, `new WebGPURenderPass(${this.id})`)();
13
+ log.probe(1, JSON.stringify(renderPassDescriptor, null, 2))();
14
+ log.groupEnd(1)();
16
15
  this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
17
16
  this.handle.label = this.props.id;
18
17
  }
19
-
20
18
  destroy() {}
21
-
22
- endPass() {
23
- this.handle.endPass();
19
+ end() {
20
+ this.handle.end();
24
21
  }
25
-
26
22
  setPipeline(pipeline) {
27
23
  this.pipeline = cast(pipeline);
28
24
  this.handle.setPipeline(this.pipeline.handle);
29
25
  }
30
-
31
26
  setBindings(bindings) {
32
- this.pipeline.setBindings(bindings);
33
- this.handle.setBindGroup(0, this.pipeline._getBindGroup());
27
+ var _this$pipeline, _this$pipeline2;
28
+ (_this$pipeline = this.pipeline) === null || _this$pipeline === void 0 ? void 0 : _this$pipeline.setBindings(bindings);
29
+ const bindGroup = (_this$pipeline2 = this.pipeline) === null || _this$pipeline2 === void 0 ? void 0 : _this$pipeline2._getBindGroup();
30
+ if (bindGroup) {
31
+ this.handle.setBindGroup(0, bindGroup);
32
+ }
34
33
  }
35
-
36
- setIndexBuffer(buffer, indexFormat, offset = 0, size) {
34
+ setIndexBuffer(buffer, indexFormat) {
35
+ let offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
36
+ let size = arguments.length > 3 ? arguments[3] : undefined;
37
37
  this.handle.setIndexBuffer(cast(buffer).handle, indexFormat, offset, size);
38
38
  }
39
-
40
- setVertexBuffer(slot, buffer, offset = 0) {
39
+ setVertexBuffer(slot, buffer) {
40
+ let offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
41
41
  this.handle.setVertexBuffer(slot, cast(buffer).handle, offset);
42
42
  }
43
-
44
43
  draw(options) {
45
44
  if (options.indexCount) {
46
45
  this.handle.drawIndexed(options.indexCount, options.instanceCount, options.firstIndex, options.baseVertex, options.firstInstance);
47
46
  } else {
48
- this.handle.draw(options.vertexCount, options.instanceCount, options.firstIndex, options.firstInstance);
47
+ this.handle.draw(options.vertexCount || 0, options.instanceCount || 1, options.firstIndex, options.firstInstance);
49
48
  }
50
49
  }
51
-
52
50
  drawIndirect() {}
53
-
54
51
  setParameters(parameters) {
55
52
  const {
56
53
  blendConstant,
@@ -58,35 +55,61 @@ export default class WebGPURenderPass extends RenderPass {
58
55
  scissorRect,
59
56
  viewport
60
57
  } = parameters;
61
-
62
58
  if (blendConstant) {
63
59
  this.handle.setBlendConstant(blendConstant);
64
60
  }
65
-
66
61
  if (stencilReference) {
67
62
  this.handle.setStencilReference(stencilReference);
68
63
  }
69
-
70
64
  if (scissorRect) {
71
65
  this.handle.setScissorRect(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);
72
66
  }
73
-
74
67
  if (viewport) {
75
68
  this.handle.setViewport(viewport[0], viewport[1], viewport[2], viewport[3], viewport[4], viewport[5]);
76
69
  }
77
70
  }
78
-
79
71
  pushDebugGroup(groupLabel) {
80
72
  this.handle.pushDebugGroup(groupLabel);
81
73
  }
82
-
83
74
  popDebugGroup() {
84
75
  this.handle.popDebugGroup();
85
76
  }
86
-
87
77
  insertDebugMarker(markerLabel) {
88
78
  this.handle.insertDebugMarker(markerLabel);
89
79
  }
90
-
80
+ getRenderPassDescriptor(framebuffer) {
81
+ const renderPassDescriptor = {
82
+ colorAttachments: []
83
+ };
84
+ renderPassDescriptor.colorAttachments = framebuffer.colorAttachments.map(colorAttachment => ({
85
+ loadOp: this.props.clearColor !== false ? 'clear' : 'load',
86
+ colorClearValue: this.props.clearColor || [0, 0, 0, 0],
87
+ storeOp: this.props.discard ? 'discard' : 'store',
88
+ view: colorAttachment.handle.createView()
89
+ }));
90
+ if (framebuffer.depthStencilAttachment) {
91
+ renderPassDescriptor.depthStencilAttachment = {
92
+ view: framebuffer.depthStencilAttachment.handle.createView()
93
+ };
94
+ const {
95
+ depthStencilAttachment
96
+ } = renderPassDescriptor;
97
+ if (this.props.depthReadOnly) {
98
+ depthStencilAttachment.depthReadOnly = true;
99
+ }
100
+ depthStencilAttachment.depthClearValue = this.props.clearDepth || 0;
101
+ const hasDepthAspect = true;
102
+ if (hasDepthAspect) {
103
+ depthStencilAttachment.depthLoadOp = this.props.clearDepth !== false ? 'clear' : 'load';
104
+ depthStencilAttachment.depthStoreOp = 'store';
105
+ }
106
+ const hasStencilAspect = false;
107
+ if (hasStencilAspect) {
108
+ depthStencilAttachment.stencilLoadOp = this.props.clearStencil !== false ? 'clear' : 'load';
109
+ depthStencilAttachment.stencilStoreOp = 'store';
110
+ }
111
+ }
112
+ return renderPassDescriptor;
113
+ }
91
114
  }
92
115
  //# sourceMappingURL=webgpu-render-pass.js.map