react-native-wgpu 0.4.1 → 0.5.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 (197) hide show
  1. package/README.md +59 -14
  2. package/android/CMakeLists.txt +3 -3
  3. package/cpp/jsi/{RNFEnumMapper.h → EnumMapper.h} +2 -6
  4. package/cpp/jsi/{RNFJSIConverter.h → JSIConverter.h} +27 -110
  5. package/cpp/jsi/NativeObject.h +607 -0
  6. package/cpp/jsi/{RNFPromise.cpp → Promise.cpp} +3 -6
  7. package/cpp/jsi/{RNFPromise.h → Promise.h} +2 -5
  8. package/cpp/jsi/RuntimeAwareCache.cpp +7 -0
  9. package/cpp/jsi/RuntimeAwareCache.h +100 -0
  10. package/cpp/jsi/RuntimeLifecycleMonitor.cpp +72 -0
  11. package/cpp/jsi/RuntimeLifecycleMonitor.h +32 -0
  12. package/cpp/rnwgpu/ArrayBuffer.h +8 -12
  13. package/cpp/rnwgpu/RNWebGPUManager.cpp +187 -28
  14. package/cpp/rnwgpu/RNWebGPUManager.h +7 -0
  15. package/cpp/rnwgpu/api/Canvas.h +14 -12
  16. package/cpp/rnwgpu/api/GPU.cpp +4 -6
  17. package/cpp/rnwgpu/api/GPU.h +13 -11
  18. package/cpp/rnwgpu/api/GPUAdapter.cpp +9 -9
  19. package/cpp/rnwgpu/api/GPUAdapter.h +14 -11
  20. package/cpp/rnwgpu/api/GPUAdapterInfo.h +17 -15
  21. package/cpp/rnwgpu/api/GPUBindGroup.h +11 -10
  22. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +12 -11
  23. package/cpp/rnwgpu/api/GPUBuffer.h +19 -16
  24. package/cpp/rnwgpu/api/GPUCanvasContext.h +17 -13
  25. package/cpp/rnwgpu/api/GPUCommandBuffer.h +12 -10
  26. package/cpp/rnwgpu/api/GPUCommandEncoder.h +35 -32
  27. package/cpp/rnwgpu/api/GPUCompilationInfo.h +19 -19
  28. package/cpp/rnwgpu/api/GPUCompilationMessage.h +10 -7
  29. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +28 -27
  30. package/cpp/rnwgpu/api/GPUComputePipeline.h +14 -13
  31. package/cpp/rnwgpu/api/GPUDevice.cpp +111 -95
  32. package/cpp/rnwgpu/api/GPUDevice.h +51 -43
  33. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +12 -10
  34. package/cpp/rnwgpu/api/GPUError.h +19 -29
  35. package/cpp/rnwgpu/api/GPUExtent3D.h +7 -10
  36. package/cpp/rnwgpu/api/GPUExternalTexture.h +12 -11
  37. package/cpp/rnwgpu/api/GPUInternalError.h +31 -0
  38. package/cpp/rnwgpu/api/GPUOrigin2D.h +6 -10
  39. package/cpp/rnwgpu/api/GPUOrigin3D.h +6 -10
  40. package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +33 -0
  41. package/cpp/rnwgpu/api/GPUPipelineLayout.h +12 -10
  42. package/cpp/rnwgpu/api/GPUQuerySet.h +14 -12
  43. package/cpp/rnwgpu/api/GPUQueue.h +18 -17
  44. package/cpp/rnwgpu/api/GPURenderBundle.h +11 -10
  45. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +36 -33
  46. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +49 -47
  47. package/cpp/rnwgpu/api/GPURenderPipeline.h +14 -12
  48. package/cpp/rnwgpu/api/GPUSampler.h +11 -10
  49. package/cpp/rnwgpu/api/GPUShaderModule.cpp +7 -8
  50. package/cpp/rnwgpu/api/GPUShaderModule.h +13 -12
  51. package/cpp/rnwgpu/api/GPUSupportedLimits.h +73 -93
  52. package/cpp/rnwgpu/api/GPUTexture.h +24 -20
  53. package/cpp/rnwgpu/api/GPUTextureView.h +11 -10
  54. package/cpp/rnwgpu/api/GPUValidationError.h +32 -0
  55. package/cpp/rnwgpu/api/ImageBitmap.h +10 -6
  56. package/cpp/rnwgpu/api/RNWebGPU.h +21 -21
  57. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +3 -7
  58. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +7 -11
  59. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +3 -7
  60. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +3 -7
  61. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +3 -8
  62. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +3 -7
  63. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +3 -7
  64. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +3 -8
  65. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +3 -8
  66. package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +28 -32
  67. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +3 -7
  68. package/cpp/rnwgpu/api/descriptors/GPUColor.h +3 -8
  69. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +3 -7
  70. package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +18 -20
  71. package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +3 -8
  72. package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +3 -8
  73. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +3 -7
  74. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +3 -7
  75. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +3 -7
  76. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +3 -7
  77. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +3 -7
  78. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +3 -8
  79. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +3 -7
  80. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +3 -7
  81. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +3 -7
  82. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +3 -7
  83. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +3 -7
  84. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +3 -7
  85. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +3 -8
  86. package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +11 -14
  87. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +3 -8
  88. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +3 -7
  89. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +3 -8
  90. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +3 -7
  91. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +3 -8
  92. package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +3 -8
  93. package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +3 -8
  94. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +3 -8
  95. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +3 -7
  96. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +3 -7
  97. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +3 -7
  98. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +3 -7
  99. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +3 -7
  100. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +3 -8
  101. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +3 -8
  102. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +3 -8
  103. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +3 -7
  104. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +3 -7
  105. package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +14 -16
  106. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +3 -8
  107. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +3 -8
  108. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +3 -8
  109. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +3 -7
  110. package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +18 -29
  111. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +3 -8
  112. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +3 -7
  113. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +3 -8
  114. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +3 -7
  115. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +3 -7
  116. package/cpp/rnwgpu/api/descriptors/Unions.h +3 -3
  117. package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +10 -10
  118. package/cpp/rnwgpu/async/AsyncTaskHandle.h +2 -2
  119. package/lib/commonjs/Canvas.js +9 -14
  120. package/lib/commonjs/Canvas.js.map +1 -1
  121. package/lib/commonjs/external/ModuleProxy.js +36 -0
  122. package/lib/commonjs/external/ModuleProxy.js.map +1 -0
  123. package/lib/commonjs/external/index.js +17 -0
  124. package/lib/commonjs/external/index.js.map +1 -0
  125. package/lib/commonjs/external/reanimated/ReanimatedProxy.js +18 -0
  126. package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +1 -0
  127. package/lib/commonjs/external/reanimated/index.js +21 -0
  128. package/lib/commonjs/external/reanimated/index.js.map +1 -0
  129. package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js +50 -0
  130. package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js.map +1 -0
  131. package/lib/commonjs/main/index.js +2 -142
  132. package/lib/commonjs/main/index.js.map +1 -1
  133. package/lib/module/Canvas.js +10 -16
  134. package/lib/module/Canvas.js.map +1 -1
  135. package/lib/module/external/ModuleProxy.js +28 -0
  136. package/lib/module/external/ModuleProxy.js.map +1 -0
  137. package/lib/module/external/index.js +2 -0
  138. package/lib/module/external/index.js.map +1 -0
  139. package/lib/module/external/reanimated/ReanimatedProxy.js +12 -0
  140. package/lib/module/external/reanimated/ReanimatedProxy.js.map +1 -0
  141. package/lib/module/external/reanimated/index.js +3 -0
  142. package/lib/module/external/reanimated/index.js.map +1 -0
  143. package/lib/module/external/reanimated/registerWebGPUForReanimated.js +43 -0
  144. package/lib/module/external/reanimated/registerWebGPUForReanimated.js.map +1 -0
  145. package/lib/module/main/index.js +2 -141
  146. package/lib/module/main/index.js.map +1 -1
  147. package/lib/typescript/babel.config.d.ts +1 -0
  148. package/lib/typescript/lib/commonjs/Canvas.d.ts +5 -1
  149. package/lib/typescript/lib/commonjs/Canvas.d.ts.map +1 -1
  150. package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts +12 -0
  151. package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts.map +1 -0
  152. package/lib/typescript/lib/commonjs/external/index.d.ts +2 -0
  153. package/lib/typescript/lib/commonjs/external/index.d.ts.map +1 -0
  154. package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +6 -0
  155. package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
  156. package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts +4 -0
  157. package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts.map +1 -0
  158. package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts +9 -0
  159. package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
  160. package/lib/typescript/lib/module/Canvas.d.ts +6 -1
  161. package/lib/typescript/lib/module/Canvas.d.ts.map +1 -1
  162. package/lib/typescript/lib/module/external/ModuleProxy.d.ts +7 -0
  163. package/lib/typescript/lib/module/external/ModuleProxy.d.ts.map +1 -0
  164. package/lib/typescript/lib/module/external/index.d.ts +2 -0
  165. package/lib/typescript/lib/module/external/index.d.ts.map +1 -0
  166. package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts +5 -0
  167. package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
  168. package/lib/typescript/lib/module/external/reanimated/index.d.ts +3 -0
  169. package/lib/typescript/lib/module/external/reanimated/index.d.ts.map +1 -0
  170. package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts +2 -0
  171. package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
  172. package/lib/typescript/src/Canvas.d.ts +4 -2
  173. package/lib/typescript/src/Canvas.d.ts.map +1 -1
  174. package/lib/typescript/src/external/ModuleProxy.d.ts +11 -0
  175. package/lib/typescript/src/external/ModuleProxy.d.ts.map +1 -0
  176. package/lib/typescript/src/external/index.d.ts +2 -0
  177. package/lib/typescript/src/external/index.d.ts.map +1 -0
  178. package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts +4 -0
  179. package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
  180. package/lib/typescript/src/external/reanimated/index.d.ts +3 -0
  181. package/lib/typescript/src/external/reanimated/index.d.ts.map +1 -0
  182. package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts +8 -0
  183. package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
  184. package/package.json +15 -2
  185. package/src/Canvas.tsx +16 -22
  186. package/src/external/ModuleProxy.ts +30 -0
  187. package/src/external/index.ts +1 -0
  188. package/src/external/reanimated/ReanimatedProxy.ts +19 -0
  189. package/src/external/reanimated/index.ts +2 -0
  190. package/src/external/reanimated/registerWebGPUForReanimated.ts +43 -0
  191. package/src/main/index.tsx +3 -170
  192. package/cpp/jsi/RNFHybridObject.cpp +0 -150
  193. package/cpp/jsi/RNFHybridObject.h +0 -181
  194. package/cpp/jsi/RNFJSIHelper.h +0 -51
  195. package/cpp/jsi/RNFPointerHolder.h +0 -95
  196. package/cpp/jsi/RNFRuntimeState.cpp +0 -18
  197. package/cpp/jsi/RNFRuntimeState.h +0 -106
