react-native-wgpu 0.1.0 → 0.1.2

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 (269) hide show
  1. package/README.md +221 -13
  2. package/android/CMakeLists.txt +15 -1
  3. package/android/build.gradle +0 -18
  4. package/android/cpp/AndroidPlatformContext.h +26 -0
  5. package/android/cpp/cpp-adapter.cpp +66 -3
  6. package/android/src/main/java/com/webgpu/WebGPUModule.java +64 -22
  7. package/android/src/main/java/com/webgpu/WebGPUView.java +63 -8
  8. package/android/src/main/java/com/webgpu/WebGPUViewManager.java +5 -6
  9. package/android/src/newarch/{WgpuViewManagerSpec.java → com/webgpu/WebGPUViewManagerSpec.java} +5 -5
  10. package/android/src/oldarch/com/webgpu/NativeWebGPUModuleSpec.java +23 -0
  11. package/android/src/oldarch/{WebGPUViewManagerSpec.java → com/webgpu/WebGPUViewManagerSpec.java} +1 -1
  12. package/cpp/{Logger.h → WGPULogger.h} +13 -6
  13. package/cpp/dawn/webgpu.h +9 -0
  14. package/cpp/dawn/webgpu_cpp.h +95 -43
  15. package/cpp/dawn/webgpu_cpp_print.h +6 -0
  16. package/cpp/dawn/wire/client/webgpu_cpp.h +80 -43
  17. package/cpp/jsi/RNFHybridObject.cpp +1 -1
  18. package/cpp/jsi/RNFHybridObject.h +4 -4
  19. package/cpp/jsi/RNFJSIConverter.h +204 -17
  20. package/cpp/rnwgpu/ArrayBuffer.h +72 -0
  21. package/cpp/rnwgpu/PlatformContext.h +16 -0
  22. package/cpp/rnwgpu/RNWebGPUManager.cpp +14 -9
  23. package/cpp/rnwgpu/RNWebGPUManager.h +12 -1
  24. package/cpp/rnwgpu/SurfaceRegistry.h +36 -0
  25. package/cpp/rnwgpu/api/AsyncRunner.h +30 -0
  26. package/cpp/rnwgpu/api/Canvas.h +55 -0
  27. package/cpp/rnwgpu/api/Convertors.h +765 -0
  28. package/cpp/rnwgpu/api/External.h +12 -0
  29. package/cpp/rnwgpu/api/GPU.cpp +100 -23
  30. package/cpp/rnwgpu/api/GPU.h +24 -6
  31. package/cpp/rnwgpu/api/GPUAdapter.cpp +122 -8
  32. package/cpp/rnwgpu/api/GPUAdapter.h +24 -5
  33. package/cpp/rnwgpu/api/GPUAdapterInfo.h +19 -7
  34. package/cpp/rnwgpu/api/GPUBindGroup.cpp +3 -0
  35. package/cpp/rnwgpu/api/GPUBindGroup.h +11 -4
  36. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +11 -4
  37. package/cpp/rnwgpu/api/GPUBuffer.cpp +82 -7
  38. package/cpp/rnwgpu/api/GPUBuffer.h +43 -7
  39. package/cpp/rnwgpu/api/GPUCanvasContext.cpp +63 -0
  40. package/cpp/rnwgpu/api/GPUCanvasContext.h +51 -8
  41. package/cpp/rnwgpu/api/GPUCommandBuffer.h +11 -4
  42. package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +177 -0
  43. package/cpp/rnwgpu/api/GPUCommandEncoder.h +75 -3
  44. package/cpp/rnwgpu/api/GPUCompilationInfo.h +65 -8
  45. package/cpp/rnwgpu/api/GPUCompilationMessage.h +6 -4
  46. package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +58 -0
  47. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +49 -3
  48. package/cpp/rnwgpu/api/GPUComputePipeline.cpp +11 -0
  49. package/cpp/rnwgpu/api/GPUComputePipeline.h +18 -3
  50. package/cpp/rnwgpu/api/GPUDevice.cpp +330 -3
  51. package/cpp/rnwgpu/api/GPUDevice.h +119 -5
  52. package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +6 -0
  53. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +14 -7
  54. package/cpp/rnwgpu/api/GPUError.h +42 -0
  55. package/cpp/rnwgpu/api/GPUExtent3D.h +69 -0
  56. package/cpp/rnwgpu/api/GPUExternalTexture.h +11 -4
  57. package/cpp/rnwgpu/api/GPUFeatures.h +221 -0
  58. package/cpp/rnwgpu/api/GPUOrigin2D.h +59 -0
  59. package/cpp/rnwgpu/api/GPUOrigin3D.h +66 -0
  60. package/cpp/rnwgpu/api/GPUPipelineLayout.h +11 -4
  61. package/cpp/rnwgpu/api/GPUQuerySet.cpp +11 -0
  62. package/cpp/rnwgpu/api/GPUQuerySet.h +19 -5
  63. package/cpp/rnwgpu/api/GPUQueue.cpp +110 -0
  64. package/cpp/rnwgpu/api/GPUQueue.h +45 -4
  65. package/cpp/rnwgpu/api/GPURenderBundle.h +11 -4
  66. package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +128 -0
  67. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +72 -3
  68. package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +161 -0
  69. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +93 -3
  70. package/cpp/rnwgpu/api/GPURenderPipeline.cpp +13 -0
  71. package/cpp/rnwgpu/api/GPURenderPipeline.h +18 -3
  72. package/cpp/rnwgpu/api/GPUSampler.h +11 -4
  73. package/cpp/rnwgpu/api/GPUShaderModule.cpp +39 -0
  74. package/cpp/rnwgpu/api/GPUShaderModule.h +23 -4
  75. package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +133 -0
  76. package/cpp/rnwgpu/api/GPUSupportedLimits.h +128 -4
  77. package/cpp/rnwgpu/api/GPUTexture.cpp +47 -0
  78. package/cpp/rnwgpu/api/GPUTexture.h +38 -4
  79. package/cpp/rnwgpu/api/GPUTextureView.h +11 -4
  80. package/cpp/rnwgpu/api/ImageData.h +50 -0
  81. package/cpp/rnwgpu/api/Navigator.h +46 -0
  82. package/cpp/rnwgpu/api/WebGPUCanvasContextFactory.h +59 -0
  83. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +31 -43
  84. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +40 -31
  85. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +24 -32
  86. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +56 -49
  87. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +27 -20
  88. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +23 -31
  89. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +25 -36
  90. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +25 -25
  91. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +26 -46
  92. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +31 -53
  93. package/cpp/rnwgpu/api/descriptors/GPUColor.h +72 -0
  94. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +27 -33
  95. package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +51 -0
  96. package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +51 -0
  97. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +24 -25
  98. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +25 -42
  99. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +32 -42
  100. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +58 -76
  101. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +38 -30
  102. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +11 -11
  103. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +43 -34
  104. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +39 -46
  105. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +29 -45
  106. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +25 -34
  107. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +32 -36
  108. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +42 -44
  109. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +24 -34
  110. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +24 -32
  111. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +25 -35
  112. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +35 -26
  113. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +29 -35
  114. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +23 -43
  115. package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +49 -0
  116. package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +51 -0
  117. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +41 -57
  118. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +42 -61
  119. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +54 -66
  120. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +52 -55
  121. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +25 -42
  122. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +60 -56
  123. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +21 -20
  124. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +17 -14
  125. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +63 -63
  126. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +28 -27
  127. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +28 -49
  128. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +32 -23
  129. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +27 -29
  130. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +27 -20
  131. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +49 -76
  132. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +48 -64
  133. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +29 -31
  134. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +23 -44
  135. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +30 -36
  136. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +39 -38
  137. package/cpp/rnwgpu/api/descriptors/Unions.h +57 -2
  138. package/ios/IOSPlatformContext.h +16 -0
  139. package/ios/IOSPlatformContext.mm +18 -0
  140. package/ios/MetalView.h +10 -0
  141. package/ios/MetalView.mm +27 -0
  142. package/ios/SurfaceUtils.h +13 -0
  143. package/ios/SurfaceUtils.mm +24 -0
  144. package/ios/WebGPUModule.h +8 -7
  145. package/ios/WebGPUModule.mm +47 -14
  146. package/ios/WebGPUView.h +6 -3
  147. package/ios/WebGPUView.mm +36 -24
  148. package/ios/WebGPUViewComponentDescriptor.h +61 -0
  149. package/ios/WebGPUViewManager.mm +6 -4
  150. package/lib/commonjs/Canvas.js +49 -0
  151. package/lib/commonjs/Canvas.js.map +1 -0
  152. package/lib/commonjs/{WebGPUNativeModule.js → NativeWebGPUModule.js} +1 -1
  153. package/lib/commonjs/{WebGPUNativeModule.js.map → NativeWebGPUModule.js.map} +1 -1
  154. package/lib/commonjs/WebGPUView.js +2 -0
  155. package/lib/commonjs/WebGPUView.js.map +1 -0
  156. package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -1
  157. package/lib/commonjs/index.js +158 -19
  158. package/lib/commonjs/index.js.map +1 -1
  159. package/lib/module/Canvas.js +42 -0
  160. package/lib/module/Canvas.js.map +1 -0
  161. package/lib/module/{WebGPUNativeModule.js → NativeWebGPUModule.js} +1 -1
  162. package/lib/module/NativeWebGPUModule.js.map +1 -0
  163. package/lib/module/WebGPUView.js +2 -0
  164. package/lib/module/WebGPUView.js.map +1 -0
  165. package/lib/module/WebGPUViewNativeComponent.js.map +1 -1
  166. package/lib/module/index.js +144 -6
  167. package/lib/module/index.js.map +1 -1
  168. package/lib/typescript/example/src/Triangle/triangle.d.ts +3 -0
  169. package/lib/typescript/example/src/Triangle/triangle.d.ts.map +1 -0
  170. package/lib/typescript/example/src/Wireframe/Shaders.d.ts +3 -0
  171. package/lib/typescript/example/src/Wireframe/Shaders.d.ts.map +1 -0
  172. package/lib/typescript/example/src/Wireframe/models.d.ts +29 -0
  173. package/lib/typescript/example/src/Wireframe/models.d.ts.map +1 -0
  174. package/lib/typescript/example/src/components/DrawingContext.d.ts +13 -0
  175. package/lib/typescript/example/src/components/DrawingContext.d.ts.map +1 -0
  176. package/lib/typescript/example/src/components/cube.d.ts +7 -0
  177. package/lib/typescript/example/src/components/cube.d.ts.map +1 -0
  178. package/lib/typescript/example/src/components/meshes/sphere.d.ts +12 -0
  179. package/lib/typescript/example/src/components/meshes/sphere.d.ts.map +1 -0
  180. package/lib/typescript/example/src/components/meshes/teapot.d.ts +6 -0
  181. package/lib/typescript/example/src/components/meshes/teapot.d.ts.map +1 -0
  182. package/lib/typescript/example/src/components/meshes/utils.d.ts +10 -0
  183. package/lib/typescript/example/src/components/meshes/utils.d.ts.map +1 -0
  184. package/lib/typescript/jest.config.d.ts +4 -0
  185. package/lib/typescript/lib/commonjs/Canvas.d.ts +4 -0
  186. package/lib/typescript/lib/commonjs/Canvas.d.ts.map +1 -0
  187. package/lib/typescript/lib/commonjs/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +1 -1
  188. package/lib/typescript/lib/commonjs/NativeWebGPUModule.d.ts.map +1 -0
  189. package/lib/typescript/lib/commonjs/WebGPUView.d.ts +1 -0
  190. package/lib/typescript/lib/commonjs/WebGPUView.d.ts.map +1 -0
  191. package/lib/typescript/lib/commonjs/index.d.ts +0 -2
  192. package/lib/typescript/lib/module/Canvas.d.ts +2 -0
  193. package/lib/typescript/lib/module/Canvas.d.ts.map +1 -0
  194. package/lib/typescript/lib/module/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +1 -1
  195. package/lib/typescript/lib/module/NativeWebGPUModule.d.ts.map +1 -0
  196. package/lib/typescript/lib/module/WebGPUView.d.ts +1 -0
  197. package/lib/typescript/lib/module/WebGPUView.d.ts.map +1 -0
  198. package/lib/typescript/lib/module/index.d.ts +2 -3
  199. package/lib/typescript/src/Canvas.d.ts +22 -0
  200. package/lib/typescript/src/Canvas.d.ts.map +1 -0
  201. package/lib/typescript/src/{WebGPUNativeModule.d.ts → NativeWebGPUModule.d.ts} +2 -1
  202. package/lib/typescript/src/NativeWebGPUModule.d.ts.map +1 -0
  203. package/lib/typescript/src/WebGPUView.d.ts +1 -0
  204. package/lib/typescript/src/WebGPUView.d.ts.map +1 -0
  205. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +2 -1
  206. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -1
  207. package/lib/typescript/src/index.d.ts +2 -7
  208. package/lib/typescript/src/index.d.ts.map +1 -1
  209. package/libs/android/arm64-v8a/libwebgpu_dawn.so +0 -0
  210. package/libs/android/armeabi-v7a/libwebgpu_dawn.so +0 -0
  211. package/libs/android/x86/libwebgpu_dawn.so +0 -0
  212. package/libs/android/x86_64/libwebgpu_dawn.so +0 -0
  213. package/libs/dawn.json +4597 -0
  214. package/libs/ios/arm64_iphoneos/libwebgpu_dawn.a +0 -0
  215. package/libs/ios/arm64_iphonesimulator/libwebgpu_dawn.a +0 -0
  216. package/libs/ios/libwebgpu_dawn.a +0 -0
  217. package/libs/ios/libwebgpu_dawn.xcframework/Info.plist +44 -0
  218. package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
  219. package/libs/ios/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
  220. package/libs/ios/x86_64_iphonesimulator/libwebgpu_dawn.a +0 -0
  221. package/package.json +25 -8
  222. package/{react-native-webgpu.podspec → react-native-wgpu.podspec} +6 -9
  223. package/src/Canvas.tsx +68 -0
  224. package/src/{WebGPUNativeModule.ts → NativeWebGPUModule.ts} +1 -0
  225. package/src/WebGPUView.tsx +0 -0
  226. package/src/WebGPUViewNativeComponent.ts +2 -1
  227. package/src/index.tsx +172 -8
  228. package/android/src/main/AndroidManifestNew.xml +0 -2
  229. package/cpp/rnwgpu/MutableBuffer.h +0 -48
  230. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -33
  231. package/cpp/rnwgpu/api/descriptors/GPUColorDict.h +0 -81
  232. package/cpp/rnwgpu/api/descriptors/GPUExtent3DDict.h +0 -76
  233. package/cpp/rnwgpu/api/descriptors/GPUExtent3DDictStrict.h +0 -91
  234. package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDict.h +0 -61
  235. package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDictStrict.h +0 -75
  236. package/cpp/rnwgpu/api/descriptors/GPUOrigin3DDict.h +0 -71
  237. package/cpp/rnwgpu/api/descriptors/GPUPipelineErrorInit.h +0 -54
  238. package/cpp/rnwgpu/api/descriptors/GPURenderPassLayout.h +0 -83
  239. package/ios/RNFAppleLogger.mm +0 -22
  240. package/ios/Utils.h +0 -5
  241. package/ios/Utils.m +0 -26
  242. package/lib/module/WebGPUNativeModule.js.map +0 -1
  243. package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts.map +0 -1
  244. package/lib/typescript/lib/module/WebGPUNativeModule.d.ts.map +0 -1
  245. package/lib/typescript/scripts/build/copy-artifacts.d.ts +0 -2
  246. package/lib/typescript/scripts/build/copy-artifacts.d.ts.map +0 -1
  247. package/lib/typescript/scripts/build/dawn.d.ts +0 -2
  248. package/lib/typescript/scripts/build/dawn.d.ts.map +0 -1
  249. package/lib/typescript/scripts/build/util.d.ts +0 -13
  250. package/lib/typescript/scripts/build/util.d.ts.map +0 -1
  251. package/lib/typescript/scripts/codegen/codegen.d.ts +0 -2
  252. package/lib/typescript/scripts/codegen/codegen.d.ts.map +0 -1
  253. package/lib/typescript/scripts/codegen/model/dawn.d.ts +0 -2
  254. package/lib/typescript/scripts/codegen/model/dawn.d.ts.map +0 -1
  255. package/lib/typescript/scripts/codegen/model/model.d.ts +0 -8
  256. package/lib/typescript/scripts/codegen/model/model.d.ts.map +0 -1
  257. package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts +0 -4
  258. package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts.map +0 -1
  259. package/lib/typescript/scripts/codegen/templates/Enum.d.ts +0 -3
  260. package/lib/typescript/scripts/codegen/templates/Enum.d.ts.map +0 -1
  261. package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts +0 -3
  262. package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts.map +0 -1
  263. package/lib/typescript/scripts/codegen/templates/Unions.d.ts +0 -6
  264. package/lib/typescript/scripts/codegen/templates/Unions.d.ts.map +0 -1
  265. package/lib/typescript/scripts/codegen/templates/common.d.ts +0 -9
  266. package/lib/typescript/scripts/codegen/templates/common.d.ts.map +0 -1
  267. package/lib/typescript/scripts/codegen/util.d.ts +0 -2
  268. package/lib/typescript/scripts/codegen/util.d.ts.map +0 -1
  269. package/lib/typescript/src/WebGPUNativeModule.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_WebGPUViewNativeComponent","_interopRequireDefault","_NativeWebGPUModule","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","CONTEXT_COUNTER","generateContextId","global","__WebGPUContextRegistry","WebGPUContextRegistry","Canvas","exports","forwardRef","props","ref","contextId","_","useState","useImperativeHandle","getNativeSurface","WebGPUNativeModule","createSurfaceContext","getContext","contextName","Error","nativeSurface","ctx","navigator","MakeWebGPUCanvasContext","useEffect","React","createElement"],"sourceRoot":"../../src","sources":["Canvas.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAsD,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAA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AAS,CAAC;MACtD,IAAI,CAACU,aAAa,EAAE;QAClB,OAAO,IAAI;MACb;MACA;MACA;MACA,MAAMC,GAAG,GAAGC,SAAS,CAACC,uBAAuB,CAACH,aAAa,CAAC;MAC5D,OAAOC,GAAG;IACZ;EACF,CAAC,CAAC,CAAC;EAEH,IAAAG,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACX,OAAOpB,qBAAqB,CAACM,SAAS,CAAC;IACzC,CAAC;EACH,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;EAEf,oBAAOe,KAAA,CAAAC,aAAA,CAAC5C,0BAAA,CAAAK,OAAgB,EAAAC,QAAA,KAAKoB,KAAK;IAAEE,SAAS,EAAEA;EAAU,EAAE,CAAC;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -7,4 +7,4 @@ exports.default = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  // eslint-disable-next-line import/no-default-export
