@shopify/react-native-skia 2.9.1 → 2.10.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 (220) hide show
  1. package/android/CMakeLists.txt +1 -5
  2. package/cpp/api/JsiNativeBuffer.h +15 -10
  3. package/cpp/api/JsiSkAnimatedImage.h +21 -19
  4. package/cpp/api/JsiSkAnimatedImageFactory.h +13 -14
  5. package/cpp/api/JsiSkApi.h +246 -92
  6. package/cpp/api/JsiSkCanvas.h +76 -58
  7. package/cpp/api/JsiSkColor.h +7 -5
  8. package/cpp/api/JsiSkColorFilter.h +15 -8
  9. package/cpp/api/JsiSkColorFilterFactory.h +45 -45
  10. package/cpp/api/JsiSkContourMeasure.h +24 -21
  11. package/cpp/api/JsiSkContourMeasureIter.h +18 -21
  12. package/cpp/api/JsiSkData.h +13 -7
  13. package/cpp/api/JsiSkDataFactory.h +22 -21
  14. package/cpp/api/JsiSkFont.h +56 -44
  15. package/cpp/api/JsiSkFontMgr.h +22 -13
  16. package/cpp/api/JsiSkFontMgrFactory.h +12 -10
  17. package/cpp/api/JsiSkFontStyle.h +14 -12
  18. package/cpp/api/JsiSkImage.h +45 -34
  19. package/cpp/api/JsiSkImageFactory.h +47 -52
  20. package/cpp/api/JsiSkImageFilter.h +21 -11
  21. package/cpp/api/JsiSkImageFilterFactory.h +96 -96
  22. package/cpp/api/JsiSkImageInfo.h +22 -19
  23. package/cpp/api/JsiSkMaskFilter.h +21 -11
  24. package/cpp/api/JsiSkMaskFilterFactory.h +16 -13
  25. package/cpp/api/JsiSkMatrix.h +31 -31
  26. package/cpp/api/JsiSkNativeObjects.h +419 -0
  27. package/cpp/api/JsiSkPaint.h +59 -39
  28. package/cpp/api/JsiSkParagraph.h +39 -32
  29. package/cpp/api/JsiSkParagraphBuilder.h +24 -21
  30. package/cpp/api/JsiSkParagraphBuilderFactory.h +13 -12
  31. package/cpp/api/JsiSkPath.h +95 -70
  32. package/cpp/api/JsiSkPathBuilder.h +83 -67
  33. package/cpp/api/JsiSkPathBuilderFactory.h +16 -17
  34. package/cpp/api/JsiSkPathEffect.h +21 -11
  35. package/cpp/api/JsiSkPathEffectFactory.h +33 -32
  36. package/cpp/api/JsiSkPathFactory.h +79 -103
  37. package/cpp/api/JsiSkPicture.h +24 -13
  38. package/cpp/api/JsiSkPictureFactory.h +21 -26
  39. package/cpp/api/JsiSkPictureRecorder.h +21 -22
  40. package/cpp/api/JsiSkPoint.h +19 -22
  41. package/cpp/api/JsiSkRRect.h +22 -29
  42. package/cpp/api/JsiSkRSXform.h +26 -30
  43. package/cpp/api/JsiSkRect.h +28 -30
  44. package/cpp/api/JsiSkRuntimeEffect.h +39 -30
  45. package/cpp/api/JsiSkRuntimeEffectFactory.h +12 -12
  46. package/cpp/api/JsiSkRuntimeShaderBuilder.h +25 -18
  47. package/cpp/api/JsiSkSVG.h +13 -13
  48. package/cpp/api/JsiSkSVGFactory.h +17 -20
  49. package/cpp/api/JsiSkShader.h +15 -8
  50. package/cpp/api/JsiSkShaderFactory.h +41 -48
  51. package/cpp/api/JsiSkSkottie.h +49 -39
  52. package/cpp/api/JsiSkSurface.h +24 -24
  53. package/cpp/api/JsiSkSurfaceFactory.h +15 -16
  54. package/cpp/api/JsiSkTextBlob.h +15 -8
  55. package/cpp/api/JsiSkTextBlobFactory.h +25 -28
  56. package/cpp/api/JsiSkTypeface.h +19 -12
  57. package/cpp/api/JsiSkTypefaceFactory.h +12 -12
  58. package/cpp/api/JsiSkTypefaceFontProvider.h +30 -25
  59. package/cpp/api/JsiSkTypefaceFontProviderFactory.h +14 -12
  60. package/cpp/api/JsiSkVertices.h +21 -18
  61. package/cpp/api/JsiSkiaContext.h +17 -17
  62. package/cpp/api/JsiSkottieFactory.h +16 -17
  63. package/cpp/api/JsiVideo.h +27 -25
  64. package/cpp/api/recorder/Convertor.h +31 -61
  65. package/cpp/api/recorder/DataTypes.h +8 -16
  66. package/cpp/api/recorder/JsiRecorder.h +83 -55
  67. package/cpp/api/recorder/RNRecorder.h +1 -1
  68. package/cpp/jsi/BoxedNativeObject.h +146 -0
  69. package/cpp/{jsi2 → jsi}/EnumMapper.h +4 -1
  70. package/cpp/{jsi2 → jsi}/NativeObject.h +120 -146
  71. package/cpp/jsi/RuntimeAwareCache.cpp +1 -1
  72. package/cpp/jsi/RuntimeAwareCache.h +26 -8
  73. package/cpp/jsi/ViewProperty.h +5 -11
  74. package/cpp/rnskia/RNSkJsiViewApi.h +20 -11
  75. package/cpp/rnskia/RNSkManager.cpp +23 -25
  76. package/cpp/rnskia/RNSkPictureView.h +1 -1
  77. package/cpp/rnwgpu/ArrayBuffer.h +5 -6
  78. package/cpp/rnwgpu/Canvas.h +4 -2
  79. package/cpp/rnwgpu/api/GPU.cpp +4 -4
  80. package/cpp/rnwgpu/api/GPU.h +1 -1
  81. package/cpp/rnwgpu/api/GPUAdapter.cpp +2 -3
  82. package/cpp/rnwgpu/api/GPUAdapter.h +4 -4
  83. package/cpp/rnwgpu/api/GPUAdapterInfo.h +1 -1
  84. package/cpp/rnwgpu/api/GPUBindGroup.h +1 -1
  85. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +1 -1
  86. package/cpp/rnwgpu/api/GPUBuffer.h +1 -1
  87. package/cpp/rnwgpu/api/GPUCanvasContext.h +1 -1
  88. package/cpp/rnwgpu/api/GPUCommandBuffer.h +1 -1
  89. package/cpp/rnwgpu/api/GPUCommandEncoder.h +1 -1
  90. package/cpp/rnwgpu/api/GPUCompilationInfo.h +1 -1
  91. package/cpp/rnwgpu/api/GPUCompilationMessage.h +1 -1
  92. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +1 -1
  93. package/cpp/rnwgpu/api/GPUComputePipeline.h +1 -1
  94. package/cpp/rnwgpu/api/GPUDevice.cpp +6 -7
  95. package/cpp/rnwgpu/api/GPUDevice.h +3 -3
  96. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +1 -1
  97. package/cpp/rnwgpu/api/GPUError.h +1 -1
  98. package/cpp/rnwgpu/api/GPUExtent3D.h +1 -1
  99. package/cpp/rnwgpu/api/GPUExternalTexture.h +1 -1
  100. package/cpp/rnwgpu/api/GPUInternalError.h +1 -1
  101. package/cpp/rnwgpu/api/GPUOrigin2D.h +1 -1
  102. package/cpp/rnwgpu/api/GPUOrigin3D.h +1 -1
  103. package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +1 -1
  104. package/cpp/rnwgpu/api/GPUPipelineLayout.h +1 -1
  105. package/cpp/rnwgpu/api/GPUQuerySet.h +1 -1
  106. package/cpp/rnwgpu/api/GPUQueue.h +1 -1
  107. package/cpp/rnwgpu/api/GPURenderBundle.h +1 -1
  108. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +1 -1
  109. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +1 -1
  110. package/cpp/rnwgpu/api/GPURenderPipeline.h +1 -1
  111. package/cpp/rnwgpu/api/GPUSampler.h +1 -1
  112. package/cpp/rnwgpu/api/GPUShaderModule.cpp +1 -1
  113. package/cpp/rnwgpu/api/GPUShaderModule.h +1 -1
  114. package/cpp/rnwgpu/api/GPUSharedFence.h +1 -1
  115. package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +1 -1
  116. package/cpp/rnwgpu/api/GPUSupportedLimits.h +1 -1
  117. package/cpp/rnwgpu/api/GPUTexture.h +1 -1
  118. package/cpp/rnwgpu/api/GPUTextureView.h +1 -1
  119. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +1 -1
  120. package/cpp/rnwgpu/api/GPUValidationError.h +1 -1
  121. package/cpp/rnwgpu/api/ImageBitmap.h +1 -1
  122. package/cpp/rnwgpu/api/RNWebGPU.h +1 -1
  123. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +1 -1
  124. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +1 -1
  125. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +1 -1
  126. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +1 -1
  127. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +1 -1
  128. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +1 -1
  129. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +1 -1
  130. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +1 -1
  131. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +1 -1
  132. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +1 -1
  133. package/cpp/rnwgpu/api/descriptors/GPUColor.h +1 -1
  134. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +1 -1
  135. package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +1 -1
  136. package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +1 -1
  137. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +1 -1
  138. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +1 -1
  139. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +1 -1
  140. package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +1 -1
  141. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +1 -1
  142. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +1 -1
  143. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +1 -1
  144. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +1 -1
  145. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +1 -1
  146. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +1 -1
  147. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +1 -1
  148. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +1 -1
  149. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +1 -1
  150. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +1 -1
  151. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +1 -1
  152. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +1 -1
  153. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +1 -1
  154. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +1 -1
  155. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +1 -1
  156. package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +1 -1
  157. package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +1 -1
  158. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +1 -1
  159. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +1 -1
  160. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +1 -1
  161. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +1 -1
  162. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +1 -1
  163. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +1 -1
  164. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +1 -1
  165. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +1 -1
  166. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +1 -1
  167. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +1 -1
  168. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +1 -1
  169. package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +1 -1
  170. package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +1 -1
  171. package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +1 -1
  172. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +1 -1
  173. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +1 -1
  174. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +1 -1
  175. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +1 -1
  176. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +1 -1
  177. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +1 -1
  178. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +1 -1
  179. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +1 -1
  180. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +1 -1
  181. package/cpp/rnwgpu/api/descriptors/Unions.h +1 -1
  182. package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +20 -21
  183. package/lib/commonjs/external/reanimated/renderHelpers.d.ts +15 -0
  184. package/lib/commonjs/external/reanimated/renderHelpers.js +30 -1
  185. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  186. package/lib/commonjs/skia/NativeSetup.js +4 -0
  187. package/lib/commonjs/skia/NativeSetup.js.map +1 -1
  188. package/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +1 -0
  189. package/lib/commonjs/skia/SkiaWorkletSerialization.js +66 -0
  190. package/lib/commonjs/skia/SkiaWorkletSerialization.js.map +1 -0
  191. package/lib/commonjs/sksg/Container.native.js +20 -1
  192. package/lib/commonjs/sksg/Container.native.js.map +1 -1
  193. package/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
  194. package/lib/module/external/reanimated/renderHelpers.js +29 -0
  195. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  196. package/lib/module/skia/NativeSetup.js +4 -0
  197. package/lib/module/skia/NativeSetup.js.map +1 -1
  198. package/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
  199. package/lib/module/skia/SkiaWorkletSerialization.js +59 -0
  200. package/lib/module/skia/SkiaWorkletSerialization.js.map +1 -0
  201. package/lib/module/sksg/Container.native.js +21 -2
  202. package/lib/module/sksg/Container.native.js.map +1 -1
  203. package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
  204. package/lib/typescript/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +2 -0
  205. package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
  206. package/lib/typescript/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
  207. package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +15 -0
  208. package/lib/typescript/src/skia/SkiaWorkletSerialization.d.ts +1 -0
  209. package/package.json +6 -2
  210. package/react-native-skia.podspec +1 -2
  211. package/src/external/reanimated/renderHelpers.ts +30 -0
  212. package/src/skia/NativeSetup.ts +5 -0
  213. package/src/skia/SkiaWorkletSerialization.ts +67 -0
  214. package/src/sksg/Container.native.ts +40 -2
  215. package/cpp/api/JsiSkHostObjects.h +0 -257
  216. package/cpp/jsi/JsiHostObject.cpp +0 -137
  217. package/cpp/jsi/JsiHostObject.h +0 -385
  218. /package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -0
  219. /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
  220. /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