@@ -1,40 +1,29 @@
1
1
  #pragma once
2
- #include <string>
3
2
 
4
- #include <RNFHybridObject.h>
3
+ #include <jsi/jsi.h>
5
4
 
6
5
  #include "webgpu/webgpu_cpp.h"
7
6
 
8
7
  namespace rnwgpu {
9
8
 
10
- namespace m = margelo;
9
+ namespace jsi = facebook::jsi;
11
10
 
12
- class GPUTextureUsage : public m::HybridObject {
11
+ class GPUTextureUsage {
13
12
  public:
14
- GPUTextureUsage() : HybridObject("GPUTextureUsage") {}
15
-
16
- public:
17
- double CopySrc() { return static_cast<double>(wgpu::TextureUsage::CopySrc); }
18
- double CopyDst() { return static_cast<double>(wgpu::TextureUsage::CopyDst); }
19
- double TextureBinding() {
20
- return static_cast<double>(wgpu::TextureUsage::TextureBinding);
21
- }
22
- double StorageBinding() {
23
- return static_cast<double>(wgpu::TextureUsage::StorageBinding);
24
- }
25
- double RenderAttachment() {
26
- return static_cast<double>(wgpu::TextureUsage::RenderAttachment);
27
- }
28
-
29
- void loadHybridMethods() override {
30
- registerHybridGetter("COPY_SRC", &GPUTextureUsage::CopySrc, this);
31
- registerHybridGetter("COPY_DST", &GPUTextureUsage::CopyDst, this);
32
- registerHybridGetter("TEXTURE_BINDING", &GPUTextureUsage::TextureBinding,
33
- this);
34
- registerHybridGetter("STORAGE_BINDING", &GPUTextureUsage::StorageBinding,
35
- this);
36
- registerHybridGetter("RENDER_ATTACHMENT",
37
- &GPUTextureUsage::RenderAttachment, this);
13
+ static jsi::Object create(jsi::Runtime &runtime) {
14
+ jsi::Object obj(runtime);
15
+ obj.setProperty(runtime, "COPY_SRC",
16
+ static_cast<double>(wgpu::TextureUsage::CopySrc));
17
+ obj.setProperty(runtime, "COPY_DST",
18
+ static_cast<double>(wgpu::TextureUsage::CopyDst));
19
+ obj.setProperty(runtime, "TEXTURE_BINDING",
20
+ static_cast<double>(wgpu::TextureUsage::TextureBinding));
21
+ obj.setProperty(runtime, "STORAGE_BINDING",
22
+ static_cast<double>(wgpu::TextureUsage::StorageBinding));
23
+ obj.setProperty(runtime, "RENDER_ATTACHMENT",
24
+ static_cast<double>(wgpu::TextureUsage::RenderAttachment));
25
+ return obj;
38
26
  }
39
27
  };
40
- } // namespace rnwgpu
28
+
29
+ } // namespace rnwgpu
@@ -5,13 +5,10 @@
5
5
 
6
6
  #include "webgpu/webgpu_cpp.h"
7
7
 
8
- #include "RNFJSIConverter.h"
8
+ #include "JSIConverter.h"
9
9
  #include "WGPULogger.h"
10
10
 
11
- #include "RNFHybridObject.h"
12
-
13
11
  namespace jsi = facebook::jsi;
14
- namespace m = margelo;
15
12
 
16
13
  namespace rnwgpu {
17
14
 
@@ -29,9 +26,7 @@ struct GPUTextureViewDescriptor {
29
26
 
30
27
  } // namespace rnwgpu
31
28
 
32
- namespace margelo {
33
-
34
- using namespace rnwgpu; // NOLINT(build/namespaces)
29
+ namespace rnwgpu {
35
30
 
36
31
  template <>
37
32
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUTextureViewDescriptor>> {
@@ -94,4 +89,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUTextureViewDescriptor>> {
94
89
  }
95
90
  };
96
91
 
97
- } // namespace margelo
92
+ } // namespace rnwgpu
@@ -4,14 +4,12 @@
4
4
 
5
5
  #include "webgpu/webgpu_cpp.h"
6
6
 
7
- #include "RNFJSIConverter.h"
7
+ #include "JSIConverter.h"
8
8
  #include "WGPULogger.h"
9
9
 
10
10
  #include "GPUError.h"
11
- #include "RNFHybridObject.h"
12
11
 
13
12
  namespace jsi = facebook::jsi;
14
- namespace m = margelo;
15
13
 
16
14
  namespace rnwgpu {
17
15
 
@@ -24,9 +22,7 @@ struct GPUUncapturedErrorEventInit {
24
22
 
25
23
  } // namespace rnwgpu
26
24
 
27
- namespace margelo {
28
-
29
- using namespace rnwgpu; // NOLINT(build/namespaces)
25
+ namespace rnwgpu {
30
26
 
31
27
  template <>
32
28
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUUncapturedErrorEventInit>> {
@@ -66,4 +62,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUUncapturedErrorEventInit>> {
66
62
  }
67
63
  };
68
64
 
69
- } // namespace margelo
65
+ } // namespace rnwgpu
@@ -4,13 +4,10 @@
4
4
 
5
5
  #include "webgpu/webgpu_cpp.h"
6
6
 
7
- #include "RNFJSIConverter.h"
7
+ #include "JSIConverter.h"
8
8
  #include "WGPULogger.h"
9
9
 
10
- #include "RNFHybridObject.h"
11
-
12
10
  namespace jsi = facebook::jsi;
13
- namespace m = margelo;
14
11
 
15
12
  namespace rnwgpu {
16
13
 
@@ -22,9 +19,7 @@ struct GPUVertexAttribute {
22
19
 
23
20
  } // namespace rnwgpu
24
21
 
25
- namespace margelo {
26
-
27
- using namespace rnwgpu; // NOLINT(build/namespaces)
22
+ namespace rnwgpu {
28
23
 
29
24
  template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexAttribute>> {
30
25
  static std::shared_ptr<rnwgpu::GPUVertexAttribute>
@@ -56,4 +51,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexAttribute>> {
56
51
  }
57
52
  };
58
53
 
59
- } // namespace margelo
54
+ } // namespace rnwgpu
@@ -5,14 +5,12 @@
5
5
 
6
6
  #include "webgpu/webgpu_cpp.h"
7
7
 
8
- #include "RNFJSIConverter.h"
8
+ #include "JSIConverter.h"
9
9
  #include "WGPULogger.h"
10
10
 
11
11
  #include "GPUVertexAttribute.h"
12
- #include "RNFHybridObject.h"
13
12
 
14
13
  namespace jsi = facebook::jsi;
15
- namespace m = margelo;
16
14
 
17
15
  namespace rnwgpu {
18
16
 
@@ -25,9 +23,7 @@ struct GPUVertexBufferLayout {
25
23
 
26
24
  } // namespace rnwgpu
27
25
 
28
- namespace margelo {
29
-
30
- using namespace rnwgpu; // NOLINT(build/namespaces)
26
+ namespace rnwgpu {
31
27
 
32
28
  template <>
33
29
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexBufferLayout>> {
@@ -64,4 +60,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexBufferLayout>> {
64
60
  }
65
61
  };
66
62
 
67
- } // namespace margelo
63
+ } // namespace rnwgpu
@@ -8,15 +8,13 @@
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
11
- #include "RNFJSIConverter.h"
11
+ #include "JSIConverter.h"
12
12
  #include "WGPULogger.h"
13
13
 
14
14
  #include "GPUShaderModule.h"
15
15
  #include "GPUVertexBufferLayout.h"
16
- #include "RNFHybridObject.h"
17
16
 
18
17
  namespace jsi = facebook::jsi;
19
- namespace m = margelo;
20
18
 
21
19
  namespace rnwgpu {
22
20
 
@@ -32,9 +30,7 @@ struct GPUVertexState {
32
30
 
33
31
  } // namespace rnwgpu
34
32
 
35
- namespace margelo {
36
-
37
- using namespace rnwgpu; // NOLINT(build/namespaces)
33
+ namespace rnwgpu {
38
34
 
39
35
  template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexState>> {
40
36
  static std::shared_ptr<rnwgpu::GPUVertexState>
@@ -75,4 +71,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUVertexState>> {
75
71
  }
76
72
  };
77
73
 
78
- } // namespace margelo
74
+ } // namespace rnwgpu
@@ -2,11 +2,11 @@
2
2
 
3
3
  #include <string>
4
4
 
5
+ #include "EnumMapper.h"
5
6
  #include "External.h"
6
- #include "RNFEnumMapper.h"
7
7
  #include "webgpu/webgpu_cpp.h"
8
8
 
9
- namespace margelo {
9
+ namespace rnwgpu {
10
10
  namespace EnumMapper {
11
11
 
12
12
  inline void convertJSUnionToEnum(const std::string &inUnion,
@@ -1981,4 +1981,4 @@ inline void convertEnumToJSUnion(rnwgpu::PremultiplyAlpha inEnum,
1981
1981
  }
1982
1982
 
1983
1983
  } // namespace EnumMapper
1984
- } // namespace margelo
1984
+ } // namespace rnwgpu
@@ -3,13 +3,13 @@
3
3
  #include <string>
4
4
  #include <utility>
5
5
 
6
- #include "RNFPromise.h"
6
+ #include "Promise.h"
7
7
 
8
8
  #include "AsyncRunner.h"
9
9
 
10
10
  namespace rnwgpu::async {
11
11
 
12
- using Action = std::function<void(jsi::Runtime &, margelo::Promise &)>;
12
+ using Action = std::function<void(jsi::Runtime &, rnwgpu::Promise &)>;
13
13
 
14
14
  struct AsyncTaskHandle::State
15
15
  : public std::enable_shared_from_this<AsyncTaskHandle::State> {
@@ -17,17 +17,17 @@ struct AsyncTaskHandle::State
17
17
  : runner(std::move(runner)), keepPumping(keepPumping) {}
18
18
 
19
19
  void settle(Action action);
20
- void attachPromise(const std::shared_ptr<margelo::Promise> &promise);
20
+ void attachPromise(const std::shared_ptr<rnwgpu::Promise> &promise);
21
21
  void schedule(Action action);
22
22
 
23
23
  ResolveFunction createResolveFunction();
24
24
  RejectFunction createRejectFunction();
25
25
 
26
- std::shared_ptr<margelo::Promise> currentPromise();
26
+ std::shared_ptr<rnwgpu::Promise> currentPromise();
27
27
 
28
28
  std::mutex mutex;
29
29
  std::weak_ptr<AsyncRunner> runner;
30
- std::shared_ptr<margelo::Promise> promise;
30
+ std::shared_ptr<rnwgpu::Promise> promise;
31
31
  std::optional<Action> pendingAction;
32
32
  bool settled = false;
33
33
  std::shared_ptr<State> keepAlive;
@@ -59,7 +59,7 @@ void AsyncTaskHandle::State::settle(Action action) {
59
59
  }
60
60
 
61
61
  void AsyncTaskHandle::State::attachPromise(
62
- const std::shared_ptr<margelo::Promise> &newPromise) {
62
+ const std::shared_ptr<rnwgpu::Promise> &newPromise) {
63
63
  std::optional<Action> actionToSchedule;
64
64
  {
65
65
  std::lock_guard<std::mutex> lock(mutex);
@@ -114,7 +114,7 @@ AsyncTaskHandle::State::createResolveFunction() {
114
114
  };
115
115
  self->settle(
116
116
  [factory = std::move(resolvedFactory)](
117
- jsi::Runtime &runtime, margelo::Promise &promise) mutable {
117
+ jsi::Runtime &runtime, rnwgpu::Promise &promise) mutable {
118
118
  auto value = factory(runtime);
119
119
  promise.resolve(std::move(value));
120
120
  });
@@ -127,14 +127,14 @@ AsyncTaskHandle::RejectFunction AsyncTaskHandle::State::createRejectFunction() {
127
127
  return [weakSelf](std::string reason) {
128
128
  if (auto self = weakSelf.lock()) {
129
129
  self->settle([reason = std::move(reason)](jsi::Runtime & /*runtime*/,
130
- margelo::Promise &promise) {
130
+ rnwgpu::Promise &promise) {
131
131
  promise.reject(reason);
132
132
  });
133
133
  }
134
134
  };
135
135
  }
136
136
 
137
- std::shared_ptr<margelo::Promise> AsyncTaskHandle::State::currentPromise() {
137
+ std::shared_ptr<rnwgpu::Promise> AsyncTaskHandle::State::currentPromise() {
138
138
  std::lock_guard<std::mutex> lock(mutex);
139
139
  return promise;
140
140
  }
@@ -172,7 +172,7 @@ AsyncTaskHandle::RejectFunction AsyncTaskHandle::createRejectFunction() const {
172
172
  }
173
173
 
174
174
  void AsyncTaskHandle::attachPromise(
175
- const std::shared_ptr<margelo::Promise> &promise) const {
175
+ const std::shared_ptr<rnwgpu::Promise> &promise) const {
176
176
  if (_state) {
177
177
  _state->attachPromise(promise);
178
178
  }
@@ -10,7 +10,7 @@
10
10
 
11
11
  #include "AsyncDispatcher.h"
12
12
 
13
- namespace margelo {
13
+ namespace rnwgpu {
14
14
  class Promise;
15
15
  }
16
16
 
@@ -43,7 +43,7 @@ public:
43
43
  ResolveFunction createResolveFunction() const;
44
44
  RejectFunction createRejectFunction() const;
45
45
 
46
- void attachPromise(const std::shared_ptr<margelo::Promise> &promise) const;
46
+ void attachPromise(const std::shared_ptr<rnwgpu::Promise> &promise) const;
47
47
 
48
48
  static AsyncTaskHandle create(const std::shared_ptr<AsyncRunner> &runner,
49
49
  bool keepPumping);
@@ -14,11 +14,11 @@ let CONTEXT_COUNTER = 1;
14
14
  function generateContextId() {
15
15
  return CONTEXT_COUNTER++;
16
16
  }
17
- const Canvas = exports.Canvas = /*#__PURE__*/(0, _react.forwardRef)(({
18
- onLayout: _onLayout,
17
+ const Canvas = ({
19
18
  transparent,
19
+ ref,
20
20
  ...props
21
- }, ref) => {
21
+ }) => {
22
22
  const viewRef = (0, _react.useRef)(null);
23
23
  const [contextId, _] = (0, _react.useState)(() => generateContextId());
24
24
  (0, _react.useImperativeHandle)(ref, () => ({
@@ -33,16 +33,10 @@ const Canvas = exports.Canvas = /*#__PURE__*/(0, _react.forwardRef)(({
33
33
  if (!viewRef.current) {
34
34
  throw new Error("[WebGPU] Cannot get context before mount");
35
35
  }
36
- let size;
37
- if (_reactNative.Platform.OS === "web") {
38
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
- // @ts-expect-error
40
- size = viewRef.current.getBoundingClientRect();
41
- } else {
42
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
43
- // @ts-expect-error
44
- size = viewRef.current.unstable_getBoundingClientRect();
45
- }
36
+ // getBoundingClientRect became stable in RN 0.83
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ const view = viewRef.current;
39
+ const size = "getBoundingClientRect" in view ? view.getBoundingClientRect() : view.unstable_getBoundingClientRect();
46
40
  return RNWebGPU.MakeWebGPUCanvasContext(contextId, size.width, size.height);
47
41
  }
48
42
  }));
@@ -56,5 +50,6 @@ const Canvas = exports.Canvas = /*#__PURE__*/(0, _react.forwardRef)(({
56
50
  contextId: contextId,
57
51
  transparent: !!transparent
58
52
  }));
59
- });
53
+ };
54
+ exports.Canvas = Canvas;
60
55
  //# sourceMappingURL=Canvas.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_WebGPUViewNativeComponent","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","CONTEXT_COUNTER","generateContextId","Canvas","exports","forwardRef","onLayout","_onLayout","transparent","props","ref","viewRef","useRef","contextId","_","useState","useImperativeHandle","getContextId","getNativeSurface","RNWebGPU","getContext","contextName","Error","current","size","Platform","OS","getBoundingClientRect","unstable_getBoundingClientRect","MakeWebGPUCanvasContext","width","height","createElement","View","collapsable","style","flex"],"sourceRoot":"../../src","sources":["Canvas.tsx"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_WebGPUViewNativeComponent","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","CONTEXT_COUNTER","generateContextId","Canvas","transparent","ref","props","viewRef","useRef","contextId","_","useState","useImperativeHandle","getContextId","getNativeSurface","RNWebGPU","getContext","contextName","Error","current","view","size","getBoundingClientRect","unstable_getBoundingClientRect","MakeWebGPUCanvasContext","width","height","createElement","View","collapsable","style","flex","exports"],"sourceRoot":"../../src","sources":["Canvas.tsx"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createModuleProxy = exports.OptionalDependencyNotInstalledError = void 0;
7
+ // https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/dependencies/ModuleProxy.ts
8
+
9
+ /**
10
+ * Create a lazily-imported module proxy.
11
+ * This is useful for lazily requiring optional dependencies.
12
+ */
13
+ const createModuleProxy = getModule => {
14
+ const holder = {
15
+ module: undefined
16
+ };
17
+ const proxy = new Proxy(holder, {
18
+ get: (target, property) => {
19
+ if (target.module == null) {
20
+ // lazy initialize module via require()
21
+ // caller needs to make sure the require() call is wrapped in a try/catch
22
+ target.module = getModule();
23
+ }
24
+ return target.module[property];
25
+ }
26
+ });
27
+ return proxy;
28
+ };
29
+ exports.createModuleProxy = createModuleProxy;
30
+ class OptionalDependencyNotInstalledError extends Error {
31
+ constructor(name) {
32
+ super(`${name} is not installed!`);
33
+ }
34
+ }
35
+ exports.OptionalDependencyNotInstalledError = OptionalDependencyNotInstalledError;
36
+ //# sourceMappingURL=ModuleProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createModuleProxy","getModule","holder","module","undefined","proxy","Proxy","get","target","property","exports","OptionalDependencyNotInstalledError","Error","constructor","name"],"sourceRoot":"../../../src","sources":["external/ModuleProxy.ts"],"mappings":";;;;;;AAAA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAC5BC,SAA2B,IACf;EACZ,MAAMC,MAAuC,GAAG;IAAEC,MAAM,EAAEC;EAAU,CAAC;EAErE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAACJ,MAAM,EAAE;IAC9BK,GAAG,EAAEA,CAACC,MAAM,EAAEC,QAAQ,KAAK;MACzB,IAAID,MAAM,CAACL,MAAM,IAAI,IAAI,EAAE;QACzB;QACA;QACAK,MAAM,CAACL,MAAM,GAAGF,SAAS,CAAC,CAAY;MACxC;MACA,OAAOO,MAAM,CAACL,MAAM,CAACM,QAAQ,CAA+B;IAC9D;EACF,CAAC,CAAC;EACF,OAAOJ,KAAK;AACd,CAAC;AAACK,OAAA,CAAAV,iBAAA,GAAAA,iBAAA;AAEK,MAAMW,mCAAmC,SAASC,KAAK,CAAC;EAC7DC,WAAWA,CAACC,IAAY,EAAE;IACxB,KAAK,CAAC,GAAGA,IAAI,oBAAoB,CAAC;EACpC;AACF;AAACJ,OAAA,CAAAC,mCAAA,GAAAA,mCAAA","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _reanimated = require("./reanimated");
7
+ Object.keys(_reanimated).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _reanimated[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _reanimated[key];
14
+ }
15
+ });
16
+ });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reanimated","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../../src","sources":["external/index.ts"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ModuleProxy = require("../ModuleProxy");
8
+ const Reanimated = (0, _ModuleProxy.createModuleProxy)(() => {
9
+ try {
10
+ return require("react-native-reanimated");
11
+ } catch (e) {
12
+ throw new _ModuleProxy.OptionalDependencyNotInstalledError("react-native-reanimated");
13
+ }
14
+ });
15
+
16
+ // eslint-disable-next-line import/no-default-export
17
+ var _default = exports.default = Reanimated;
18
+ //# sourceMappingURL=ReanimatedProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ModuleProxy","require","Reanimated","createModuleProxy","e","OptionalDependencyNotInstalledError","_default","exports","default"],"sourceRoot":"../../../../src","sources":["external/reanimated/ReanimatedProxy.ts"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAOA,MAAMC,UAAU,GAAG,IAAAC,8BAAiB,EAAc,MAAM;EACtD,IAAI;IACF,OAAOF,OAAO,CAAC,yBAAyB,CAAC;EAC3C,CAAC,CAAC,OAAOG,CAAC,EAAE;IACV,MAAM,IAAIC,gDAAmC,CAAC,yBAAyB,CAAC;EAC1E;AACF,CAAC,CAAC;;AAEF;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeN,UAAU","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Reanimated", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ReanimatedProxy.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "registerWebGPUForReanimated", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _registerWebGPUForReanimated.registerWebGPUForReanimated;
16
+ }
17
+ });
18
+ var _registerWebGPUForReanimated = require("./registerWebGPUForReanimated");
19
+ var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_registerWebGPUForReanimated","require","_ReanimatedProxy","_interopRequireDefault","e","__esModule","default"],"sourceRoot":"../../../../src","sources":["external/reanimated/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,4BAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA0D,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -0,0 +1,50 @@
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
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
24
+ const {
25
+ registerCustomSerializable
26
+ } = require("react-native-worklets");
27
+ registerCustomSerializable({
28
+ name: "WebGPU",
29
+ determine: value => {
30
+ "worklet";
31
+
32
+ return __webgpuIsWebGPUObject(value);
33
+ },
34
+ pack: value => {
35
+ "worklet";
36
+
37
+ return __webgpuBox(value);
38
+ },
39
+ unpack: boxed => {
40
+ "worklet";
41
+
42
+ return boxed.unbox();
43
+ }
44
+ });
45
+ } catch {
46
+ // react-native-worklets not installed, skip registration
47
+ }
48
+ };
49
+ exports.registerWebGPUForReanimated = registerWebGPUForReanimated;
50
+ //# sourceMappingURL=registerWebGPUForReanimated.js.map
@@ -0,0 +1 @@
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;;AAMA,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;IACA,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":[]}