9
9
  var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing("WebGPUModule");
10
- //# sourceMappingURL=WebGPUNativeModule.js.map
10
+ //# sourceMappingURL=NativeWebGPUModule.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["WebGPUNativeModule.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAMA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,gCAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeWebGPUModule.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAOA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,gCAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=WebGPUView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["WebGPUView.tsx"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../src","sources":["WebGPUViewNativeComponent.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAO7F;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GACe,IAAAG,+BAAsB,EAAc,YAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../src","sources":["WebGPUViewNativeComponent.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQ7F;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GACe,IAAAG,+BAAsB,EAAc,YAAY,CAAC","ignoreList":[]}
@@ -4,25 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
- gpu: true,
8
- WebGPUModule: true,
9
- WebGPUView: true
7
+ WebGPUModule: true
10
8
  };
11
9
  Object.defineProperty(exports, "WebGPUModule", {
12
10
  enumerable: true,
13
11
  get: function () {
14
- return _WebGPUNativeModule.default;
12
+ return _NativeWebGPUModule.default;
15
13
  }
16
14
  });
17
- Object.defineProperty(exports, "WebGPUView", {
18
- enumerable: true,
19
- get: function () {
20
- return _WebGPUViewNativeComponent.default;
21
- }
15
+ var _NativeWebGPUModule = _interopRequireDefault(require("./NativeWebGPUModule"));
16
+ var _Canvas = require("./Canvas");
17
+ Object.keys(_Canvas).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
+ if (key in exports && exports[key] === _Canvas[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _Canvas[key];
25
+ }
26
+ });
22
27
  });
