@nativescript/canvas 2.0.0-webgpu.4 → 2.0.0-webgpu.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 (211) hide show
  1. package/Canvas/common.d.ts +5 -10
  2. package/Canvas/common.js +61 -144
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +6 -5
  5. package/Canvas/index.android.js +63 -42
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +13 -3
  8. package/Canvas/index.ios.d.ts +9 -1
  9. package/Canvas/index.ios.js +117 -66
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas/utils.d.ts +3 -0
  12. package/Canvas/utils.js +85 -0
  13. package/Canvas/utils.js.map +1 -0
  14. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +3 -1
  15. package/Canvas2D/CanvasRenderingContext2D/index.js +2 -4
  16. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  17. package/Dom/Group.d.ts +1 -2
  18. package/Dom/Group.js.map +1 -1
  19. package/Dom/Image.js +0 -1
  20. package/Dom/Image.js.map +1 -1
  21. package/Dom/Paint.d.ts +1 -1
  22. package/Dom/shapes/Path.d.ts +1 -1
  23. package/ImageAsset/index.d.ts +4 -2
  24. package/ImageAsset/index.js +151 -37
  25. package/ImageAsset/index.js.map +1 -1
  26. package/ImageBitmap/index.js +107 -20
  27. package/ImageBitmap/index.js.map +1 -1
  28. package/README.md +2 -4
  29. package/WebGL/WebGLRenderingContext/common.d.ts +1 -1
  30. package/WebGL/WebGLRenderingContext/index.js +76 -32
  31. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  32. package/WebGL2/WebGL2RenderingContext/index.js +5 -5
  33. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  34. package/WebGPU/GPU.js +4 -3
  35. package/WebGPU/GPU.js.map +1 -1
  36. package/WebGPU/GPUAdapter.d.ts +6 -3
  37. package/WebGPU/GPUAdapter.js +31 -0
  38. package/WebGPU/GPUAdapter.js.map +1 -1
  39. package/WebGPU/GPUBindGroup.d.ts +1 -0
  40. package/WebGPU/GPUBindGroup.js +3 -0
  41. package/WebGPU/GPUBindGroup.js.map +1 -1
  42. package/WebGPU/GPUBindGroupLayout.d.ts +1 -0
  43. package/WebGPU/GPUBindGroupLayout.js +3 -0
  44. package/WebGPU/GPUBindGroupLayout.js.map +1 -1
  45. package/WebGPU/GPUBuffer.js +10 -2
  46. package/WebGPU/GPUBuffer.js.map +1 -1
  47. package/WebGPU/GPUCanvasContext.d.ts +5 -3
  48. package/WebGPU/GPUCanvasContext.js +52 -10
  49. package/WebGPU/GPUCanvasContext.js.map +1 -1
  50. package/WebGPU/GPUCommandBuffer.d.ts +1 -0
  51. package/WebGPU/GPUCommandBuffer.js +3 -0
  52. package/WebGPU/GPUCommandBuffer.js.map +1 -1
  53. package/WebGPU/GPUCommandEncoder.d.ts +3 -9
  54. package/WebGPU/GPUCommandEncoder.js +94 -41
  55. package/WebGPU/GPUCommandEncoder.js.map +1 -1
  56. package/WebGPU/GPUComputePassEncoder.d.ts +1 -0
  57. package/WebGPU/GPUComputePassEncoder.js +3 -0
  58. package/WebGPU/GPUComputePassEncoder.js.map +1 -1
  59. package/WebGPU/GPUComputePipeline.d.ts +1 -0
  60. package/WebGPU/GPUComputePipeline.js +3 -0
  61. package/WebGPU/GPUComputePipeline.js.map +1 -1
  62. package/WebGPU/GPUDevice.d.ts +17 -79
  63. package/WebGPU/GPUDevice.js +75 -91
  64. package/WebGPU/GPUDevice.js.map +1 -1
  65. package/WebGPU/GPUExternalTexture.d.ts +1 -0
  66. package/WebGPU/GPUExternalTexture.js +3 -0
  67. package/WebGPU/GPUExternalTexture.js.map +1 -1
  68. package/WebGPU/GPUPipelineLayout.d.ts +1 -0
  69. package/WebGPU/GPUPipelineLayout.js +3 -0
  70. package/WebGPU/GPUPipelineLayout.js.map +1 -1
  71. package/WebGPU/GPUQuerySet.d.ts +1 -0
  72. package/WebGPU/GPUQuerySet.js +3 -0
  73. package/WebGPU/GPUQuerySet.js.map +1 -1
  74. package/WebGPU/GPUQueue.d.ts +1 -0
  75. package/WebGPU/GPUQueue.js +65 -14
  76. package/WebGPU/GPUQueue.js.map +1 -1
  77. package/WebGPU/GPURenderBundle.d.ts +1 -0
  78. package/WebGPU/GPURenderBundle.js +3 -0
  79. package/WebGPU/GPURenderBundle.js.map +1 -1
  80. package/WebGPU/GPURenderBundleEncoder.d.ts +4 -2
  81. package/WebGPU/GPURenderBundleEncoder.js +7 -3
  82. package/WebGPU/GPURenderBundleEncoder.js.map +1 -1
  83. package/WebGPU/GPURenderPassEncoder.d.ts +5 -1
  84. package/WebGPU/GPURenderPassEncoder.js +14 -2
  85. package/WebGPU/GPURenderPassEncoder.js.map +1 -1
  86. package/WebGPU/GPURenderPipeline.d.ts +1 -0
  87. package/WebGPU/GPURenderPipeline.js +3 -0
  88. package/WebGPU/GPURenderPipeline.js.map +1 -1
  89. package/WebGPU/GPUSampler.d.ts +1 -0
  90. package/WebGPU/GPUSampler.js +3 -0
  91. package/WebGPU/GPUSampler.js.map +1 -1
  92. package/WebGPU/GPUShaderModule.d.ts +1 -1
  93. package/WebGPU/GPUShaderModule.js +2 -2
  94. package/WebGPU/GPUShaderModule.js.map +1 -1
  95. package/WebGPU/GPUTexture.d.ts +1 -0
  96. package/WebGPU/GPUTexture.js +3 -0
  97. package/WebGPU/GPUTexture.js.map +1 -1
  98. package/WebGPU/GPUTextureView.d.ts +1 -0
  99. package/WebGPU/GPUTextureView.js +3 -0
  100. package/WebGPU/GPUTextureView.js.map +1 -1
  101. package/WebGPU/Interfaces.d.ts +95 -4
  102. package/WebGPU/Types.d.ts +9 -1
  103. package/WebGPU/Utils.d.ts +6 -0
  104. package/WebGPU/Utils.js +226 -0
  105. package/WebGPU/Utils.js.map +1 -1
  106. package/angular/esm2022/index.mjs +4 -4
  107. package/angular/fesm2022/nativescript-canvas-angular.mjs +4 -4
  108. package/angular/fesm2022/nativescript-canvas-angular.mjs.map +1 -1
  109. package/common.js.map +1 -1
  110. package/index.d.ts +2 -1
  111. package/index.js +3 -2
  112. package/index.js.map +1 -1
  113. package/package.json +1 -1
  114. package/platforms/android/canvas-release.aar +0 -0
  115. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  116. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +61 -30
  117. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +1 -0
  118. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
  119. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +144 -176
  120. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +342 -72
  121. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  122. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  123. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +1928 -630
  124. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +85 -23
  125. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  126. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +85 -23
  127. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/NSCCanvas.nib +0 -0
  128. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  129. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +681 -644
  130. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  131. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +122 -60
  132. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +1 -0
  133. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
  134. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +144 -176
  135. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +342 -72
  136. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  137. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  138. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  139. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +1928 -630
  140. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +85 -23
  141. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  142. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +85 -23
  143. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1928 -630
  144. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +85 -23
  145. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  146. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +85 -23
  147. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/NSCCanvas.nib +0 -0
  148. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +40 -29
  149. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  150. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +683 -646
  151. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +736 -684
  152. package/platforms/ios/src/NSOperationQueueWrapper.h +1 -1
  153. package/platforms/ios/src/NSOperationQueueWrapper.mm +41 -9
  154. package/platforms/ios/src/cpp/AsyncCallback.h +16 -8
  155. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +310 -801
  156. package/platforms/ios/src/cpp/CanvasJSIModule.h +2 -0
  157. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +578 -413
  158. package/platforms/ios/src/cpp/ImageAssetImpl.h +7 -3
  159. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +60 -3
  160. package/platforms/ios/src/cpp/ImageBitmapImpl.h +10 -3
  161. package/platforms/ios/src/cpp/PromiseCallback.h +1 -2
  162. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +7 -11
  163. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +3 -3
  164. package/platforms/ios/src/cpp/canvas2d/Path2D.h +5 -5
  165. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +106 -1
  166. package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +6 -6
  167. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +26 -23
  168. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +31 -5
  169. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +4 -1
  170. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +26 -0
  171. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +3 -0
  172. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +41 -7
  173. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +4 -0
  174. package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +11 -5
  175. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +28 -1
  176. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +3 -0
  177. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +75 -79
  178. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +4 -0
  179. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +56 -23
  180. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +3 -0
  181. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +25 -0
  182. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +2 -0
  183. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +1606 -681
  184. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +2 -0
  185. package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +2 -1
  186. package/platforms/ios/src/cpp/webgpu/GPUImpl.h +1 -1
  187. package/platforms/ios/src/cpp/webgpu/GPULabel.h +33 -0
  188. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +26 -0
  189. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +3 -1
  190. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +1 -2
  191. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +1 -1
  192. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +83 -14
  193. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +3 -0
  194. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +66 -34
  195. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +3 -0
  196. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +25 -0
  197. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +3 -0
  198. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +151 -52
  199. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +7 -0
  200. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +25 -0
  201. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +3 -0
  202. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +26 -0
  203. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +4 -1
  204. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +24 -0
  205. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +3 -0
  206. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +34 -8
  207. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +2 -0
  208. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +26 -0
  209. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +3 -0
  210. package/platforms/ios/src/cpp/webgpu/GPUUtils.h +511 -0
  211. package/utils.d.ts +1 -1
