react-native-wgpu 0.4.2 → 0.5.1

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 (186) hide show
  1. package/README.md +31 -0
  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/external/ModuleProxy.js +36 -0
  120. package/lib/commonjs/external/ModuleProxy.js.map +1 -0
  121. package/lib/commonjs/external/index.js +17 -0
  122. package/lib/commonjs/external/index.js.map +1 -0
  123. package/lib/commonjs/external/reanimated/ReanimatedProxy.js +18 -0
  124. package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +1 -0
  125. package/lib/commonjs/external/reanimated/index.js +21 -0
  126. package/lib/commonjs/external/reanimated/index.js.map +1 -0
  127. package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js +50 -0
  128. package/lib/commonjs/external/reanimated/registerWebGPUForReanimated.js.map +1 -0
  129. package/lib/commonjs/main/index.js +2 -142
  130. package/lib/commonjs/main/index.js.map +1 -1
  131. package/lib/module/external/ModuleProxy.js +28 -0
  132. package/lib/module/external/ModuleProxy.js.map +1 -0
  133. package/lib/module/external/index.js +2 -0
  134. package/lib/module/external/index.js.map +1 -0
  135. package/lib/module/external/reanimated/ReanimatedProxy.js +12 -0
  136. package/lib/module/external/reanimated/ReanimatedProxy.js.map +1 -0
  137. package/lib/module/external/reanimated/index.js +3 -0
  138. package/lib/module/external/reanimated/index.js.map +1 -0
  139. package/lib/module/external/reanimated/registerWebGPUForReanimated.js +43 -0
  140. package/lib/module/external/reanimated/registerWebGPUForReanimated.js.map +1 -0
  141. package/lib/module/main/index.js +2 -141
  142. package/lib/module/main/index.js.map +1 -1
  143. package/lib/typescript/babel.config.d.ts +1 -0
  144. package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts +12 -0
  145. package/lib/typescript/lib/commonjs/external/ModuleProxy.d.ts.map +1 -0
  146. package/lib/typescript/lib/commonjs/external/index.d.ts +2 -0
  147. package/lib/typescript/lib/commonjs/external/index.d.ts.map +1 -0
  148. package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +6 -0
  149. package/lib/typescript/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
  150. package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts +4 -0
  151. package/lib/typescript/lib/commonjs/external/reanimated/index.d.ts.map +1 -0
  152. package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts +9 -0
  153. package/lib/typescript/lib/commonjs/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
  154. package/lib/typescript/lib/module/external/ModuleProxy.d.ts +7 -0
  155. package/lib/typescript/lib/module/external/ModuleProxy.d.ts.map +1 -0
  156. package/lib/typescript/lib/module/external/index.d.ts +2 -0
  157. package/lib/typescript/lib/module/external/index.d.ts.map +1 -0
  158. package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts +5 -0
  159. package/lib/typescript/lib/module/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
  160. package/lib/typescript/lib/module/external/reanimated/index.d.ts +3 -0
  161. package/lib/typescript/lib/module/external/reanimated/index.d.ts.map +1 -0
  162. package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts +2 -0
  163. package/lib/typescript/lib/module/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
  164. package/lib/typescript/src/external/ModuleProxy.d.ts +11 -0
  165. package/lib/typescript/src/external/ModuleProxy.d.ts.map +1 -0
  166. package/lib/typescript/src/external/index.d.ts +2 -0
  167. package/lib/typescript/src/external/index.d.ts.map +1 -0
  168. package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts +4 -0
  169. package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts.map +1 -0
  170. package/lib/typescript/src/external/reanimated/index.d.ts +3 -0
  171. package/lib/typescript/src/external/reanimated/index.d.ts.map +1 -0
  172. package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts +8 -0
  173. package/lib/typescript/src/external/reanimated/registerWebGPUForReanimated.d.ts.map +1 -0
  174. package/package.json +16 -3
  175. package/src/external/ModuleProxy.ts +30 -0
  176. package/src/external/index.ts +1 -0
  177. package/src/external/reanimated/ReanimatedProxy.ts +19 -0
  178. package/src/external/reanimated/index.ts +2 -0
  179. package/src/external/reanimated/registerWebGPUForReanimated.ts +43 -0
  180. package/src/main/index.tsx +3 -170
  181. package/cpp/jsi/RNFHybridObject.cpp +0 -150
  182. package/cpp/jsi/RNFHybridObject.h +0 -181
  183. package/cpp/jsi/RNFJSIHelper.h +0 -51
  184. package/cpp/jsi/RNFPointerHolder.h +0 -95
  185. package/cpp/jsi/RNFRuntimeState.cpp +0 -18
  186. package/cpp/jsi/RNFRuntimeState.h +0 -106
