react-native-webgpu 0.10.5 → 0.11.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.
@@ -1,6 +1,7 @@
1
1
  #import "WebGPUModule.h"
2
2
  #include "ApplePlatformContext.h"
3
3
  #import "GPUCanvasContext.h"
4
+ #import "RNWGUIKit.h"
4
5
 
5
6
  #import <React/RCTBridge+Private.h>
6
7
  #import <React/RCTCallInvoker.h>
@@ -31,6 +32,11 @@ static std::shared_ptr<rnwgpu::RNWebGPUManager> webgpuManager;
31
32
  // calls setCallInvoker: during module initialization.
32
33
  @synthesize callInvoker = _callInvoker;
33
34
 
35
+ // Synthesize the view registry so the TurboModule infra injects it too. It
36
+ // resolves React tags to native views in both Bridge and Bridgeless mode
37
+ // (Fabric component views included), which drawElementImageToTexture needs.
38
+ @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED;
39
+
34
40
  + (std::shared_ptr<rnwgpu::RNWebGPUManager>)getManager {
35
41
  return webgpuManager;
36
42
  }
@@ -74,8 +80,21 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
74
80
  return [NSNumber numberWithBool:NO];
75
81
  }
76
82
 
83
+ // Main-thread only (see ApplePlatformContext::ViewLookup). Weak: the module
84
+ // is invalidated on reload, after which lookups simply fail.
85
+ __weak WebGPUModule *weakSelf = self;
86
+ rnwgpu::ApplePlatformContext::ViewLookup viewLookup =
87
+ [weakSelf](int tag) -> void * {
88
+ WebGPUModule *strongSelf = weakSelf;
89
+ if (strongSelf == nil) {
90
+ return nullptr;
91
+ }
92
+ RNWGPlatformView *view =
93
+ [strongSelf.viewRegistry_DEPRECATED viewForReactTag:@(tag)];
94
+ return (__bridge void *)view;
95
+ };
77
96
  std::shared_ptr<rnwgpu::PlatformContext> platformContext =
78
- std::make_shared<rnwgpu::ApplePlatformContext>();
97
+ std::make_shared<rnwgpu::ApplePlatformContext>(std::move(viewLookup));
79
98
  webgpuManager = std::make_shared<rnwgpu::RNWebGPUManager>(runtime, jsInvoker,
80
99
  platformContext);
81
100
  return @true;
@@ -2,6 +2,7 @@
2
2
 
3
3
  #include <functional>
4
4
  #include <memory>
5
+ #include <mutex>
5
6
  #include <span>
6
7
  #include <string>
7
8
  #include <utility>
@@ -72,11 +73,55 @@ public:
72
73
  virtual void pause() = 0;
73
74
  };
74
75
 
