react-native-webgpu 0.21.1 → 0.21.3
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 +1 -0
- package/cpp/jsi/JSIConverter.h +4 -2
- package/cpp/jsi/NativeObject.h +16 -17
- package/cpp/rnwgpu/api/Convertors.h +30 -10
- package/cpp/rnwgpu/api/GPUDevice.cpp +6 -3
- package/cpp/rnwgpu/api/GPUDevice.h +7 -0
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +6 -6
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.d.ts +1 -1
- package/lib/typescript/lib/commonjs/hooks.d.ts +2 -2
- package/lib/typescript/lib/commonjs/hooks.d.ts.map +1 -1
- package/lib/typescript/lib/module/Canvas.d.ts +3 -2
- package/lib/typescript/lib/module/Canvas.d.ts.map +1 -1
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.d.ts +1 -1
- package/lib/typescript/lib/module/hooks.d.ts +2 -2
- package/lib/typescript/lib/module/hooks.d.ts.map +1 -1
- package/lib/typescript/lib/module/mock.d.ts +5 -4
- package/lib/typescript/lib/module/mock.d.ts.map +1 -1
- package/lib/typescript/src/hooks.d.ts +2 -2
- package/lib/typescript/src/hooks.d.ts.map +1 -1
- package/lib/typescript/src/mock.d.ts +6 -5
- package/lib/typescript/src/mock.d.ts.map +1 -1
- package/package.json +9 -8
- package/react-native-webgpu.podspec +7 -1
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",
|
package/cpp/jsi/JSIConverter.h
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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()));
|
package/cpp/jsi/NativeObject.h
CHANGED
|
@@ -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
|
-
|
|
328
|
-
|
|
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
|
-
|
|
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
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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(
|
|
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]]
|
|
156
|
-
|
|
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
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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;
|
|
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::
|
|
39
|
-
|
|
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<
|
|
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.
|
|
4
|
+
ref: _react.RefObject<null>;
|
|
5
5
|
surface: null;
|
|
6
6
|
};
|
|
7
|
-
export function useCanvasRef(): _react.
|
|
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,
|
|
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.
|
|
6
|
-
import
|
|
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
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../module/Canvas.js"],"names":[],"mappings":"AA6IO;;;;;;GA8CN;kBA1LuE,OAAO"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export function warnIfNotHardwareAccelerated(adapter: any): void;
|
|
2
2
|
export function useSurface(): {
|
|
3
|
-
ref: import("react").
|
|
3
|
+
ref: import("react").RefObject<null>;
|
|
4
4
|
surface: null;
|
|
5
5
|
};
|
|
6
|
-
export function useCanvasRef(): import("react").
|
|
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,
|
|
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.
|
|
46
|
-
|
|
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.
|
|
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
|
|
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,
|
|
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.
|
|
13
|
-
|
|
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.
|
|
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;
|
|
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.
|
|
3
|
+
"version": "0.21.3",
|
|
4
4
|
"description": "React Native WebGPU",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"app.plugin.js",
|
|
25
25
|
"plugin/build/**"
|
|
26
26
|
],
|
|
27
|
-
"dawn": "chrome-
|
|
27
|
+
"dawn": "chrome-m158",
|
|
28
28
|
"androidMinSdkVersion": 26,
|
|
29
29
|
"scripts": {
|
|
30
30
|
"test": "NODE_OPTIONS='--experimental-require-module' jest -i",
|
|
@@ -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,7 +77,7 @@
|
|
|
76
77
|
"@types/node": "^20.14.7",
|
|
77
78
|
"@types/pixelmatch": "5.2.4",
|
|
78
79
|
"@types/pngjs": "^6.0.5",
|
|
79
|
-
"@types/react": "^
|
|
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",
|
|
@@ -91,12 +92,12 @@
|
|
|
91
92
|
"pngjs": "^7.0.0",
|
|
92
93
|
"prettier": "^3.0.3",
|
|
93
94
|
"puppeteer": "24.43.1",
|
|
94
|
-
"react": "19.
|
|
95
|
-
"react-native": "0.
|
|
95
|
+
"react": "19.3.0",
|
|
96
|
+
"react-native": "0.88.1",
|
|
96
97
|
"react-native-builder-bob": "^0.23.2",
|
|
97
|
-
"react-native-reanimated": "4.
|
|
98
|
+
"react-native-reanimated": "4.7.1",
|
|
98
99
|
"react-native-web": "^0.21.2",
|
|
99
|
-
"react-native-worklets": "0.
|
|
100
|
+
"react-native-worklets": "0.13.1",
|
|
100
101
|
"seedrandom": "^3.0.5",
|
|
101
102
|
"semantic-release": "^25.0.9",
|
|
102
103
|
"semantic-release-yarn": "^3.0.2",
|
|
@@ -108,7 +109,7 @@
|
|
|
108
109
|
"ws": "^8.18.0"
|
|
109
110
|
},
|
|
110
111
|
"dependencies": {
|
|
111
|
-
"react-native-webgpu-dawn": "
|
|
112
|
+
"react-native-webgpu-dawn": "158.0.0"
|
|
112
113
|
},
|
|
113
114
|
"peerDependencies": {
|
|
114
115
|
"react": "*",
|
|
@@ -95,8 +95,14 @@ Pod::Spec.new do |s|
|
|
|
95
95
|
s.frameworks = "AVFoundation", "CoreMedia", "CoreVideo", "ImageIO"
|
|
96
96
|
end
|
|
97
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
|
+
|
|
98
104
|
s.pod_target_xcconfig = {
|
|
99
|
-
'HEADER_SEARCH_PATHS' =>
|
|
105
|
+
'HEADER_SEARCH_PATHS' => (header_search_paths + ["\"#{dawn_include}\""]).join(' '),
|
|
100
106
|
# Xcode's all-target headermaps let same-named headers leak across pods
|
|
101
107
|
# (e.g. @shopify/react-native-skia keeps a jsi/ helper layer with
|
|
102
108
|
# identical relative header paths). Resolve includes strictly through our
|