react-native-wgpu 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +31 -0
  3. package/android/CMakeLists.txt +74 -0
  4. package/android/build.gradle +166 -0
  5. package/android/cpp/cpp-adapter.cpp +12 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +3 -0
  8. package/android/src/main/AndroidManifestNew.xml +2 -0
  9. package/android/src/main/java/com/webgpu/WebGPUModule.java +39 -0
  10. package/android/src/main/java/com/webgpu/WebGPUView.java +24 -0
  11. package/android/src/main/java/com/webgpu/WebGPUViewManager.java +31 -0
  12. package/android/src/main/java/com/webgpu/WebGPUViewPackage.java +26 -0
  13. package/android/src/newarch/WgpuViewManagerSpec.java +24 -0
  14. package/android/src/oldarch/WebGPUViewManagerSpec.java +11 -0
  15. package/cpp/Logger.h +82 -0
  16. package/cpp/dawn/dawn_proc_table.h +308 -0
  17. package/cpp/dawn/webgpu.h +4201 -0
  18. package/cpp/dawn/webgpu_cpp.h +8985 -0
  19. package/cpp/dawn/webgpu_cpp_print.h +2460 -0
  20. package/cpp/dawn/wire/client/webgpu.h +339 -0
  21. package/cpp/dawn/wire/client/webgpu_cpp.h +9140 -0
  22. package/cpp/jsi/RNFEnumMapper.h +49 -0
  23. package/cpp/jsi/RNFHybridObject.cpp +145 -0
  24. package/cpp/jsi/RNFHybridObject.h +162 -0
  25. package/cpp/jsi/RNFJSIConverter.h +412 -0
  26. package/cpp/jsi/RNFJSIHelper.h +49 -0
  27. package/cpp/jsi/RNFPointerHolder.h +95 -0
  28. package/cpp/jsi/RNFPromise.cpp +45 -0
  29. package/cpp/jsi/RNFPromise.h +38 -0
  30. package/cpp/jsi/RNFRuntimeCache.cpp +57 -0
  31. package/cpp/jsi/RNFRuntimeCache.h +79 -0
  32. package/cpp/jsi/RNFWorkletRuntimeCollector.h +43 -0
  33. package/cpp/jsi/RNFWorkletRuntimeRegistry.cpp +11 -0
  34. package/cpp/jsi/RNFWorkletRuntimeRegistry.h +44 -0
  35. package/cpp/rnwgpu/MutableBuffer.h +48 -0
  36. package/cpp/rnwgpu/RNWebGPUManager.cpp +60 -0
  37. package/cpp/rnwgpu/RNWebGPUManager.h +30 -0
  38. package/cpp/rnwgpu/api/GPU.cpp +40 -0
  39. package/cpp/rnwgpu/api/GPU.h +43 -0
  40. package/cpp/rnwgpu/api/GPUAdapter.cpp +33 -0
  41. package/cpp/rnwgpu/api/GPUAdapter.h +40 -0
  42. package/cpp/rnwgpu/api/GPUAdapterInfo.h +33 -0
  43. package/cpp/rnwgpu/api/GPUBindGroup.h +38 -0
  44. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +39 -0
  45. package/cpp/rnwgpu/api/GPUBuffer.cpp +16 -0
  46. package/cpp/rnwgpu/api/GPUBuffer.h +44 -0
  47. package/cpp/rnwgpu/api/GPUCanvasContext.h +33 -0
  48. package/cpp/rnwgpu/api/GPUCommandBuffer.h +38 -0
  49. package/cpp/rnwgpu/api/GPUCommandEncoder.h +38 -0
  50. package/cpp/rnwgpu/api/GPUCompilationInfo.h +33 -0
  51. package/cpp/rnwgpu/api/GPUCompilationMessage.h +33 -0
  52. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +40 -0
  53. package/cpp/rnwgpu/api/GPUComputePipeline.h +39 -0
  54. package/cpp/rnwgpu/api/GPUDevice.cpp +12 -0
  55. package/cpp/rnwgpu/api/GPUDevice.h +45 -0
  56. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +33 -0
  57. package/cpp/rnwgpu/api/GPUExternalTexture.h +39 -0
  58. package/cpp/rnwgpu/api/GPUPipelineLayout.h +38 -0
  59. package/cpp/rnwgpu/api/GPUQuerySet.h +38 -0
  60. package/cpp/rnwgpu/api/GPUQueue.h +38 -0
  61. package/cpp/rnwgpu/api/GPURenderBundle.h +38 -0
  62. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +40 -0
  63. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +40 -0
  64. package/cpp/rnwgpu/api/GPURenderPipeline.h +38 -0
  65. package/cpp/rnwgpu/api/GPUSampler.h +38 -0
  66. package/cpp/rnwgpu/api/GPUShaderModule.h +38 -0
  67. package/cpp/rnwgpu/api/GPUSupportedLimits.h +33 -0
  68. package/cpp/rnwgpu/api/GPUTexture.h +38 -0
  69. package/cpp/rnwgpu/api/GPUTextureView.h +38 -0
  70. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +33 -0
  71. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +81 -0
  72. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +67 -0
  73. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +69 -0
  74. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +95 -0
  75. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +56 -0
  76. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +65 -0
  77. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +72 -0
  78. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +62 -0
  79. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +85 -0
  80. package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +43 -0
  81. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +93 -0
  82. package/cpp/rnwgpu/api/descriptors/GPUColorDict.h +81 -0
  83. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +69 -0
  84. package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +31 -0
  85. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +62 -0
  86. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +80 -0
  87. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +82 -0
  88. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +126 -0
  89. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +69 -0
  90. package/cpp/rnwgpu/api/descriptors/GPUExtent3DDict.h +76 -0
  91. package/cpp/rnwgpu/api/descriptors/GPUExtent3DDictStrict.h +91 -0
  92. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +44 -0
  93. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +75 -0
  94. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +85 -0
  95. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +83 -0
  96. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +66 -0
  97. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +74 -0
  98. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +88 -0
  99. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +70 -0
  100. package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +25 -0
  101. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +68 -0
  102. package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDict.h +61 -0
  103. package/cpp/rnwgpu/api/descriptors/GPUOrigin2DDictStrict.h +75 -0
  104. package/cpp/rnwgpu/api/descriptors/GPUOrigin3DDict.h +71 -0
  105. package/cpp/rnwgpu/api/descriptors/GPUPipelineErrorInit.h +54 -0
  106. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +72 -0
  107. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +66 -0
  108. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +72 -0
  109. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +81 -0
  110. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +102 -0
  111. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +105 -0
  112. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +118 -0
  113. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +100 -0
  114. package/cpp/rnwgpu/api/descriptors/GPURenderPassLayout.h +83 -0
  115. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +80 -0
  116. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +104 -0
  117. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +56 -0
  118. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +48 -0
  119. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +116 -0
  120. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +64 -0
  121. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +88 -0
  122. package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +27 -0
  123. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +61 -0
  124. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +67 -0
  125. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +58 -0
  126. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +123 -0
  127. package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +40 -0
  128. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +113 -0
  129. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +71 -0
  130. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +80 -0
  131. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +73 -0
  132. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +77 -0
  133. package/cpp/rnwgpu/api/descriptors/Unions.h +1645 -0
  134. package/cpp/webgpu/webgpu.h +33 -0
  135. package/cpp/webgpu/webgpu_cpp.h +33 -0
  136. package/cpp/webgpu/webgpu_cpp_chained_struct.h +55 -0
  137. package/cpp/webgpu/webgpu_enum_class_bitmasks.h +161 -0
  138. package/ios/RNFAppleLogger.mm +22 -0
  139. package/ios/Utils.h +5 -0
  140. package/ios/Utils.m +26 -0
  141. package/ios/WebGPUModule.h +18 -0
  142. package/ios/WebGPUModule.mm +77 -0
  143. package/ios/WebGPUView.h +15 -0
  144. package/ios/WebGPUView.mm +58 -0
  145. package/ios/WebGPUViewManager.mm +21 -0
  146. package/lib/commonjs/WebGPUNativeModule.js +10 -0
  147. package/lib/commonjs/WebGPUNativeModule.js.map +1 -0
  148. package/lib/commonjs/WebGPUViewNativeComponent.js +11 -0
  149. package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -0
  150. package/lib/commonjs/index.js +45 -0
  151. package/lib/commonjs/index.js.map +1 -0
  152. package/lib/module/WebGPUNativeModule.js +4 -0
  153. package/lib/module/WebGPUNativeModule.js.map +1 -0
  154. package/lib/module/WebGPUViewNativeComponent.js +4 -0
  155. package/lib/module/WebGPUViewNativeComponent.js.map +1 -0
  156. package/lib/module/index.js +9 -0
  157. package/lib/module/index.js.map +1 -0
  158. package/lib/typescript/babel.config.d.ts +2 -0
  159. package/lib/typescript/babel.config.d.ts.map +1 -0
  160. package/lib/typescript/jest.config.d.ts +5 -0
  161. package/lib/typescript/jest.config.d.ts.map +1 -0
  162. package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts +5 -0
  163. package/lib/typescript/lib/commonjs/WebGPUNativeModule.d.ts.map +1 -0
  164. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts +4 -0
  165. package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts.map +1 -0
  166. package/lib/typescript/lib/commonjs/index.d.ts +5 -0
  167. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -0
  168. package/lib/typescript/lib/module/WebGPUNativeModule.d.ts +3 -0
  169. package/lib/typescript/lib/module/WebGPUNativeModule.d.ts.map +1 -0
  170. package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts +4 -0
  171. package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts.map +1 -0
  172. package/lib/typescript/lib/module/index.d.ts +5 -0
  173. package/lib/typescript/lib/module/index.d.ts.map +1 -0
  174. package/lib/typescript/scripts/build/copy-artifacts.d.ts +2 -0
  175. package/lib/typescript/scripts/build/copy-artifacts.d.ts.map +1 -0
  176. package/lib/typescript/scripts/build/dawn.d.ts +2 -0
  177. package/lib/typescript/scripts/build/dawn.d.ts.map +1 -0
  178. package/lib/typescript/scripts/build/util.d.ts +13 -0
  179. package/lib/typescript/scripts/build/util.d.ts.map +1 -0
  180. package/lib/typescript/scripts/codegen/codegen.d.ts +2 -0
  181. package/lib/typescript/scripts/codegen/codegen.d.ts.map +1 -0
  182. package/lib/typescript/scripts/codegen/model/dawn.d.ts +2 -0
  183. package/lib/typescript/scripts/codegen/model/dawn.d.ts.map +1 -0
  184. package/lib/typescript/scripts/codegen/model/model.d.ts +8 -0
  185. package/lib/typescript/scripts/codegen/model/model.d.ts.map +1 -0
  186. package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts +4 -0
  187. package/lib/typescript/scripts/codegen/templates/Descriptor.d.ts.map +1 -0
  188. package/lib/typescript/scripts/codegen/templates/Enum.d.ts +3 -0
  189. package/lib/typescript/scripts/codegen/templates/Enum.d.ts.map +1 -0
  190. package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts +3 -0
  191. package/lib/typescript/scripts/codegen/templates/HybridObject.d.ts.map +1 -0
  192. package/lib/typescript/scripts/codegen/templates/Unions.d.ts +6 -0
  193. package/lib/typescript/scripts/codegen/templates/Unions.d.ts.map +1 -0
  194. package/lib/typescript/scripts/codegen/templates/common.d.ts +9 -0
  195. package/lib/typescript/scripts/codegen/templates/common.d.ts.map +1 -0
  196. package/lib/typescript/scripts/codegen/util.d.ts +2 -0
  197. package/lib/typescript/scripts/codegen/util.d.ts.map +1 -0
  198. package/lib/typescript/src/WebGPUNativeModule.d.ts +7 -0
  199. package/lib/typescript/src/WebGPUNativeModule.d.ts.map +1 -0
  200. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +8 -0
  201. package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -0
  202. package/lib/typescript/src/index.d.ts +9 -0
  203. package/lib/typescript/src/index.d.ts.map +1 -0
  204. package/package.json +120 -0
  205. package/react-native-webgpu.podspec +56 -0
  206. package/src/WebGPUNativeModule.ts +9 -0
  207. package/src/WebGPUViewNativeComponent.ts +9 -0
  208. package/src/index.tsx +13 -0
