@nativescript/canvas 2.0.0-beta.9 → 2.0.0-webgpu.0

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 (285) hide show
  1. package/Canvas/common.d.ts +23 -15
  2. package/Canvas/common.js +125 -56
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +5 -7
  5. package/Canvas/index.android.js +61 -133
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +4 -1
  8. package/Canvas/index.ios.d.ts +4 -5
  9. package/Canvas/index.ios.js +72 -82
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -1
  12. package/Canvas2D/CanvasRenderingContext2D/index.js +8 -11
  13. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  14. package/Canvas2D/DOMMatrix/index.d.ts +14 -0
  15. package/Canvas2D/DOMMatrix/index.js +62 -0
  16. package/Canvas2D/DOMMatrix/index.js.map +1 -1
  17. package/Canvas2D/ImageData/index.js +4 -6
  18. package/Canvas2D/ImageData/index.js.map +1 -1
  19. package/ImageAsset/index.d.ts +1 -0
  20. package/ImageAsset/index.js +49 -0
  21. package/ImageAsset/index.js.map +1 -1
  22. package/WebGL/WebGLRenderingContext/index.d.ts +1 -0
  23. package/WebGL/WebGLRenderingContext/index.js +86 -32
  24. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  25. package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -0
  26. package/WebGL2/WebGL2RenderingContext/index.js +2 -3
  27. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  28. package/WebGPU/Constants.d.ts +36 -0
  29. package/WebGPU/Constants.js +42 -0
  30. package/WebGPU/Constants.js.map +1 -0
  31. package/WebGPU/Errors.d.ts +18 -0
  32. package/WebGPU/Errors.js +21 -0
  33. package/WebGPU/Errors.js.map +1 -0
  34. package/WebGPU/GPU.d.ts +13 -0
  35. package/WebGPU/GPU.js +35 -0
  36. package/WebGPU/GPU.js.map +1 -0
  37. package/WebGPU/GPUAdapter.d.ts +23 -0
  38. package/WebGPU/GPUAdapter.js +62 -0
  39. package/WebGPU/GPUAdapter.js.map +1 -0
  40. package/WebGPU/GPUAdapterInfo.d.ts +9 -0
  41. package/WebGPU/GPUAdapterInfo.js +24 -0
  42. package/WebGPU/GPUAdapterInfo.js.map +1 -0
  43. package/WebGPU/GPUBindGroup.d.ts +5 -0
  44. package/WebGPU/GPUBindGroup.js +12 -0
  45. package/WebGPU/GPUBindGroup.js.map +1 -0
  46. package/WebGPU/GPUBindGroupLayout.d.ts +5 -0
  47. package/WebGPU/GPUBindGroupLayout.js +12 -0
  48. package/WebGPU/GPUBindGroupLayout.js.map +1 -0
  49. package/WebGPU/GPUBuffer.d.ts +15 -0
  50. package/WebGPU/GPUBuffer.js +54 -0
  51. package/WebGPU/GPUBuffer.js.map +1 -0
  52. package/WebGPU/GPUCanvasContext.d.ts +33 -0
  53. package/WebGPU/GPUCanvasContext.js +67 -0
  54. package/WebGPU/GPUCanvasContext.js.map +1 -0
  55. package/WebGPU/GPUCommandBuffer.d.ts +5 -0
  56. package/WebGPU/GPUCommandBuffer.js +12 -0
  57. package/WebGPU/GPUCommandBuffer.js.map +1 -0
  58. package/WebGPU/GPUCommandEncoder.d.ts +41 -0
  59. package/WebGPU/GPUCommandEncoder.js +105 -0
  60. package/WebGPU/GPUCommandEncoder.js.map +1 -0
  61. package/WebGPU/GPUComputePassEncoder.d.ts +16 -0
  62. package/WebGPU/GPUComputePassEncoder.js +50 -0
  63. package/WebGPU/GPUComputePassEncoder.js.map +1 -0
  64. package/WebGPU/GPUComputePipeline.d.ts +7 -0
  65. package/WebGPU/GPUComputePipeline.js +16 -0
  66. package/WebGPU/GPUComputePipeline.js.map +1 -0
  67. package/WebGPU/GPUDevice.d.ts +173 -0
  68. package/WebGPU/GPUDevice.js +381 -0
  69. package/WebGPU/GPUDevice.js.map +1 -0
  70. package/WebGPU/GPUDeviceLostInfo.d.ts +1 -0
  71. package/WebGPU/GPUDeviceLostInfo.js +10 -0
  72. package/WebGPU/GPUDeviceLostInfo.js.map +1 -0
  73. package/WebGPU/GPUExternalTexture.d.ts +5 -0
  74. package/WebGPU/GPUExternalTexture.js +12 -0
  75. package/WebGPU/GPUExternalTexture.js.map +1 -0
  76. package/WebGPU/GPUPipelineLayout.d.ts +5 -0
  77. package/WebGPU/GPUPipelineLayout.js +12 -0
  78. package/WebGPU/GPUPipelineLayout.js.map +1 -0
  79. package/WebGPU/GPUQuerySet.d.ts +5 -0
  80. package/WebGPU/GPUQuerySet.js +12 -0
  81. package/WebGPU/GPUQuerySet.js.map +1 -0
  82. package/WebGPU/GPUQueue.d.ts +14 -0
  83. package/WebGPU/GPUQueue.js +77 -0
  84. package/WebGPU/GPUQueue.js.map +1 -0
  85. package/WebGPU/GPURenderBundle.d.ts +5 -0
  86. package/WebGPU/GPURenderBundle.js +12 -0
  87. package/WebGPU/GPURenderBundle.js.map +1 -0
  88. package/WebGPU/GPURenderBundleEncoder.d.ts +20 -0
  89. package/WebGPU/GPURenderBundleEncoder.js +61 -0
  90. package/WebGPU/GPURenderBundleEncoder.js.map +1 -0
  91. package/WebGPU/GPURenderPassEncoder.d.ts +29 -0
  92. package/WebGPU/GPURenderPassEncoder.js +94 -0
  93. package/WebGPU/GPURenderPassEncoder.js.map +1 -0
  94. package/WebGPU/GPURenderPipeline.d.ts +7 -0
  95. package/WebGPU/GPURenderPipeline.js +16 -0
  96. package/WebGPU/GPURenderPipeline.js.map +1 -0
  97. package/WebGPU/GPUSampler.d.ts +5 -0
  98. package/WebGPU/GPUSampler.js +12 -0
  99. package/WebGPU/GPUSampler.js.map +1 -0
  100. package/WebGPU/GPUShaderModule.d.ts +6 -0
  101. package/WebGPU/GPUShaderModule.js +15 -0
  102. package/WebGPU/GPUShaderModule.js.map +1 -0
  103. package/WebGPU/GPUTexture.d.ts +16 -0
  104. package/WebGPU/GPUTexture.js +41 -0
  105. package/WebGPU/GPUTexture.js.map +1 -0
  106. package/WebGPU/GPUTextureView.d.ts +5 -0
  107. package/WebGPU/GPUTextureView.js +12 -0
  108. package/WebGPU/GPUTextureView.js.map +1 -0
  109. package/WebGPU/Interfaces.d.ts +155 -0
  110. package/WebGPU/Interfaces.js +2 -0
  111. package/WebGPU/Interfaces.js.map +1 -0
  112. package/WebGPU/Types.d.ts +39 -0
  113. package/WebGPU/Types.js +2 -0
  114. package/WebGPU/Types.js.map +1 -0
  115. package/WebGPU/Utils.d.ts +1 -0
  116. package/WebGPU/Utils.js +75 -0
  117. package/WebGPU/Utils.js.map +1 -0
  118. package/WebGPU/index.d.ts +28 -0
  119. package/WebGPU/index.js +29 -0
  120. package/WebGPU/index.js.map +1 -0
  121. package/index.d.ts +1 -1
  122. package/index.js +22 -1
  123. package/index.js.map +1 -1
  124. package/package.json +1 -4
  125. package/platforms/android/canvas-release.aar +0 -0
  126. package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
  127. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  128. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +23 -23
  129. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +41 -8
  130. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2280 -103
  131. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  132. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  133. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +1563 -3729
  134. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +27 -34
  135. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  136. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +27 -34
  137. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  138. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +602 -663
  139. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  140. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +46 -46
  141. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +41 -8
  142. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2280 -103
  143. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  144. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  145. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  146. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +1563 -3729
  147. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +27 -34
  148. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  149. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +27 -34
  150. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1563 -3729
  151. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +27 -34
  152. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  153. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +27 -34
  154. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +31 -31
  155. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  156. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +604 -662
  157. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +638 -641
  158. package/platforms/ios/build.xcconfig +3 -1
  159. package/platforms/ios/src/cpp/Caches.h +69 -1
  160. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +320 -395
  161. package/platforms/ios/src/cpp/CanvasJSIModule.h +7 -1
  162. package/platforms/ios/src/cpp/Helpers.h +43 -8
  163. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +35 -37
  164. package/platforms/ios/src/cpp/ImageAssetImpl.h +14 -10
  165. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +2 -2
  166. package/platforms/ios/src/cpp/ImageBitmapImpl.h +1 -1
  167. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +0 -10
  168. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +41 -4
  169. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +409 -3
  170. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +27 -0
  171. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +131 -149
  172. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +1766 -1659
  173. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +302 -0
  174. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.h +63 -0
  175. package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.cpp +174 -0
  176. package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.h +58 -0
  177. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +53 -0
  178. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +45 -0
  179. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +53 -0
  180. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +45 -0
  181. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +229 -0
  182. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +59 -0
  183. package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +317 -0
  184. package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +55 -0
  185. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +54 -0
  186. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +45 -0
  187. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +1087 -0
  188. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +69 -0
  189. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +260 -0
  190. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +62 -0
  191. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +84 -0
  192. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +49 -0
  193. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +2741 -0
  194. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +95 -0
  195. package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +186 -0
  196. package/platforms/ios/src/cpp/webgpu/GPUImpl.h +55 -0
  197. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +54 -0
  198. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +46 -0
  199. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +137 -0
  200. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +55 -0
  201. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +521 -0
  202. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +56 -0
  203. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +469 -0
  204. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +71 -0
  205. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +53 -0
  206. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +45 -0
  207. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +653 -0
  208. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +85 -0
  209. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +84 -0
  210. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +49 -0
  211. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +53 -0
  212. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +45 -0
  213. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +56 -0
  214. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +45 -0
  215. package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.cpp +1304 -0
  216. package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.h +288 -0
  217. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +360 -0
  218. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +75 -0
  219. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +53 -0
  220. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +45 -0
  221. package/platforms/ios/src/cpp/webgpu/GPUUtils.h +178 -0
  222. package/SVG/Circle.d.ts +0 -11
  223. package/SVG/Circle.js +0 -21
  224. package/SVG/Circle.js.map +0 -1
  225. package/SVG/ClipPath.d.ts +0 -4
  226. package/SVG/ClipPath.js +0 -9
  227. package/SVG/ClipPath.js.map +0 -1
  228. package/SVG/Defs.d.ts +0 -4
  229. package/SVG/Defs.js +0 -9
  230. package/SVG/Defs.js.map +0 -1
  231. package/SVG/Ellipse.d.ts +0 -13
  232. package/SVG/Ellipse.js +0 -26
  233. package/SVG/Ellipse.js.map +0 -1
  234. package/SVG/G.d.ts +0 -7
  235. package/SVG/G.js +0 -9
  236. package/SVG/G.js.map +0 -1
  237. package/SVG/Image.d.ts +0 -11
  238. package/SVG/Image.js +0 -40
  239. package/SVG/Image.js.map +0 -1
  240. package/SVG/Line.d.ts +0 -13
  241. package/SVG/Line.js +0 -26
  242. package/SVG/Line.js.map +0 -1
  243. package/SVG/LinearGradient.d.ts +0 -10
  244. package/SVG/LinearGradient.js +0 -13
  245. package/SVG/LinearGradient.js.map +0 -1
  246. package/SVG/Path.d.ts +0 -7
  247. package/SVG/Path.js +0 -14
  248. package/SVG/Path.js.map +0 -1
  249. package/SVG/Pattern.d.ts +0 -4
  250. package/SVG/Pattern.js +0 -9
  251. package/SVG/Pattern.js.map +0 -1
  252. package/SVG/Polygon.d.ts +0 -7
  253. package/SVG/Polygon.js +0 -14
  254. package/SVG/Polygon.js.map +0 -1
  255. package/SVG/Polyline.d.ts +0 -7
  256. package/SVG/Polyline.js +0 -14
  257. package/SVG/Polyline.js.map +0 -1
  258. package/SVG/Rect.d.ts +0 -8
  259. package/SVG/Rect.js +0 -13
  260. package/SVG/Rect.js.map +0 -1
  261. package/SVG/SVG.d.ts +0 -32
  262. package/SVG/SVG.js +0 -204
  263. package/SVG/SVG.js.map +0 -1
  264. package/SVG/SVGItem.d.ts +0 -5
  265. package/SVG/SVGItem.js +0 -8
  266. package/SVG/SVGItem.js.map +0 -1
  267. package/SVG/Stop.d.ts +0 -5
  268. package/SVG/Stop.js +0 -9
  269. package/SVG/Stop.js.map +0 -1
  270. package/SVG/Symbol.d.ts +0 -4
  271. package/SVG/Symbol.js +0 -9
  272. package/SVG/Symbol.js.map +0 -1
  273. package/SVG/Text.d.ts +0 -14
  274. package/SVG/Text.js +0 -26
  275. package/SVG/Text.js.map +0 -1
  276. package/SVG/Use.d.ts +0 -4
  277. package/SVG/Use.js +0 -9
  278. package/SVG/Use.js.map +0 -1
  279. package/SVG/index.d.ts +0 -18
  280. package/SVG/index.js +0 -19
  281. package/SVG/index.js.map +0 -1
  282. package/platforms/ios/src/cpp/PerIsolateData.cpp +0 -49
  283. package/platforms/ios/src/cpp/PerIsolateData.h +0 -54
  284. package/platforms/ios/src/cpp/URLImpl.cpp +0 -464
  285. package/platforms/ios/src/cpp/URLImpl.h +0 -121