23
- exports.gpu = void 0;
24
- var _WebGPUNativeModule = _interopRequireDefault(require("./WebGPUNativeModule"));
25
- var _WebGPUViewNativeComponent = _interopRequireWildcard(require("./WebGPUViewNativeComponent"));
28
+ var _WebGPUViewNativeComponent = require("./WebGPUViewNativeComponent");
26
29
  Object.keys(_WebGPUViewNativeComponent).forEach(function (key) {
27
30
  if (key === "default" || key === "__esModule") return;
28
31
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -34,12 +37,148 @@ Object.keys(_WebGPUViewNativeComponent).forEach(function (key) {
34
37
  }
35
38
  });
36
39
  });
37
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
38
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
39
40
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
40
- _WebGPUNativeModule.default.install();
41
- const {
42
- gpu
43
- } = global;
44
- exports.gpu = gpu;
41
+ /* eslint-disable @typescript-eslint/no-explicit-any */
42
+
43
+ const GPU = {};
44
+ GPU[Symbol.hasInstance] = function (instance) {
45
+ return "__brand" in instance && instance.__brand === "GPU";
46
+ };
47
+ const GPUAdapter = {};
48
+ GPUAdapter[Symbol.hasInstance] = function (instance) {
49
+ return "__brand" in instance && instance.__brand === "GPUAdapter";
50
+ };
51
+ const GPUAdapterInfo = {};
52
+ GPUAdapterInfo[Symbol.hasInstance] = function (instance) {
53
+ return "__brand" in instance && instance.__brand === "GPUAdapterInfo";
54
+ };
55
+ const GPUBindGroup = {};
56
+ GPUBindGroup[Symbol.hasInstance] = function (instance) {
57
+ return "__brand" in instance && instance.__brand === "GPUBindGroup";
58
+ };
59
+ const GPUBindGroupLayout = {};
60
+ GPUBindGroupLayout[Symbol.hasInstance] = function (instance) {
61
+ return "__brand" in instance && instance.__brand === "GPUBindGroupLayout";
62
+ };
63
+ const GPUBuffer = {};
64
+ GPUBuffer[Symbol.hasInstance] = function (instance) {
65
+ return "__brand" in instance && instance.__brand === "GPUBuffer";
66
+ };
67
+ const GPUCanvasContext = {};
68
+ GPUCanvasContext[Symbol.hasInstance] = function (instance) {
69
+ return "__brand" in instance && instance.__brand === "GPUCanvasContext";
70
+ };
71
+ const GPUCommandBuffer = {};
72
+ GPUCommandBuffer[Symbol.hasInstance] = function (instance) {
73
+ return "__brand" in instance && instance.__brand === "GPUCommandBuffer";
74
+ };
75
+ const GPUCommandEncoder = {};
76
+ GPUCommandEncoder[Symbol.hasInstance] = function (instance) {
77
+ return "__brand" in instance && instance.__brand === "GPUCommandEncoder";
78
+ };
79
+ const GPUCompilationInfo = {};
80
+ GPUCompilationInfo[Symbol.hasInstance] = function (instance) {
81
+ return "__brand" in instance && instance.__brand === "GPUCompilationInfo";
82
+ };
83
+ const GPUCompilationMessage = {};
84
+ GPUCompilationMessage[Symbol.hasInstance] = function (instance) {
85
+ return "__brand" in instance && instance.__brand === "GPUCompilationMessage";
86
+ };
87
+ const GPUComputePassEncoder = {};
88
+ GPUComputePassEncoder[Symbol.hasInstance] = function (instance) {
89
+ return "__brand" in instance && instance.__brand === "GPUComputePassEncoder";
90
+ };
91
+ const GPUComputePipeline = {};
92
+ GPUComputePipeline[Symbol.hasInstance] = function (instance) {
93
+ return "__brand" in instance && instance.__brand === "GPUComputePipeline";
94
+ };
95
+ const GPUDevice = {};
96
+ GPUDevice[Symbol.hasInstance] = function (instance) {
97
+ return "__brand" in instance && instance.__brand === "GPUDevice";
98
+ };
99
+ const GPUDeviceLostInfo = {};
100
+ GPUDeviceLostInfo[Symbol.hasInstance] = function (instance) {
101
+ return "__brand" in instance && instance.__brand === "GPUDeviceLostInfo";
102
+ };
103
+ const GPUError = {};
104
+ GPUError[Symbol.hasInstance] = function (instance) {
105
+ return "__brand" in instance && instance.__brand === "GPUError";
106
+ };
107
+ const GPUExternalTexture = {};
108
+ GPUExternalTexture[Symbol.hasInstance] = function (instance) {
109
+ return "__brand" in instance && instance.__brand === "GPUExternalTexture";
110
+ };
111
+ const GPUPipelineLayout = {};
112
+ GPUPipelineLayout[Symbol.hasInstance] = function (instance) {
113
+ return "__brand" in instance && instance.__brand === "GPUPipelineLayout";
114
+ };
115
+ const GPUQuerySet = {};
116
+ GPUQuerySet[Symbol.hasInstance] = function (instance) {
117
+ return "__brand" in instance && instance.__brand === "GPUQuerySet";
118
+ };
119
+ const GPUQueue = {};
120
+ GPUQueue[Symbol.hasInstance] = function (instance) {
121
+ return "__brand" in instance && instance.__brand === "GPUQueue";
122
+ };
123
+ const GPURenderBundle = {};
124
+ GPURenderBundle[Symbol.hasInstance] = function (instance) {
125
+ return "__brand" in instance && instance.__brand === "GPURenderBundle";
126
+ };
127
+ const GPURenderBundleEncoder = {};
128
+ GPURenderBundleEncoder[Symbol.hasInstance] = function (instance) {
129
+ return "__brand" in instance && instance.__brand === "GPURenderBundleEncoder";
130
+ };
131
+ const GPURenderPassEncoder = {};
132
+ GPURenderPassEncoder[Symbol.hasInstance] = function (instance) {
133
+ return "__brand" in instance && instance.__brand === "GPURenderPassEncoder";
134
+ };
135
+ const GPURenderPipeline = {};
136
+ GPURenderPipeline[Symbol.hasInstance] = function (instance) {
137
+ return "__brand" in instance && instance.__brand === "GPURenderPipeline";
138
+ };
139
+ const GPUSampler = {};
140
+ GPUSampler[Symbol.hasInstance] = function (instance) {
141
+ return "__brand" in instance && instance.__brand === "GPUSampler";
142
+ };
143
+ const GPUShaderModule = {};
144
+ GPUShaderModule[Symbol.hasInstance] = function (instance) {
145
+ return "__brand" in instance && instance.__brand === "GPUShaderModule";
146
+ };
147
+ const GPUTexture = {};
148
+ GPUTexture[Symbol.hasInstance] = function (instance) {
149
+ return "__brand" in instance && instance.__brand === "GPUTexture";
150
+ };
151
+ const GPUTextureView = {};
152
+ GPUTextureView[Symbol.hasInstance] = function (instance) {
153
+ return "__brand" in instance && instance.__brand === "GPUTextureView";
154
+ };
155
+ global.GPU = GPU;
156
+ global.GPUAdapter = GPUAdapter;
157
+ global.GPUAdapterInfo = GPUAdapterInfo;
158
+ global.GPUBindGroup = GPUBindGroup;
159
+ global.GPUBindGroupLayout = GPUBindGroupLayout;
160
+ global.GPUBuffer = GPUBuffer;
161
+ global.GPUCanvasContext = GPUCanvasContext;
162
+ global.GPUCommandBuffer = GPUCommandBuffer;
163
+ global.GPUCommandEncoder = GPUCommandEncoder;
164
+ global.GPUCompilationInfo = GPUCompilationInfo;
165
+ global.GPUCompilationMessage = GPUCompilationMessage;
166
+ global.GPUComputePassEncoder = GPUComputePassEncoder;
167
+ global.GPUComputePipeline = GPUComputePipeline;
168
+ global.GPUDevice = GPUDevice;
169
+ global.GPUDeviceLostInfo = GPUDeviceLostInfo;
170
+ global.GPUError = GPUError;
171
+ global.GPUExternalTexture = GPUExternalTexture;
172
+ global.GPUPipelineLayout = GPUPipelineLayout;
173
+ global.GPUQuerySet = GPUQuerySet;
174
+ global.GPUQueue = GPUQueue;
175
+ global.GPURenderBundle = GPURenderBundle;
176
+ global.GPURenderBundleEncoder = GPURenderBundleEncoder;
177
+ global.GPURenderPassEncoder = GPURenderPassEncoder;
178
+ global.GPURenderPipeline = GPURenderPipeline;
179
+ global.GPUSampler = GPUSampler;
180
+ global.GPUShaderModule = GPUShaderModule;
181
+ global.GPUTexture = GPUTexture;
182
+ global.GPUTextureView = GPUTextureView;
183
+ _NativeWebGPUModule.default.install();
45
184
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_WebGPUNativeModule","_interopRequireDefault","require","_WebGPUViewNativeComponent","_interopRequireWildcard","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","WebGPUNativeModule","install","gpu","global"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAC,uBAAA,CAAAF,OAAA;AACAG,MAAA,CAAAC,IAAA,CAAAH,0BAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,0BAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,0BAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAA4C,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wB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3,"names":["_NativeWebGPUModule","_interopRequireDefault","require","_Canvas","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_WebGPUViewNativeComponent","e","__esModule","default","GPU","Symbol","hasInstance","instance","__brand","GPUAdapter","GPUAdapterInfo","GPUBindGroup","GPUBindGroupLayout","GPUBuffer","GPUCanvasContext","GPUCommandBuffer","GPUCommandEncoder","GPUCompilationInfo","GPUCompilationMessage","GPUComputePassEncoder","GPUComputePipeline","GPUDevice","GPUDeviceLostInfo","GPUError","GPUExternalTexture","GPUPipelineLayout","GPUQuerySet","GPUQueue","GPURenderBundle","GPURenderBundleEncoder","GPURenderPassEncoder","GPURenderPipeline","GPUSampler","GPUShaderModule","GPUTexture","GPUTextureView","global","WebGPUNativeModule","install"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,0BAAA,GAAAd,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAW,0BAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,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gBAAgB;AAC1CsB,MAAM,CAACrB,gBAAgB,GAAGA,gBAAgB;AAC1CqB,MAAM,CAACpB,iBAAiB,GAAGA,iBAAiB;AAC5CoB,MAAM,CAACnB,kBAAkB,GAAGA,kBAAkB;AAC9CmB,MAAM,CAAClB,qBAAqB,GAAGA,qBAAqB;AACpDkB,MAAM,CAACjB,qBAAqB,GAAGA,qBAAqB;AACpDiB,MAAM,CAAChB,kBAAkB,GAAGA,kBAAkB;AAC9CgB,MAAM,CAACf,SAAS,GAAGA,SAAS;AAC5Be,MAAM,CAACd,iBAAiB,GAAGA,iBAAiB;AAC5Cc,MAAM,CAACb,QAAQ,GAAGA,QAAQ;AAC1Ba,MAAM,CAACZ,kBAAkB,GAAGA,kBAAkB;AAC9CY,MAAM,CAACX,iBAAiB,GAAGA,iBAAiB;AAC5CW,MAAM,CAACV,WAAW,GAAGA,WAAW;AAChCU,MAAM,CAACT,QAAQ,GAAGA,QAAQ;AAC1BS,MAAM,CAACR,eAAe,GAAGA,eAAe;AACxCQ,MAAM,CAACP,sBAAsB,GAAGA,sBAAsB;AACtDO,MAAM,CAACN,oBAAoB,GAAGA,oBAAoB;AAClDM,MAAM,CAACL,iBAAiB,GAAGA,iBAAiB;AAC5CK,MAAM,CAACJ,UAAU,GAAGA,UAAU;AAC9BI,MAAM,CAACH,eAAe,GAAGA,eAAe;AACxCG,MAAM,CAACF,UAAU,GAAGA,UAAU;AAC9BE,MAAM,CAACD,cAAc,GAAGA,cAAc;AAEtCE,2BAAkB,CAACC,OAAO,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,42 @@
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 { forwardRef, useEffect, useImperativeHandle, useState } from "react";
3
+ import WebGPUNativeView from "./WebGPUViewNativeComponent";
4
+ import WebGPUNativeModule from "./NativeWebGPUModule";
5
+ let CONTEXT_COUNTER = 1;
6
+ function generateContextId() {
7
+ return CONTEXT_COUNTER++;
8
+ }
9
+ global.__WebGPUContextRegistry = {};
10
+ const WebGPUContextRegistry = global.__WebGPUContextRegistry;
11
+ export const Canvas = /*#__PURE__*/forwardRef((props, ref) => {
12
+ const [contextId, _] = useState(() => generateContextId());
13
+ useImperativeHandle(ref, () => ({
14
+ getNativeSurface: () => {
15
+ WebGPUNativeModule.createSurfaceContext(contextId);
16
+ return WebGPUContextRegistry[contextId];
17
+ },
18
+ getContext(contextName) {
19
+ if (contextName !== "webgpu") {
20
+ throw new Error(`[WebGPU] Unsupported context: ${contextName}`);
21
+ }
22
+ WebGPUNativeModule.createSurfaceContext(contextId);
23
+ const nativeSurface = WebGPUContextRegistry[contextId];
24
+ if (!nativeSurface) {
25
+ return null;
26
+ }
27
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
28
+ // @ts-expect-error
29
+ const ctx = navigator.MakeWebGPUCanvasContext(nativeSurface);
30
+ return ctx;
31
+ }
32
+ }));
33
+ useEffect(() => {
34
+ return () => {
35
+ delete WebGPUContextRegistry[contextId];
36
+ };
37
+ }, [contextId]);
38
+ return /*#__PURE__*/React.createElement(WebGPUNativeView, _extends({}, props, {
39
+ contextId: contextId
40
+ }));
41
+ });
42
+ //# sourceMappingURL=Canvas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","useEffect","useImperativeHandle","useState","WebGPUNativeView","WebGPUNativeModule","CONTEXT_COUNTER","generateContextId","global","__WebGPUContextRegistry","WebGPUContextRegistry","Canvas","props","ref","contextId","_","getNativeSurface","createSurfaceContext","getContext","contextName","Error","nativeSurface","ctx","navigator","MakeWebGPUCanvasContext","React","createElement","_extends"],"sourceRoot":"../../src","sources":["Canvas.tsx"],"mappings":";AACA,SAASA,UAAU,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,QAAQ,QAAQ,OAAO;AAE5E,OAAOC,gBA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AAEE,SAAS,EAAEA;EAAU,EAAE,CAAC;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import { TurboModuleRegistry } from "react-native";
2
2
  // eslint-disable-next-line import/no-default-export