@@ -5,27 +5,27 @@
5
5
 
6
6
  #include <jsi/jsi.h>
7
7
 
8
- #include "api/JsiSkApi.h"
9
8
  #include "RNSkJsiViewApi.h"
10
9
  #include "RNSkView.h"
10
+ #include "api/JsiSkApi.h"
11
11
 
12
12
  #include "jsi/RuntimeAwareCache.h"
13
13
 
14
14
  #ifdef SK_GRAPHITE
15
15
  #include "RNDawnContext.h"
16
+ #include "jsi/Promise.h"
16
17
  #include "rnwgpu/ArrayBuffer.h"
17
18
  #include "rnwgpu/api/GPU.h"
18
19
  #include "rnwgpu/api/GPUUncapturedErrorEvent.h"
19
20
  #include "rnwgpu/api/ImageBitmap.h"
20
21
  #include "rnwgpu/api/RNWebGPU.h"
22
+ #include "rnwgpu/api/WebGPUConstants.h"
21
23
  #include "rnwgpu/api/descriptors/GPUBufferUsage.h"
22
24
  #include "rnwgpu/api/descriptors/GPUColorWrite.h"
23
25
  #include "rnwgpu/api/descriptors/GPUMapMode.h"
24
26
  #include "rnwgpu/api/descriptors/GPUShaderStage.h"