@@ -2,7 +2,11 @@ import { native_ } from './Constants';
2
2
  import { GPUCommandBuffer } from './GPUCommandBuffer';
3
3
  import { GPUComputePassEncoder } from './GPUComputePassEncoder';
4
4
  import { GPURenderPassEncoder } from './GPURenderPassEncoder';
5
+ import { parseComputePassDescriptor, parseRenderPassDescriptor } from './Utils';
5
6
  export class GPUCommandEncoder {
7
+ get label() {
8
+ return this[native_]?.label ?? '';
9
+ }
6
10
  static fromNative(encoder) {
7
11
  if (encoder) {
8
12
  const ret = new GPUCommandEncoder();
@@ -12,37 +16,12 @@ export class GPUCommandEncoder {
12
16
  return null;
13
17
  }
14
18
  beginComputePass(descriptor) {
15
- if (descriptor?.timestampWrites) {
16
- descriptor.timestampWrites.querySet = descriptor.timestampWrites.querySet[native_];
17
- }
18
- return GPUComputePassEncoder.fromNative(this[native_].beginComputePass(descriptor));
19
+ const desc = parseComputePassDescriptor(descriptor);
20
+ return GPUComputePassEncoder.fromNative(this[native_].beginComputePass(desc));
19
21
  }
20
22
  beginRenderPass(descriptor) {
21
- descriptor.colorAttachments = descriptor.colorAttachments.map((attachment) => {
22
- if (Array.isArray(attachment.clearValue)) {
23
- attachment.clearValue = { r: attachment.clearValue[0], g: attachment.clearValue[1], b: attachment.clearValue[2], a: attachment.clearValue[3] };
24
- }
25
- if (attachment.view) {
26
- attachment.view = attachment.view[native_];
27
- }
28
- else {
29
- /// ???
30
- }
31
- if (attachment.resolveTarget) {
32
- attachment.resolveTarget = attachment.resolveTarget[native_];
33
- }
34
- return attachment;
35
- });
36
- if (descriptor?.depthStencilAttachment?.view?.[native_]) {
37
- descriptor.depthStencilAttachment.view = descriptor.depthStencilAttachment.view[native_];
38
- }
39
- if (descriptor?.occlusionQuerySet) {
40
- descriptor.occlusionQuerySet = descriptor.occlusionQuerySet[native_];
41
- }
42
- if (descriptor?.timestampWrites?.querySet) {
43
- descriptor.timestampWrites.querySet = descriptor.timestampWrites.querySet[native_];
44
- }
45
- const passEncoder = this[native_].beginRenderPass(descriptor);
23
+ const desc = parseRenderPassDescriptor(descriptor);
24
+ const passEncoder = this[native_].beginRenderPass(desc);
46
25
  return GPURenderPassEncoder.fromNative(passEncoder);
47
26
  }
48
27
  clearBuffer(buffer, offset, size) {
@@ -52,40 +31,114 @@ export class GPUCommandEncoder {
52
31
  this[native_].copyBufferToBuffer(source[native_], sourceOffset, destination[native_], destinationOffset, size);
53
32
  }
54
33
  copyBufferToTexture(source, destination, copySize) {
55
- source.buffer = source.buffer[native_];
56
- destination.texture = destination.texture[native_];
34
+ const src = {
35
+ buffer: source.buffer[native_],
36
+ bytesPerRow: source.bytesPerRow,
37
+ };
38
+ if (typeof source.offset === 'number') {
39
+ src.offset = source.offset;
40
+ }
41
+ if (typeof source.rowsPerImage === 'number') {
42
+ src.rowsPerImage = source.rowsPerImage;
43
+ }
44
+ const dst = {
45
+ texture: destination.texture[native_],
46
+ };
47
+ if (destination.aspect) {
48
+ dst.aspect = destination.aspect;
49
+ }
50
+ if (typeof destination.mipLevel === 'number') {
51
+ dst.mipLevel = destination.mipLevel;
52
+ }
53
+ if (destination.origin) {
54
+ dst.origin = destination.origin;
55
+ }
56
+ let size;
57
57
  if (Array.isArray(copySize)) {
58
- copySize = {
58
+ size = {
59
59
  width: copySize[0],
60
60
  height: copySize[1] ?? 1,
61
61
  depthOrArrayLayers: copySize[2] ?? 1,
62
62
  };
63
63
  }
64
- this[native_].copyBufferToTexture(source, destination, copySize);
64
+ else {
65
+ size = { ...copySize };
66
+ }
67
+ this[native_].copyBufferToTexture(src, dst, size);
65
68
  }
66
69
  copyTextureToBuffer(source, destination, copySize) {
67
- source.texture = source.texture[native_];
68
- destination.buffer = destination.buffer[native_];
70
+ const src = {
71
+ texture: source.texture[native_],
72
+ };
73
+ if (source.aspect) {
74
+ src.aspect = source.aspect;
75
+ }
76
+ if (typeof source.mipLevel === 'number') {
77
+ src.mipLevel = source.mipLevel;
78
+ }
79
+ if (source.origin) {
80
+ src.origin = source.origin;
81
+ }
82
+ const dst = {
83
+ buffer: destination.buffer[native_],
84
+ bytesPerRow: destination.bytesPerRow,
85
+ };
86
+ if (typeof destination.offset === 'number') {
87
+ dst.offset = destination.offset;
88
+ }
89
+ if (typeof destination.rowsPerImage === 'number') {
90
+ dst.rowsPerImage = destination.rowsPerImage;
91
+ }
92
+ let size;
69
93
  if (Array.isArray(copySize)) {
70
- copySize = {
94
+ size = {
71
95
  width: copySize[0],
72
96
  height: copySize[1] ?? 1,
73
97
  depthOrArrayLayers: copySize[2] ?? 1,
74
98
  };
75
99
  }
76
- this[native_].copyTextureToBuffer(source, destination, copySize);
100
+ else {
101
+ size = { ...copySize };
102
+ }
103
+ this[native_].copyTextureToBuffer(src, dst, size);
77
104
  }
78
105
  copyTextureToTexture(source, destination, copySize) {
79
- source.texture = source.texture[native_];
80
- destination.texture = destination.texture[native_];
106
+ const src = {
107
+ texture: source.texture[native_],
108
+ };
109
+ if (source.aspect) {
110
+ src.aspect = source.aspect;
111
+ }
112
+ if (typeof source.mipLevel === 'number') {
113
+ src.mipLevel = source.mipLevel;
114
+ }
115
+ if (source.origin) {
116
+ src.origin = source.origin;
117
+ }
118
+ const dst = {
119
+ texture: destination.texture[native_],
120
+ };
121
+ if (destination.aspect) {
122
+ dst.aspect = destination.aspect;
123
+ }
124
+ if (typeof destination.mipLevel === 'number') {
125
+ dst.mipLevel = destination.mipLevel;
126
+ }
127
+ if (destination.origin) {
128
+ dst.origin = destination.origin;
129
+ }
130
+ let size;
81
131
  if (Array.isArray(copySize)) {
82
- copySize = {
132
+ size = {
83
133
  width: copySize[0],
84
134
  height: copySize[1] ?? 1,
85
135
  depthOrArrayLayers: copySize[2] ?? 1,
86
136
  };
87
137
  }
88
- this[native_].copyTextureToTexture(source, destination, copySize);
138
+ else {
139
+ size = { ...copySize };
140
+ }
141
+ this[native_].copyTextureToTexture(src, dst, size);
89
142
  }
90
143
  finish(descriptor) {
91
144
  const ret = this[native_].finish(descriptor);
@@ -1 +1 @@
1
- {"version":3,"file":"GPUCommandEncoder.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUCommandEncoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAI9D,MAAM,OAAO,iBAAiB;IAG7B,MAAM,CAAC,UAAU,CAAC,OAAO;QACxB,IAAI,OAAO,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACpC,GAAG,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;YACvB,OAAO,GAAG,CAAC;QACZ,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,gBAAgB,CAAC,UAOhB;QACA,IAAI,UAAU,EAAE,eAAe,EAAE,CAAC;YACjC,UAAU,CAAC,eAAe,CAAC,QAAQ,GAAG,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpF,CAAC;QAED,OAAO,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC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
@@ -4,6 +4,7 @@ import { GPUBuffer } from './GPUBuffer';
4
4
  import { GPUComputePipeline } from './GPUComputePipeline';
5
5
  export declare class GPUComputePassEncoder {
6
6
  [native_]: any;
7
+ get label(): any;
7
8
  dispatchWorkgroups(workgroupCountX: number, workgroupCountY?: number, workgroupCountZ?: number): void;
8
9
  dispatchWorkgroupsIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;
9
10
  end(): void;
@@ -1,5 +1,8 @@
1
1
  import { native_ } from './Constants';
2
2
  export class GPUComputePassEncoder {
3
+ get label() {
4
+ return this[native_]?.label ?? '';
5
+ }
3
6
  dispatchWorkgroups(workgroupCountX, workgroupCountY = 1, workgroupCountZ = 1) {
4
7
  this[native_].dispatchWorkgroups(workgroupCountX, workgroupCountY ?? 1, workgroupCountZ ?? 1);
5
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GPUComputePassEncoder.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUComputePassEncoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,MAAM,OAAO,qBAAqB;IAGjC,kBAAkB,CAAC,eAAuB,EAAE,kBAA0B,CAAC,EAAE,kBAA0B,CAAC;QACnG,IAAI,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,eAAe,EAAE,eAAe,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC;IAC/F,CAAC;IAED,0BAA0B,CAAC,cAAyB,EAAE,cAAsB;QAC3E,IAAI,CAAC,OAAO,CAAC,CAAC,0BAA0B,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IACnF,CAAC;IAED,GAAG;QACF,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,iBAAiB,CAAC,WAAmB;QACpC,IAAI,CAAC,OAAO,C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iC;QACpK,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,OAAO;QACR,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,kBAAkB,CAAC,CAAC;YACjD,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAChE,CAAC;aAAM,IAAI,kBAAkB,YAAY,WAAW,EAAE,CAAC;YACtD,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,wBAAwB,CAAC,CAAC;QACjH,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC1C,CAAC;IACF,CAAC;IAED,WAAW,CAAC,cAAkC;QAC7C,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,IAAI;QACrB,IAAI,IAAI,EAAE,CAAC;YACV,MAAM,GAAG,GAAG,IAAI,qBAAqB,EAAE,CAAC;YACxC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;YACpB,OAAO,GAAG,CAAC;QACZ,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
@@ -2,6 +2,7 @@ import { native_ } from './Constants';
2
2
  import { GPUBindGroupLayout } from './GPUBindGroupLayout';
3
3
  export declare class GPUComputePipeline {
4
4
  [native_]: any;
5
+ get label(): any;
5
6
  getBindGroupLayout(index: number): GPUBindGroupLayout;
6
7
  static fromNative(pipeline: any): GPUComputePipeline;
7
8
  }
@@ -1,6 +1,9 @@
1
1
  import { native_ } from './Constants';
2
2
  import { GPUBindGroupLayout } from './GPUBindGroupLayout';
3
3
  export class GPUComputePipeline {
4
+ get label() {
5
+ return this[native_]?.label ?? '';
6
+ }
4
7
  getBindGroupLayout(index) {
5
8
  return GPUBindGroupLayout.fromNative(this[native_].getBindGroupLayout(index));
6
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GPUComputePipeline.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUComputePipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,OAAO,kBAAkB;IAG9B,kBAAkB,CAAC,KAAa;QAC/B,OAAO,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,QAAQ;QACzB,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,GAAG,GAAG,IAAI,kBAAkB,EAAE,CAAC;YACrC,GAAG,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;YACxB,OAAO,GAAG,CAAC;QACZ,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
1
+ {"version":3,"file":"GPUComputePipeline.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUComputePipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,OAAO,kBAAkB;IAG9B,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;IACnC,CAAC;IAED,kBAAkB,CAAC,KAAa;QAC/B,OAAO,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,QAAQ;QACzB,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,GAAG,GAAG,IAAI,kBAAkB,EAAE,CAAC;YACrC,GAAG,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;YACxB,OAAO,GAAG,CAAC;QACZ,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
@@ -10,17 +10,15 @@ import { GPUCommandEncoder } from './GPUCommandEncoder';
10
10
  import { GPUDeviceLostInfo } from './Errors';
11
11
  import { GPUBindGroup } from './GPUBindGroup';
12
12
  import { GPUBindGroupLayout } from './GPUBindGroupLayout';
13
- import { GPUTextureView } from './GPUTextureView';
14
13
  import { GPUSampler } from './GPUSampler';
15
- import { GPUExternalTexture } from './GPUExternalTexture';
16
- import type { GPUAddressMode, GPUCompareFunction, GPUErrorFilter, GPUFilterMode, GPUMipmapFilterMode, GPUQueryType, GPUTextureFormat, GPUTextureSampleType, GPUTextureViewDimension } from './Types';
17
- import type { GPUDepthStencilState, GPUExternalTextureBindingLayout, GPUFragmentState, GPUMultisampleState, GPUPrimitiveState, GPUProgrammableStage, GPUVertexState } from './Interfaces';
14
+ import type { GPUAddressMode, GPUCompareFunction, GPUErrorFilter, GPUFilterMode, GPUMipmapFilterMode, GPUQueryType, GPUTextureFormat } from './Types';
15
+ import type { GPUBindGroupDescriptor, GPUBindGroupLayoutEntry, GPUComputePipelineDescriptor, GPURenderPipelineDescriptor } from './Interfaces';
18
16
  import { GPUComputePipeline } from './GPUComputePipeline';
19
17
  import { GPUQuerySet } from './GPUQuerySet';
20
18
  import { GPURenderBundleEncoder } from './GPURenderBundleEncoder';
21
- import { GPUAdapter } from './GPUAdapter';
19
+ import { GPUAdapter, GPUSupportedFeatures } from './GPUAdapter';
22
20
  export declare class EventTarget {
23
- _emitter?: WeakRef<Observable>;
21
+ protected _emitter?: WeakRef<Observable>;
24
22
  addEventListener(event: string, handler: any, options?: AddEventListenerOptions): void;
25
23
  removeEventListener(event: string, handler?: any): void;
26
24
  dispatchEvent(event: any): void;
@@ -33,55 +31,19 @@ interface GPUExtent3DDict {
33
31
  type GPUExtent3D = [number, number, number] | [number, number] | GPUExtent3DDict;
34
32
  export declare class GPUDevice extends EventTarget {
35
33
  [native_]: any;
36
- label: string;
37
- _lostPromise: Promise<GPUDeviceLostInfo>;
38
- _observerable: Observable;
34
+ private _lost;
35
+ private _observerable;
39
36
  constructor();
40
37
  private _uncapturederror;
41
38
  static fromNative(device: any, adapter: GPUAdapter): GPUDevice;
39
+ get label(): any;
42
40
  get lost(): Promise<GPUDeviceLostInfo>;
43
41
  get native(): any;
44
42
  get limits(): any;
45
- get features(): Map<string, string>;
43
+ get features(): GPUSupportedFeatures;
46
44
  destroy(): void;
47
- createBindGroup(descriptor: {
48
- label?: string;
49
- layout: GPUBindGroupLayout;
50
- entries: {
51
- binding: number;
52
- resource: GPUTextureView | GPUSampler | GPUExternalTexture | {
53
- buffer: GPUBuffer;
54
- offset?: number;
55
- size?: number;
56
- };
57
- }[];
58
- }): GPUBindGroup;
59
- createBindGroupLayout(descriptor: {
60
- label?: string;
61
- entries: {
62
- binding: number;
63
- visibility: number;
64
- buffer?: {
65
- hasDynamicOffset?: boolean;
66
- minBindingSize?: number;
67
- type?: 'uniform' | 'storage' | 'read-only-storage';
68
- };
69
- externalTexture?: GPUExternalTextureBindingLayout;
70
- sampler?: {
71
- type?: 'filtering' | 'non-filtering' | 'comparison';
72
- };
73
- storageTexture?: {
74
- access?: 'write-only' | 'read-only' | 'read-write';
75
- format: GPUTextureFormat;
76
- viewDimension?: GPUTextureViewDimension;
77
- };
78
- texture?: {
79
- multisampled?: boolean;
80
- sampleType?: GPUTextureSampleType;
81
- viewDimension?: GPUTextureViewDimension;
82
- };
83
- }[];
84
- }): GPUBindGroupLayout;
45
+ createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup;
46
+ createBindGroupLayout(descriptor: GPUBindGroupLayoutEntry): GPUBindGroupLayout;
85
47
  createBuffer(descriptor: {
86
48
  label?: string;
87
49
  mappedAtCreation?: boolean;
@@ -91,16 +53,8 @@ export declare class GPUDevice extends EventTarget {
91
53
  createCommandEncoder(descriptor?: {
92
54
  label?: string;
93
55
  }): GPUCommandEncoder;
94
- createComputePipeline(descriptor: {
95
- compute: GPUProgrammableStage;
96
- label?: string;
97
- layout: GPUPipelineLayout | 'auto';
98
- }): GPUComputePipeline;
99
- createComputePipelineAsync(descriptor: {
100
- compute: GPUProgrammableStage;
101
- label?: string;
102
- layout: GPUPipelineLayout | 'auto';
103
- }): Promise<unknown>;
56
+ createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline;
57
+ createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Promise<unknown>;
104
58
  createPipelineLayout(descriptor: {
105
59
  bindGroupLayouts: GPUBindGroupLayout[];
106
60
  label?: string;
@@ -118,24 +72,8 @@ export declare class GPUDevice extends EventTarget {
118
72
  sampleCount?: number;
119
73
  stencilReadOnly?: boolean;
120
74
  }): GPURenderBundleEncoder;
121
- createRenderPipeline(descriptor: {
122
- depthStencil?: GPUDepthStencilState;
123
- fragment?: GPUFragmentState;
124
- label?: string;
125
- layout: GPUPipelineLayout | 'auto';
126
- multisample?: GPUMultisampleState;
127
- primitive?: GPUPrimitiveState;
128
- vertex: GPUVertexState;
129
- }): GPURenderPipeline;
130
- createRenderPipelineAsync(descriptor: {
131
- depthStencil?: GPUDepthStencilState;
132
- fragment?: GPUFragmentState;
133
- label?: string;
134
- layout: GPUPipelineLayout | 'auto';
135
- multisample?: GPUMultisampleState;
136
- primitive?: GPUPrimitiveState;
137
- vertex: GPUVertexState;
138
- }): Promise<unknown>;
75
+ createRenderPipeline(descriptor: GPURenderPipelineDescriptor): GPURenderPipeline;
76
+ createRenderPipelineAsync(descriptor: GPURenderPipelineDescriptor): Promise<unknown>;
139
77
  createSampler(descriptor?: {
140
78
  addressModeU?: GPUAddressMode;
141
79
  addressModeV?: GPUAddressMode;
@@ -149,7 +87,7 @@ export declare class GPUDevice extends EventTarget {
149
87
  minFilter?: GPUFilterMode;
150
88
  mipmapFilter?: GPUMipmapFilterMode;
151
89
  }): GPUSampler;
152
- createShaderModule(desc: {
90
+ createShaderModule(descriptor: {
153
91
  label?: string;
154
92
  code: string;
155
93
  sourceMap?: object;
@@ -161,8 +99,8 @@ export declare class GPUDevice extends EventTarget {
161
99
  mipLevelCount?: number;
162
100
  sampleCount?: number;
163
101
  dimension?: '1d' | '2d' | '3d';
164
- format: any;
165
- usage: any;
102
+ format: GPUTextureFormat;
103
+ usage: number;
166
104
  viewFormats?: any[];
167
105
  }): GPUTexture;
168
106
  popErrorScope(): Promise<unknown>;