react-native-webgpu 0.21.0 → 0.21.2

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.
package/Package.swift CHANGED
@@ -128,6 +128,7 @@ if let skiaPath = nodePackage("react-native-skia"),
128
128
  // cpp/rnwgpu), so every directory that's the target of one of those bare
129
129
  // includes has to be listed explicitly here. The "webgpu/..." and "dawn/..."
130
130
  // includes resolve through the Dawn xcframework's embedded headers.
131
+ // Keep in sync with header_dirs in react-native-webgpu.podspec.
131
132
  let internalHeaderDirs = [
132
133
  "apple",
133
134
  "cpp",
@@ -379,7 +379,8 @@ struct JSIConverter<std::variant<std::nullptr_t, std::shared_ptr<O>>> {
379
379
 
380
380
  static Target fromJSI(jsi::Runtime &runtime, const jsi::Value &arg,
381
381
  bool outOfBound) {
382
- if (arg.isNull()) {
382
+ // WebIDL converts undefined to null for a nullable type.
383
+ if (arg.isNull() || arg.isUndefined()) {
383
384
  return Target(nullptr);
384
385
  }
385
386
  return Target(
@@ -402,7 +403,8 @@ struct JSIConverter<std::variant<std::nullptr_t, O>,
402
403
 
403
404
  static Target fromJSI(jsi::Runtime &runtime, const jsi::Value &arg,
404
405
  bool outOfBound) {
405
- if (arg.isNull()) {
406
+ // WebIDL converts undefined to null for a nullable type.
407
+ if (arg.isNull() || arg.isUndefined()) {
406
408
  return Target(nullptr);
407
409
  } else if (arg.isNumber()) {
408
410
  return Target(static_cast<O>(arg.asNumber()));
@@ -324,8 +324,17 @@ public:
324
324
  * Called automatically by create(), but can be called manually.
325
325
  */
326
326
  static void installPrototype(jsi::Runtime &runtime) {
327
- if (getCachedPrototype(runtime) != nullptr) {
328
- return; // Already installed on this runtime
327
+ ensurePrototype(runtime, JSICache::get(runtime));
328
+ }
329
+
330
+ /**
331
+ * This class's prototype on `runtime`, installed first if needed. Takes the
332
+ * runtime's cache so that create() looks it up once per new wrapper.
333
+ */
334
+ static jsi::Object &ensurePrototype(jsi::Runtime &runtime,
335
+ JSICache &cache) {
336
+ if (auto *prototype = cache.getPrototype(prototypeKey())) {
337
+ return *prototype; // Already installed on this runtime
329
338
  }
330
339
 
331
340
  // Every wrapper is made by create(), which installs the prototype first,
@@ -403,7 +412,7 @@ public:
403
412
  prototype.setProperty(runtime, "toJSON", toJSON);
404
413
 
405
414
  // Hand the prototype to the runtime-owned cache
406
- JSICache::get(runtime).setPrototype(prototypeKey(), std::move(prototype));
415
+ return cache.setPrototype(prototypeKey(), std::move(prototype));
407
416
  }
408
417
 
409
418
  /**
@@ -522,25 +531,15 @@ public:
522
531
  return existing;
523
532
  }
524
533
 
525
- installPrototype(runtime);
526
-
527
534
  // Store creation runtime for logging etc.
528
535
  instance->setCreationRuntime(&runtime);
529
536
 
530
- // Create a new object
531
- jsi::Object obj(runtime);
532
-
533
- // Attach native state
537
+ // Create the object with its prototype in one step, and attach the
538
+ // native state.
539
+ auto obj = jsi::Object::create(
540
+ runtime, jsi::Value(runtime, ensurePrototype(runtime, cache)));
534
541
  obj.setNativeState(runtime, instance);
535
542
 
536
- // Set prototype
537
- if (auto *prototype = getCachedPrototype(runtime)) {
538
- auto objectCtor = runtime.global().getPropertyAsObject(runtime, "Object");
539
- auto setPrototypeOf =
540
- objectCtor.getPropertyAsFunction(runtime, "setPrototypeOf");
541
- setPrototypeOf.call(runtime, obj, *prototype);
542
- }
543
-
544
543
  // Set memory pressure hint for GC
545
544
  auto pressure = instance->getMemoryPressure();
546
545
  if (pressure > 0) {
@@ -117,16 +117,25 @@ public:
117
117
  [[nodiscard]] inline bool
118
118
  Convert(OUT *&out_els, size_t &out_count,
119
119
  const std::vector<std::variant<std::nullptr_t, IN>> &in) {
120
- std::vector<IN> filtered;
121
- filtered.reserve(in.size());
122
-
123
- for (const auto &item : in) {
124
- if (auto ptr = std::get_if<IN>(&item)) {
125
- filtered.push_back(*ptr);
120
+ if (in.size() == 0) {
121
+ out_els = nullptr;
122
+ out_count = 0;
123
+ return true;
124
+ }
125
+ // A null entry keeps its index, as the spec says: it stays the default
126
+ // struct, which Dawn reads as an unused slot (a vertex buffer layout with
127
+ // no attributes, an Undefined color target or format, an attachment with
128
+ // no view).
129
+ auto *els = Allocate<std::remove_const_t<OUT>>(in.size());
130
+ for (size_t i = 0; i < in.size(); i++) {
131
+ if (auto ptr = std::get_if<IN>(&in[i])) {
132
+ if (!Convert(els[i], *ptr)) {
133
+ return false;
134
+ }
126
135
  }
127
136
  }
128
-
129
- return Convert(out_els, out_count, filtered);
137
+ out_els = els;
138
+ return Convert(out_count, in.size());
130
139
  }
131
140
 
132
141
  template <typename OUT, typename INKEY, typename INVALUE>
@@ -151,9 +160,17 @@ public:
151
160
  return Convert(out_count, val.size());
152
161
  }
153
162
 
163
+ // A null handle becomes nullptr. A null struct or enum stays at its
164
+ // default, which is how a null entry in a slot list (vertex buffers, color
165
+ // targets, color attachments, color formats, bind group layouts) keeps its
166
+ // index: Dawn reads the default value as an unused slot.
154
167
  template <typename T>
155
- [[nodiscard]] auto Convert(T &out, const std::nullptr_t &in) {
156
- out = nullptr;
168
+ [[nodiscard]] bool Convert(T &out, const std::nullptr_t &in) {
169
+ if constexpr (std::is_assignable_v<T &, std::nullptr_t>) {
170
+ out = nullptr;
171
+ } else {
172
+ out = T{};
173
+ }
157
174
  return true;
158
175
  }
159
176
 
@@ -690,6 +707,9 @@ public:
690
707
  - return Convert(out.stepMode, in.stepMode);
691
708
  - }
692
709
  */
710
+ // stepMode defaults to "vertex" in the spec. Leaving it Undefined would
711
+ // make Dawn read a layout with no attributes as an unused slot.
712
+ out.stepMode = wgpu::VertexStepMode::Vertex;
693
713
  return Convert(out.attributes, out.attributeCount, in.attributes) &&
694
714
  Convert(out.arrayStride, in.arrayStride) &&
695
715
  Convert(out.stepMode, in.stepMode);
@@ -258,9 +258,12 @@ std::shared_ptr<GPUAdapterInfo> GPUDevice::getAdapterInfo() {
258
258
  }
259
259
 
260
260
  std::shared_ptr<GPUQueue> GPUDevice::getQueue() {
261
- auto result = _instance.GetQueue();
262
- return std::make_shared<GPUQueue>(_instance, result, _async, _videoFrameBlit,
263
- _label, weak_from_this());
261
+ std::call_once(_queueOnce, [this] {
262
+ _queue =
263
+ std::make_shared<GPUQueue>(_instance, _instance.GetQueue(), _async,
264
+ _videoFrameBlit, _label, weak_from_this());
265
+ });
266
+ return _queue;
264
267
  }
265
268
 
266
269
  std::shared_ptr<GPUCommandEncoder> GPUDevice::createCommandEncoder(
@@ -352,6 +352,13 @@ private:
352
352
  std::shared_ptr<async::RuntimeContext> _async;
353
353
  std::string _label;
354
354
  const Origin _origin;
355
+ // device.queue is [SameObject]: made on the first read, then returned on
356
+ // every read after it. Not made in the constructor, where weak_from_this()
357
+ // is still empty and the queue could never reach the device to flush its
358
+ // pipeline cache on submit. The once_flag makes the first read safe from
359
+ // any runtime's thread.
360
+ std::once_flag _queueOnce;
361
+ std::shared_ptr<GPUQueue> _queue;
355
362
  // Set once the blob cache refused the pipeline cache's data as too large
356
363
  // (see flushPipelineCache). Shared with the flushes on the cache's thread,
357
364
  // which hold the device by its Dawn handle and may outlive this wrapper.
@@ -2,6 +2,7 @@
2
2
 
3
3
  #include <memory>
4
4
  #include <string>
5
+ #include <variant>
5
6
  #include <vector>
6
7
 
7
8
  #include "webgpu/webgpu_cpp.h"
@@ -16,8 +17,8 @@ namespace jsi = facebook::jsi;
16
17
  namespace rnwgpu {
17
18
 
18
19
  struct GPUPipelineLayoutDescriptor {
19
- std::vector<std::shared_ptr<GPUBindGroupLayout>>
20
- bindGroupLayouts; // Iterable<GPUBindGroupLayout>
20
+ std::vector<std::variant<std::nullptr_t, std::shared_ptr<GPUBindGroupLayout>>>
21
+ bindGroupLayouts; // Iterable<GPUBindGroupLayout | null | undefined>
21
22
  std::optional<std::string> label; // string
22
23
  };
23
24
 
@@ -34,10 +35,9 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUPipelineLayoutDescriptor>> {
34
35
  auto value = arg.getObject(runtime);
35
36
  if (value.hasProperty(runtime, "bindGroupLayouts")) {
36
37
  auto prop = value.getProperty(runtime, "bindGroupLayouts");
37
- result->bindGroupLayouts = JSIConverter<
38
- std::vector<std::shared_ptr<GPUBindGroupLayout>>>::fromJSI(runtime,
39
- prop,
40
- false);
38
+ result->bindGroupLayouts = JSIConverter<std::vector<std::variant<
39
+ std::nullptr_t, std::shared_ptr<GPUBindGroupLayout>>>>::
40
+ fromJSI(runtime, prop, false);
41
41
  }
42
42
  if (value.hasProperty(runtime, "label")) {
43
43
  auto prop = value.getProperty(runtime, "label");
@@ -1,5 +1,5 @@
1
1
  export const __esModule: boolean;
2
- declare const _default: _reactNative.HostComponent<object>;
2
+ declare const _default: _reactNative.HostComponent<{}>;
3
3
  export default _default;
4
4
  import _reactNative = require("react-native");
5
5
  //# sourceMappingURL=WebGPUViewNativeComponent.d.ts.map
@@ -1,10 +1,10 @@
1
1
  export const __esModule: boolean;
2
2
  export function warnIfNotHardwareAccelerated(adapter: any): void;
3
3
  export function useSurface(): {
4
- ref: _react.MutableRefObject<null>;
4
+ ref: _react.RefObject<null>;
5
5
  surface: null;
6
6
  };
7
- export function useCanvasRef(): _react.MutableRefObject<null>;
7
+ export function useCanvasRef(): _react.RefObject<null>;
8
8
  export function useDevice(adapterOptions: any, deviceDescriptor: any): {
9
9
  adapter: any;
10
10
  device: any;
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../commonjs/hooks.js"],"names":[],"mappings":";AAOA,iEAMC;AAED;;;EAWC;AAED,8DAAmD;AAEnD;;;EA0BC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../commonjs/hooks.js"],"names":[],"mappings":";AAOA,iEAMC;AAED;;;EAWC;AAED,uDAAmD;AAEnD;;;EA0BC"}
@@ -2,7 +2,8 @@ export function Canvas({ android, ref, ...props }: {
2
2
  [x: string]: any;
3
3
  android: any;
4
4
  ref: any;
5
- }): React.CElement<import("react-native").ViewProps, View>;
6
- import { View } from "react-native";
5
+ }): React.FunctionComponentElement<Omit<import("react-native").ViewProps, "ref"> & {
6
+ ref?: React.Ref<import("react-native").ViewInstance> | undefined;
7
+ }>;
7
8
  import React from "react";
8
9
  //# sourceMappingURL=Canvas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../module/Canvas.js"],"names":[],"mappings":"AA6IO;;;;2DA8CN;qBAzL8B,cAAc;kBAD2B,OAAO"}
1
+ {"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../module/Canvas.js"],"names":[],"mappings":"AA6IO;;;;;;GA8CN;kBA1LuE,OAAO"}
@@ -1,3 +1,3 @@
1
- declare const _default: import("react-native").HostComponent<object>;
1
+ declare const _default: import("react-native").HostComponent<{}>;
2
2
  export default _default;
3
3
  //# sourceMappingURL=WebGPUViewNativeComponent.d.ts.map
@@ -1,9 +1,9 @@
1
1
  export function warnIfNotHardwareAccelerated(adapter: any): void;
2
2
  export function useSurface(): {
3
- ref: import("react").MutableRefObject<null>;
3
+ ref: import("react").RefObject<null>;
4
4
  surface: null;
5
5
  };
6
- export function useCanvasRef(): import("react").MutableRefObject<null>;
6
+ export function useCanvasRef(): import("react").RefObject<null>;
7
7
  export function useDevice(adapterOptions: any, deviceDescriptor: any): {
8
8
  adapter: any;
9
9
  device: any;
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../module/hooks.js"],"names":[],"mappings":"AACO,iEAMN;AACM;;;EAWN;AACM,uEAAuC;AACvC;;;EA0BN"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../module/hooks.js"],"names":[],"mappings":"AACO,iEAMN;AACM;;;EAWN;AACM,gEAAuC;AACvC;;;EA0BN"}
@@ -42,10 +42,12 @@ export function Canvas({ android: _android, ref, ...props }: {
42
42
  [x: string]: any;
43
43
  android: any;
44
44
  ref: any;
45
- }): React.CElement<import("react-native").ViewProps, View>;
46
- export function useCanvasRef(): React.MutableRefObject<null>;
45
+ }): React.FunctionComponentElement<Omit<import("react-native").ViewProps, "ref"> & {
46
+ ref?: React.Ref<import("react-native").ViewInstance> | undefined;
47
+ }>;
48
+ export function useCanvasRef(): React.RefObject<null>;
47
49
  export function useSurface(): {
48
- ref: React.MutableRefObject<null>;
50
+ ref: React.RefObject<null>;
49
51
  surface: null;
50
52
  };
51
53
  export function warnIfNotHardwareAccelerated(): undefined;
@@ -63,6 +65,5 @@ export function installWebGPU(): undefined;
63
65
  export namespace WebGPUModule {
64
66
  function install(): boolean;
65
67
  }
66
- import { View } from "react-native";
67
68
  import React from "react";
68
69
  //# sourceMappingURL=mock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../module/mock.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEO;;;;2DAaN;AACM,6DAA6C;AAC7C;;;EAGL;AACK,0DAAoD;AACpD;;;EAGL;AACK;;QAEe;AACf,uCAEN;AACM,mDAEN;AACM,mDAEN;AACM,2CAAqC;;IAEjC,4BAAW;;qBA5GD,cAAc;kBADjB,OAAO"}
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../module/mock.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEO;;;;;;GAaN;AACM,sDAA6C;AAC7C;;;EAGL;AACK,0DAAoD;AACpD;;;EAGL;AACK;;QAEe;AACf,uCAEN;AACM,mDAEN;AACM,mDAEN;AACM,2CAAqC;;IAEjC,4BAAW;;kBA7GJ,OAAO"}
@@ -1,10 +1,10 @@
1
1
  import type { CanvasRef, NativeCanvas } from "./Canvas";
2
2
  export declare const warnIfNotHardwareAccelerated: (adapter: GPUAdapter) => void;
3
3
  export declare const useSurface: () => {
4
- ref: import("react").RefObject<CanvasRef>;
4
+ ref: import("react").RefObject<CanvasRef | null>;
5
5
  surface: NativeCanvas | null;
6
6
  };
7
- export declare const useCanvasRef: () => import("react").RefObject<CanvasRef>;
7
+ export declare const useCanvasRef: () => import("react").RefObject<CanvasRef | null>;
8
8
  export declare const useDevice: (adapterOptions?: GPURequestAdapterOptions, deviceDescriptor?: GPUDeviceDescriptor) => {
9
9
  adapter: GPUAdapter | null;
10
10
  device: GPUDevice | null;
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,4BAA4B,GAAI,SAAS,UAAU,SAQ/D,CAAC;AAOF,eAAO,MAAM,UAAU;;;CAQtB,CAAC;AAEF,eAAO,MAAM,YAAY,4CAAgC,CAAC;AAE1D,eAAO,MAAM,SAAS,GACpB,iBAAiB,wBAAwB,EACzC,mBAAmB,mBAAmB;;;CAqBvC,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,4BAA4B,GAAI,SAAS,UAAU,SAQ/D,CAAC;AAOF,eAAO,MAAM,UAAU;;;CAQtB,CAAC;AAEF,eAAO,MAAM,YAAY,mDAAgC,CAAC;AAE1D,eAAO,MAAM,SAAS,GACpB,iBAAiB,wBAAwB,EACzC,mBAAmB,mBAAmB;;;CAqBvC,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import type { ReactNode } from "react";
3
- import { View } from "react-native";
4
3
  import type { CanvasProps } from "./Canvas";
5
4
  export * from "./formats";
6
5
  export declare const GPUBufferUsage: GPUBufferUsage;
@@ -9,10 +8,12 @@ export declare const GPUShaderStage: GPUShaderStage;
9
8
  export declare const GPUColorWrite: GPUColorWrite;
10
9
  export declare const GPUMapMode: GPUMapMode;
11
10
  export type { AndroidBackingView, AndroidCanvasProps, AndroidHardwareBufferViewProps, AndroidSurfaceViewProps, AndroidTextureViewProps, CanvasProps, CanvasRef, NativeCanvas, RNCanvasContext, } from "./Canvas";
12
- export declare const Canvas: ({ android: _android, ref, ...props }: CanvasProps) => React.CElement<import("react-native").ViewProps, View>;
13
- export declare const useCanvasRef: () => React.MutableRefObject<null>;
11
+ export declare const Canvas: ({ android: _android, ref, ...props }: CanvasProps) => React.FunctionComponentElement<Omit<import("react-native").ViewProps, "ref"> & {
12
+ ref?: React.Ref<import("react-native").ViewInstance> | undefined;
13
+ }>;
14
+ export declare const useCanvasRef: () => React.RefObject<null>;
14
15
  export declare const useSurface: () => {
15
- ref: React.MutableRefObject<null>;
16
+ ref: React.RefObject<null>;
16
17
  surface: null;
17
18
  };
18
19
  export declare const warnIfNotHardwareAccelerated: () => undefined;
@@ -22,7 +23,7 @@ export declare const useDevice: () => {
22
23
  };
23
24
  export declare const GPUDeviceProvider: ({ children }: {
24
25
  children?: ReactNode;
25
- }) => string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null;
26
+ }) => string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null;
26
27
  export declare const useMainDevice: () => never;
27
28
  export declare const importDevice: (_pointer: bigint) => GPUDevice;
28
29
  export declare const adoptTexture: (_pointer: bigint) => GPUTexture;
@@ -1 +1 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/mock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAiC,MAAM,UAAU,CAAC;AAa3E,cAAc,WAAW,CAAC;AAM1B,eAAO,MAAM,cAAc,EAAE,cAW5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eAO7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAM3B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAGxB,CAAC;AAoBF,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,8BAA8B,EAC9B,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,MAAM,GAAI,sCAAsC,WAAW,2DASvE,CAAC;AAEF,eAAO,MAAM,YAAY,oCAA2B,CAAC;AACrD,eAAO,MAAM,UAAU;;;CAAqD,CAAC;AAC7E,eAAO,MAAM,4BAA4B,iBAAkB,CAAC;AAE5D,eAAO,MAAM,SAAS;;;CAA0C,CAAC;AAEjE,eAAO,MAAM,iBAAiB,GAAI,cAAc;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,sIACtD,CAAC;AAEnB,eAAO,MAAM,aAAa,QAAO,KAEhC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,SAE/C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,UAE/C,CAAC;AAEF,eAAO,MAAM,aAAa,iBAAkB,CAAC;AAE7C,eAAO,MAAM,YAAY;;CAA2B,CAAC"}
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/mock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,WAAW,EAAiC,MAAM,UAAU,CAAC;AAa3E,cAAc,WAAW,CAAC;AAM1B,eAAO,MAAM,cAAc,EAAE,cAW5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eAO7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAM3B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAGxB,CAAC;AAoBF,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,8BAA8B,EAC9B,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,MAAM,GAAI,sCAAsC,WAAW;;EASvE,CAAC;AAEF,eAAO,MAAM,YAAY,6BAA2B,CAAC;AACrD,eAAO,MAAM,UAAU;;;CAAqD,CAAC;AAC7E,eAAO,MAAM,4BAA4B,iBAAkB,CAAC;AAE5D,eAAO,MAAM,SAAS;;;CAA0C,CAAC;AAEjE,eAAO,MAAM,iBAAiB,GAAI,cAAc;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,6UACtD,CAAC;AAEnB,eAAO,MAAM,aAAa,QAAO,KAEhC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,SAE/C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,UAE/C,CAAC;AAEF,eAAO,MAAM,aAAa,iBAAkB,CAAC;AAE7C,eAAO,MAAM,YAAY;;CAA2B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-webgpu",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "React Native WebGPU",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -41,7 +41,7 @@
41
41
  "clang-format-ios": "find apple/ -iname \"*.h\" -o -iname \"*.mm\" -o -iname \"*.cpp\" | xargs clang-format -i",
42
42
  "clang-format-android": "find android/cpp/ -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
43
43
  "clang-format-common": "find cpp/rnwgpu -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
44
- "cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=example --exclude=android/.cxx --exclude=cpp/webgpu --exclude=cpp/dawn --exclude=ios --exclude=android/build --exclude=node_modules --recursive .",
44
+ "cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=android/.cxx --exclude=cpp/dawn --exclude=libs --exclude=android/build --exclude=node_modules --recursive .",
45
45
  "check-dawn": "tsx scripts/check-dawn.ts"
46
46
  },
47
47
  "keywords": [
@@ -68,6 +68,7 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@expo/config-plugins": "^57.0.3",
71
+ "@react-native/jest-preset": "0.88.1",
71
72
  "@semantic-release/commit-analyzer": "^13.0.1",
72
73
  "@semantic-release/exec": "^7.0.3",
73
74
  "@semantic-release/github": "^12.0.9",
@@ -76,13 +77,11 @@
76
77
  "@types/node": "^20.14.7",
77
78
  "@types/pixelmatch": "5.2.4",
78
79
  "@types/pngjs": "^6.0.5",
79
- "@types/react": "^18.2.44",
80
+ "@types/react": "^19.2.0",
80
81
  "@types/seedrandom": "^3.0.8",
81
82
  "@types/ws": "^8.5.10",
82
83
  "@webgpu/types": "0.1.65",
83
- "baseline-browser-mapping": "^2.9.14",
84
84
  "clang-format": "^1.8.0",
85
- "del-cli": "^5.1.0",
86
85
  "eslint": "9.35.0",
87
86
  "eslint-config-react-native-wcandillon": "5.0.1",
88
87
  "eslint-plugin-import": "2.32.0",
@@ -93,13 +92,12 @@
93
92
  "pngjs": "^7.0.0",
94
93
  "prettier": "^3.0.3",
95
94
  "puppeteer": "24.43.1",
96
- "react": "19.2.3",
97
- "react-native": "0.83.10",
95
+ "react": "19.3.0",
96
+ "react-native": "0.88.1",
98
97
  "react-native-builder-bob": "^0.23.2",
99
- "react-native-reanimated": "4.6.0",
98
+ "react-native-reanimated": "4.7.1",
100
99
  "react-native-web": "^0.21.2",
101
- "react-native-worklets": "0.12.2",
102
- "rimraf": "^5.0.7",
100
+ "react-native-worklets": "0.13.1",
103
101
  "seedrandom": "^3.0.5",
104
102
  "semantic-release": "^25.0.9",
105
103
  "semantic-release-yarn": "^3.0.2",
@@ -108,8 +106,7 @@
108
106
  "typescript": "^5.2.2",
109
107
  "webgpu": "0.4.0",
110
108
  "wgpu-matrix": "^3.0.2",
111
- "ws": "^8.18.0",
112
- "yargs": "^17.7.2"
109
+ "ws": "^8.18.0"
113
110
  },
114
111
  "dependencies": {
115
112
  "react-native-webgpu-dawn": "157.1.0"
@@ -47,7 +47,17 @@ Pod::Spec.new do |s|
47
47
  s.license = package["license"]
48
48
  s.authors = package["author"]
49
49
 
50
- s.platforms = { :ios => min_ios_version_supported, :osx => "10.15", :visionos => "1.0" }
50
+ # React Native's CocoaPods autolinking drops any pod whose podspec does not
51
+ # declare the Podfile target's platform (#608), so every platform the Dawn
52
+ # xcframework ships a slice for is listed. react-native-tvos keeps the tvOS
53
+ # floor equal to the iOS one (its min_supported_versions helper). visionOS
54
+ # is not listed: react-native-webgpu-dawn ships no xros slice, so a visionOS
55
+ # target would autolink the pod and then fail to link it.
56
+ s.platforms = {
57
+ :ios => min_ios_version_supported,
58
+ :tvos => min_ios_version_supported,
59
+ :osx => "10.15",
60
+ }
51
61
  s.source = { :git => "https://github.com/wcandillon/react-native-webgpu.git", :tag => "#{s.version}" }
52
62
 
53
63
  # CocoaPods is the supported default. Package.swift (React Native 0.87+
@@ -85,8 +95,14 @@ Pod::Spec.new do |s|
85
95
  s.frameworks = "AVFoundation", "CoreMedia", "CoreVideo", "ImageIO"
86
96
  end
87
97
 
98
+ # Under use_frameworks!, bare includes across folders (e.g. "GPU.h")
99
+ # resolve only through these paths. Keep in sync with internalHeaderDirs
100
+ # in Package.swift.
101
+ header_dirs = %w[apple cpp cpp/jsi cpp/rnwgpu cpp/rnwgpu/api cpp/rnwgpu/api/descriptors cpp/rnwgpu/async]
102
+ header_search_paths = header_dirs.map { |dir| "\"$(PODS_TARGET_SRCROOT)/#{dir}\"" }
103
+
88
104
  s.pod_target_xcconfig = {
89
- 'HEADER_SEARCH_PATHS' => "$(PODS_TARGET_SRCROOT)/cpp \"#{dawn_include}\"",
105
+ 'HEADER_SEARCH_PATHS' => (header_search_paths + ["\"#{dawn_include}\""]).join(' '),
90
106
  # Xcode's all-target headermaps let same-named headers leak across pods
91
107
  # (e.g. @shopify/react-native-skia keeps a jsi/ helper layer with
92
108
  # identical relative header paths). Resolve includes strictly through our