@@ -1,31 +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 GPUColorWrite : public m::HybridObject {
11
+ class GPUColorWrite {
13
12
  public:
14
- GPUColorWrite() : HybridObject("GPUColorWrite") {}
15
-
16
- public:
17
- double Red() { return static_cast<double>(wgpu::ColorWriteMask::Red); }
18
- double Green() { return static_cast<double>(wgpu::ColorWriteMask::Green); }
19
- double Blue() { return static_cast<double>(wgpu::ColorWriteMask::Blue); }
20
- double Alpha() { return static_cast<double>(wgpu::ColorWriteMask::Alpha); }
21
- double All() { return static_cast<double>(wgpu::ColorWriteMask::All); }
22
-
23
- void loadHybridMethods() override {
24
- registerHybridGetter("RED", &GPUColorWrite::Red, this);
25
- registerHybridGetter("GREEN", &GPUColorWrite::Green, this);
26
- registerHybridGetter("BLUE", &GPUColorWrite::Blue, this);
27
- registerHybridGetter("ALPHA", &GPUColorWrite::Alpha, this);
28
- registerHybridGetter("ALL", &GPUColorWrite::All, this);
13
+ static jsi::Object create(jsi::Runtime &runtime) {
14
+ jsi::Object obj(runtime);
15
+ obj.setProperty(runtime, "RED",
16
+ static_cast<double>(wgpu::ColorWriteMask::Red));
17
+ obj.setProperty(runtime, "GREEN",
18
+ static_cast<double>(wgpu::ColorWriteMask::Green));
19
+ obj.setProperty(runtime, "BLUE",
20
+ static_cast<double>(wgpu::ColorWriteMask::Blue));
21
+ obj.setProperty(runtime, "ALPHA",
22
+ static_cast<double>(wgpu::ColorWriteMask::Alpha));
23
+ obj.setProperty(runtime, "ALL",
24
+ static_cast<double>(wgpu::ColorWriteMask::All));
25
+ return obj;
29
26
  }
30
27
  };
31
- } // 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
 
@@ -21,9 +18,7 @@ struct GPUCommandBufferDescriptor {
21
18
 
22
19
  } // namespace rnwgpu
23
20
 
24
- namespace margelo {
25
-
26
- using namespace rnwgpu; // NOLINT(build/namespaces)
21
+ namespace rnwgpu {
27
22
 
28
23
  template <>
29
24
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUCommandBufferDescriptor>> {
@@ -48,4 +43,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUCommandBufferDescriptor>> {
48
43
  }
49
44
  };
50
45
 
51
- } // namespace margelo
46
+ } // 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
 
@@ -21,9 +18,7 @@ struct GPUCommandEncoderDescriptor {
21
18
 
22
19
  } // namespace rnwgpu
23
20
 
24
- namespace margelo {
25
-
26
- using namespace rnwgpu; // NOLINT(build/namespaces)
21
+ namespace rnwgpu {
27
22
 
28
23
  template <>
29
24
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUCommandEncoderDescriptor>> {
@@ -48,4 +43,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUCommandEncoderDescriptor>> {
48
43
  }
49
44
  };
50
45
 
51
- } // namespace margelo
46
+ } // 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 "GPUComputePassTimestampWrites.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
 
@@ -24,9 +22,7 @@ struct GPUComputePassDescriptor {
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::GPUComputePassDescriptor>> {
@@ -58,4 +54,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUComputePassDescriptor>> {
58
54
  }
59
55
  };
60
56
 
61
- } // namespace margelo
57
+ } // 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 "GPUQuerySet.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
 