76
+ // A request to rasterize a native React Native view (looked up by its React
77
+ // tag) for GPUQueue.drawElementImageToTexture.
78
+ //
79
+ // The source rectangle is expressed in the view's own coordinate space, in
80
+ // density-independent points (the units of React Native layout). A
81
+ // non-positive sourceWidth/sourceHeight means "the whole view". The
82
+ // destination size is in pixels: the platform rasterizes the source rectangle
83
+ // scaled to exactly width x height.
84
+ struct ViewSnapshotRequest {
85
+ int viewTag = 0;
86
+ double sourceX = 0;
87
+ double sourceY = 0;
88
+ double sourceWidth = 0;
89
+ double sourceHeight = 0;
90
+ uint32_t width = 0;
91
+ uint32_t height = 0;
92
+ };
93
+
75
94
  class PlatformContext {
76
95
  public:
77
96
  PlatformContext() = default;
78
97
  virtual ~PlatformContext() = default;
79
98
 
99
+ // The platform context of the currently installed RNWebGPUManager, for API
100
+ // objects (e.g. GPUQueue) that are created without a reference to it. Set on
101
+ // install, cleared on teardown; a dev reload replaces it.
102
+ static void setCurrent(std::shared_ptr<PlatformContext> context) {
103
+ std::lock_guard<std::mutex> lock(currentMutex());
104
+ currentSlot() = std::move(context);
105
+ }
106
+ static std::shared_ptr<PlatformContext> current() {
107
+ std::lock_guard<std::mutex> lock(currentMutex());
108
+ return currentSlot();
109
+ }
110
+
111
+ // Rasterize a native view into CPU pixels (see ViewSnapshotRequest). The
112
+ // implementation hops to the platform UI thread, so this is asynchronous:
113
+ // exactly one of onSuccess / onError is invoked, from an arbitrary thread
114
+ // (typically the UI thread). Callers must not touch JSI in the callbacks.
115
+ //
116
+ // The returned ImageData is tightly packed (no row padding), 4 bytes per
117
+ // pixel, `format` is rgba8unorm or bgra8unorm depending on what the platform
118
+ // rasterizer produces natively, and `premultiplied` reports its alpha
119
+ // representation.
120
+ virtual void
121
+ snapshotView(const ViewSnapshotRequest &request,
122
+ std::function<void(ImageData)> onSuccess,
123
+ std::function<void(std::string)> onError) = 0;
124
+
80
125
  virtual wgpu::Surface makeSurface(wgpu::Instance instance, void *surface,
81
126
  int width, int height) = 0;
82
127
  virtual ImageData createImageBitmap(std::string blobId, double offset,
@@ -129,6 +174,16 @@ public:
129
174
  // and return its absolute path. Lets the SharedTextureMemory example play
130
175
  // a real decoded video without bundling an asset.
131
176
  virtual std::string writeTestVideoFile() = 0;
177
+
178
+ private:
179
+ static std::mutex &currentMutex() {
180
+ static std::mutex mutex;
181
+ return mutex;
182
+ }
183
+ static std::shared_ptr<PlatformContext> &currentSlot() {
184
+ static std::shared_ptr<PlatformContext> slot;
185
+ return slot;
186
+ }
132
187
  };
133
188
 
134
189
  } // namespace rnwgpu