@@ -0,0 +1,381 @@
1
+ import { fromObject } from '@nativescript/core';
2
+ import { GPUBuffer } from './GPUBuffer';
3
+ import { GPUTexture } from './GPUTexture';
4
+ import { adapter_, native_ } from './Constants';
5
+ import { GPUShaderModule } from './GPUShaderModule';
6
+ import { GPUQueue } from './GPUQueue';
7
+ import { GPUPipelineLayout } from './GPUPipelineLayout';
8
+ import { parseVertexFormat } from './Utils';
9
+ import { GPURenderPipeline } from './GPURenderPipeline';
10
+ import { GPUCommandEncoder } from './GPUCommandEncoder';
11
+ import { GPUDeviceLostInfo, GPUInternalError, GPUOutOfMemoryError, GPUValidationError } from './Errors';
12
+ import { GPUBindGroup } from './GPUBindGroup';
13
+ import { GPUBindGroupLayout } from './GPUBindGroupLayout';
14
+ import { GPUTextureView } from './GPUTextureView';
15
+ import { GPUSampler } from './GPUSampler';
16
+ import { GPUExternalTexture } from './GPUExternalTexture';
17
+ import { GPUComputePipeline } from './GPUComputePipeline';
18
+ import { GPUQuerySet } from './GPUQuerySet';
19
+ import { GPURenderBundleEncoder } from './GPURenderBundleEncoder';
20
+ // Doing so because :D
21
+ export class EventTarget {
22
+ addEventListener(event, handler, options = {}) {
23
+ const { capture, once } = options;
24
+ if (capture) {
25
+ // debug("Bubble propagation is not supported");
26
+ }
27
+ if (once) {
28
+ const oldHandler = handler;
29
+ const self = this;
30
+ handler = (...args) => {
31
+ oldHandler.call(null, ...args);
32
+ self.removeEventListener(event, handler);
33
+ };
34
+ }
35
+ let emitter;
36
+ if (global.isAndroid) {
37
+ emitter = this._emitter?.get?.();
38
+ }
39
+ if (global.isIOS) {
40
+ emitter = this._emitter?.deref?.();
41
+ }
42
+ if (emitter !== null && emitter !== undefined) {
43
+ emitter.addEventListener(event, handler, this);
44
+ }
45
+ }
46
+ removeEventListener(event, handler) {
47
+ let emitter;
48
+ if (global.isAndroid) {
49
+ emitter = this._emitter?.get?.();
50
+ }
51
+ if (global.isIOS) {
52
+ emitter = this._emitter?.deref?.();
53
+ }
54
+ if (emitter !== null && emitter !== undefined) {
55
+ emitter.removeEventListener(event, handler);
56
+ }
57
+ }
58
+ dispatchEvent(event) {
59
+ let emitter;
60
+ if (global.isAndroid) {
61
+ emitter = this._emitter?.get?.();
62
+ }
63
+ if (global.isIOS) {
64
+ emitter = this._emitter?.deref?.();
65
+ }
66
+ if (emitter !== null && emitter !== undefined) {
67
+ emitter.notify({ ...event, eventName: event.type, object: emitter });
68
+ }
69
+ }
70
+ }
71
+ export class GPUDevice extends EventTarget {
72
+ constructor() {
73
+ super();
74
+ this.label = '';
75
+ this._observerable = fromObject({});
76
+ this._emitter = new WeakRef(this._observerable);
77
+ }
78
+ _uncapturederror(type, message) {
79
+ const emitter = this._emitter?.deref();
80
+ if (emitter) {
81
+ const has = emitter.hasListeners('uncapturederror');
82
+ if (has) {
83
+ // emitter.notify();
84
+ switch (type) {
85
+ case 1:
86
+ // lost
87
+ // noop
88
+ break;
89
+ case 2:
90
+ // oom
91
+ emitter.notify({
92
+ eventName: 'uncapturederror',
93
+ object: fromObject({}),
94
+ error: new GPUOutOfMemoryError(),
95
+ });
96
+ break;
97
+ case 3:
98
+ // validation
99
+ emitter.notify({
100
+ eventName: 'uncapturederror',
101
+ object: fromObject({}),
102
+ error: new GPUValidationError(message),
103
+ });
104
+ break;
105
+ case 4:
106
+ // internal
107
+ emitter.notify({
108
+ eventName: 'uncapturederror',
109
+ object: fromObject({}),
110
+ error: new GPUInternalError(),
111
+ });
112
+ break;
113
+ }
114
+ }
115
+ }
116
+ }
117
+ static fromNative(device, adapter) {
118
+ if (device) {
119
+ const ret = new GPUDevice();
120
+ device.setuncapturederror(ret._uncapturederror.bind(this));
121
+ ret[native_] = device;
122
+ ret[adapter_] = adapter;
123
+ return ret;
124
+ }
125
+ return null;
126
+ }
127
+ get lost() {
128
+ if (!this._lostPromise) {
129
+ this._lostPromise = new Promise((resolve, reject) => {
130
+ this[native_].lost
131
+ .then((info) => {
132
+ const ret = new GPUDeviceLostInfo();
133
+ ret[native_] = info;
134
+ resolve(ret);
135
+ })
136
+ .reject((error) => {
137
+ reject(error);
138
+ });
139
+ });
140
+ }
141
+ return this._lostPromise;
142
+ }
143
+ get native() {
144
+ return this[native_];
145
+ }
146
+ get limits() {
147
+ return this.native.limits;
148
+ }
149
+ get features() {
150
+ return this.native.features;
151
+ }
152
+ destroy() {
153
+ this.native.destroy();
154
+ }
155
+ createBindGroup(descriptor) {
156
+ descriptor.layout = descriptor?.layout?.[native_];
157
+ if (Array.isArray(descriptor.entries)) {
158
+ for (const entry of descriptor.entries) {
159
+ if (entry.resource instanceof GPUTextureView) {
160
+ entry.resource = entry.resource[native_];
161
+ }
162
+ else if (entry.resource instanceof GPUSampler) {
163
+ entry.resource = entry.resource[native_];
164
+ }
165
+ else if (entry.resource instanceof GPUExternalTexture) {
166
+ entry.resource = entry.resource[native_];
167
+ }
168
+ else if (entry?.resource?.buffer && entry?.resource?.buffer instanceof GPUBuffer) {
169
+ entry.resource.buffer = entry.resource.buffer[native_];
170
+ }
171
+ }
172
+ }
173
+ const group = this.native.createBindGroup(descriptor);
174
+ if (group) {
175
+ return GPUBindGroup.fromNative(group);
176
+ }
177
+ return undefined;
178
+ }
179
+ createBindGroupLayout(descriptor) {
180
+ const groupLayout = this.native.createBindGroupLayout(descriptor);
181
+ if (groupLayout) {
182
+ return GPUBindGroupLayout.fromNative(groupLayout);
183
+ }
184
+ return undefined;
185
+ }
186
+ createBuffer(descriptor) {
187
+ const buffer = this.native.createBuffer(descriptor);
188
+ if (buffer) {
189
+ return GPUBuffer.fromNative(buffer, descriptor.mappedAtCreation);
190
+ }
191
+ return undefined;
192
+ }
193
+ createCommandEncoder(descriptor) {
194
+ const encoder = this.native.createCommandEncoder(descriptor);
195
+ return GPUCommandEncoder.fromNative(encoder);
196
+ }
197
+ createComputePipeline(descriptor) {
198
+ if (descriptor.layout instanceof GPUPipelineLayout) {
199
+ descriptor.layout = descriptor.layout[native_];
200
+ }
201
+ descriptor.compute.module = descriptor.compute.module[native_];
202
+ return GPUComputePipeline.fromNative(this.native.createComputePipeline(descriptor));
203
+ }
204
+ createComputePipelineAsync(descriptor) {
205
+ return new Promise((resolve, reject) => {
206
+ if (descriptor.layout instanceof GPUPipelineLayout) {
207
+ descriptor.layout = descriptor.layout[native_];
208
+ }
209
+ descriptor.compute.module = descriptor.compute.module[native_];
210
+ this.native.createComputePipelineAsync(descriptor, (error, pipeline) => {
211
+ if (error) {
212
+ reject(error);
213
+ }
214
+ else {
215
+ resolve(GPUComputePipeline.fromNative(pipeline));
216
+ }
217
+ });
218
+ });
219
+ }
220
+ createPipelineLayout(descriptor) {
221
+ const desc = {
222
+ label: descriptor.label,
223
+ bindGroupLayouts: descriptor.bindGroupLayouts.map((layout) => {
224
+ return layout[native_];
225
+ }),
226
+ };
227
+ return GPUPipelineLayout.fromNative(this.native.createPipelineLayout(desc));
228
+ }
229
+ createQuerySet(descriptor) {
230
+ return GPUQuerySet.fromNative(this.native.createPipelineLayout(descriptor));
231
+ }
232
+ createRenderBundleEncoder(descriptor) {
233
+ return GPURenderBundleEncoder.fromNative(this.native.createRenderBundleEncoder(descriptor));
234
+ }
235
+ createRenderPipeline(descriptor) {
236
+ const vertex = descriptor.vertex;
237
+ vertex.module = vertex.module[native_];
238
+ const buffers = vertex?.buffers;
239
+ if (Array.isArray(buffers)) {
240
+ vertex.buffers = buffers.map((buffer) => {
241
+ buffer.attributes = buffer.attributes.map((attr) => {
242
+ attr.format = parseVertexFormat(attr.format);
243
+ return attr;
244
+ });
245
+ return buffer;
246
+ });
247
+ }
248
+ const fragment = descriptor.fragment;
249
+ if (fragment) {
250
+ fragment.module = fragment.module[native_];
251
+ }
252
+ const layout = descriptor.layout;
253
+ if (layout instanceof GPUPipelineLayout) {
254
+ descriptor.layout = descriptor.layout[native_];
255
+ }
256
+ return GPURenderPipeline.fromNative(this[native_].createRenderPipeline(descriptor));
257
+ }
258
+ createRenderPipelineAsync(descriptor) {
259
+ return new Promise((resolve, reject) => {
260
+ const vertex = descriptor.vertex;
261
+ vertex.module = vertex.module[native_];
262
+ const buffers = vertex?.buffers;
263
+ if (Array.isArray(buffers)) {
264
+ vertex.buffers = buffers.map((buffer) => {
265
+ buffer.attributes = buffer.attributes.map((attr) => {
266
+ attr['format'] = parseVertexFormat(attr['format']);
267
+ return attr;
268
+ });
269
+ switch (buffer.stepMode) {
270
+ case 'vertex':
271
+ buffer.stepMode = 0;
272
+ break;
273
+ case 'instance':
274
+ buffer.stepMode = 1;
275
+ break;
276
+ }
277
+ return buffer;
278
+ });
279
+ }
280
+ const fragment = descriptor.fragment;
281
+ if (fragment) {
282
+ fragment.module = fragment.module[native_];
283
+ }
284
+ const layout = descriptor.layout;
285
+ if (layout instanceof GPUPipelineLayout) {
286
+ descriptor.layout = descriptor.layout[native_];
287
+ }
288
+ const primitive = descriptor.primitive;
289
+ if (primitive) {
290
+ switch (primitive.topology) {
291
+ case 'point-list':
292
+ primitive.topology = 0;
293
+ break;
294
+ case 'line-list':
295
+ primitive.topology = 1;
296
+ break;
297
+ case 'line-strip':
298
+ primitive.topology = 2;
299
+ break;
300
+ case 'triangle-list':
301
+ primitive.topology = 3;
302
+ break;
303
+ case 'triangle-strip':
304
+ primitive.topology = 4;
305
+ break;
306
+ default:
307
+ break;
308
+ }
309
+ }
310
+ this[native_].createRenderPipeline(descriptor, (error, pipeline) => {
311
+ if (error) {
312
+ reject(error);
313
+ }
314
+ else {
315
+ resolve(GPURenderPipeline.fromNative(pipeline));
316
+ }
317
+ });
318
+ });
319
+ }
320
+ createSampler(descriptor) {
321
+ return GPUSampler.fromNative(this.native.createSampler(descriptor));
322
+ }
323
+ createShaderModule(desc) {
324
+ const module = this.native.createShaderModule(desc);
325
+ if (module) {
326
+ return GPUShaderModule.fromNative(module);
327
+ }
328
+ return undefined;
329
+ }
330
+ createTexture(descriptor) {
331
+ const sizeIsArray = Array.isArray(descriptor.size);
332
+ const opts = {
333
+ label: descriptor?.label,
334
+ mipLevelCount: descriptor?.mipLevelCount ?? 1,
335
+ sampleCount: descriptor?.sampleCount ?? 1,
336
+ dimension: descriptor?.dimension ?? '2d',
337
+ format: descriptor?.format,
338
+ usage: descriptor?.usage,
339
+ viewFormats: descriptor?.viewFormats ?? [],
340
+ width: sizeIsArray ? descriptor.size[0] : descriptor.size?.width,
341
+ height: sizeIsArray ? descriptor.size[1] ?? 1 : descriptor.size?.height ?? 1,
342
+ depthOrArrayLayers: sizeIsArray ? descriptor.size[2] ?? 1 : descriptor.size?.depthOrArrayLayers ?? 1,
343
+ };
344
+ return GPUTexture.fromNative(this.native.createTexture(opts));
345
+ }
346
+ popErrorScope() {
347
+ return new Promise((resolve, reject) => {
348
+ this.native.popErrorScope((type, message) => {
349
+ switch (type) {
350
+ case 0:
351
+ resolve(null);
352
+ break;
353
+ case 1:
354
+ // should not reach
355
+ // throw internal error
356
+ resolve(new GPUInternalError());
357
+ break;
358
+ case 2:
359
+ resolve(new GPUOutOfMemoryError());
360
+ break;
361
+ case 3:
362
+ resolve(new GPUValidationError(message));
363
+ break;
364
+ case 4:
365
+ resolve(new GPUInternalError());
366
+ break;
367
+ }
368
+ });
369
+ });
370
+ }
371
+ pushErrorScope(filter) {
372
+ this.native.pushErrorScope(filter);
373
+ }
374
+ get queue() {
375
+ if (!this._queue) {
376
+ this._queue = GPUQueue.fromNative(this[native_].queue);
377
+ }
378
+ return this._queue;
379
+ }
380
+ }
381
+ //# sourceMappingURL=GPUDevice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GPUDevice.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUDevice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,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IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACjB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;SACvD;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;CACD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { native_ } from './Constants';
2
+ class GPUDeviceLostInfo {
3
+ get message() {
4
+ return this[native_].message;
5
+ }
6
+ get reason() {
7
+ return this[native_].reason;
8
+ }
9
+ }
10
+ //# sourceMappingURL=GPUDeviceLostInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GPUDeviceLostInfo.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUDeviceLostInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,iBAAiB;IAGtB,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAC7B,CAAC;CACD"}
@@ -0,0 +1,5 @@
1
+ import { native_ } from './Constants';
2
+ export declare class GPUExternalTexture {
3
+ [native_]: any;
4
+ static fromNative(texture: any): GPUExternalTexture;
5
+ }
@@ -0,0 +1,12 @@
1
+ import { native_ } from './Constants';
2
+ export class GPUExternalTexture {
3
+ static fromNative(texture) {
4
+ if (texture) {
5
+ const ret = new GPUExternalTexture();
6
+ ret[native_] = texture;
7
+ return ret;
8
+ }
9
+ return null;
10
+ }
11
+ }
12
+ //# sourceMappingURL=GPUExternalTexture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GPUExternalTexture.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUExternalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,OAAO,kBAAkB;IAG9B,MAAM,CAAC,UAAU,CAAC,OAAO;QACxB,IAAI,OAAO,EAAE;YACZ,MAAM,GAAG,GAAG,IAAI,kBAAkB,EAAE,CAAC;YACrC,GAAG,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;YACvB,OAAO,GAAG,CAAC;SACX;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
@@ -0,0 +1,5 @@
1
+ import { native_ } from './Constants';
2
+ export declare class GPUPipelineLayout {
3
+ [native_]: any;
4
+ static fromNative(layout: any): GPUPipelineLayout;
5
+ }
@@ -0,0 +1,12 @@
1
+ import { native_ } from './Constants';
2
+ export class GPUPipelineLayout {
3
+ static fromNative(layout) {
4
+ if (layout) {
5
+ const ret = new GPUPipelineLayout();
6
+ ret[native_] = layout;
7
+ return ret;
8
+ }
9
+ return null;
10
+ }
11
+ }
12
+ //# sourceMappingURL=GPUPipelineLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GPUPipelineLayout.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUPipelineLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,OAAO,iBAAiB;IAG7B,MAAM,CAAC,UAAU,CAAC,MAAM;QACvB,IAAI,MAAM,EAAE;YACX,MAAM,GAAG,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACpC,GAAG,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;YACtB,OAAO,GAAG,CAAC;SACX;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
@@ -0,0 +1,5 @@
1
+ import { native_ } from './Constants';
2
+ export declare class GPUQuerySet {
3
+ [native_]: any;
4
+ static fromNative(query: any): GPUQuerySet;
5
+ }
@@ -0,0 +1,12 @@
1
+ import { native_ } from './Constants';
2
+ export class GPUQuerySet {
3
+ static fromNative(query) {
4
+ if (query) {
5
+ const ret = new GPUQuerySet();
6
+ ret[native_] = query;
7
+ return ret;
8
+ }
9
+ return null;
10
+ }
11
+ }
12
+ //# sourceMappingURL=GPUQuerySet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GPUQuerySet.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUQuerySet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,OAAO,WAAW;IAGvB,MAAM,CAAC,UAAU,CAAC,KAAK;QACtB,IAAI,KAAK,EAAE;YACV,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACrB,OAAO,GAAG,CAAC;SACX;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
@@ -0,0 +1,14 @@
1
+ import { native_ } from './Constants';
2
+ import { GPUBuffer } from './GPUBuffer';
3
+ import { GPUCommandBuffer } from './GPUCommandBuffer';
4
+ import { GPUImageCopyExternalImage, GPUImageCopyTexture, GPUImageCopyTextureTagged, GPUImageDataLayout } from './Interfaces';
5
+ import { GPUExtent3D } from './Types';
6
+ export declare class GPUQueue {
7
+ [native_]: any;
8
+ static fromNative(value: any): GPUQueue;
9
+ copyExternalImageToTexture(source: GPUImageCopyExternalImage, destination: GPUImageCopyTextureTagged, copySize: GPUExtent3D): void;
10
+ submit(commands: GPUCommandBuffer[]): void;
11
+ onSubmittedWorkDone(): Promise<void>;
12
+ writeBuffer(buffer: GPUBuffer, bufferOffset: number, data: BufferSource | Array<number>, dataOffset?: number, size?: number): void;
13
+ writeTexture(destination: GPUImageCopyTexture, data: BufferSource, dataLayout: GPUImageDataLayout, size: GPUExtent3D): void;
14
+ }
@@ -0,0 +1,77 @@
1
+ import { ImageAsset } from '../ImageAsset';
2
+ import { native_ } from './Constants';
3
+ export class GPUQueue {
4
+ static fromNative(value) {
5
+ if (value) {
6
+ const ret = new GPUQueue();
7
+ ret[native_] = value;
8
+ return ret;
9
+ }
10
+ return null;
11
+ }
12
+ copyExternalImageToTexture(source, destination, copySize) {
13
+ destination.texture = destination.texture[native_];
14
+ if (source.source) {
15
+ if (source.source instanceof ImageBitmap) {
16
+ source.source = source.source.native;
17
+ }
18
+ else if (source.source instanceof ImageData) {
19
+ source.source = source.source.native;
20
+ }
21
+ else if (source.source instanceof ImageAsset) {
22
+ source.source = source.source.native;
23
+ }
24
+ else if (typeof source.source.tagName === 'string' && (source.source.tagName === 'IMG' || source.source.tagName === 'IMAGE')) {
25
+ if (source.source._asset instanceof ImageAsset) {
26
+ source.source = source.source._asset.native;
27
+ }
28
+ }
29
+ }
30
+ if (Array.isArray(copySize)) {
31
+ copySize = {
32
+ width: copySize[0],
33
+ height: copySize[1] ?? 1,
34
+ depthOrArrayLayers: copySize[2] ?? 1,
35
+ };
36
+ }
37
+ this[native_].copyExternalImageToTexture(source, destination, copySize);
38
+ }
39
+ submit(commands) {
40
+ if (Array.isArray(commands)) {
41
+ this[native_].submit(commands.map((command) => {
42
+ return command[native_];
43
+ }));
44
+ }
45
+ }
46
+ onSubmittedWorkDone() {
47
+ return new Promise((resolve, reject) => {
48
+ this[native_].onSubmittedWorkDone(() => {
49
+ resolve();
50
+ });
51
+ });
52
+ }
53
+ writeBuffer(buffer, bufferOffset, data, dataOffset, size) {
54
+ if (Array.isArray(data)) {
55
+ data = new Uint8Array(data);
56
+ }
57
+ else if (ArrayBuffer.isView(data)) {
58
+ data = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
59
+ }
60
+ else if (data instanceof ArrayBuffer) {
61
+ data = new Uint8Array(data);
62
+ }
63
+ this[native_].writeBuffer(buffer?.[native_], bufferOffset ?? 0, data, dataOffset ?? 0, size ?? -1);
64
+ }
65
+ writeTexture(destination, data, dataLayout, size) {
66
+ destination.texture = destination.texture[native_];
67
+ if (Array.isArray(size)) {
68
+ size = {
69
+ width: size[0],
70
+ height: size[1] ?? 1,
71
+ depthOrArrayLayers: size[2] ?? 1,
72
+ };
73
+ }
74
+ this[native_].writeTexture(destination, data, dataLayout, size);
75
+ }
76
+ }
77
+ //# sourceMappingURL=GPUQueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GPUQueue.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPUQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,MAAM,OAAO,QAAQ;IAGpB,MAAM,CAAC,UAAU,CAAC,KAAK;QACtB,IAAI,KAAK,EAAE;YACV,MAAM,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC3B,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACrB,OAAO,GAAG,CAAC;SACX;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,0BAA0B,CAAC,MAAiC,EAAE,WAAsC,EAAE,QAAqB;QAC1H,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,MAAM,CAAC,MAAM,EAAE;YAClB,IAAI,MAAM,CAAC,MAAM,YAAY,WAAW,EAAE;gBACzC,MAAM,CAAC,MAAM,GAAI,MAAM,CAAC,MAAc,CAAC,MAAM,CAAC;aAC9C;iBAAM,IAAI,MAAM,CAAC,MAAM,YAAY,SAAS,EAAE;gBAC9C,MAAM,CAAC,MAAM,GAAI,MAAM,CAAC,MAAc,CAAC,MAAM,CAAC;aAC9C;iBAAM,IAAI,MAAM,CAAC,MAAM,YAAY,UAAU,EAAE;gBAC/C,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;aACrC;iBAAM,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,KAAK,IAAI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IAAI,CAAC,CAAC;SAC5B;aAAM,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACpC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;SACrE;aAAM,IAAK,IAAY,YAAY,WAAW,EAAE;YAChD,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;SAC5B;QAED,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACpG,CAAC;IAED,YAAY,CAAC,WAAgC,EAAE,IAAkB,EAAE,UAA8B,EAAE,IAAiB;QACnH,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxB,IAAI,GAAG;gBACN,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;gBACd,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBACpB,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;aAChC,CAAC;SACF;QACD,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC;CACD"}
@@ -0,0 +1,5 @@
1
+ import { native_ } from './Constants';
2
+ export declare class GPURenderBundle {
3
+ [native_]: any;
4
+ static fromNative(value: any): GPURenderBundle;
5
+ }
@@ -0,0 +1,12 @@
1
+ import { native_ } from './Constants';
2
+ export class GPURenderBundle {
3
+ static fromNative(value) {
4
+ if (value) {
5
+ const ret = new GPURenderBundle();
6
+ ret[native_] = value;
7
+ return ret;
8
+ }
9
+ return null;
10
+ }
11
+ }
12
+ //# sourceMappingURL=GPURenderBundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GPURenderBundle.js","sourceRoot":"","sources":["../../../../packages/canvas/WebGPU/GPURenderBundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,OAAO,eAAe;IAG3B,MAAM,CAAC,UAAU,CAAC,KAAK;QACtB,IAAI,KAAK,EAAE;YACV,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;YAClC,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACrB,OAAO,GAAG,CAAC;SACX;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
@@ -0,0 +1,20 @@
1
+ import { native_ } from './Constants';
2
+ import { GPUBindGroup } from './GPUBindGroup';
3
+ import { GPUBuffer } from './GPUBuffer';
4
+ import { GPURenderPipeline } from './GPURenderPipeline';
5
+ export declare class GPURenderBundleEncoder {
6
+ [native_]: any;
7
+ draw(vertexCount: number, instanceCount?: number, firstVertex?: number, firstInstance?: number): void;
8
+ drawIndexed(indexCount: number, instanceCount?: number, firstVertex?: number, firstInstance?: number): void;
9
+ drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;
10
+ drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;
11
+ finish(): void;
12
+ insertDebugMarker(markerLabel: string): void;
13
+ popDebugGroup(): void;
14
+ pushDebugGroup(groupLabel: string): void;
15
+ setBindGroup(index: number, bindGroup: GPUBindGroup, dynamicOffsetsData?: number[] | Uint32Array, dynamicOffsetsDataStart?: number, dynamicOffsetsDataLength?: number): void;
16
+ setIndexBuffer(buffer: GPUBindGroup, indexFormat: 'uint16' | 'uint32', offset?: number, size?: number): void;
17
+ setPipeline(renderPipeline: GPURenderPipeline): void;
18
+ setVertexBuffer(slot: number, buffer: GPUBuffer, offset?: number, size?: number): void;
19
+ static fromNative(encoder: any): GPURenderBundleEncoder;
20
+ }