3
3
  export default TurboModuleRegistry.getEnforcing("WebGPUModule");
4
- //# sourceMappingURL=WebGPUNativeModule.js.map
4
+ //# sourceMappingURL=NativeWebGPUModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeWebGPUModule.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAOlD;AACA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=WebGPUView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["WebGPUView.tsx"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../src","sources":["WebGPUViewNativeComponent.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAO5F;AACA,eAAeA,sBAAsB,CAAc,YAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../src","sources":["WebGPUViewNativeComponent.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAQ5F;AACA,eAAeA,sBAAsB,CAAc,YAAY,CAAC","ignoreList":[]}
@@ -1,9 +1,147 @@
1
- import WebGPUNativeModule from "./WebGPUNativeModule";
2
- export { default as WebGPUView } from "./WebGPUViewNativeComponent";
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import WebGPUNativeModule from "./NativeWebGPUModule";
3
+ export * from "./Canvas";
3
4
  export * from "./WebGPUViewNativeComponent";
4
- export { default as WebGPUModule } from "./WebGPUNativeModule";
5
+ export { default as WebGPUModule } from "./NativeWebGPUModule";
6
+ const GPU = {};
7
+ GPU[Symbol.hasInstance] = function (instance) {
8
+ return "__brand" in instance && instance.__brand === "GPU";
9
+ };
10
+ const GPUAdapter = {};
11
+ GPUAdapter[Symbol.hasInstance] = function (instance) {
12
+ return "__brand" in instance && instance.__brand === "GPUAdapter";
13
+ };
14
+ const GPUAdapterInfo = {};
15
+ GPUAdapterInfo[Symbol.hasInstance] = function (instance) {
16
+ return "__brand" in instance && instance.__brand === "GPUAdapterInfo";
17
+ };
18
+ const GPUBindGroup = {};
19
+ GPUBindGroup[Symbol.hasInstance] = function (instance) {
20
+ return "__brand" in instance && instance.__brand === "GPUBindGroup";
21
+ };
22
+ const GPUBindGroupLayout = {};
23
+ GPUBindGroupLayout[Symbol.hasInstance] = function (instance) {
24
+ return "__brand" in instance && instance.__brand === "GPUBindGroupLayout";
25
+ };
26
+ const GPUBuffer = {};
27
+ GPUBuffer[Symbol.hasInstance] = function (instance) {
28
+ return "__brand" in instance && instance.__brand === "GPUBuffer";
29
+ };
30
+ const GPUCanvasContext = {};
31
+ GPUCanvasContext[Symbol.hasInstance] = function (instance) {
32
+ return "__brand" in instance && instance.__brand === "GPUCanvasContext";
33
+ };
34
+ const GPUCommandBuffer = {};
35
+ GPUCommandBuffer[Symbol.hasInstance] = function (instance) {
36
+ return "__brand" in instance && instance.__brand === "GPUCommandBuffer";
37
+ };
38
+ const GPUCommandEncoder = {};
39
+ GPUCommandEncoder[Symbol.hasInstance] = function (instance) {
40
+ return "__brand" in instance && instance.__brand === "GPUCommandEncoder";
41
+ };
42
+ const GPUCompilationInfo = {};
43
+ GPUCompilationInfo[Symbol.hasInstance] = function (instance) {
44
+ return "__brand" in instance && instance.__brand === "GPUCompilationInfo";
45
+ };
46
+ const GPUCompilationMessage = {};
47
+ GPUCompilationMessage[Symbol.hasInstance] = function (instance) {
48
+ return "__brand" in instance && instance.__brand === "GPUCompilationMessage";
49
+ };
50
+ const GPUComputePassEncoder = {};
51
+ GPUComputePassEncoder[Symbol.hasInstance] = function (instance) {
52
+ return "__brand" in instance && instance.__brand === "GPUComputePassEncoder";
53
+ };
54
+ const GPUComputePipeline = {};
55
+ GPUComputePipeline[Symbol.hasInstance] = function (instance) {
56
+ return "__brand" in instance && instance.__brand === "GPUComputePipeline";
57
+ };
58
+ const GPUDevice = {};
59
+ GPUDevice[Symbol.hasInstance] = function (instance) {
60
+ return "__brand" in instance && instance.__brand === "GPUDevice";
61
+ };
62
+ const GPUDeviceLostInfo = {};
63
+ GPUDeviceLostInfo[Symbol.hasInstance] = function (instance) {
64
+ return "__brand" in instance && instance.__brand === "GPUDeviceLostInfo";
65
+ };
66
+ const GPUError = {};
67
+ GPUError[Symbol.hasInstance] = function (instance) {
68
+ return "__brand" in instance && instance.__brand === "GPUError";
69
+ };
70
+ const GPUExternalTexture = {};
71
+ GPUExternalTexture[Symbol.hasInstance] = function (instance) {
72
+ return "__brand" in instance && instance.__brand === "GPUExternalTexture";
73
+ };
74
+ const GPUPipelineLayout = {};
75
+ GPUPipelineLayout[Symbol.hasInstance] = function (instance) {
76
+ return "__brand" in instance && instance.__brand === "GPUPipelineLayout";
77
+ };
78
+ const GPUQuerySet = {};
79
+ GPUQuerySet[Symbol.hasInstance] = function (instance) {
80
+ return "__brand" in instance && instance.__brand === "GPUQuerySet";
81
+ };
82
+ const GPUQueue = {};
83
+ GPUQueue[Symbol.hasInstance] = function (instance) {
84
+ return "__brand" in instance && instance.__brand === "GPUQueue";
85
+ };
86
+ const GPURenderBundle = {};
87
+ GPURenderBundle[Symbol.hasInstance] = function (instance) {
88
+ return "__brand" in instance && instance.__brand === "GPURenderBundle";
89
+ };
90
+ const GPURenderBundleEncoder = {};
91
+ GPURenderBundleEncoder[Symbol.hasInstance] = function (instance) {
92
+ return "__brand" in instance && instance.__brand === "GPURenderBundleEncoder";
93
+ };
94
+ const GPURenderPassEncoder = {};
95
+ GPURenderPassEncoder[Symbol.hasInstance] = function (instance) {
96
+ return "__brand" in instance && instance.__brand === "GPURenderPassEncoder";
97
+ };
98
+ const GPURenderPipeline = {};
99
+ GPURenderPipeline[Symbol.hasInstance] = function (instance) {
100
+ return "__brand" in instance && instance.__brand === "GPURenderPipeline";
101
+ };
102
+ const GPUSampler = {};
103
+ GPUSampler[Symbol.hasInstance] = function (instance) {
104
+ return "__brand" in instance && instance.__brand === "GPUSampler";
105
+ };
106
+ const GPUShaderModule = {};
107
+ GPUShaderModule[Symbol.hasInstance] = function (instance) {
108
+ return "__brand" in instance && instance.__brand === "GPUShaderModule";
109
+ };
110
+ const GPUTexture = {};
111
+ GPUTexture[Symbol.hasInstance] = function (instance) {
112
+ return "__brand" in instance && instance.__brand === "GPUTexture";
113
+ };
114
+ const GPUTextureView = {};
115
+ GPUTextureView[Symbol.hasInstance] = function (instance) {
116
+ return "__brand" in instance && instance.__brand === "GPUTextureView";
117
+ };
118
+ global.GPU = GPU;
119
+ global.GPUAdapter = GPUAdapter;
120
+ global.GPUAdapterInfo = GPUAdapterInfo;
121
+ global.GPUBindGroup = GPUBindGroup;
122
+ global.GPUBindGroupLayout = GPUBindGroupLayout;
123
+ global.GPUBuffer = GPUBuffer;
124
+ global.GPUCanvasContext = GPUCanvasContext;
125
+ global.GPUCommandBuffer = GPUCommandBuffer;
126
+ global.GPUCommandEncoder = GPUCommandEncoder;
127
+ global.GPUCompilationInfo = GPUCompilationInfo;
128
+ global.GPUCompilationMessage = GPUCompilationMessage;
129
+ global.GPUComputePassEncoder = GPUComputePassEncoder;
130
+ global.GPUComputePipeline = GPUComputePipeline;
131
+ global.GPUDevice = GPUDevice;
132
+ global.GPUDeviceLostInfo = GPUDeviceLostInfo;
133
+ global.GPUError = GPUError;
134
+ global.GPUExternalTexture = GPUExternalTexture;
135
+ global.GPUPipelineLayout = GPUPipelineLayout;
136
+ global.GPUQuerySet = GPUQuerySet;
137
+ global.GPUQueue = GPUQueue;
138
+ global.GPURenderBundle = GPURenderBundle;
139
+ global.GPURenderBundleEncoder = GPURenderBundleEncoder;
140
+ global.GPURenderPassEncoder = GPURenderPassEncoder;
141
+ global.GPURenderPipeline = GPURenderPipeline;
142
+ global.GPUSampler = GPUSampler;
143
+ global.GPUShaderModule = GPUShaderModule;
144
+ global.GPUTexture = GPUTexture;
145
+ global.GPUTextureView = GPUTextureView;
5
146
  WebGPUNativeModule.install();