@@ -67,6 +67,10 @@ RNWebGPUManager::RNWebGPUManager(
67
67
  // no invoker (best-effort; see README "Threading model").
68
68
  async::RuntimeContext::registerMainRuntime(_jsRuntime, _jsCallInvoker);
69
69
 
70
+ // Expose the platform context to API objects created later without a
71
+ // reference to it (GPUQueue::drawElementImageToTexture).
72
+ PlatformContext::setCurrent(_platformContext);
73
+
70
74
  auto gpu = std::make_shared<GPU>(*_jsRuntime);
71
75
  auto rnWebGPU =
72
76
  std::make_shared<RNWebGPU>(gpu, _platformContext, _jsCallInvoker);
@@ -248,6 +252,9 @@ RNWebGPUManager::~RNWebGPUManager() {
248
252
  // contextId counter, and stale entries would alias new canvases onto dead
249
253
  // surfaces.
250
254
  SurfaceRegistry::getInstance().clear();
255
+ if (PlatformContext::current() == _platformContext) {
256
+ PlatformContext::setCurrent(nullptr);
257
+ }
251
258
  _jsRuntime = nullptr;
252
259
  _jsCallInvoker = nullptr;
253
260
  }
@@ -1,10 +1,16 @@
1
1
  #include "GPUQueue.h"
2
2
 
3
+ #include <algorithm>
4
+ #include <cmath>
3
5
  #include <limits>
4
6
  #include <memory>
7
+ #include <string>
8
+ #include <utility>
5
9
  #include <vector>
6
10
 
7
11
  #include "Convertors.h"
12
+ #include "ImageBitmap.h"
13
+ #include "PlatformContext.h"
8
14
 
9
15
  namespace rnwgpu {
10
16
 
@@ -193,6 +199,187 @@ void GPUQueue::copyExternalImageToTexture(
193
199
  }
194
200
  }
195
201
 
202
+ async::AsyncTaskHandle GPUQueue::drawElementImageToTexture(
203
+ jsi::Runtime &runtime, std::shared_ptr<GPUDrawElementImageSource> source,
204
+ std::shared_ptr<GPUDrawElementImageDestination> destination) {
205
+ auto platform = PlatformContext::current();
206
+ if (!platform) {
207
+ throw std::runtime_error(
208
+ "drawElementImageToTexture: react-native-webgpu is not installed");
209
+ }
210
+ if (!destination || !destination->info || !destination->info->texture) {
211
+ throw std::runtime_error(
212
+ "drawElementImageToTexture: `destination.texture` is required");
213
+ }
214
+ const auto &info = destination->info;
215
+
216
+ // Destination texture: only the 8-bit RGBA/BGRA formats the platform
217
+ // rasterizers produce natively are accepted (with a byte swizzle between
218
+ // the two); anything else would need a GPU blit.
219
+ wgpu::TexelCopyTextureInfo dst{};
220
+ Convertor conv;
221
+ if (!conv(dst.aspect, info->aspect) || !conv(dst.mipLevel, info->mipLevel) ||
222
+ !conv(dst.origin, info->origin) || !conv(dst.texture, info->texture)) {
223
+ throw std::runtime_error(
224
+ "drawElementImageToTexture: invalid destination");
225
+ }
226
+ const wgpu::Texture texture = info->texture->get();
227
+ bool destinationIsBgra = false;
228
+ switch (texture.GetFormat()) {
229
+ case wgpu::TextureFormat::RGBA8Unorm:
230
+ case wgpu::TextureFormat::RGBA8UnormSrgb:
231
+ destinationIsBgra = false;
232
+ break;
233
+ case wgpu::TextureFormat::BGRA8Unorm:
234
+ case wgpu::TextureFormat::BGRA8UnormSrgb:
235
+ destinationIsBgra = true;
236
+ break;
237
+ default:
238
+ throw std::runtime_error(
239
+ "drawElementImageToTexture: the destination texture must be "
240
+ "rgba8unorm, rgba8unorm-srgb, bgra8unorm or bgra8unorm-srgb");
241
+ }
242
+ if (!(texture.GetUsage() & wgpu::TextureUsage::CopyDst)) {
243
+ throw std::runtime_error(
244
+ "drawElementImageToTexture: the destination texture must have "
245
+ "GPUTextureUsage.COPY_DST");
246
+ }
247
+ if (texture.GetDimension() != wgpu::TextureDimension::e2D ||
248
+ texture.GetSampleCount() != 1) {
249
+ throw std::runtime_error(
250
+ "drawElementImageToTexture: the destination must be a single-sampled "
251
+ "2D texture");
252
+ }
253
+ if (dst.mipLevel >= texture.GetMipLevelCount()) {
254
+ throw std::runtime_error(
255
+ "drawElementImageToTexture: destination.mipLevel is out of range");
256
+ }
257
+ const uint32_t mipWidth =
258
+ std::max<uint32_t>(1, texture.GetWidth() >> dst.mipLevel);
259
+ const uint32_t mipHeight =
260
+ std::max<uint32_t>(1, texture.GetHeight() >> dst.mipLevel);
261
+ if (dst.origin.z >= texture.GetDepthOrArrayLayers()) {
262
+ throw std::runtime_error(
263
+ "drawElementImageToTexture: destination.origin.z is out of range");
264
+ }
265
+
266
+ // Source rectangle (points, view space). Omitted width/height mean "the
267
+ // whole view", which only the platform knows.
268
+ ViewSnapshotRequest request{};
269
+ request.viewTag = source->viewTag;
270
+ request.sourceX = source->sourceX.value_or(0.0);
271
+ request.sourceY = source->sourceY.value_or(0.0);
272
+ request.sourceWidth = source->sourceWidth.value_or(0.0);
273
+ request.sourceHeight = source->sourceHeight.value_or(0.0);
274
+ if (!std::isfinite(request.sourceX) || !std::isfinite(request.sourceY) ||
275
+ !std::isfinite(request.sourceWidth) ||
276
+ !std::isfinite(request.sourceHeight) ||
277
+ (source->sourceWidth.has_value() && request.sourceWidth <= 0) ||
278
+ (source->sourceHeight.has_value() && request.sourceHeight <= 0)) {
279
+ throw std::runtime_error(
280
+ "drawElementImageToTexture: the source rectangle must be finite with "
281
+ "a positive width and height");
282
+ }
283
+
284
+ // Destination size (pixels). Omitted means the source rectangle's natural
285
+ // pixel size (points times the device pixel ratio), which the platform
286
+ // computes; the bounds check then happens once the pixels are back.
287
+ if (destination->size.has_value()) {
288
+ wgpu::Extent3D size{};
289
+ if (!conv(size, destination->size.value())) {
290
+ throw std::runtime_error(
291
+ "drawElementImageToTexture: invalid destination.size");
292
+ }
293
+ if (size.width == 0 || size.height == 0 || size.depthOrArrayLayers != 1) {
294
+ throw std::runtime_error(
295
+ "drawElementImageToTexture: destination.size must have a positive "
296
+ "width and height and a depthOrArrayLayers of 1");
297
+ }
298
+ if (size.width > mipWidth - std::min(dst.origin.x, mipWidth) ||
299
+ size.height > mipHeight - std::min(dst.origin.y, mipHeight)) {
300
+ throw std::runtime_error(
301
+ "drawElementImageToTexture: destination.origin + destination.size "
302
+ "exceeds the texture's extent at destination.mipLevel");
303
+ }
304
+ request.width = size.width;
305
+ request.height = size.height;
306
+ }
307
+
308
+ // premultipliedAlpha defaults to false, like copyExternalImageToTexture.
309
+ const bool destinationPremultiplied =
310
+ info->premultipliedAlpha.value_or(false);
311
+
312
+ // Settle on the CALLING runtime's context (see GPUBuffer::mapAsync): the
313
+ // snapshot completes on the UI thread and is deposited into that context's
314
+ // mailbox; the texture write and the resolve then run on the runtime's own
315
+ // thread during its next tick.
316
+ auto context =
317
+ async::RuntimeContext::getOrCreate(runtime, _async->instance());
318
+ auto queue = _instance;
319
+ // Keeps the destination texture alive until the write is issued.
320
+ auto gpuTexture = info->texture;
321
+ return context->postTask(
322
+ [platform, request, dst, mipWidth, mipHeight, destinationIsBgra,
323
+ destinationPremultiplied, queue,
324
+ gpuTexture](const async::AsyncTaskHandle::ResolveFunction &resolve,
325
+ const async::AsyncTaskHandle::RejectFunction &reject) {
326
+ platform->snapshotView(
327
+ request,
328
+ [resolve, reject, dst, mipWidth, mipHeight, destinationIsBgra,
329
+ destinationPremultiplied, queue,
330
+ gpuTexture](ImageData image) mutable {
331
+ // Arbitrary (UI) thread: validate without touching JSI.
332
+ if (image.width == 0 || image.height == 0 ||
333
+ image.data.size() < image.width * image.height * 4) {
334
+ reject("drawElementImageToTexture: the view produced no "
335
+ "pixels (is it mounted with a non-zero size?)");
336
+ return;
337
+ }
338
+ if (image.width > mipWidth - std::min<uint32_t>(dst.origin.x,
339
+ mipWidth) ||
340
+ image.height > mipHeight - std::min<uint32_t>(dst.origin.y,
341
+ mipHeight)) {
342
+ reject("drawElementImageToTexture: the view's natural pixel "
343
+ "size (" +
344
+ std::to_string(image.width) + "x" +
345
+ std::to_string(image.height) +
346
+ ") does not fit in the destination texture at "
347
+ "destination.origin; pass destination.size to scale "
348
+ "it, or create a larger texture");
349
+ return;
350
+ }
351
+ resolve([image = std::move(image), dst, destinationIsBgra,
352
+ destinationPremultiplied, queue,
353
+ gpuTexture](jsi::Runtime &) mutable -> jsi::Value {
354
+ // Owning runtime's thread. Bring the pixels into the
355
+ // destination's channel order and alpha representation, then
356
+ // issue the write.
357
+ const bool sourceIsBgra =
358
+ image.format == wgpu::TextureFormat::BGRA8Unorm ||
359
+ image.format == wgpu::TextureFormat::BGRA8UnormSrgb;
360
+ uint8_t *pixels = image.data.data();
361
+ const size_t byteLength = image.width * image.height * 4;
362
+ if (sourceIsBgra != destinationIsBgra) {
363
+ for (size_t i = 0; i + 3 < byteLength; i += 4) {
364
+ std::swap(pixels[i], pixels[i + 2]);
365
+ }
366
+ }
367
+ convertAlpha(pixels, byteLength, image.premultiplied,
368
+ destinationPremultiplied);
369
+ wgpu::TexelCopyBufferLayout layout{};
370
+ layout.offset = 0;
371
+ layout.bytesPerRow = static_cast<uint32_t>(image.width * 4);
372
+ layout.rowsPerImage = static_cast<uint32_t>(image.height);
373
+ wgpu::Extent3D extent{static_cast<uint32_t>(image.width),
374
+ static_cast<uint32_t>(image.height), 1};
375
+ queue.WriteTexture(&dst, pixels, byteLength, &layout, &extent);
376
+ return jsi::Value::undefined();
377
+ });
378
+ },
379
+ [reject](std::string error) { reject(std::move(error)); });
380
+ });
381
+ }
382
+
196
383
  void GPUQueue::writeTexture(std::shared_ptr<GPUImageCopyTexture> destination,
197
384
  std::shared_ptr<ArrayBuffer> data,
198
385
  std::shared_ptr<GPUImageDataLayout> dataLayout,
@@ -16,6 +16,8 @@
16
16
  #include "ArrayBuffer.h"
17
17
  #include "GPUBuffer.h"
18
18
  #include "GPUCommandBuffer.h"
19
+ #include "GPUDrawElementImageDestination.h"
20
+ #include "GPUDrawElementImageSource.h"
19
21
  #include "GPUImageCopyExternalImage.h"
20
22
  #include "GPUImageCopyTextureTagged.h"
21
23
 
@@ -51,6 +53,18 @@ public:
51
53
  std::shared_ptr<GPUImageCopyTextureTagged> destination,
52
54
  std::shared_ptr<GPUExtent3D> copySize);
53
55
 
56
+ // Non-spec React Native extension modeled on the html-in-canvas proposal's
57
+ // GPUQueue.drawElementImageToTexture: rasterizes a native view (the
58
+ // "element") and writes the pixels into `destination.texture`. Unlike the
59
+ // web API it returns a Promise, because the view can only be rasterized on
60
+ // the platform UI thread; the texture write is issued on the calling
61
+ // runtime's thread right before the promise resolves, so work submitted
62
+ // after `await` observes the new contents.
63
+ async::AsyncTaskHandle drawElementImageToTexture(
64
+ jsi::Runtime &runtime,
65
+ std::shared_ptr<GPUDrawElementImageSource> source,
66
+ std::shared_ptr<GPUDrawElementImageDestination> destination);
67
+
54
68
  std::string getLabel() { return _label; }
55
69
  void setLabel(const std::string &label) {
56
70
  _label = label;
@@ -66,6 +80,8 @@ public:
66
80
  installMethod(runtime, prototype, "writeTexture", &GPUQueue::writeTexture);
67
81
  installMethod(runtime, prototype, "copyExternalImageToTexture",
68
82
  &GPUQueue::copyExternalImageToTexture);
83
+ installMethodWithRuntime(runtime, prototype, "drawElementImageToTexture",
84
+ &GPUQueue::drawElementImageToTexture);
69
85
  installGetterSetter(runtime, prototype, "label", &GPUQueue::getLabel,
70
86
  &GPUQueue::setLabel);
71
87
  }
@@ -0,0 +1,60 @@
1
+ #pragma once
2
+
3
+ #include <memory>
4
+ #include <optional>
5
+
6
+ #include "JSIConverter.h"
7
+
8
+ #include "GPUExtent3D.h"
9
+ #include "GPUImageCopyTextureTagged.h"
10
+
11
+ namespace jsi = facebook::jsi;
12
+
13
+ namespace rnwgpu {
14
+
15
+ // The `destination` argument of GPUQueue.drawElementImageToTexture:
16
+ // dictionary GPUDrawElementImageDestination : GPUCopyExternalImageDestInfo {
17
+ // GPUExtent3D size;
18
+ // };
19
+ // `size` is the pixel size of the region the view is drawn into. When omitted
20
+ // it is the source rectangle's natural pixel size (points times the device
21
+ // pixel ratio).
22
+ struct GPUDrawElementImageDestination {
23
+ std::shared_ptr<GPUImageCopyTextureTagged> info;
24
+ std::optional<std::shared_ptr<GPUExtent3D>> size;
25
+ };
26
+
27
+ } // namespace rnwgpu
28
+
29
+ namespace rnwgpu {
30
+
31
+ template <>
32
+ struct JSIConverter<std::shared_ptr<rnwgpu::GPUDrawElementImageDestination>> {
33
+ static std::shared_ptr<rnwgpu::GPUDrawElementImageDestination>
34
+ fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
35
+ auto result = std::make_unique<rnwgpu::GPUDrawElementImageDestination>();
36
+ if (outOfBounds || !arg.isObject()) {
37
+ throw std::runtime_error(
38
+ "drawElementImageToTexture: expected a destination dictionary");
39
+ }
40
+ result->info =
41
+ JSIConverter<std::shared_ptr<GPUImageCopyTextureTagged>>::fromJSI(
42
+ runtime, arg, false);
43
+ auto obj = arg.getObject(runtime);
44
+ if (obj.hasProperty(runtime, "size")) {
45
+ result->size =
46
+ JSIConverter<std::optional<std::shared_ptr<GPUExtent3D>>>::fromJSI(
47
+ runtime, obj.getProperty(runtime, "size"), false);
48
+ }
49
+ return result;
50
+ }
51
+
52
+ static jsi::Value
53
+ toJSI(jsi::Runtime &runtime,
54
+ std::shared_ptr<rnwgpu::GPUDrawElementImageDestination> arg) {
55
+ throw std::runtime_error(
56
+ "Invalid GPUDrawElementImageDestination::toJSI()");
57
+ }
58
+ };
59
+
60
+ } // namespace rnwgpu
@@ -0,0 +1,106 @@
1
+ #pragma once
2
+
3
+ #include <memory>
4
+ #include <optional>
5
+ #include <string>
6
+
7
+ #include "JSIConverter.h"
8
+
9
+ namespace jsi = facebook::jsi;
10
+
11
+ namespace rnwgpu {
12
+
13
+ // The `source` argument of GPUQueue.drawElementImageToTexture, modeled on the
14
+ // html-in-canvas proposal's GPUDrawElementImageSource. On the web `source` is
15
+ // an Element; here it is a native React Native view, identified by its React
16
+ // tag. The optional rectangle selects the part of the view to draw, in the
17
+ // view's own coordinate space and in density-independent points (React Native
18
+ // layout units); it defaults to the whole view.
19
+ struct GPUDrawElementImageSource {
20
+ int viewTag = 0; // resolved from `source`
21
+ std::optional<double> sourceX; // float
22
+ std::optional<double> sourceY; // float
23
+ std::optional<double> sourceWidth; // float
24
+ std::optional<double> sourceHeight; // float
25
+ };
26
+
27
+ } // namespace rnwgpu
28
+
29
+ namespace rnwgpu {
30
+
31
+ template <>
32
+ struct JSIConverter<std::shared_ptr<rnwgpu::GPUDrawElementImageSource>> {
33
+ // Resolve `source` to a React tag. Accepted shapes:
34
+ // - a number: the tag itself (what findNodeHandle returns)
35
+ // - a React Native host component instance: on the New Architecture these
36
+ // carry the tag as `__nativeTag` (ReactFabricHostComponent /
37
+ // ReactNativeElement), which is also what findNodeHandle reads
38
+ // - a ref object (`{ current }`) wrapping either of the above
39
+ // The JS wrapper on the main runtime additionally runs findNodeHandle so
40
+ // class components and legacy instances resolve too; this native fallback is
41
+ // what worklet runtimes (no findNodeHandle) get.
42
+ static int resolveViewTag(jsi::Runtime &runtime, const jsi::Value &value,
43
+ int depth = 0) {
44
+ if (value.isNumber()) {
45
+ return static_cast<int>(value.getNumber());
46
+ }
47
+ if (value.isObject() && depth < 2) {
48
+ auto obj = value.getObject(runtime);
49
+ if (obj.hasProperty(runtime, "__nativeTag")) {
50
+ auto tag = obj.getProperty(runtime, "__nativeTag");
51
+ if (tag.isNumber()) {
52
+ return static_cast<int>(tag.getNumber());
53
+ }
54
+ }
55
+ if (obj.hasProperty(runtime, "current")) {
56
+ return resolveViewTag(runtime, obj.getProperty(runtime, "current"),
57
+ depth + 1);
58
+ }
59
+ }
60
+ throw std::runtime_error(
61
+ "drawElementImageToTexture: `source` must be a React Native view "
62
+ "(a host component ref, its instance, or the tag returned by "
63
+ "findNodeHandle)");
64
+ }
65
+
66
+ static std::shared_ptr<rnwgpu::GPUDrawElementImageSource>
67
+ fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
68
+ auto result = std::make_unique<rnwgpu::GPUDrawElementImageSource>();
69
+ if (outOfBounds || !arg.isObject()) {
70
+ throw std::runtime_error(
71
+ "drawElementImageToTexture: expected a source dictionary");
72
+ }
73
+ auto obj = arg.getObject(runtime);
74
+ if (!obj.hasProperty(runtime, "source")) {
75
+ throw std::runtime_error(
76
+ "drawElementImageToTexture: `source.source` is required");
77
+ }
78
+ result->viewTag =
79
+ resolveViewTag(runtime, obj.getProperty(runtime, "source"));
80
+ if (obj.hasProperty(runtime, "sourceX")) {
81
+ result->sourceX = JSIConverter<std::optional<double>>::fromJSI(
82
+ runtime, obj.getProperty(runtime, "sourceX"), false);
83
+ }
84
+ if (obj.hasProperty(runtime, "sourceY")) {
85
+ result->sourceY = JSIConverter<std::optional<double>>::fromJSI(
86
+ runtime, obj.getProperty(runtime, "sourceY"), false);
87
+ }
88
+ if (obj.hasProperty(runtime, "sourceWidth")) {
89
+ result->sourceWidth = JSIConverter<std::optional<double>>::fromJSI(
90
+ runtime, obj.getProperty(runtime, "sourceWidth"), false);
91
+ }
92
+ if (obj.hasProperty(runtime, "sourceHeight")) {
93
+ result->sourceHeight = JSIConverter<std::optional<double>>::fromJSI(
94
+ runtime, obj.getProperty(runtime, "sourceHeight"), false);
95
+ }
96
+ return result;
97
+ }
98
+
99
+ static jsi::Value
100
+ toJSI(jsi::Runtime &runtime,
101
+ std::shared_ptr<rnwgpu::GPUDrawElementImageSource> arg) {
102
+ throw std::runtime_error("Invalid GPUDrawElementImageSource::toJSI()");
103
+ }
104
+ };
105
+
106
+ } // namespace rnwgpu
@@ -1 +1 @@
1
- {"version":3,"names":["_main","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_constants","_install"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;AAcA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,UAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,UAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,UAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,QAAA,GAAAd,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_main","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_constants","_install"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;AAgBA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,UAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,UAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,UAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,QAAA,GAAAd,OAAA","ignoreList":[]}
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "WebGPUModule", {
12
12
  return _NativeWebGPUModule.default;
13
13
  }
14
14
  });