25
27
  #include "rnwgpu/api/descriptors/GPUTextureUsage.h"
26
- #include "rnwgpu/api/WebGPUConstants.h"
27
28
  #include "rnwgpu/async/RuntimeContext.h"
28
- #include "jsi2/Promise.h"
29
29
 
30
30
  #include "include/core/SkData.h"
31
31
  #include "include/core/SkImage.h"
@@ -82,19 +82,18 @@ void RNSkManager::installBindings() {
82
82
  // provided runtime.
83
83
  auto skiaApi = std::make_shared<JsiSkApi>(_platformContext);
84
84
  _jsRuntime->global().setProperty(
85
- *_jsRuntime, "SkiaApi",
86
- jsi::Object::createFromHostObject(*_jsRuntime, std::move(skiaApi)));
85
+ *_jsRuntime, "SkiaApi", makeJsiObject(*_jsRuntime, std::move(skiaApi)));
87
86
 
88
- _jsRuntime->global().setProperty(
89
- *_jsRuntime, "SkiaViewApi",
90
- jsi::Object::createFromHostObject(*_jsRuntime, _viewApi));
87
+ _jsRuntime->global().setProperty(*_jsRuntime, "SkiaViewApi",
88
+ makeJsiObject(*_jsRuntime, _viewApi));
91
89
 