@@ -23,9 +21,7 @@ struct GPUComputePassTimestampWrites {
23
21
 
24
22
  } // namespace rnwgpu
25
23
 
26
- namespace margelo {
27
-
28
- using namespace rnwgpu; // NOLINT(build/namespaces)
24
+ namespace rnwgpu {
29
25
 
30
26
  template <>
31
27
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUComputePassTimestampWrites>> {
@@ -60,4 +56,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUComputePassTimestampWrites>> {
60
56
  }
61
57
  };
62
58
 
63
- } // namespace margelo
59
+ } // namespace rnwgpu
@@ -5,15 +5,13 @@
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 "GPUPipelineLayout.h"
12
12
  #include "GPUProgrammableStage.h"
13
- #include "RNFHybridObject.h"
14
13
 
15
14
  namespace jsi = facebook::jsi;
16
- namespace m = margelo;
17
15
 
18
16
  namespace rnwgpu {
19
17
 
@@ -26,9 +24,7 @@ struct GPUComputePipelineDescriptor {
26
24
 
27
25
  } // namespace rnwgpu
28
26
 
29
- namespace margelo {
30
-
31
- using namespace rnwgpu; // NOLINT(build/namespaces)
27
+ namespace rnwgpu {
32
28
 
33
29
  template <>
34
30
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUComputePipelineDescriptor>> {
@@ -69,4 +65,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUComputePipelineDescriptor>> {
69
65
  }
70
66
  };
71
67
 
72
- } // namespace margelo
68
+ } // 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 "GPUStencilFaceState.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
 
@@ -32,9 +30,7 @@ struct GPUDepthStencilState {
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::GPUDepthStencilState>> {
40
36
  static std::shared_ptr<rnwgpu::GPUDepthStencilState>
@@ -105,4 +101,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUDepthStencilState>> {
105
101
  }
106
102
  };
107
103
 
108
- } // namespace margelo
104
+ } // namespace rnwgpu
@@ -7,14 +7,12 @@
7
7
 
8
8
  #include "webgpu/webgpu_cpp.h"
9
9
 
10
- #include "RNFJSIConverter.h"
10
+ #include "JSIConverter.h"
11
11
  #include "WGPULogger.h"
12
12
 
13
13
  #include "GPUQueueDescriptor.h"
14
- #include "RNFHybridObject.h"
15
14
 
16
15
  namespace jsi = facebook::jsi;
17
- namespace m = margelo;
18
16
 
19
17
  namespace rnwgpu {
20
18
 
@@ -30,9 +28,7 @@ struct GPUDeviceDescriptor {
30
28
 
31
29
  } // namespace rnwgpu
32
30
 
33
- namespace margelo {
34
-
35
- using namespace rnwgpu; // NOLINT(build/namespaces)
31
+ namespace rnwgpu {
36
32
 
37
33
  // We add this extra convertor because we found so library that are sending
38
34
  // invalid feature elements
@@ -101,4 +97,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUDeviceDescriptor>> {
101
97
  }
102
98
  };
103
99
 
104
- } // namespace margelo
100
+ } // 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
 
@@ -18,9 +15,7 @@ struct GPUExternalTextureBindingLayout {};
18
15
 
19
16
  } // namespace rnwgpu
20
17
 