15
+ var _reactNative = require("react-native");
15
16
  var _external = require("../external");
16
17
  var _install = require("../install");
17
18
  var _NativeWebGPUModule = _interopRequireDefault(require("../NativeWebGPUModule"));
@@ -100,6 +101,37 @@ Object.keys(_formats).forEach(function (key) {
100
101
  });
101
102
  });
102
103
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
104
+ // Resolve the `source` of drawElementImageToTexture to a React tag on the
105
+ // main JS runtime, where findNodeHandle is available: it handles class
106
+ // components and legacy host instances that the native fallback (a number or
107
+ // an instance carrying `__nativeTag`) does not.
108
+ const resolveElementSource = source => {
109
+ if (typeof source === "number") {
110
+ return source;
111
+ }
112
+ const instance = source !== null && typeof source === "object" && "current" in source ? source.current : source;
113
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
+ const tag = instance == null ? null : (0, _reactNative.findNodeHandle)(instance);
115
+ if (tag === null || tag === undefined) {
116
+ throw new Error("[WebGPU] drawElementImageToTexture: `source` does not resolve to a " + "mounted native view (pass a host component ref rendered with " + "collapsable={false})");
117
+ }
118
+ return tag;
119
+ };
120
+ const installDrawElementImageToTexture = () => {
121
+ if (typeof GPUQueue === "undefined") {
122
+ return;
123
+ }
124
+ const native = GPUQueue.prototype.drawElementImageToTexture;
125
+ if (typeof native !== "function") {
126
+ return;
127
+ }
128
+ GPUQueue.prototype.drawElementImageToTexture = function (source, destination) {
129
+ return native.call(this, {
130
+ ...source,
131
+ source: resolveElementSource(source.source)
132
+ }, destination);
133
+ };
134
+ };
103
135
  const _installOk = _NativeWebGPUModule.default.install();
