react-native-wgpu 0.5.13 → 0.5.14

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 (405) hide show
  1. package/README.md +13 -386
  2. package/lib/commonjs/index.js +7 -4
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/module/index.js +4 -4
  5. package/lib/module/index.js.map +1 -1
  6. package/lib/typescript/webgpu/src/Canvas.d.ts.map +1 -0
  7. package/lib/typescript/webgpu/src/NativeWebGPUModule.d.ts.map +1 -0
  8. package/lib/typescript/webgpu/src/Offscreen.d.ts.map +1 -0
  9. package/lib/typescript/webgpu/src/WebGPUViewNativeComponent.d.ts.map +1 -0
  10. package/lib/typescript/webgpu/src/external/ModuleProxy.d.ts.map +1 -0
  11. package/lib/typescript/webgpu/src/external/index.d.ts.map +1 -0
  12. package/lib/typescript/webgpu/src/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
  13. package/lib/typescript/webgpu/src/external/reanimated/index.d.ts.map +1 -0
  14. package/lib/typescript/webgpu/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
  15. package/lib/typescript/webgpu/src/hooks.d.ts.map +1 -0
  16. package/lib/typescript/webgpu/src/index.d.ts.map +1 -0
  17. package/lib/typescript/webgpu/src/main/index.d.ts.map +1 -0
  18. package/lib/typescript/webgpu/src/types.d.ts.map +1 -0
  19. package/lib/typescript/{eslint.config.d.mts.map → webgpu-shim/eslint.config.d.mts.map} +1 -1
  20. package/lib/typescript/{lib → webgpu-shim/lib}/commonjs/index.d.ts.map +1 -1
  21. package/lib/typescript/webgpu-shim/lib/module/index.d.ts +2 -0
  22. package/lib/typescript/{lib → webgpu-shim/lib}/module/index.d.ts.map +1 -1
  23. package/lib/typescript/webgpu-shim/src/index.d.ts +2 -0
  24. package/lib/typescript/webgpu-shim/src/index.d.ts.map +1 -0
  25. package/package.json +12 -81
  26. package/src/index.ts +9 -0
  27. package/LICENSE +0 -20
  28. package/android/CMakeLists.txt +0 -110
  29. package/android/build.gradle +0 -138
  30. package/android/cpp/AndroidPlatformContext.h +0 -328
  31. package/android/cpp/cpp-adapter.cpp +0 -71
  32. package/android/src/main/AndroidManifest.xml +0 -3
  33. package/android/src/main/java/com/webgpu/WebGPUAHBView.java +0 -298
  34. package/android/src/main/java/com/webgpu/WebGPUAPI.java +0 -20
  35. package/android/src/main/java/com/webgpu/WebGPUBaseView.java +0 -61
  36. package/android/src/main/java/com/webgpu/WebGPUModule.java +0 -50
  37. package/android/src/main/java/com/webgpu/WebGPUSurfaceView.java +0 -41
  38. package/android/src/main/java/com/webgpu/WebGPUSurfaceViewWithSC.java +0 -79
  39. package/android/src/main/java/com/webgpu/WebGPUTextureView.java +0 -46
  40. package/android/src/main/java/com/webgpu/WebGPUView.java +0 -108
  41. package/android/src/main/java/com/webgpu/WebGPUViewManager.java +0 -38
  42. package/android/src/main/java/com/webgpu/WebGPUViewPackage.java +0 -50
  43. package/android/src/newarch/com/webgpu/WebGPUViewManagerSpec.java +0 -24
  44. package/apple/ApplePlatformContext.h +0 -44
  45. package/apple/ApplePlatformContext.mm +0 -302
  46. package/apple/AppleVideoPlayer.h +0 -31
  47. package/apple/AppleVideoPlayer.mm +0 -314
  48. package/apple/MetalView.h +0 -13
  49. package/apple/MetalView.mm +0 -50
  50. package/apple/RNWGUIKit.h +0 -16
  51. package/apple/WebGPUModule.h +0 -13
  52. package/apple/WebGPUModule.mm +0 -89
  53. package/apple/WebGPUView.h +0 -12
  54. package/apple/WebGPUView.mm +0 -66
  55. package/cpp/WGPULogger.h +0 -100
  56. package/cpp/dawn_logging.cpp +0 -119
  57. package/cpp/jsi/EnumMapper.h +0 -45
  58. package/cpp/jsi/JSIConverter.h +0 -473
  59. package/cpp/jsi/NativeObject.h +0 -607
  60. package/cpp/jsi/Promise.cpp +0 -44
  61. package/cpp/jsi/Promise.h +0 -35
  62. package/cpp/jsi/RuntimeAwareCache.cpp +0 -7
  63. package/cpp/jsi/RuntimeAwareCache.h +0 -100
  64. package/cpp/jsi/RuntimeLifecycleMonitor.cpp +0 -72
  65. package/cpp/jsi/RuntimeLifecycleMonitor.h +0 -32
  66. package/cpp/rnwgpu/ArrayBuffer.h +0 -117
  67. package/cpp/rnwgpu/PlatformContext.h +0 -127
  68. package/cpp/rnwgpu/RNWebGPUManager.cpp +0 -237
  69. package/cpp/rnwgpu/RNWebGPUManager.h +0 -46
  70. package/cpp/rnwgpu/SurfaceRegistry.h +0 -230
  71. package/cpp/rnwgpu/api/Canvas.h +0 -57
  72. package/cpp/rnwgpu/api/Convertors.h +0 -783
  73. package/cpp/rnwgpu/api/External.h +0 -12
  74. package/cpp/rnwgpu/api/GPU.cpp +0 -154
  75. package/cpp/rnwgpu/api/GPU.h +0 -58
  76. package/cpp/rnwgpu/api/GPUAdapter.cpp +0 -267
  77. package/cpp/rnwgpu/api/GPUAdapter.h +0 -59
  78. package/cpp/rnwgpu/api/GPUAdapterInfo.h +0 -57
  79. package/cpp/rnwgpu/api/GPUBindGroup.cpp +0 -3
  80. package/cpp/rnwgpu/api/GPUBindGroup.h +0 -51
  81. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +0 -52
  82. package/cpp/rnwgpu/api/GPUBuffer.cpp +0 -97
  83. package/cpp/rnwgpu/api/GPUBuffer.h +0 -87
  84. package/cpp/rnwgpu/api/GPUCanvasContext.cpp +0 -67
  85. package/cpp/rnwgpu/api/GPUCanvasContext.h +0 -66
  86. package/cpp/rnwgpu/api/GPUCommandBuffer.h +0 -45
  87. package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +0 -179
  88. package/cpp/rnwgpu/api/GPUCommandEncoder.h +0 -111
  89. package/cpp/rnwgpu/api/GPUCompilationInfo.h +0 -79
  90. package/cpp/rnwgpu/api/GPUCompilationMessage.h +0 -36
  91. package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +0 -60
  92. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +0 -85
  93. package/cpp/rnwgpu/api/GPUComputePipeline.cpp +0 -12
  94. package/cpp/rnwgpu/api/GPUComputePipeline.h +0 -60
  95. package/cpp/rnwgpu/api/GPUDevice.cpp +0 -545
  96. package/cpp/rnwgpu/api/GPUDevice.h +0 -265
  97. package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +0 -7
  98. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +0 -40
  99. package/cpp/rnwgpu/api/GPUError.h +0 -35
  100. package/cpp/rnwgpu/api/GPUExtent3D.h +0 -66
  101. package/cpp/rnwgpu/api/GPUExternalTexture.cpp +0 -335
  102. package/cpp/rnwgpu/api/GPUExternalTexture.h +0 -90
  103. package/cpp/rnwgpu/api/GPUFeatures.h +0 -206
  104. package/cpp/rnwgpu/api/GPUInternalError.h +0 -31
  105. package/cpp/rnwgpu/api/GPUOrigin2D.h +0 -55
  106. package/cpp/rnwgpu/api/GPUOrigin3D.h +0 -62
  107. package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +0 -33
  108. package/cpp/rnwgpu/api/GPUPipelineLayout.h +0 -45
  109. package/cpp/rnwgpu/api/GPUQuerySet.cpp +0 -11
  110. package/cpp/rnwgpu/api/GPUQuerySet.h +0 -73
  111. package/cpp/rnwgpu/api/GPUQueue.cpp +0 -169
  112. package/cpp/rnwgpu/api/GPUQueue.h +0 -81
  113. package/cpp/rnwgpu/api/GPURenderBundle.h +0 -44
  114. package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +0 -131
  115. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +0 -110
  116. package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +0 -165
  117. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +0 -130
  118. package/cpp/rnwgpu/api/GPURenderPipeline.cpp +0 -13
  119. package/cpp/rnwgpu/api/GPURenderPipeline.h +0 -61
  120. package/cpp/rnwgpu/api/GPUSampler.h +0 -44
  121. package/cpp/rnwgpu/api/GPUShaderModule.cpp +0 -50
  122. package/cpp/rnwgpu/api/GPUShaderModule.h +0 -66
  123. package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +0 -80
  124. package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +0 -71
  125. package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +0 -129
  126. package/cpp/rnwgpu/api/GPUSupportedLimits.h +0 -131
  127. package/cpp/rnwgpu/api/GPUTexture.cpp +0 -47
  128. package/cpp/rnwgpu/api/GPUTexture.h +0 -162
  129. package/cpp/rnwgpu/api/GPUTextureView.h +0 -44
  130. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -71
  131. package/cpp/rnwgpu/api/GPUValidationError.h +0 -32
  132. package/cpp/rnwgpu/api/ImageBitmap.h +0 -48
  133. package/cpp/rnwgpu/api/RNWebGPU.h +0 -241
  134. package/cpp/rnwgpu/api/RnFeatures.h +0 -53
  135. package/cpp/rnwgpu/api/VideoFrame.h +0 -76
  136. package/cpp/rnwgpu/api/VideoPlayer.h +0 -69
  137. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +0 -65
  138. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +0 -81
  139. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +0 -57
  140. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +0 -98
  141. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +0 -58
  142. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +0 -53
  143. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +0 -57
  144. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +0 -57
  145. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +0 -60
  146. package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +0 -39
  147. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +0 -76
  148. package/cpp/rnwgpu/api/descriptors/GPUColor.h +0 -67
  149. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +0 -59
  150. package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +0 -29
  151. package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +0 -46
  152. package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +0 -46
  153. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +0 -57
  154. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +0 -59
  155. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +0 -68
  156. package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +0 -57
  157. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +0 -104
  158. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +0 -115
  159. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +0 -39
  160. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +0 -82
  161. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +0 -74
  162. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +0 -63
  163. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +0 -63
  164. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +0 -66
  165. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +0 -82
  166. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +0 -55
  167. package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +0 -22
  168. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +0 -55
  169. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +0 -58
  170. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +0 -70
  171. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +0 -62
  172. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +0 -56
  173. package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +0 -44
  174. package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +0 -46
  175. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +0 -81
  176. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +0 -82
  177. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +0 -102
  178. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +0 -93
  179. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +0 -59
  180. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +0 -104
  181. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +0 -52
  182. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +0 -46
  183. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +0 -111
  184. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +0 -61
  185. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +0 -63
  186. package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +0 -25
  187. package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +0 -62
  188. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +0 -65
  189. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +0 -60
  190. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +0 -60
  191. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +0 -92
  192. package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +0 -29
  193. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +0 -92
  194. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +0 -65
  195. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +0 -54
  196. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +0 -63
  197. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +0 -74
  198. package/cpp/rnwgpu/api/descriptors/Unions.h +0 -1979
  199. package/cpp/rnwgpu/async/AsyncDispatcher.h +0 -28
  200. package/cpp/rnwgpu/async/AsyncRunner.cpp +0 -215
  201. package/cpp/rnwgpu/async/AsyncRunner.h +0 -53
  202. package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +0 -181
  203. package/cpp/rnwgpu/async/AsyncTaskHandle.h +0 -55
  204. package/cpp/rnwgpu/async/JSIMicrotaskDispatcher.cpp +0 -23
  205. package/cpp/rnwgpu/async/JSIMicrotaskDispatcher.h +0 -22
  206. package/cpp/webgpu/webgpu.h +0 -4979
  207. package/cpp/webgpu/webgpu_cpp.h +0 -10059
  208. package/cpp/webgpu/webgpu_cpp_chained_struct.h +0 -57
  209. package/cpp/webgpu/webgpu_cpp_print.h +0 -2844
  210. package/cpp/webgpu/webgpu_enum_class_bitmasks.h +0 -161
  211. package/lib/commonjs/Canvas.js +0 -55
  212. package/lib/commonjs/Canvas.js.map +0 -1
  213. package/lib/commonjs/NativeWebGPUModule.js +0 -10
  214. package/lib/commonjs/NativeWebGPUModule.js.map +0 -1
  215. package/lib/commonjs/Offscreen.js +0 -103
  216. package/lib/commonjs/Offscreen.js.map +0 -1
  217. package/lib/commonjs/WebGPUViewNativeComponent.js +0 -10
  218. package/lib/commonjs/WebGPUViewNativeComponent.js.map +0 -1
  219. package/lib/commonjs/WebGPUViewNativeComponent.web.js +0 -103
  220. package/lib/commonjs/WebGPUViewNativeComponent.web.js.map +0 -1
  221. package/lib/commonjs/WebPolyfillGPUModule.js +0 -40
  222. package/lib/commonjs/WebPolyfillGPUModule.js.map +0 -1
  223. package/lib/commonjs/external/ModuleProxy.js +0 -36
  224. package/lib/commonjs/external/ModuleProxy.js.map +0 -1
  225. package/lib/commonjs/external/index.js +0 -17
  226. package/lib/commonjs/external/index.js.map +0 -1
  227. package/lib/commonjs/external/reanimated/ReanimatedProxy.js +0 -18
  228. package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +0 -1
  229. package/lib/commonjs/external/reanimated/index.js +0 -21
  230. package/lib/commonjs/external/reanimated/index.js.map +0 -1
  231. package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js +0 -49
  232. package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js.map +0 -1
  233. package/lib/commonjs/hooks.js +0 -83
  234. package/lib/commonjs/hooks.js.map +0 -1
  235. package/lib/commonjs/main/index.js +0 -91
  236. package/lib/commonjs/main/index.js.map +0 -1
  237. package/lib/commonjs/main/index.web.js +0 -51
  238. package/lib/commonjs/main/index.web.js.map +0 -1
  239. package/lib/commonjs/types.js +0 -2
  240. package/lib/commonjs/types.js.map +0 -1
  241. package/lib/commonjs/utils.js +0 -11
  242. package/lib/commonjs/utils.js.map +0 -1
  243. package/lib/module/Canvas.js +0 -46
  244. package/lib/module/Canvas.js.map +0 -1
  245. package/lib/module/NativeWebGPUModule.js +0 -4
  246. package/lib/module/NativeWebGPUModule.js.map +0 -1
  247. package/lib/module/Offscreen.js +0 -96
  248. package/lib/module/Offscreen.js.map +0 -1
  249. package/lib/module/WebGPUViewNativeComponent.js +0 -4
  250. package/lib/module/WebGPUViewNativeComponent.js.map +0 -1
  251. package/lib/module/WebGPUViewNativeComponent.web.js +0 -96
  252. package/lib/module/WebGPUViewNativeComponent.web.js.map +0 -1
  253. package/lib/module/WebPolyfillGPUModule.js +0 -38
  254. package/lib/module/WebPolyfillGPUModule.js.map +0 -1
  255. package/lib/module/external/ModuleProxy.js +0 -28
  256. package/lib/module/external/ModuleProxy.js.map +0 -1
  257. package/lib/module/external/index.js +0 -2
  258. package/lib/module/external/index.js.map +0 -1
  259. package/lib/module/external/reanimated/ReanimatedProxy.js +0 -12
  260. package/lib/module/external/reanimated/ReanimatedProxy.js.map +0 -1
  261. package/lib/module/external/reanimated/index.js +0 -3
  262. package/lib/module/external/reanimated/index.js.map +0 -1
  263. package/lib/module/external/reanimated/registerWebGPUForReanimated.js +0 -42
  264. package/lib/module/external/reanimated/registerWebGPUForReanimated.js.map +0 -1
  265. package/lib/module/hooks.js +0 -70
  266. package/lib/module/hooks.js.map +0 -1
  267. package/lib/module/main/index.js +0 -33
  268. package/lib/module/main/index.js.map +0 -1
  269. package/lib/module/main/index.web.js +0 -8
  270. package/lib/module/main/index.web.js.map +0 -1
  271. package/lib/module/types.js +0 -2
  272. package/lib/module/types.js.map +0 -1
  273. package/lib/module/utils.js +0 -5
  274. package/lib/module/utils.js.map +0 -1
  275. package/lib/typescript/babel.config.d.ts +0 -3
  276. package/lib/typescript/babel.config.d.ts.map +0 -1
  277. package/lib/typescript/jest.config.d.ts +0 -9
  278. package/lib/typescript/jest.config.d.ts.map +0 -1
  279. package/lib/typescript/lib/commonjs/Canvas.d.ts +0 -7
  280. package/lib/typescript/lib/commonjs/Canvas.d.ts.map +0 -1
  281. package/lib/typescript/lib/commonjs/NativeWebGPUModule.d.ts +0 -5
  282. package/lib/typescript/lib/commonjs/NativeWebGPUModule.d.ts.map +0 -1
  283. package/lib/typescript/lib/commonjs/Offscreen.d.ts +0 -26
  284. package/lib/typescript/lib/commonjs/Offscreen.d.ts.map +0 -1
  285. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts +0 -5
  286. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts.map +0 -1
  287. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.web.d.ts +0 -4
  288. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.web.d.ts.map +0 -1
  289. package/lib/typescript/lib/commonjs/WebPolyfillGPUModule.d.ts +0 -2
  290. package/lib/typescript/lib/commonjs/WebPolyfillGPUModule.d.ts.map +0 -1
  291. package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts +0 -12
  292. package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts.map +0 -1
  293. package/lib/typescript/lib/commonjs/external/index.d.ts.map +0 -1
  294. package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +0 -6
  295. package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts.map +0 -1
  296. package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts +0 -4
  297. package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts.map +0 -1
  298. package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts +0 -9
  299. package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts.map +0 -1
  300. package/lib/typescript/lib/commonjs/hooks.d.ts +0 -18
  301. package/lib/typescript/lib/commonjs/hooks.d.ts.map +0 -1
  302. package/lib/typescript/lib/commonjs/index.d.ts +0 -2
  303. package/lib/typescript/lib/commonjs/main/index.d.ts +0 -3
  304. package/lib/typescript/lib/commonjs/main/index.d.ts.map +0 -1
  305. package/lib/typescript/lib/commonjs/main/index.web.d.ts +0 -2
  306. package/lib/typescript/lib/commonjs/main/index.web.d.ts.map +0 -1
  307. package/lib/typescript/lib/commonjs/types.d.ts +0 -1
  308. package/lib/typescript/lib/commonjs/types.d.ts.map +0 -1
  309. package/lib/typescript/lib/commonjs/utils.d.ts +0 -3
  310. package/lib/typescript/lib/commonjs/utils.d.ts.map +0 -1
  311. package/lib/typescript/lib/module/Canvas.d.ts +0 -8
  312. package/lib/typescript/lib/module/Canvas.d.ts.map +0 -1
  313. package/lib/typescript/lib/module/NativeWebGPUModule.d.ts +0 -3
  314. package/lib/typescript/lib/module/NativeWebGPUModule.d.ts.map +0 -1
  315. package/lib/typescript/lib/module/Offscreen.d.ts +0 -25
  316. package/lib/typescript/lib/module/Offscreen.d.ts.map +0 -1
  317. package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts +0 -3
  318. package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts.map +0 -1
  319. package/lib/typescript/lib/module/WebGPUViewNativeComponent.web.d.ts +0 -3
  320. package/lib/typescript/lib/module/WebGPUViewNativeComponent.web.d.ts.map +0 -1
  321. package/lib/typescript/lib/module/WebPolyfillGPUModule.d.ts +0 -2
  322. package/lib/typescript/lib/module/WebPolyfillGPUModule.d.ts.map +0 -1
  323. package/lib/typescript/lib/module/external/ModuleProxy.d.ts +0 -7
  324. package/lib/typescript/lib/module/external/ModuleProxy.d.ts.map +0 -1
  325. package/lib/typescript/lib/module/external/index.d.ts.map +0 -1
  326. package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts +0 -5
  327. package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts.map +0 -1
  328. package/lib/typescript/lib/module/external/reanimated/index.d.ts.map +0 -1
  329. package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts +0 -2
  330. package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts.map +0 -1
  331. package/lib/typescript/lib/module/hooks.d.ts +0 -18
  332. package/lib/typescript/lib/module/hooks.d.ts.map +0 -1
  333. package/lib/typescript/lib/module/index.d.ts +0 -2
  334. package/lib/typescript/lib/module/main/index.d.ts.map +0 -1
  335. package/lib/typescript/lib/module/main/index.web.d.ts +0 -5
  336. package/lib/typescript/lib/module/main/index.web.d.ts.map +0 -1
  337. package/lib/typescript/lib/module/types.d.ts +0 -1
  338. package/lib/typescript/lib/module/types.d.ts.map +0 -1
  339. package/lib/typescript/lib/module/utils.d.ts +0 -2
  340. package/lib/typescript/lib/module/utils.d.ts.map +0 -1
  341. package/lib/typescript/src/Canvas.d.ts.map +0 -1
  342. package/lib/typescript/src/NativeWebGPUModule.d.ts.map +0 -1
  343. package/lib/typescript/src/Offscreen.d.ts.map +0 -1
  344. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +0 -1
  345. package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts +0 -9
  346. package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts.map +0 -1
  347. package/lib/typescript/src/WebPolyfillGPUModule.d.ts +0 -2
  348. package/lib/typescript/src/WebPolyfillGPUModule.d.ts.map +0 -1
  349. package/lib/typescript/src/external/ModuleProxy.d.ts.map +0 -1
  350. package/lib/typescript/src/external/index.d.ts +0 -2
  351. package/lib/typescript/src/external/index.d.ts.map +0 -1
  352. package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts.map +0 -1
  353. package/lib/typescript/src/external/reanimated/index.d.ts +0 -3
  354. package/lib/typescript/src/external/reanimated/index.d.ts.map +0 -1
  355. package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +0 -1
  356. package/lib/typescript/src/hooks.d.ts.map +0 -1
  357. package/lib/typescript/src/index.d.ts.map +0 -1
  358. package/lib/typescript/src/main/index.d.ts +0 -6
  359. package/lib/typescript/src/main/index.d.ts.map +0 -1
  360. package/lib/typescript/src/main/index.web.d.ts +0 -6
  361. package/lib/typescript/src/main/index.web.d.ts.map +0 -1
  362. package/lib/typescript/src/types.d.ts.map +0 -1
  363. package/lib/typescript/src/utils.d.ts +0 -2
  364. package/lib/typescript/src/utils.d.ts.map +0 -1
  365. package/libs/android/arm64-v8a/libwebgpu_dawn.so +0 -0
  366. package/libs/android/armeabi-v7a/libwebgpu_dawn.so +0 -0
  367. package/libs/android/x86/libwebgpu_dawn.so +0 -0
  368. package/libs/android/x86_64/libwebgpu_dawn.so +0 -0
  369. package/libs/apple/libwebgpu_dawn.xcframework/Info.plist +0 -59
  370. package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
  371. package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
  372. package/libs/apple/libwebgpu_dawn.xcframework/macos-arm64_x86_64/libwebgpu_dawn.a +0 -0
  373. package/react-native-wgpu.podspec +0 -47
  374. package/src/Canvas.tsx +0 -76
  375. package/src/NativeWebGPUModule.ts +0 -9
  376. package/src/Offscreen.ts +0 -113
  377. package/src/WebGPUViewNativeComponent.ts +0 -11
  378. package/src/WebGPUViewNativeComponent.web.ts +0 -113
  379. package/src/WebPolyfillGPUModule.ts +0 -53
  380. package/src/external/ModuleProxy.ts +0 -30
  381. package/src/external/index.ts +0 -1
  382. package/src/external/reanimated/ReanimatedProxy.ts +0 -19
  383. package/src/external/reanimated/index.ts +0 -2
  384. package/src/external/reanimated/registerWebGPUForReanimated.ts +0 -43
  385. package/src/hooks.tsx +0 -93
  386. package/src/index.tsx +0 -91
  387. package/src/main/index.tsx +0 -40
  388. package/src/main/index.web.tsx +0 -8
  389. package/src/types.ts +0 -102
  390. package/src/utils.ts +0 -4
  391. /package/lib/typescript/{src → webgpu/src}/Canvas.d.ts +0 -0
  392. /package/lib/typescript/{src → webgpu/src}/NativeWebGPUModule.d.ts +0 -0
  393. /package/lib/typescript/{src → webgpu/src}/Offscreen.d.ts +0 -0
  394. /package/lib/typescript/{src → webgpu/src}/WebGPUViewNativeComponent.d.ts +0 -0
  395. /package/lib/typescript/{src → webgpu/src}/external/ModuleProxy.d.ts +0 -0
  396. /package/lib/typescript/{lib/module → webgpu/src}/external/index.d.ts +0 -0
  397. /package/lib/typescript/{src → webgpu/src}/external/reanimated/ReanimatedProxy.d.ts +0 -0
  398. /package/lib/typescript/{lib/module → webgpu/src}/external/reanimated/index.d.ts +0 -0
  399. /package/lib/typescript/{src → webgpu/src}/external/reanimated/registerWebGPUForReanimated.d.ts +0 -0
  400. /package/lib/typescript/{src → webgpu/src}/hooks.d.ts +0 -0
  401. /package/lib/typescript/{src → webgpu/src}/index.d.ts +0 -0
  402. /package/lib/typescript/{lib/module → webgpu/src}/main/index.d.ts +0 -0
  403. /package/lib/typescript/{src → webgpu/src}/types.d.ts +0 -0
  404. /package/lib/typescript/{eslint.config.d.mts → webgpu-shim/eslint.config.d.mts} +0 -0
  405. /package/lib/typescript/{lib/commonjs/external → webgpu-shim/lib/commonjs}/index.d.ts +0 -0
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.registerWebGPUForReanimated = void 0;
7
- // Declare global WebGPU worklet helper functions (installed by native module)
8
-
9
- let isRegistered = false;
10
-
11
- /**
12
- * Register WebGPU objects for Worklets serialization.
13
- * This allows GPUDevice, GPUCanvasContext, etc. to be passed to worklets.
14
- *
15
- * This is called automatically when the module loads if react-native-worklets is installed.
16
- */
17
- const registerWebGPUForReanimated = () => {
18
- if (isRegistered) {
19
- return;
20
- }
21
- isRegistered = true;
22
- try {
23
- const {
24
- registerCustomSerializable
25
- } = require("react-native-worklets");
26
- registerCustomSerializable({
27
- name: "WebGPU",
28
- determine: value => {
29
- "worklet";
30
-
31
- return __webgpuIsWebGPUObject(value);
32
- },
33
- pack: value => {
34
- "worklet";
35
-
36
- return __webgpuBox(value);
37
- },
38
- unpack: boxed => {
39
- "worklet";
40
-
41
- return boxed.unbox();
42
- }
43
- });
44
- } catch {
45
- // react-native-worklets not installed, skip registration
46
- }
47
- };
48
- exports.registerWebGPUForReanimated = registerWebGPUForReanimated;
49
- //# sourceMappingURL=registerWebGPUForReanimated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["isRegistered","registerWebGPUForReanimated","registerCustomSerializable","require","name","determine","value","__webgpuIsWebGPUObject","pack","__webgpuBox","unpack","boxed","unbox","exports"],"sourceRoot":"../../../../src","sources":["external/reanimated/registerWebGPUForReanimated.ts"],"mappings":";;;;;;AAAA;;AAOA,IAAIA,YAAY,GAAG,KAAK;;AAExB;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,2BAA2B,GAAGA,CAAA,KAAM;EAC/C,IAAID,YAAY,EAAE;IAChB;EACF;EACAA,YAAY,GAAG,IAAI;EAEnB,IAAI;IACF,MAAM;MAAEE;IAA2B,CAAC,GAAGC,OAAO,CAAC,uBAAuB,CAAC;IAEvED,0BAA0B,CAAC;MACzBE,IAAI,EAAE,QAAQ;MACdC,SAAS,EAAGC,KAAa,IAAsB;QAC7C,SAAS;;QACT,OAAOC,sBAAsB,CAACD,KAAK,CAAC;MACtC,CAAC;MACDE,IAAI,EAAGF,KAAa,IAAK;QACvB,SAAS;;QACT,OAAOG,WAAW,CAACH,KAAK,CAAC;MAC3B,CAAC;MACDI,MAAM,EAAGC,KAA8B,IAAK;QAC1C,SAAS;;QACT,OAAOA,KAAK,CAACC,KAAK,CAAC,CAAC;MACtB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ,CAAC;AAACC,OAAA,CAAAZ,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.warnIfNotHardwareAccelerated = exports.useSurface = exports.useMainDevice = exports.useDevice = exports.useCanvasRef = exports.GPUDeviceProvider = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
9
- const warnIfNotHardwareAccelerated = adapter => {
10
- // Check if adapter is a fallback adapter using the new GPUAdapterInfo API
11
- // Note: isFallbackAdapter was moved from GPUAdapter to GPUAdapterInfo in Chrome 140
12
- if (adapter.info && adapter.info.isFallbackAdapter) {
13
- console.warn("GPUAdapter is not hardware accelerated. This is common on Android emulators. Rendering will be slow. Some features may be unavailable.");
14
- }
15
- };
16
- exports.warnIfNotHardwareAccelerated = warnIfNotHardwareAccelerated;
17
- const DeviceContext = /*#__PURE__*/(0, _react.createContext)(null);
18
- const GPUDeviceProvider = ({
19
- children,
20
- adapterOptions,
21
- deviceDescriptor
22
- }) => {
23
- const state = useDevice(adapterOptions, deviceDescriptor);
24
- if (!state.device) {
25
- return null;
26
- }
27
- return /*#__PURE__*/_react.default.createElement(DeviceContext.Provider, {
28
- value: state
29
- }, children);
30
- };
31
- exports.GPUDeviceProvider = GPUDeviceProvider;
32
- const useSurface = () => {
33
- const ref = (0, _react.useRef)(null);
34
- const [surface, setSurface] = (0, _react.useState)(null);
35
- (0, _react.useLayoutEffect)(() => {
36
- const sur = ref.current.getNativeSurface();
37
- setSurface(sur);
38
- }, []);
39
- return {
40
- ref,
41
- surface
42
- };
43
- };
44
- exports.useSurface = useSurface;
45
- const useMainDevice = () => {
46
- const ctx = (0, _react.useContext)(DeviceContext);
47
- if (!ctx) {
48
- throw new Error("No DeviceContext found.");
49
- }
50
- return ctx;
51
- };
52
- exports.useMainDevice = useMainDevice;
53
- const useCanvasRef = () => (0, _react.useRef)(null);
54
- exports.useCanvasRef = useCanvasRef;
55
- const useDevice = (adapterOptions, deviceDescriptor) => {
56
- const [state, setState] = (0, _react.useState)(null);
57
- (0, _react.useEffect)(() => {
58
- (async () => {
59
- if (!state) {
60
- const adapter = await navigator.gpu.requestAdapter(adapterOptions);
61
- if (!adapter) {
62
- throw new Error("No appropriate GPUAdapter found.");
63
- }
64
- warnIfNotHardwareAccelerated(adapter);
65
- const device = await adapter.requestDevice(deviceDescriptor);
66
- if (!device) {
67
- throw new Error("No appropriate GPUDevice found.");
68
- }
69
- setState({
70
- adapter,
71
- device
72
- });
73
- return;
74
- }
75
- })();
76
- }, [adapterOptions, deviceDescriptor, state]);
77
- return {
78
- adapter: state?.adapter ?? null,
79
- device: state?.device ?? null
80
- };
81
- };
82
- exports.useDevice = useDevice;
83
- //# sourceMappingURL=hooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","warnIfNotHardwareAccelerated","adapter","info","isFallbackAdapter","console","warn","exports","DeviceContext","createContext","GPUDeviceProvider","children","adapterOptions","deviceDescriptor","state","useDevice","device","createElement","Provider","value","useSurface","ref","useRef","surface","setSurface","useState","useLayoutEffect","sur","current","getNativeSurface","useMainDevice","ctx","useContext","Error","useCanvasRef","setState","useEffect","navigator","gpu","requestAdapter","requestDevice"],"sourceRoot":"../../src","sources":["hooks.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOe,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,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,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- WebGPUModule: true
8
- };
9
- Object.defineProperty(exports, "WebGPUModule", {
10
- enumerable: true,
11
- get: function () {
12
- return _NativeWebGPUModule.default;
13
- }
14
- });
15
- var _external = require("../external");
16
- var _NativeWebGPUModule = _interopRequireDefault(require("../NativeWebGPUModule"));
17
- var _Canvas = require("../Canvas");
18
- Object.keys(_Canvas).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
21
- if (key in exports && exports[key] === _Canvas[key]) return;
22
- Object.defineProperty(exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _Canvas[key];
26
- }
27
- });
28
- });
29
- var _Offscreen = require("../Offscreen");
30
- Object.keys(_Offscreen).forEach(function (key) {
31
- if (key === "default" || key === "__esModule") return;
32
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
33
- if (key in exports && exports[key] === _Offscreen[key]) return;
34
- Object.defineProperty(exports, key, {
35
- enumerable: true,
36
- get: function () {
37
- return _Offscreen[key];
38
- }
39
- });
40
- });
41
- var _WebGPUViewNativeComponent = require("../WebGPUViewNativeComponent");
42
- Object.keys(_WebGPUViewNativeComponent).forEach(function (key) {
43
- if (key === "default" || key === "__esModule") return;
44
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
45
- if (key in exports && exports[key] === _WebGPUViewNativeComponent[key]) return;
46
- Object.defineProperty(exports, key, {
47
- enumerable: true,
48
- get: function () {
49
- return _WebGPUViewNativeComponent[key];
50
- }
51
- });
52
- });
53
- var _hooks = require("../hooks");
54
- Object.keys(_hooks).forEach(function (key) {
55
- if (key === "default" || key === "__esModule") return;
56
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
57
- if (key in exports && exports[key] === _hooks[key]) return;
58
- Object.defineProperty(exports, key, {
59
- enumerable: true,
60
- get: function () {
61
- return _hooks[key];
62
- }
63
- });
64
- });
65
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
66
- const _installOk = _NativeWebGPUModule.default.install();
67
- (0, _external.registerWebGPUForReanimated)();
68
- if (typeof RNWebGPU !== "undefined") {
69
- if (!navigator) {
70
- // @ts-expect-error Navigation object is more complex than this, setting it to an empty object to add gpu property
71
- navigator = {
72
- gpu: RNWebGPU.gpu,
73
- userAgent: "react-native"
74
- };
75
- } else {
76
- navigator.gpu = RNWebGPU.gpu;
77
- if (typeof navigator.userAgent !== "string") {
78
- try {
79
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
80
- // @ts-ignore - Hermes navigator may not include a userAgent, align with the polyfill if needed
81
- navigator.userAgent = "react-native";
82
- } catch {
83
- // navigator.userAgent can be read-only; ignore if assignment fails
84
- }
85
- }
86
- }
87
- global.createImageBitmap = global.createImageBitmap ?? RNWebGPU.createImageBitmap.bind(RNWebGPU);
88
- } else {
89
- console.warn(`[react-native-wgpu] install() returned ${_installOk} but RNWebGPU global is not available`);
90
- }
91
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_external","require","_NativeWebGPUModule","_interopRequireDefault","_Canvas","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Offscreen","_WebGPUViewNativeComponent","_hooks","e","__esModule","default","_installOk","WebGPUModule","install","registerWebGPUForReanimated","RNWebGPU","navigator","gpu","userAgent","global","createImageBitmap","bind","console","warn"],"sourceRoot":"../../../src","sources":["main/index.tsx"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CA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"use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- require("../WebPolyfillGPUModule");
7
- var _Canvas = require("../Canvas");
8
- Object.keys(_Canvas).forEach(function (key) {
9
- if (key === "default" || key === "__esModule") return;
10
- if (key in exports && exports[key] === _Canvas[key]) return;
11
- Object.defineProperty(exports, key, {
12
- enumerable: true,
13
- get: function () {
14
- return _Canvas[key];
15
- }
16
- });
17
- });
18
- var _Offscreen = require("../Offscreen");
19
- Object.keys(_Offscreen).forEach(function (key) {
20
- if (key === "default" || key === "__esModule") return;
21
- if (key in exports && exports[key] === _Offscreen[key]) return;
22
- Object.defineProperty(exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _Offscreen[key];
26
- }
27
- });
28
- });
29
- var _WebGPUViewNativeComponent = require("../WebGPUViewNativeComponent");
30
- Object.keys(_WebGPUViewNativeComponent).forEach(function (key) {
31
- if (key === "default" || key === "__esModule") return;
32
- if (key in exports && exports[key] === _WebGPUViewNativeComponent[key]) return;
33
- Object.defineProperty(exports, key, {
34
- enumerable: true,
35
- get: function () {
36
- return _WebGPUViewNativeComponent[key];
37
- }
38
- });
39
- });
40
- var _hooks = require("../hooks");
41
- Object.keys(_hooks).forEach(function (key) {
42
- if (key === "default" || key === "__esModule") return;
43
- if (key in exports && exports[key] === _hooks[key]) return;
44
- Object.defineProperty(exports, key, {
45
- enumerable: true,
46
- get: function () {
47
- return _hooks[key];
48
- }
49
- });
50
- });
51
- //# sourceMappingURL=index.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["require","_Canvas","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_Offscreen","_WebGPUViewNativeComponent","_hooks"],"sourceRoot":"../../../src","sources":["main/index.web.tsx"],"mappings":";;;;;AAAAA,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GA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AAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,MAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.contextIdToId = contextIdToId;
7
- // Only used on the web
8
- function contextIdToId(contextId) {
9
- return "rnwgpu-canvas-" + contextId;
10
- }
11
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["contextIdToId","contextId"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAA;AACO,SAASA,aAAaA,CAACC,SAAiB,EAAE;EAC/C,OAAO,gBAAgB,GAAGA,SAAS;AACrC","ignoreList":[]}
@@ -1,46 +0,0 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useImperativeHandle, useRef, useState } from "react";
3
- import { View } from "react-native";
4
- import WebGPUNativeView from "./WebGPUViewNativeComponent";
5
- let CONTEXT_COUNTER = 1;
6
- function generateContextId() {
7
- return CONTEXT_COUNTER++;
8
- }
9
- export const Canvas = ({
10
- transparent,
11
- ref,
12
- ...props
13
- }) => {
14
- const viewRef = useRef(null);
15
- const [contextId, _] = useState(() => generateContextId());
16
- useImperativeHandle(ref, () => ({
17
- getContextId: () => contextId,
18
- getNativeSurface: () => {
19
- return RNWebGPU.getNativeSurface(contextId);
20
- },
21
- getContext(contextName) {
22
- if (contextName !== "webgpu") {
23
- throw new Error(`[WebGPU] Unsupported context: ${contextName}`);
24
- }
25
- if (!viewRef.current) {
26
- throw new Error("[WebGPU] Cannot get context before mount");
27
- }
28
- // getBoundingClientRect became stable in RN 0.83
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- const view = viewRef.current;
31
- const size = "getBoundingClientRect" in view ? view.getBoundingClientRect() : view.unstable_getBoundingClientRect();
32
- return RNWebGPU.MakeWebGPUCanvasContext(contextId, size.width, size.height);
33
- }
34
- }));
35
- return /*#__PURE__*/React.createElement(View, _extends({
36
- collapsable: false,
37
- ref: viewRef
38
- }, props), /*#__PURE__*/React.createElement(WebGPUNativeView, {
39
- style: {
40
- flex: 1
41
- },
42
- contextId: contextId,
43
- transparent: !!transparent
44
- }));
45
- };
46
- //# sourceMappingURL=Canvas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useImperativeHandle","useRef","useState","View","WebGPUNativeView","CONTEXT_COUNTER","generateContextId","Canvas","transparent","ref","props","viewRef","contextId","_","getContextId","getNativeSurface","RNWebGPU","getContext","contextName","Error","current","view","size","getBoundingClientRect","unstable_getBoundingClientRect","MakeWebGPUCanvasContext","width","height","createElement","_extends","collapsable","style","flex"],"sourceRoot":"../../src","sources":["Canvas.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,mBAAmB,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEpE,SAASC,IAAI,QAAQ,cAAc;AAEnC,OAAOC,gBAAgB,MAAM,6BAA6B;AAE1D,IAAIC,eAAe,GAAG,CAAC;AACvB,SAASC,iBAAiBA,CAAA,EAAG;EAC3B,OAAOD,eAAe,EAAE;AAC1B;AA2BA,OAAO,MAAME,MAAM,GAAGA,CAAC;EAAEC,WAAW;EAAEC,GAAG;EAAE,GAAGC;AAAmB,CAAC,KAAK;EACrE,MAAMC,OAAO,GAAGV,MAAM,CAAC,IAAI,CAAC;EAC5B,MAAM,CAACW,SAAS,EAAEC,CAAC,CAAC,GAAGX,QAAQ,CAAC,MAAMI,iBAAiB,CAAC,CAAC,CAAC;EAC1DN,mBAAmB,CAACS,GAAG,EAAE,OAAO;IAC9BK,YAAY,EAAEA,CAAA,KAAMF,SAAS;IAC7BG,gBAAgB,EAAEA,CAAA,KAAM;MACtB,OAAOC,QAAQ,CAACD,gBAAgB,CAACH,SAAS,CAAC;IAC7C,CAAC;IACDK,UAAUA,CAACC,WAAqB,EAA0B;MACxD,IAAIA,WAAW,KAAK,QAAQ,EAAE;QAC5B,MAAM,IAAIC,KAAK,CAAC,iCAAiCD,WAAW,EAAE,CAAC;MACjE;MACA,IAAI,CAACP,OAAO,CAACS,OAAO,EAAE;QACpB,MAAM,IAAID,KAAK,CAAC,0CAA0C,CAAC;MAC7D;MACA;MACA;MACA,MAAME,IAAI,GAAGV,OAAO,CAACS,OAAc;MACnC,MAAME,IAAI,GACR,uBAAuB,IAAID,IAAI,GAC3BA,IAAI,CAACE,qBAAqB,CAAC,CAAC,GAC5BF,IAAI,CAACG,8BAA8B,CAAC,CAAC;MAC3C,OAAOR,QAAQ,CAACS,uBAAuB,CACrCb,SAAS,EACTU,IAAI,CAACI,KAAK,EACVJ,IAAI,CAACK,MACP,CAAC;IACH;EACF,CAAC,CAAC,CAAC;EAEH,oBACE5B,KAAA,CAAA6B,aAAA,CAACzB,IAAI,EAAA0B,QAAA;IAACC,WAAW,EAAE,KAAM;IAACrB,GAAG,EAAEE;EAAQ,GAAKD,KAAK,gBAC/CX,KAAA,CAAA6B,aAAA,CAACxB,gBAAgB;IACf2B,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAE,CAAE;IACnBpB,SAAS,EAAEA,SAAU;IACrBJ,WAAW,EAAE,CAAC,CAACA;EAAY,CAC5B,CACG,CAAC;AAEX,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import { TurboModuleRegistry } from "react-native";
2
- // eslint-disable-next-line import/no-default-export
3
- export default TurboModuleRegistry.getEnforcing("WebGPUModule");
4
- //# sourceMappingURL=NativeWebGPUModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeWebGPUModule.ts"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,cAAc;AAOlD;AACA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
@@ -1,96 +0,0 @@
1
- export class GPUOffscreenCanvas {
2
- constructor(width, height) {
3
- this.width = width;
4
- this.height = height;
5
- this.context = new GPUOffscreenCanvasContext(this);
6
- }
7
- getContext(contextId) {
8
- if (contextId === "webgpu") {
9
- return this.context;
10
- }
11
- // Implement other context types if necessary
12
- return null;
13
- }
14
- getImageData() {
15
- const device = this.context.getDevice();
16
- const texture = this.context.getTexture();
17
- const commandEncoder = device.createCommandEncoder();
18
- const bytesPerRow = this.width * 4;
19
- const buffer = device.createBuffer({
20
- size: bytesPerRow * this.height,
21
- usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
22
- });
23
- commandEncoder.copyTextureToBuffer({
24
- texture: texture
25
- }, {
26
- buffer: buffer,
27
- bytesPerRow
28
- }, [this.width, this.height]);
29
- device.queue.submit([commandEncoder.finish()]);
30
- return buffer.mapAsync(GPUMapMode.READ).then(() => {
31
- const arrayBuffer = buffer.getMappedRange();
32
- const uint8Array = new Uint8Array(arrayBuffer);
33
- const data = Array.from(uint8Array);
34
- buffer.unmap();
35
- return {
36
- data,
37
- width: this.width,
38
- height: this.height,
39
- format: navigator.gpu.getPreferredCanvasFormat()
40
- };
41
- });
42
- }
43
- }
44
- class GPUOffscreenCanvasContext {
45
- __brand = "GPUCanvasContext";
46
- texture = null;
47
- device = null;
48
-
49
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
- constructor(canvas) {
51
- this.canvas = canvas;
52
- this.textureFormat = navigator.gpu.getPreferredCanvasFormat();
53
- }
54
- getConfiguration() {
55
- throw new Error("Method not implemented.");
56
- }
57
- present() {
58
- // Do nothing
59
- }
60
- getDevice() {
61
- if (!this.device) {
62
- throw new Error("Device is not configured.");
63
- }
64
- return this.device;
65
- }
66
- getTexture() {
67
- if (!this.texture) {
68
- throw new Error("Texture is not configured");
69
- }
70
- return this.texture;
71
- }
72
- configure(config) {
73
- // Configure the canvas context with the device and format
74
- this.device = config.device;
75
- this.texture = config.device.createTexture({
76
- size: [this.canvas.width, this.canvas.height],
77
- format: this.textureFormat,
78
- usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC | GPUTextureUsage.TEXTURE_BINDING
79
- });
80
- return undefined;
81
- }
82
- unconfigure() {
83
- // Unconfigure the canvas context
84
- if (this.texture) {
85
- this.texture.destroy();
86
- }
87
- return undefined;
88
- }
89
- getCurrentTexture() {
90
- if (!this.texture) {
91
- throw new Error("Texture is not configured");
92
- }
93
- return this.texture;
94
- }
95
- }
96
- //# sourceMappingURL=Offscreen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["GPUOffscreenCanvas","constructor","width","height","context","GPUOffscreenCanvasContext","getContext","contextId","getImageData","device","getDevice","texture","getTexture","commandEncoder","createCommandEncoder","bytesPerRow","buffer","createBuffer","size","usage","GPUBufferUsage","COPY_DST","MAP_READ","copyTextureToBuffer","queue","submit","finish","mapAsync","GPUMapMode","READ","then","arrayBuffer","getMappedRange","uint8Array","Uint8Array","data","Array","from","unmap","format","navigator","gpu","getPreferredCanvasFormat","__brand","canvas","textureFormat","getConfiguration","Error","present","configure","config","createTexture","GPUTextureUsage","RENDER_ATTACHMENT","COPY_SRC","TEXTURE_BINDING","undefined","unconfigure","destroy","getCurrentTexture"],"sourceRoot":"../../src","sources":["Offscreen.ts"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,CAAC;EAM9BC,WAAWA,CAACC,KAAa,EAAEC,MAAc,EAAE;IACzC,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,OAAO,GAAG,IAAIC,yBAAyB,CAAC,IAAI,CAAC;EACpD;EAEAC,UAAUA,CAACC,SAA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;IACpB,CAAC,CAAC;IACF,OAAOC,SAAS;EAClB;EAEAC,WAAWA,CAAA,EAAG;IACZ;IACA,IAAI,IAAI,CAAC9C,OAAO,EAAE;MAChB,IAAI,CAACA,OAAO,CAAC+C,OAAO,CAAC,CAAC;IACxB;IACA,OAAOF,SAAS;EAClB;EAEAG,iBAAiBA,CAAA,EAAe;IAC9B,IAAI,CAAC,IAAI,CAAChD,OAAO,EAAE;MACjB,MAAM,IAAIoC,KAAK,CAAC,2BAA2B,CAAC;IAC9C;IACA,OAAO,IAAI,CAACpC,OAAO;EACrB;AACF","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import { codegenNativeComponent } from "react-native";
2
- // eslint-disable-next-line import/no-default-export
3
- export default codegenNativeComponent("WebGPUView");
4
- //# sourceMappingURL=WebGPUViewNativeComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../src","sources":["WebGPUViewNativeComponent.ts"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,cAAc;AASrD;AACA,eAAeA,sBAAsB,CAAc,YAAY,CAAC","ignoreList":[]}
@@ -1,96 +0,0 @@
1
- import React, { useEffect, useRef } from "react";
2
- import { StyleSheet } from "react-native";
3
- import { contextIdToId } from "./utils";
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- function debounce(func, wait, immediate = false) {
6
- let timeout;
7
- return function debounced(...args) {
8
- const context = this;
9
- const callNow = immediate && !timeout;
10
- if (timeout) {
11
- clearTimeout(timeout);
12
- }
13
- timeout = setTimeout(() => {
14
- timeout = undefined;
15
- if (!immediate) {
16
- func.apply(context, args);
17
- }
18
- }, wait);
19
- if (callNow) {
20
- func.apply(context, args);
21
- }
22
- };
23
- }
24
- function resizeCanvas(canvas) {
25
- if (!canvas) {
26
- return;
27
- }
28
- const dpr = window.devicePixelRatio || 1;
29
- const {
30
- height,
31
- width
32
- } = canvas.getBoundingClientRect();
33
- canvas.setAttribute("height", (height * dpr).toString());
34
- canvas.setAttribute("width", (width * dpr).toString());
35
- }
36
-
37
- // eslint-disable-next-line import/no-default-export
38
- export default function WebGPUViewNativeComponent(props) {
39
- const {
40
- contextId,
41
- style,
42
- transparent,
43
- ...rest
44
- } = props;
45
- const canvasElm = useRef();
46
- useEffect(() => {
47
- const onResize = debounce(() => resizeCanvas(canvasElm.current ?? null), 100);
48
- window.addEventListener("resize", onResize);
49
- return () => {
50
- window.removeEventListener("resize", onResize);
51
- };
52
- }, []);
53
- return /*#__PURE__*/React.createElement("canvas", {
54
- ...rest,
55
- id: contextIdToId(contextId),
56
- style: {
57
- ...styles.view,
58
- ...styles.flex1,
59
- ...(transparent === false ? {
60
- backgroundColor: "white"
61
- } : {}),
62
- ...(typeof style === "object" ? style : {})
63
- },
64
- ref: ref => {
65
- canvasElm.current = ref;
66
- if (ref) {
67
- resizeCanvas(ref);
68
- }
69
- }
70
- });
71
- }
72
- const styles = StyleSheet.create({
73
- flex1: {
74
- flex: 1
75
- },
76
- view: {
77
- alignItems: "stretch",
78
- backgroundColor: "transparent",
79
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
80
- // @ts-expect-error
81
- border: "0 solid black",
82
- boxSizing: "border-box",
83
- display: "flex",
84
- flexBasis: "auto",
85
- flexDirection: "column",
86
- flexShrink: 0,
87
- listStyle: "none",
88
- margin: 0,
89
- minHeight: 0,
90
- minWidth: 0,
91
- padding: 0,
92
- position: "relative",
93
- zIndex: 0
94
- }
95
- });
96
- //# sourceMappingURL=WebGPUViewNativeComponent.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useEffect","useRef","StyleSheet","contextIdToId","debounce","func","wait","immediate","timeout","debounced","args","context","callNow","clearTimeout","setTimeout","undefined","apply","resizeCanvas","canvas","dpr","window","devicePixelRatio","height","width","getBoundingClientRect","setAttribute","toString","WebGPUViewNativeComponent","props","contextId","style","transparent","rest","canvasElm","onResize","current","addEventListener","removeEventListener","createElement","id","styles","view","flex1","backgroundColor","ref","create","flex","alignItems","border","boxSizing","display","flexBasis","flexDirection","flexShrink","listStyle","margin","minHeight","minWidth","padding","position","zIndex"],"sourceRoot":"../../src","sources":["WebGPUViewNativeComponent.web.ts"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,UAAU,QAAQ,cAAc;AAIzC,SAASC,aAAa,QAAQ,SAAS;AAOvC;AACA,SAASC,QAAQA,CACfC,IAAO,EACPC,IAAY,EACZC,SAAS,GAAG,KAAK,EACjB;EACA,IAAIC,OAAkD;EACtD,OAAO,SAASC,SAASA,CAEvB,GAAGC,IAAmB,EACtB;IACA,MAAMC,OAAO,GAAG,IAAI;IACpB,MAAMC,OAAO,GAAGL,SAAS,IAAI,CAACC,OAAO;IACrC,IAAIA,OAAO,EAAE;MACXK,YAAY,CAACL,OAAO,CAAC;IACvB;IACAA,OAAO,GAAGM,UAAU,CAAC,MAAM;MACzBN,OAAO,GAAGO,SAAS;MACnB,IAAI,CAACR,SAAS,EAAE;QACdF,IAAI,CAACW,KAAK,CAACL,OAAO,EAAED,IAAI,CAAC;MAC3B;IACF,CAAC,EAAEJ,IAAI,CAAC;IACR,IAAIM,OAAO,EAAE;MACXP,IAAI,CAACW,KAAK,CAACL,OAAO,EAAED,IAAI,CAAC;IAC3B;EACF,CAAC;AACH;AAEA,SAASO,YAAYA,CAACC,MAAgC,EAAE;EACtD,IAAI,CAACA,MAAM,EAAE;IACX;EACF;EAEA,MAAMC,GAAG,GAAGC,MAAM,CAACC,gBAAgB,IAAI,CAAC;EAExC,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGL,MAAM,CAACM,qBAAqB,CAAC,CAAC;EACxDN,MAAM,CAACO,YAAY,CAAC,QAAQ,EAAE,CAACH,MAAM,GAAGH,GAAG,EAAEO,QAAQ,CAAC,CAAC,CAAC;EACxDR,MAAM,CAACO,YAAY,CAAC,OAAO,EAAE,CAACF,KAAK,GAAGJ,GAAG,EAAEO,QAAQ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S;IACrBJ,eAAe,EAAE,aAAa;IAC9B;IACA;IACAK,MAAM,EAAE,eAAe;IACvBC,SAAS,EAAE,YAAY;IACvBC,OAAO,EAAE,MAAM;IACfC,SAAS,EAAE,MAAM;IACjBC,aAAa,EAAE,QAAQ;IACvBC,UAAU,EAAE,CAAC;IACbC,SAAS,EAAE,MAAM;IACjBC,MAAM,EAAE,CAAC;IACTC,SAAS,EAAE,CAAC;IACZC,QAAQ,EAAE,CAAC;IACXC,OAAO,EAAE,CAAC;IACVC,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,38 +0,0 @@
1
- import { contextIdToId } from "./utils";
2
- const fabric = true;
3
- function getNativeSurface(contextId) {
4
- const canvas = document.getElementById(contextIdToId(contextId));
5
- const {
6
- height,
7
- width
8
- } = canvas.getBoundingClientRect();
9
- return {
10
- surface: BigInt(contextId),
11
- height,
12
- width,
13
- clientHeight: height,
14
- clientWidth: width
15
- };
16
- }
17
- function makeWebGPUCanvasContext(contextId, width, height) {
18
- const canvas = document.getElementById(contextIdToId(contextId));
19
- const dpr = window.devicePixelRatio || 1;
20
- const pixelWidth = (width * dpr).toString();
21
- const pixelHeight = (height * dpr).toString();
22
- if (canvas.getAttribute("width") !== pixelWidth || canvas.getAttribute("height") !== pixelHeight) {
23
- canvas.setAttribute("width", pixelWidth);
24
- canvas.setAttribute("height", pixelHeight);
25
- }
26
- const context = canvas.getContext("webgpu");
27
- return Object.assign(context, {
28
- present: () => {}
29
- });
30
- }
31
-
32
- // @ts-expect-error - polyfill for RNWebGPU native module
33
- window.RNWebGPU = {
34
- getNativeSurface,
35
- MakeWebGPUCanvasContext: makeWebGPUCanvasContext,
36
- fabric
37
- };
38
- //# sourceMappingURL=WebPolyfillGPUModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["contextIdToId","fabric","getNativeSurface","contextId","canvas","document","getElementById","height","width","getBoundingClientRect","surface","BigInt","clientHeight","clientWidth","makeWebGPUCanvasContext","dpr","window","devicePixelRatio","pixelWidth","toString","pixelHeight","getAttribute","setAttribute","context","getContext","Object","assign","present","RNWebGPU","MakeWebGPUCanvasContext"],"sourceRoot":"../../src","sources":["WebPolyfillGPUModule.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,SAAS;AAEvC,MAAMC,MAAM,GAAG,IAAI;AAEnB,SAASC,gBAAgBA,CAACC,SAAiB,EAAE;EAC3C,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CACpCN,aAAa,CAACG,SAAS,CACzB,CAAsB;EAEtB,MAAM;IAAEI,MAAM;IAAEC;EAAM,CAAC,GAAGJ,MAAM,CAACK,qBAAqB,CAAC,CAAE;EAEzD,OAAO;IACLC,OAAO,EAAEC,MAAM,CAACR,SAAS,CAAC;IAC1BI,MAAM;IACNC,KAAK;IACLI,YAAY,EAAEL,MAAM;IACpBM,WAAW,EAAEL;EACf,CAAC;AACH;AAEA,SAASM,uBAAuBA,CAC9BX,SAAiB,EACjBK,KAAa,EACbD,MAAc,EACd;EACA,MAAMH,MAAM,GAAGC,QAAQ,CAACC,cAAc,CACpCN,aAAa,CAACG,SAAS,CACzB,CAAsB;EAEtB,MAAMY,GAAG,GAAGC,MAAM,CAACC,gBAAgB,IAAI,CAAC;EACxC,MAAMC,UAAU,GAAG,CAACV,KAAK,GAAGO,GAAG,EAAEI,QAAQ,CAAC,CAAC;EAC3C,MAAMC,WAAW,GAAG,CAACb,MAAM,GAAGQ,GAAG,EAAEI,QAAQ,CAAC,CAAC;EAE7C,IACEf,MAAM,CAACiB,YAAY,CAAC,OAAO,CAAC,KAAKH,UAAU,IAC3Cd,MAAM,CAACiB,YAAY,CAAC,QAAQ,CAAC,KAAKD,WAAW,EAC7C;IACAhB,MAAM,CAACkB,YAAY,CAAC,OAAO,EAAEJ,UAAU,CAAC;IACxCd,MAAM,CAACkB,YAAY,CAAC,QAAQ,EAAEF,WAAW,CAAC;EAC5C;EAEA,MAAMG,OAAO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