92
90
  #ifdef SK_GRAPHITE
93
91
  // Register the main runtime + its CallInvoker so spontaneous events
94
92
  // (device.lost / uncapturederror) on main-runtime devices can be delivered to
95
93
  // the JS thread without the ProcessEvents pump. Worklet-runtime devices have
96
94
  // no invoker (best-effort; see the RuntimeContext "Threading model" doc).
97
- rnwgpu::async::RuntimeContext::registerMainRuntime(_jsRuntime, _jsCallInvoker);
95
+ rnwgpu::async::RuntimeContext::registerMainRuntime(_jsRuntime,
96
+ _jsCallInvoker);
98
97
 
99
98
  // Install WebGPU constructors
100
99
  rnwgpu::GPU::installConstructor(*_jsRuntime);
@@ -121,13 +120,14 @@ void RNSkManager::installBindings() {
121
120
  // Install WebGPU constant objects as plain JS objects on the main runtime.
122
121
  rnwgpu::installWebGPUConstants(*_jsRuntime);
123
122
 
124
- // Install a global `installWebGPU()` host function so worklet runtimes can get
125
- // the same constants. A host function captured into a worklet is serialized as
126
- // a SerializableHostFunction and re-created on the worklet runtime, so the body
127
- // runs there (its `rt` is the worklet runtime) and installs the constants on
128
- // that runtime. The constants come from the native wgpu::*Usage enums, so the
129
- // values stay a single source of truth across every runtime. Calling it on a
130
- // runtime that already has the globals is a safe, idempotent no-op.
123
+ // Install a global `installWebGPU()` host function so worklet runtimes can
124
+ // get the same constants. A host function captured into a worklet is
125
+ // serialized as a SerializableHostFunction and re-created on the worklet
126
+ // runtime, so the body runs there (its `rt` is the worklet runtime) and
127
+ // installs the constants on that runtime. The constants come from the native
128
+ // wgpu::*Usage enums, so the values stay a single source of truth across
129
+ // every runtime. Calling it on a runtime that already has the globals is a
130
+ // safe, idempotent no-op.
131
131
  _jsRuntime->global().setProperty(
132
132
  *_jsRuntime, "installWebGPU",
133
133
  jsi::Function::createFromHostFunction(
@@ -172,9 +172,8 @@ void RNSkManager::installBindings() {
172
172
  bool isBufferSource = obj.isArrayBuffer(rt);
173
173
  if (!isBufferSource && obj.hasProperty(rt, "buffer")) {
174
174
  auto bufferProp = obj.getProperty(rt, "buffer");
175
- isBufferSource =
176
- bufferProp.isObject() &&
177
- bufferProp.getObject(rt).isArrayBuffer(rt);
175
+ isBufferSource = bufferProp.isObject() &&
176
+ bufferProp.getObject(rt).isArrayBuffer(rt);
178
177
  }
179
178
  if (!isBufferSource) {
180
179
  throw jsi::JSError(rt, "createImageBitmap: unsupported source "
@@ -183,9 +182,9 @@ void RNSkManager::installBindings() {
183
182
  }
184
183
  // Validates bounds and THROWS synchronously on a spoofed view, so
185
184
  // the bad pointer never reaches the copy below.
186
- auto buffer =
187
- rnwgpu::JSIConverter<std::shared_ptr<rnwgpu::ArrayBuffer>>::
188
- fromJSI(rt, args[0], false);
185
+ auto buffer = rnwgpu::JSIConverter<
186
+ std::shared_ptr<rnwgpu::ArrayBuffer>>::fromJSI(rt, args[0],
187
+ false);
189
188
  // Copy the encoded bytes off the JS-owned ArrayBuffer.
190
189
  const uint8_t *bytes = buffer->data();
191
190
  std::vector<uint8_t> encoded(bytes, bytes + buffer->size());
@@ -204,9 +203,8 @@ void RNSkManager::installBindings() {
204
203
  }
205
204
  const int w = image->width();
206
205
  const int h = image->height();
207
- auto info =
208
- SkImageInfo::Make(w, h, kRGBA_8888_SkColorType,
209
- kUnpremul_SkAlphaType);
206
+ auto info = SkImageInfo::Make(w, h, kRGBA_8888_SkColorType,
207
+ kUnpremul_SkAlphaType);
210
208
  std::vector<uint8_t> pixels(info.computeMinByteSize());
211
209
  // nullptr context: decode/read on the CPU (raster).
212
210
  if (!image->readPixels(nullptr, info, pixels.data(),
@@ -13,9 +13,9 @@
13
13
  #include "RNSkView.h"
14
14
  #include "jsi/ViewProperty.h"
15
15
 
16
+ #include "RNSkPlatformContext.h"
16
17
  #include "api/JsiSkPicture.h"
17
18
  #include "utils/RNSkLog.h"
18
- #include "RNSkPlatformContext.h"
19
19
  #include "utils/RNSkTimingInfo.h"
20
20
 
21
21
  #pragma clang diagnostic push
@@ -5,7 +5,7 @@
5
5
  #include <cstdint>
6
6
  #include <memory>
7
7
 
8
- #include "jsi2/JSIConverter.h"
8
+ #include "jsi/JSIConverter.h"
9
9
 
10
10
  namespace rnwgpu {
11
11
 
@@ -77,8 +77,7 @@ template <> struct JSIConverter<std::shared_ptr<ArrayBuffer>> {
77
77
  const size_t byteLength = static_cast<size_t>(byteLengthValue);
78
78
 
79
79
  // Overflow-safe bounds check: byteOffset + byteLength <= bufferSize.
80
- if (byteOffset > bufferSize ||
81
- byteLength > bufferSize - byteOffset) {
80
+ if (byteOffset > bufferSize || byteLength > bufferSize - byteOffset) {
82
81
  throw std::runtime_error(
83
82
  "ArrayBuffer::fromJSI: view bounds [byteOffset, byteOffset + "
84
83
  "byteLength) exceed the backing ArrayBuffer size");
@@ -98,9 +97,9 @@ template <> struct JSIConverter<std::shared_ptr<ArrayBuffer>> {
98
97
  }
99
98
  }
100
99
 
101
- return std::make_shared<ArrayBuffer>(
102
- arrayBuffer.data(runtime) + byteOffset, byteLength,
103
- bytesPerElements);
100
+ return std::make_shared<ArrayBuffer>(arrayBuffer.data(runtime) +
101
+ byteOffset,
102
+ byteLength, bytesPerElements);
104
103
  }
105
104
  }
106
105
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  #include <memory>
4
4
 
5
- #include "jsi2/NativeObject.h"
5
+ #include "jsi/NativeObject.h"
6
6
 
7
7
  namespace rnwgpu {
8
8
 
@@ -10,7 +10,9 @@ namespace jsi = facebook::jsi;
10
10
 
11
11
  class Canvas : public NativeObject<Canvas> {
12
12
  public:
13
- static constexpr const char *CLASS_NAME = "Canvas";
13
+ // Note: not "Canvas" that brand belongs to RNSkia::JsiSkCanvas, and
14
+ // boxing brands must be unique process-wide (see BoxedNativeObjectRegistry).
15
+ static constexpr const char *CLASS_NAME = "WebGPUCanvas";
14
16
 
15
17
  Canvas(void *nativeSurface, int width, int height)
16
18
  : NativeObject(CLASS_NAME), _nativeSurface(nativeSurface), _width(width),
@@ -8,7 +8,7 @@
8
8
  #include <vector>
9
9
 
10
10
  #include "Convertors.h"
11
- #include "jsi2/JSIConverter.h"
11
+ #include "jsi/JSIConverter.h"
12
12
  #include "rnwgpu/async/RuntimeContext.h"
13
13
 
14
14
  namespace rnwgpu {
@@ -40,9 +40,9 @@ async::AsyncTaskHandle GPU::requestAdapter(
40
40
  const async::AsyncTaskHandle::RejectFunction &reject) {
41
41
  _instance.RequestAdapter(
42
42
  &aOptions, wgpu::CallbackMode::AllowProcessEvents,
43
- [context, resolve,
44
- reject](wgpu::RequestAdapterStatus status, wgpu::Adapter adapter,
45
- wgpu::StringView message) {
43
+ [context, resolve, reject](wgpu::RequestAdapterStatus status,
44
+ wgpu::Adapter adapter,
45
+ wgpu::StringView message) {
46
46
  if (message.length) {
47
47
  fprintf(stderr, "%s", message.data);
48
48
  }
@@ -7,7 +7,7 @@
7
7
 
8
8
  #include "descriptors/Unions.h"
9
9
 
10
- #include "jsi2/NativeObject.h"
10
+ #include "jsi/NativeObject.h"
11
11
 
12
12
  #include "rnwgpu/async/AsyncTaskHandle.h"
13
13
  #include "rnwgpu/async/RuntimeContext.h"
@@ -13,7 +13,7 @@
13
13
  #include "GPUInternalError.h"
14
14
  #include "GPUOutOfMemoryError.h"
15
15
  #include "GPUValidationError.h"
16
- #include "jsi2/JSIConverter.h"
16
+ #include "jsi/JSIConverter.h"
17
17
 
18
18
  namespace rnwgpu {
19
19
 
@@ -147,8 +147,7 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
147
147
  &deviceDesc, wgpu::CallbackMode::AllowProcessEvents,
148
148
  [context, resolve, reject, label, creationRuntime,
149
149
  deviceLostBinding](wgpu::RequestDeviceStatus status,
150
- wgpu::Device device,
151
- wgpu::StringView message) {
150
+ wgpu::Device device, wgpu::StringView message) {
152
151
  if (message.length) {
153
152
  fprintf(stderr, "%s", message.data);
154
153
  }
@@ -6,7 +6,7 @@
6
6
 
7
7
  #include "descriptors/Unions.h"
8
8
 
9
- #include "jsi2/NativeObject.h"
9
+ #include "jsi/NativeObject.h"
10
10
 
11
11
  #include "rnwgpu/async/AsyncTaskHandle.h"
12
12
  #include "rnwgpu/async/RuntimeContext.h"
@@ -33,9 +33,9 @@ public:
33
33
  public:
34
34
  std::string getBrand() { return CLASS_NAME; }
35
35
 
36
- async::AsyncTaskHandle requestDevice(
37
- jsi::Runtime &runtime,
38
- std::optional<std::shared_ptr<GPUDeviceDescriptor>> descriptor);
36
+ async::AsyncTaskHandle
37
+ requestDevice(jsi::Runtime &runtime,
38
+ std::optional<std::shared_ptr<GPUDeviceDescriptor>> descriptor);
39
39
 
40
40
  std::unordered_set<std::string> getFeatures();
41
41
  std::shared_ptr<GPUSupportedLimits> getLimits();
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "descriptors/Unions.h"
7
7
 
8
- #include "jsi2/NativeObject.h"
8
+ #include "jsi/NativeObject.h"
9
9
 
10
10
  #include "Convertors.h"
11
11
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  #include "descriptors/Unions.h"
9
9
 
10
- #include "jsi2/NativeObject.h"
10
+ #include "jsi/NativeObject.h"
11
11
 
12
12
  #include "rnwgpu/async/AsyncTaskHandle.h"
13
13
  #include "rnwgpu/async/RuntimeContext.h"
@@ -8,7 +8,7 @@
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
11
- #include "jsi2/NativeObject.h"
11
+ #include "jsi/NativeObject.h"
12
12
 
13
13
  #include "GPU.h"
14
14
  #include "GPUTexture.h"
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "descriptors/Unions.h"
7
7
 
8
- #include "jsi2/NativeObject.h"
8
+ #include "jsi/NativeObject.h"
9
9
 
10
10
  #include "webgpu/webgpu_cpp.h"
11
11
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "descriptors/Unions.h"
7
7
 
8
- #include "jsi2/NativeObject.h"
8
+ #include "jsi/NativeObject.h"
9
9
 
10
10
  #include "webgpu/webgpu_cpp.h"
11
11
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  #include "descriptors/Unions.h"
10
10
 
11
- #include "jsi2/NativeObject.h"
11
+ #include "jsi/NativeObject.h"
12
12
 
13
13
  #include "webgpu/webgpu_cpp.h"
14
14
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "descriptors/Unions.h"
7
7
 
8
- #include "jsi2/NativeObject.h"
8
+ #include "jsi/NativeObject.h"
9
9
 
10
10
  #include "webgpu/webgpu_cpp.h"
11
11
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  #include "Convertors.h"
12
12
  #include "NativeBufferUtils.h"
13
- #include "jsi2/JSIConverter.h"
13
+ #include "jsi/JSIConverter.h"
14
14
 
15
15
  #include "GPUFeatures.h"
16
16
  #include "GPUInternalError.h"
@@ -363,9 +363,9 @@ async::AsyncTaskHandle GPUDevice::createComputePipelineAsync(
363
363
  runtime, pipelineHolder);
364
364
  });
365
365
  } else {
366
- std::string error =
367
- msg.length ? std::string(msg.data, msg.length)
368
- : "Failed to create compute pipeline";
366
+ std::string error = msg.length
367
+ ? std::string(msg.data, msg.length)
368
+ : "Failed to create compute pipeline";
369
369
  reject(std::move(error));
370
370
  }
371
371
  });
@@ -410,9 +410,8 @@ async::AsyncTaskHandle GPUDevice::createRenderPipelineAsync(
410
410
  runtime, pipelineHolder);
411
411
  });
412
412
  } else {
413
- std::string error =
414
- msg.length ? std::string(msg.data, msg.length)
415
- : "Failed to create render pipeline";
413
+ std::string error = msg.length ? std::string(msg.data, msg.length)
414
+ : "Failed to create render pipeline";
416
415
  reject(std::move(error));
417
416
  }
418
417
  });
@@ -13,7 +13,7 @@
13
13
 
14
14
  #include "descriptors/Unions.h"
15
15
 
16
- #include "jsi2/NativeObject.h"
16
+ #include "jsi/NativeObject.h"
17
17
 
18
18
  #include "rnwgpu/async/AsyncTaskHandle.h"
19
19
  #include "rnwgpu/async/RuntimeContext.h"
@@ -240,8 +240,8 @@ private:
240
240
  std::shared_ptr<async::RuntimeContext> _async;
241
241
  std::string _label;
242
242
  // Guards the device-lost state below. In the ProcessEvents model both
243
- // notifyDeviceLost() (fired by Dawn during ProcessEvents) and getLost() run on
244
- // the owning runtime's own thread, but device destruction can also trigger
243
+ // notifyDeviceLost() (fired by Dawn during ProcessEvents) and getLost() run
244
+ // on the owning runtime's own thread, but device destruction can also trigger
245
245
  // notifyDeviceLost() synchronously, so the mutex keeps these fields safe.
246
246
  std::mutex _lostMutex;
247
247
  std::optional<async::AsyncTaskHandle> _lostHandle;
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #include <string>
4
4
 
5
- #include "jsi2/NativeObject.h"
5
+ #include "jsi/NativeObject.h"
6
6
 
7
7
  namespace rnwgpu {
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #include <memory>
4
4
 
5
- #include "jsi2/JSIConverter.h"
5
+ #include "jsi/JSIConverter.h"
6
6
 
7
7
  #include "webgpu/webgpu_cpp.h"
8
8
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  #include "descriptors/Unions.h"
8
8
 
9
- #include "jsi2/NativeObject.h"
9
+ #include "jsi/NativeObject.h"
10
10
 
11
11
  #include "webgpu/webgpu_cpp.h"
12
12
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #include <string>
4
4
 
5
- #include "jsi2/NativeObject.h"
5
+ #include "jsi/NativeObject.h"
6
6
 
7
7
  namespace rnwgpu {
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #include <memory>
4
4
 
5
- #include "jsi2/JSIConverter.h"
5
+ #include "jsi/JSIConverter.h"
6
6
 
7
7
  #include "webgpu/webgpu_cpp.h"
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #include <memory>
4
4
 
5
- #include "jsi2/JSIConverter.h"
5
+ #include "jsi/JSIConverter.h"
6
6
 
7
7
  #include "webgpu/webgpu_cpp.h"
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #include <string>
4
4
 
5
- #include "jsi2/NativeObject.h"
5
+ #include "jsi/NativeObject.h"
6
6
 
7
7
  namespace rnwgpu {
8
8
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  #include "descriptors/Unions.h"
8
8
 
9
- #include "jsi2/NativeObject.h"
9
+ #include "jsi/NativeObject.h"
10
10
 
11
11
  #include "rnwgpu/async/AsyncTaskHandle.h"
12
12
  #include "rnwgpu/async/RuntimeContext.h"
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  #include "descriptors/Unions.h"
10
10
 
11
- #include "jsi2/NativeObject.h"
11
+ #include "jsi/NativeObject.h"
12
12
 
13
13
  #include "webgpu/webgpu_cpp.h"
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  #include "descriptors/Unions.h"
10
10
 
11
- #include "jsi2/NativeObject.h"
11
+ #include "jsi/NativeObject.h"
12
12
 
13
13
  #include "webgpu/webgpu_cpp.h"
14
14
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "descriptors/Unions.h"
7
7
 
8
- #include "jsi2/NativeObject.h"
8
+ #include "jsi/NativeObject.h"
9
9
 
10
10
  #include "webgpu/webgpu_cpp.h"
11
11
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -3,7 +3,7 @@
3
3
  #include <memory>
4
4
  #include <utility>
5
5
 
6
- #include "jsi2/JSIConverter.h"
6
+ #include "jsi/JSIConverter.h"
7
7
 
8
8
  namespace rnwgpu {
9
9
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "descriptors/Unions.h"
7
7
 
8
- #include "jsi2/NativeObject.h"
8
+ #include "jsi/NativeObject.h"
9
9
 
10
10
  #include "rnwgpu/async/AsyncTaskHandle.h"
11
11
  #include "rnwgpu/async/RuntimeContext.h"
@@ -3,7 +3,7 @@
3
3
  #include <memory>
4
4
  #include <string>
5
5
 
6
- #include "jsi2/NativeObject.h"
6
+ #include "jsi/NativeObject.h"
7
7
 
8
8
  #include "webgpu/webgpu_cpp.h"
9
9
 
@@ -6,7 +6,7 @@
6
6
  #include <string>
7
7
  #include <vector>
8
8
 
9
- #include "jsi2/NativeObject.h"
9
+ #include "jsi/NativeObject.h"
10
10
 
11
11
  #include "webgpu/webgpu_cpp.h"
12
12
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "descriptors/Unions.h"
6
6
 
7
- #include "jsi2/NativeObject.h"
7
+ #include "jsi/NativeObject.h"
8
8
 
9
9
  #include "webgpu/webgpu_cpp.h"
10
10
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  #include "descriptors/Unions.h"
8
8
 
9
- #include "jsi2/NativeObject.h"
9
+ #include "jsi/NativeObject.h"
10
10
 
11
11
  #include "webgpu/webgpu_cpp.h"
12
12