104
136
  (0, _external.registerWebGPUForReanimated)();
105
137
  if (typeof RNWebGPU !== "undefined") {
@@ -122,6 +154,7 @@ if (typeof RNWebGPU !== "undefined") {
122
154
  }
123
155
  }
124
156
  global.createImageBitmap = global.createImageBitmap ?? RNWebGPU.createImageBitmap.bind(RNWebGPU);
157
+ installDrawElementImageToTexture();
125
158
  // Let installWebGPU() put navigator.gpu on other runtimes (see install.ts).
126
159
  (0, _install.provideGPUForInstall)(RNWebGPU.gpu);
127
160
  } else {
@@ -1 +1 @@
1
- {"version":3,"names":["_external","require","_install","_NativeWebGPUModule","_interopRequireDefault","_Canvas","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Offscreen","_WebGPUViewNativeComponent","_hooks","_GPUDeviceProvider","_importDevice","_formats","e","__esModule","default","_installOk","WebGPUModule","install","registerWebGPUForReanimated","RNWebGPU","navigator","gpu","userAgent","global","createImageBitmap","bind","provideGPUForInstall","console","warn"],"sourceRoot":"../../../src","sources":["main/index.tsx"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,UAAA,GAAAjB,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAW,UAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,UAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,0BAAA,GAAAlB,OAAA;AAAAK,MAAA,CAAAC,IAAA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EAAE;IACd;IACAA,SAAS,GAAG;MACVC,GAAG,EAAEF,QAAQ,CAACE,GAAG;MACjBC,SAAS,EAAE;IACb,CAAC;EACH,CAAC,MAAM;IACLF,SAAS,CAACC,GAAG,GAAGF,QAAQ,CAACE,GAAG;IAC5B,IAAI,OAAOD,SAAS,CAACE,SAAS,KAAK,QAAQ,EAAE;MAC3C,IAAI;QACF;QACA;QACAF,SAAS,CAACE,SAAS,GAAG,cAAc;MACtC,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;EACF;EACAC,MAAM,CAACC,iBAAiB,GACtBD,MAAM,CAACC,iBAAiB,IAAIL,QAAQ,CAACK,iBAAiB,CAACC,IAAI,CAACN,QAAQ,CAAC;EACvE;EACA,IAAAO,6BAAoB,EAACP,QAAQ,CAACE,GAAG,CAAC;AACpC,CAAC,MAAM;EACLM,OAAO,CAACC,IAAI,CACV,4CAA4Cb,UAAU,uCACxD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_external","_install","_NativeWebGPUModule","_interopRequireDefault","_Canvas","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Offscreen","_WebGPUViewNativeComponent","_hooks","_GPUDeviceProvider","_importDevice","_formats","e","__esModule","default","resolveElementSource","source","instance","current","tag","findNodeHandle","undefined","Error","installDrawElementImageToTexture","GPUQueue","native","drawElementImageToTexture","destination","_installOk","WebGPUModule","install","registerWebGPUForReanimated","RNWebGPU","navigator","gpu","userAgent","global","createImageBitmap","bind","provideGPUForInstall","console","warn"],"sourceRoot":"../../../src","sources":["main/index.tsx"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAgDA,IAAAK,OAAA,GAAAL,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAA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O,CAACC,IAAI,CACV,4CAA4Cb,UAAU,uCACxD,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["installWebGPU"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;;AAcA,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,SAASA,aAAa,QAAQ,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["installWebGPU"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;;AAgBA,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,SAASA,aAAa,QAAQ,WAAW","ignoreList":[]}