21
- namespace margelo {
22
-
23
- using namespace rnwgpu; // NOLINT(build/namespaces)
18
+ namespace rnwgpu {
24
19
 
25
20
  template <>
26
21
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureBindingLayout>> {
@@ -41,4 +36,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureBindingLayout>> {
41
36
  }
42
37
  };
43
38
 
44
- } // namespace margelo
39
+ } // namespace rnwgpu
@@ -9,12 +9,10 @@
9
9
 
10
10
  #include "Convertors.h"
11
11
 
12
- #include "RNFHybridObject.h"
13
- #include "RNFJSIConverter.h"
12
+ #include "JSIConverter.h"
14
13
  #include "WGPULogger.h"
15
14
 
16
15
  namespace jsi = facebook::jsi;
17
- namespace m = margelo;
18
16
 
19
17
  namespace rnwgpu {
20
18
 
@@ -36,9 +34,7 @@ static bool conv(wgpu::ExternalTextureDescriptor &out,
36
34
  }
37
35
  } // namespace rnwgpu
38
36
 
39
- namespace margelo {
40
-
41
- using namespace rnwgpu; // NOLINT(build/namespaces)
37
+ namespace rnwgpu {
42
38
 
43
39
  template <>
44
40
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>> {
@@ -81,4 +77,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>> {
81
77
  }
82
78
  };
83
79
 
84
- } // namespace margelo
80
+ } // 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 "GPUColorTargetState.h"
15
15
  #include "GPUShaderModule.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 GPUFragmentState {
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::GPUFragmentState>> {
40
36
  static std::shared_ptr<rnwgpu::GPUFragmentState>
@@ -75,4 +71,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUFragmentState>> {
75
71
  }
76
72
  };
77
73
 
78
- } // namespace margelo
74
+ } // 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 "GPUBuffer.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 GPUImageCopyBuffer {
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 <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyBuffer>> {
32
28
  static std::shared_ptr<rnwgpu::GPUImageCopyBuffer>
@@ -64,4 +60,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyBuffer>> {
64
60
  }
65
61
  };
66
62
 
67
- } // namespace margelo
63
+ } // namespace rnwgpu
@@ -8,14 +8,12 @@
8
8
  #include "webgpu/webgpu_cpp.h"
9
9
 
10
10
  #include "Convertors.h"
11
- #include "RNFHybridObject.h"
12
- #include "RNFJSIConverter.h"
11
+ #include "JSIConverter.h"
13
12
 
14
13
  #include "GPUOrigin2D.h"
15
14
  #include "ImageBitmap.h"
16
15
 
17
16
  namespace jsi = facebook::jsi;
18
- namespace m = margelo;
19
17
 
20
18
  namespace rnwgpu {
21
19
 
@@ -27,9 +25,7 @@ struct GPUImageCopyExternalImage {
27
25
 
28
26
  } // namespace rnwgpu
29
27
 
30
- namespace margelo {
31
-
32
- using namespace rnwgpu; // NOLINT(build/namespaces)
28
+ namespace rnwgpu {
33
29
 
34
30
  template <>
35
31
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyExternalImage>> {
@@ -64,4 +60,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyExternalImage>> {
64
60
  }
65
61
  };
66
62
 
67
- } // namespace margelo
63
+ } // namespace rnwgpu
@@ -4,15 +4,13 @@
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 "GPUOrigin3D.h"
11
11
  #include "GPUTexture.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 GPUImageCopyTexture {
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 <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyTexture>> {
33
29
  static std::shared_ptr<rnwgpu::GPUImageCopyTexture>
@@ -67,4 +63,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyTexture>> {
67
63
  }
68
64
  };
69
65
 
70
- } // namespace margelo
66
+ } // namespace rnwgpu
@@ -4,16 +4,14 @@
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 "External.h"
11
11
  #include "GPUOrigin3D.h"
12
12
  #include "GPUTexture.h"
13
- #include "RNFHybridObject.h"
14
13
 
15
14
  namespace jsi = facebook::jsi;