@@ -0,0 +1,5 @@
1
+ export let preset: string;
2
+ export let modulePathIgnorePatterns: string[];
3
+ export let globalSetup: string;
4
+ export let globalTeardown: string;
5
+ //# sourceMappingURL=jest.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../../jest.config.js"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export const __esModule: boolean;
2
+ declare const _default: _reactNative.TurboModule;
3
+ export default _default;
4
+ import _reactNative = require("react-native");
5
+ //# sourceMappingURL=WebGPUNativeModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUNativeModule.d.ts","sourceRoot":"","sources":["../../../commonjs/WebGPUNativeModule.js"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export const __esModule: boolean;
2
+ declare const _default: any;
3
+ export default _default;
4
+ //# sourceMappingURL=WebGPUViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../commonjs/WebGPUViewNativeComponent.js"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export const __esModule: boolean;
2
+ export const WebGPUModule: any;
3
+ export const WebGPUView: any;
4
+ export const gpu: GPU;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../commonjs/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("react-native").TurboModule;
2
+ export default _default;
3
+ //# sourceMappingURL=WebGPUNativeModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUNativeModule.d.ts","sourceRoot":"","sources":["../../../module/WebGPUNativeModule.js"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ /// <reference types="react-native/types/modules/Codegen" />
2
+ declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<object>;
3
+ export default _default;
4
+ //# sourceMappingURL=WebGPUViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../module/WebGPUViewNativeComponent.js"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export { default as WebGPUView } from "./WebGPUViewNativeComponent";
2
+ export * from "./WebGPUViewNativeComponent";
3
+ export { default as WebGPUModule } from "./WebGPUNativeModule";
4
+ export const gpu: GPU;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../module/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=copy-artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-artifacts.d.ts","sourceRoot":"","sources":["../../../../scripts/build/copy-artifacts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dawn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dawn.d.ts","sourceRoot":"","sources":["../../../../scripts/build/dawn.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ export declare const libs: readonly ["libwebgpu_dawn"];
3
+ export declare const platforms: readonly ["arm64", "x86_64", "x86", "armeabi-v7a", "arm64-v8a"];
4
+ export type OS = "ios" | "android";
5
+ export type Platform = (typeof platforms)[number];
6
+ export declare const runAsync: (command: string, label: string) => Promise<void>;
7
+ export declare const mapKeys: <T extends object>(obj: T) => (keyof T)[];
8
+ export declare const checkFileExists: (filePath: string) => void;
9
+ export declare const $: (command: string) => Buffer;
10
+ export declare const build: (label: string, args: Record<string, string>, debugLabel: string) => Promise<void>;
11
+ export declare const copyLib: (os: OS, platform: Platform, sdk?: string) => void;
12
+ export declare const checkBuildArtifacts: () => void;
13
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../scripts/build/util.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,IAAI,6BAA8B,CAAC;AAEhD,eAAO,MAAM,SAAS,iEAMZ,CAAC;AAEX,MAAM,MAAM,EAAE,GAAG,KAAK,GAAG,SAAS,CAAC;AACnC,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,eAAO,MAAM,QAAQ,YAAa,MAAM,SAAS,MAAM,KAAG,QAAQ,IAAI,CA4BrE,CAAC;AAEF,eAAO,MAAM,OAAO,0BAA2B,CAAC,gBACf,CAAC;AAElC,eAAO,MAAM,eAAe,aAAc,MAAM,SAW/C,CAAC;AAEF,eAAO,MAAM,CAAC,YAAa,MAAM,WAMhC,CAAC;AAQF,eAAO,MAAM,KAAK,UACT,MAAM,QACP,OAAO,MAAM,EAAE,MAAM,CAAC,cAChB,MAAM,kBAQnB,CAAC;AAEF,eAAO,MAAM,OAAO,OAAQ,EAAE,YAAY,QAAQ,QAAQ,MAAM,SAY/D,CAAC;AAEF,eAAO,MAAM,mBAAmB,YAc/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=codegen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../../../scripts/codegen/codegen.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare const dawn: any;
2
+ //# sourceMappingURL=dawn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dawn.d.ts","sourceRoot":"","sources":["../../../../../scripts/codegen/model/dawn.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,KAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { MethodSignature } from "ts-morph";
2
+ export declare const resolveMethod: (methodSignature: MethodSignature) => {
3
+ dependencies: string[];
4
+ name: string;
5
+ args: any;
6
+ returns: string | number | symbol;
7
+ };
8
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../scripts/codegen/model/model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,eAAe,EAAE,MAAM,UAAU,CAAC;AAmHtE,eAAO,MAAM,aAAa,oBAAqB,eAAe;;;;;CA0D7D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { InterfaceDeclaration } from "ts-morph";
2
+ import type { Union } from "./Unions";
3
+ export declare const getDescriptor: (decl: InterfaceDeclaration, unions: Union[]) => string;
4
+ //# sourceMappingURL=Descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Descriptor.d.ts","sourceRoot":"","sources":["../../../../../scripts/codegen/templates/Descriptor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAqB,MAAM,UAAU,CAAC;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAuFtC,eAAO,MAAM,aAAa,SAAU,oBAAoB,UAAU,KAAK,EAAE,WA4ExE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { VariableDeclaration } from "ts-morph";
2
+ export declare const getEnum: (decl: VariableDeclaration) => string;
3
+ //# sourceMappingURL=Enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Enum.d.ts","sourceRoot":"","sources":["../../../../../scripts/codegen/templates/Enum.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAYvE,eAAO,MAAM,OAAO,SAAU,mBAAmB,WAuChD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { InterfaceDeclaration } from "ts-morph";
2
+ export declare const getHybridObject: (decl: InterfaceDeclaration) => string;
3
+ //# sourceMappingURL=HybridObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HybridObject.d.ts","sourceRoot":"","sources":["../../../../../scripts/codegen/templates/HybridObject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AA2BrD,eAAO,MAAM,eAAe,SAAU,oBAAoB,WAiFzD,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface Union {
2
+ name: string;
3
+ values: string[];
4
+ }
5
+ export declare const Unions: (unions: Union[]) => string;
6
+ //# sourceMappingURL=Unions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unions.d.ts","sourceRoot":"","sources":["../../../../../scripts/codegen/templates/Unions.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,eAAO,MAAM,MAAM,WAAY,KAAK,EAAE,WAuBrC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { PropertySignature, InterfaceDeclaration } from "ts-morph";
2
+ export declare const mergeParentInterfaces: (interfaceDecl: InterfaceDeclaration) => InterfaceDeclaration;
3
+ export declare const getJSIProp: (method: PropertySignature) => {
4
+ name: string;
5
+ type: string;
6
+ dependencies: string[];
7
+ };
8
+ export declare const wrapType: (type: string, optional?: boolean) => string;
9
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../scripts/codegen/templates/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAQ,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAG9E,eAAO,MAAM,qBAAqB,kBAAmB,oBAAoB,yBAkCxE,CAAC;AAEF,eAAO,MAAM,UAAU,WAAY,iBAAiB;;;;CAInD,CAAC;AAuCF,eAAO,MAAM,QAAQ,SAAU,MAAM,+BAMpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const writeFile: (name: string, content: string, descriptors?: boolean) => void;
2
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../scripts/codegen/util.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,SAAS,SACd,MAAM,WACH,MAAM,gCAYhB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
2
+ export interface Spec extends TurboModule {
3
+ install: () => boolean;
4
+ }
5
+ declare const _default: Spec;
6
+ export default _default;
7
+ //# sourceMappingURL=WebGPUNativeModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUNativeModule.d.ts","sourceRoot":"","sources":["../../../src/WebGPUNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAGhF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,OAAO,EAAE,MAAM,OAAO,CAAC;CACxB;;AAGD,wBAAsE"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react-native/types/modules/Codegen" />
2
+ import type { ViewProps } from "react-native";
3
+ interface NativeProps extends ViewProps {
4
+ color?: string;
5
+ }
6
+ declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
7
+ export default _default;
8
+ //# sourceMappingURL=WebGPUViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,UAAU,WAAY,SAAQ,SAAS;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;AAGD,wBAAiE"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="@webgpu/types" />
2
+ export { default as WebGPUView } from "./WebGPUViewNativeComponent";
3
+ export * from "./WebGPUViewNativeComponent";
4
+ export { default as WebGPUModule } from "./WebGPUNativeModule";
5
+ declare global {
6
+ var gpu: GPU;
7
+ }
8
+ export declare const gpu: GPU;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpE,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,GAAG,EAAE,GAAG,CAAC;CACd;AAGD,eAAO,MAAQ,GAAG,KAAW,CAAC"}
package/package.json ADDED
@@ -0,0 +1,120 @@
1
+ {
2
+ "name": "react-native-wgpu",
3
+ "version": "0.1.0",
4
+ "description": "React Native WebGPU",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/src/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "*.podspec",
17
+ "!ios/build",
18
+ "!android/build",
19
+ "!android/gradle",
20
+ "!android/gradlew",
21
+ "!android/gradlew.bat",
22
+ "!android/local.properties",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__",
26
+ "!**/.*"
27
+ ],
28
+ "scripts": {
29
+ "example": "yarn workspace react-native-webgpu-example",
30
+ "test": "jest",
31
+ "tsc": "tsc --noEmit",
32
+ "lint": "eslint \"**/*.{ts,tsx}\"",
33
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
34
+ "build-dawn": "ts-node scripts/build/dawn.ts",
35
+ "clean-dawn": "rimraf ./libs && rimraf ../externals/dawn/out",
36
+ "clang-format": "yarn clang-format-ios && yarn clang-format-android && yarn clang-format-common",
37
+ "clang-format-ios": "find ios/ -iname \"*.h\" -o -iname \"*.mm\" -o -iname \"*.cpp\" | xargs clang-format -i",
38
+ "clang-format-android": "find android/cpp/ -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
39
+ "clang-format-common": "find cpp/rnwgpu -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
40
+ "cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=example --exclude=android/.cxx --exclude=cpp/webgpu --exclude=cpp/dawn --exclude=ios --exclude=android/build --exclude=node_modules --recursive .",
41
+ "copy-artifacts": "ts-node scripts/build/copy-artifacts.ts",
42
+ "codegen": "ts-node scripts/codegen/codegen.ts && yarn clang-format"
43
+ },
44
+ "keywords": [
45
+ "react-native",
46
+ "ios",
47
+ "android"
48
+ ],
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/wcandillon/react-native-wgpu.git"
52
+ },
53
+ "author": "William Candillon <wcandillon@gmail.com> (https://github.com/wcandillon)",
54
+ "license": "MIT",
55
+ "bugs": {
56
+ "url": "https://github.com/wcandillon/react-native-wgpu/issues"
57
+ },
58
+ "homepage": "https://github.com/wcandillon/react-native-wgpu#readme",
59
+ "publishConfig": {
60
+ "registry": "https://registry.npmjs.org/"
61
+ },
62
+ "devDependencies": {
63
+ "@react-native/eslint-config": "^0.74.84",
64
+ "@types/jest": "^29.5.12",
65
+ "@types/lodash": "^4.17.5",
66
+ "@types/node": "^20.14.7",
67
+ "@types/react": "^18.2.44",
68
+ "@types/ws": "^8.5.10",
69
+ "@typescript-eslint/eslint-plugin": "^7.13.1",
70
+ "@webgpu/types": "^0.1.42",
71
+ "clang-format": "^1.8.0",
72
+ "del-cli": "^5.1.0",
73
+ "eslint": "8",
74
+ "eslint-config-react-native-wcandillon": "^3.10.2",
75
+ "eslint-plugin-import": "^2.29.1",
76
+ "eslint-plugin-prettier": "^5.1.3",
77
+ "jest": "^29.7.0",
78
+ "lodash": "^4.17.21",
79
+ "prettier": "^3.0.3",
80
+ "react": "18.2.0",
81
+ "react-native": "0.74.2",
82
+ "react-native-builder-bob": "^0.23.2",
83
+ "rimraf": "^5.0.7",
84
+ "ts-morph": "^22.0.0",
85
+ "ts-node": "^10.9.2",
86
+ "turbo": "^1.10.7",
87
+ "typescript": "^5.2.2",
88
+ "ws": "^8.18.0"
89
+ },
90
+ "resolutions": {
91
+ "@types/react": "^18.2.44"
92
+ },
93
+ "peerDependencies": {
94
+ "react": "*",
95
+ "react-native": "*"
96
+ },
97
+ "workspaces": [
98
+ "example"
99
+ ],
100
+ "packageManager": "yarn@3.6.1",
101
+ "react-native-builder-bob": {
102
+ "source": "src",
103
+ "output": "lib",
104
+ "targets": [
105
+ "commonjs",
106
+ "module",
107
+ [
108
+ "typescript",
109
+ {
110
+ "project": "tsconfig.build.json"
111
+ }
112
+ ]
113
+ ]
114
+ },
115
+ "codegenConfig": {
116
+ "name": "RNWgpuViewSpec",
117
+ "type": "components",
118
+ "jsSrcsDir": "src"
119
+ }
120
+ }
@@ -0,0 +1,56 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "react-native-webgpu"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => min_ios_version_supported }
15
+ s.source = { :git => "https://github.com/wcandillon/react-native-webgpu.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = [
18
+ "ios/**/*.{h,c,cc,cpp,m,mm,swift}",
19
+ "cpp/**/*.{h,cpp}"
20
+ ]
21
+
22
+ s.pod_target_xcconfig = {
23
+ "HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/cpp"
24
+ }
25
+ s.ios.vendored_frameworks = [
26
+ 'libs/ios/libwebgpu_dawn.xcframework',
27
+ 'libs/ios/libdawn_common.xcframework',
28
+ 'libs/ios/libdawn_native.xcframework',
29
+ 'libs/ios/libdawn_proc.xcframework'
30
+ ]
31
+ s.vendored_frameworks = "$(PODS_TARGET_SRCROOT)/libs/ios/libwebgpu_dawn.xcframework"
32
+
33
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
34
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
35
+ if respond_to?(:install_modules_dependencies, true)
36
+ install_modules_dependencies(s)
37
+ else
38
+ s.dependency "React-Core"
39
+
40
+ # Don't install the dependencies when we run `pod install` in the old architecture.
41
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
42
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
43
+ s.pod_target_xcconfig = {
44
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
45
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
46
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
47
+ }
48
+ s.dependency "React-RCTFabric"
49
+ s.dependency "React-Codegen"
50
+ s.dependency "RCT-Folly"
51
+ s.dependency "RCTRequired"
52
+ s.dependency "RCTTypeSafety"
53
+ s.dependency "ReactCommon/turbomodule/core"
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,9 @@
1
+ import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
2
+ import { TurboModuleRegistry } from "react-native";
3
+
4
+ export interface Spec extends TurboModule {
5
+ install: () => boolean;
6
+ }
7
+
8
+ // eslint-disable-next-line import/no-default-export
9
+ export default TurboModuleRegistry.getEnforcing<Spec>("WebGPUModule");
@@ -0,0 +1,9 @@
1
+ import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
2
+ import type { ViewProps } from "react-native";
3
+
4
+ interface NativeProps extends ViewProps {
5
+ color?: string;
6
+ }
7
+
8
+ // eslint-disable-next-line import/no-default-export
9
+ export default codegenNativeComponent<NativeProps>("WebGPUView");
package/src/index.tsx ADDED
@@ -0,0 +1,13 @@
1
+ import WebGPUNativeModule from "./WebGPUNativeModule";
2
+
3
+ export { default as WebGPUView } from "./WebGPUViewNativeComponent";
4
+ export * from "./WebGPUViewNativeComponent";
5
+ export { default as WebGPUModule } from "./WebGPUNativeModule";
6
+
7
+ declare global {
8
+ // eslint-disable-next-line no-var
9
+ var gpu: GPU;
10
+ }
11
+
12
+ WebGPUNativeModule.install();
13
+ export const { gpu } = global;