6
- export const {
7
- gpu
8
- } = global;
9
147
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebGPUNativeModule","default","WebGPUView","WebGPUModule","install","gpu","global"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,sBAAsB;AAErD,SAASC,OAAO,IAAIC,UAAU,QAAQ,6BAA6B;AACnE,cAAc,6BAA6B;AAC3C,SAASD,OAAO,IAAIE,YAAY,QAAQ,sBAAsB;AAO9DH,kBAAkB,CAACI,OAAO,CAAC,CAAC;AAC5B,OAAO,MAAM;EAAEC;AAAI,CAAC,GAAGC,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["WebGPUNativeModule","default","WebGPUModule","GPU","Symbol","hasInstance","instance","__brand","GPUAdapter","GPUAdapterInfo","GPUBindGroup","GPUBindGroupLayout","GPUBuffer","GPUCanvasContext","GPUCommandBuffer","GPUCommandEncoder","GPUCompilationInfo","GPUCompilationMessage","GPUComputePassEncoder","GPUComputePipeline","GPUDevice","GPUDeviceLostInfo","GPUError","GPUExternalTexture","GPUPipelineLayout","GPUQuerySet","GPUQueue","GPURenderBundle","GPURenderBundleEncoder","GPURenderPassEncoder","GPURenderPipeline","GPUSampler","GPUShaderModule","GPUTexture","GPUTextureView","global","install"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;AACA,OAAOA,kBAAkB,MAAM,sBAAsB;AAErD,cAAc,UAAU;AACxB,cAAc,6BAA6B;AAC3C,SAASC,OAAO,IAAIC,YAAY,QAAQ,sBAAsB;AAE9D,MAAMC,GAAQ,GAAG,CAAC,CAAC;AACnBA,GAAG,CAACC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ACZ,kBAAkB,GAAGA,kBAAkB;AAC9CY,MAAM,CAACX,iBAAiB,GAAGA,iBAAiB;AAC5CW,MAAM,CAACV,WAAW,GAAGA,WAAW;AAChCU,MAAM,CAACT,QAAQ,GAAGA,QAAQ;AAC1BS,MAAM,CAACR,eAAe,GAAGA,eAAe;AACxCQ,MAAM,CAACP,sBAAsB,GAAGA,sBAAsB;AACtDO,MAAM,CAACN,oBAAoB,GAAGA,oBAAoB;AAClDM,MAAM,CAACL,iBAAiB,GAAGA,iBAAiB;AAC5CK,MAAM,CAACJ,UAAU,GAAGA,UAAU;AAC9BI,MAAM,CAACH,eAAe,GAAGA,eAAe;AACxCG,MAAM,CAACF,UAAU,GAAGA,UAAU;AAC9BE,MAAM,CAACD,cAAc,GAAGA,cAAc;AAEtClC,kBAAkB,CAACoC,OAAO,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ export declare const triangleVertWGSL = "@vertex\nfn main(\n @builtin(vertex_index) VertexIndex : u32\n) -> @builtin(position) vec4f {\n var pos = array<vec2f, 3>(\n vec2(0.0, 0.5),\n vec2(-0.5, -0.5),\n vec2(0.5, -0.5)\n );\n\n return vec4f(pos[VertexIndex], 0.0, 1.0);\n}";
2
+ export declare const redFragWGSL = "@fragment\nfn main() -> @location(0) vec4f {\n return vec4(1.0, 0.0, 0.0, 1.0);\n}";
3
+ //# sourceMappingURL=triangle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triangle.d.ts","sourceRoot":"","sources":["../../../../../example/src/Triangle/triangle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,0PAW3B,CAAC;AAEH,eAAO,MAAM,WAAW,wFAGtB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const solidColorLitWGSL = "struct Uniforms {\n worldViewProjectionMatrix: mat4x4f,\n worldMatrix: mat4x4f,\n color: vec4f,\n};\n\nstruct Vertex {\n @location(0) position: vec4f,\n @location(1) normal: vec3f,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n @location(0) normal: vec3f,\n};\n\n@group(0) @binding(0) var<uniform> uni: Uniforms;\n\n@vertex fn vs(vin: Vertex) -> VSOut {\n var vOut: VSOut;\n vOut.position = uni.worldViewProjectionMatrix * vin.position;\n vOut.normal = (uni.worldMatrix * vec4f(vin.normal, 0)).xyz;\n return vOut;\n}\n\n@fragment fn fs(vin: VSOut) -> @location(0) vec4f {\n let lightDirection = normalize(vec3f(4, 10, 6));\n let light = dot(normalize(vin.normal), lightDirection) * 0.5 + 0.5;\n return vec4f(uni.color.rgb * light, uni.color.a);\n}";
2
+ export declare const wireframeWGSL = "struct Uniforms {\n worldViewProjectionMatrix: mat4x4f,\n worldMatrix: mat4x4f,\n color: vec4f,\n};\n\nstruct LineUniforms {\n stride: u32,\n thickness: f32,\n alphaThreshold: f32,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n};\n\n@group(0) @binding(0) var<uniform> uni: Uniforms;\n@group(0) @binding(1) var<storage, read> positions: array<f32>;\n@group(0) @binding(2) var<storage, read> indices: array<u32>;\n@group(0) @binding(3) var<uniform> line: LineUniforms;\n\n@vertex fn vsIndexedU32(@builtin(vertex_index) vNdx: u32) -> VSOut {\n // indices make a triangle so for every 3 indices we need to output\n // 6 values\n let triNdx = vNdx / 6;\n // 0 1 0 1 0 1 0 1 0 1 0 1 vNdx % 2\n // 0 0 1 1 2 2 3 3 4 4 5 5 vNdx / 2\n // 0 1 1 2 2 3 3 4 4 5 5 6 vNdx % 2 + vNdx / 2\n // 0 1 1 2 2 0 0 1 1 2 2 0 (vNdx % 2 + vNdx / 2) % 3\n let vertNdx = (vNdx % 2 + vNdx / 2) % 3;\n let index = indices[triNdx * 3 + vertNdx];\n\n // note:\n //\n // * if your indices are U16 you could use this\n //\n // let indexNdx = triNdx * 3 + vertNdx;\n // let twoIndices = indices[indexNdx / 2]; // indices is u32 but we want u16\n // let index = (twoIndices >> ((indexNdx & 1) * 16)) & 0xFFFF;\n //\n // * if you're not using indices you could use this\n //\n // let index = triNdx * 3 + vertNdx;\n\n let pNdx = index * line.stride;\n let position = vec4f(positions[pNdx], positions[pNdx + 1], positions[pNdx + 2], 1);\n\n var vOut: VSOut;\n vOut.position = uni.worldViewProjectionMatrix * position;\n return vOut;\n}\n\n@fragment fn fs() -> @location(0) vec4f {\n return uni.color + vec4f(0.5);\n}\n\nstruct BarycentricCoordinateBasedVSOutput {\n @builtin(position) position: vec4f,\n @location(0) barycenticCoord: vec3f,\n};\n\n@vertex fn vsIndexedU32BarycentricCoordinateBasedLines(\n @builtin(vertex_index) vNdx: u32\n) -> BarycentricCoordinateBasedVSOutput {\n let vertNdx = vNdx % 3;\n let index = indices[vNdx];\n\n // note:\n //\n // * if your indices are U16 you could use this\n //\n // let twoIndices = indices[vNdx / 2]; // indices is u32 but we want u16\n // let index = (twoIndices >> ((vNdx & 1) * 16)) & 0xFFFF;\n //\n // * if you're not using indices you could use this\n //\n // let index = vNdx;\n\n let pNdx = index * line.stride;\n let position = vec4f(positions[pNdx], positions[pNdx + 1], positions[pNdx + 2], 1);\n\n var vsOut: BarycentricCoordinateBasedVSOutput;\n vsOut.position = uni.worldViewProjectionMatrix * position;\n\n // emit a barycentric coordinate\n vsOut.barycenticCoord = vec3f(0);\n vsOut.barycenticCoord[vertNdx] = 1.0;\n return vsOut;\n}\n\nfn edgeFactor(bary: vec3f) -> f32 {\n let d = fwidth(bary);\n let a3 = smoothstep(vec3f(0.0), d * line.thickness, bary);\n return min(min(a3.x, a3.y), a3.z);\n}\n\n@fragment fn fsBarycentricCoordinateBasedLines(\n v: BarycentricCoordinateBasedVSOutput\n) -> @location(0) vec4f {\n let a = 1.0 - edgeFactor(v.barycenticCoord);\n if (a < line.alphaThreshold) {\n discard;\n }\n\n return vec4((uni.color.rgb + 0.5) * a, a);\n}\n";
3
+ //# sourceMappingURL=Shaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shaders.d.ts","sourceRoot":"","sources":["../../../../../example/src/Wireframe/Shaders.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,6wBA6B5B,CAAC;AAEH,eAAO,MAAM,aAAa,oiGA0GzB,CAAC"}
@@ -0,0 +1,29 @@
1
+ type Mesh = {
2
+ positions: [number, number, number][];
3
+ triangles: [number, number, number][];
4
+ normals: [number, number, number][];
5
+ };
6
+ export declare function convertMeshToTypedArrays(mesh: Mesh, scale: number, offset?: number[]): {
7
+ vertices: Float32Array;
8
+ indices: Uint32Array;
9
+ };
10
+ export declare const modelData: {
11
+ teapot: {
12
+ vertices: Float32Array;
13
+ indices: Uint32Array;
14
+ };
15
+ sphere: {
16
+ vertices: Float32Array;
17
+ indices: Uint32Array;
18
+ };
19
+ jewel: {
20
+ vertices: Float32Array;
21
+ indices: Uint32Array;
22
+ };
23
+ rock: {
24
+ vertices: Float32Array;
25
+ indices: Uint32Array;
26
+ };
27
+ };
28
+ export {};
29
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../example/src/Wireframe/models.ts"],"names":[],"mappings":"AAUA,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACtC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACtC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CACrC,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,EACb,MAAM,WAAY;;;EAoBnB;AAoED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAKrB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="@webgpu/types" />
2
+ export interface DrawingContext {
3
+ width: number;
4
+ height: number;
5
+ getCurrentTexture(): GPUTexture;
6
+ getImageData(): Promise<{
7
+ data: number[];
8
+ width: number;
9
+ height: number;
10
+ format: string;
11
+ }>;
12
+ }
13
+ //# sourceMappingURL=DrawingContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrawingContext.d.ts","sourceRoot":"","sources":["../../../../../example/src/components/DrawingContext.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,IAAI,UAAU,CAAC;IAChC,YAAY,IAAI,OAAO,CAAC;QACtB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ"}
@@ -0,0 +1,7 @@
1
+ export declare const cubeVertexSize: number;
2
+ export declare const cubePositionOffset = 0;
3
+ export declare const cubeColorOffset: number;
4
+ export declare const cubeUVOffset: number;
5
+ export declare const cubeVertexCount = 36;
6
+ export declare const cubeVertexArray: Float32Array;
7
+ //# sourceMappingURL=cube.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cube.d.ts","sourceRoot":"","sources":["../../../../../example/src/components/cube.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,CAAC;AACrC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,eAAe,KAAK,CAAC;AAGlC,eAAO,MAAM,eAAe,cA2C1B,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface SphereMesh {
2
+ vertices: Float32Array;
3
+ indices: Uint16Array;
4
+ }
5
+ export declare const SphereLayout: {
6
+ vertexStride: number;
7
+ positionsOffset: number;
8
+ normalOffset: number;
9
+ uvOffset: number;
10
+ };
11
+ export declare function createSphereMesh(radius: number, widthSegments?: number, heightSegments?: number, randomness?: number): SphereMesh;
12
+ //# sourceMappingURL=sphere.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphere.d.ts","sourceRoot":"","sources":["../../../../../../example/src/components/meshes/sphere.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAGF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,aAAa,SAAK,EAClB,cAAc,SAAK,EACnB,UAAU,SAAI,GACb,UAAU,CAkFZ"}
@@ -0,0 +1,6 @@
1
+ export declare const mesh: {
2
+ positions: [number, number, number][];
3
+ triangles: [number, number, number][];
4
+ normals: [number, number, number][];
5
+ };
6
+ //# sourceMappingURL=teapot.d.ts.map