16
- namespace m = margelo;
17
15
 
18
16
  namespace rnwgpu {
19
17
 
@@ -28,9 +26,7 @@ struct GPUImageCopyTextureTagged {
28
26
 
29
27
  } // namespace rnwgpu
30
28
 
31
- namespace margelo {
32
-
33
- using namespace rnwgpu; // NOLINT(build/namespaces)
29
+ namespace rnwgpu {
34
30
 
35
31
  template <>
36
32
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyTextureTagged>> {
@@ -83,4 +79,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyTextureTagged>> {
83
79
  }
84
80
  };
85
81
 
86
- } // namespace margelo
82
+ } // 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 GPUImageDataLayout {
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::GPUImageDataLayout>> {
30
25
  static std::shared_ptr<rnwgpu::GPUImageDataLayout>
@@ -57,4 +52,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageDataLayout>> {
57
52
  }
58
53
  };
59
54
 
60
- } // namespace margelo
55
+ } // namespace rnwgpu
@@ -1,25 +1,22 @@
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 GPUMapMode : public m::HybridObject {
11
+ class GPUMapMode {
13
12
  public:
14
- GPUMapMode() : HybridObject("GPUMapMode") {}
15
-
16
- public:
17
- double Read() { return static_cast<double>(wgpu::MapMode::Read); }
18
- double Write() { return static_cast<double>(wgpu::MapMode::Write); }
19
-
20
- void loadHybridMethods() override {
21
- registerHybridGetter("READ", &GPUMapMode::Read, this);
22
- registerHybridGetter("WRITE", &GPUMapMode::Write, this);
13
+ static jsi::Object create(jsi::Runtime &runtime) {
14
+ jsi::Object obj(runtime);
15
+ obj.setProperty(runtime, "READ", static_cast<double>(wgpu::MapMode::Read));
16
+ obj.setProperty(runtime, "WRITE",
17
+ static_cast<double>(wgpu::MapMode::Write));
18
+ return obj;
23
19
  }
24
20
  };
25
- } // namespace rnwgpu
21
+
22
+ } // 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 GPUMultisampleState {
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::GPUMultisampleState>> {
30
25
  static std::shared_ptr<rnwgpu::GPUMultisampleState>
@@ -57,4 +52,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUMultisampleState>> {
57
52
  }
58
53
  };
59
54
 
60
- } // namespace margelo
55
+ } // namespace rnwgpu
@@ -6,14 +6,12 @@
6
6
 
7
7
  #include "webgpu/webgpu_cpp.h"
8
8
 
9
- #include "RNFJSIConverter.h"
9
+ #include "JSIConverter.h"
10
10
  #include "WGPULogger.h"
11
11
 
12
12
  #include "GPUBindGroupLayout.h"
13
- #include "RNFHybridObject.h"
14
13
 
15
14
  namespace jsi = facebook::jsi;
16
- namespace m = margelo;
17
15
 
18
16
  namespace rnwgpu {
19
17
 
@@ -25,9 +23,7 @@ struct GPUPipelineLayoutDescriptor {
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::GPUPipelineLayoutDescriptor>> {
@@ -59,4 +55,4 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUPipelineLayoutDescriptor>> {
59
55
  }
60
56
  };
61
57
 
62
- } // namespace margelo
58
+ } // 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
 
@@ -24,9 +21,7 @@ struct GPUPrimitiveState {
24
21
 
25
22
  } // namespace rnwgpu
26
23
 
27
- namespace margelo {
28
-
29
- using namespace rnwgpu; // NOLINT(build/namespaces)
24
+ namespace rnwgpu {
30
25
 
31
26
  template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUPrimitiveState>> {
32
27
  static std::shared_ptr<rnwgpu::GPUPrimitiveState>
@@ -72,4 +67,4 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUPrimitiveState>> {
72
67
  }
73
68
  };
74
69
 
75
- } // namespace margelo
70
+ } // namespace rnwgpu