react-native-wgpu 0.5.14 → 0.5.16

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/README.md CHANGED
@@ -1,30 +1,9 @@
1
1
  # react-native-wgpu
2
2
 
3
- This package is a thin shim that re-exports [`react-native-webgpu`](https://www.npmjs.com/package/react-native-webgpu) under its previous npm name.
3
+ This package has been renamed to [`react-native-webgpu`](https://www.npmjs.com/package/react-native-webgpu).
4
4
 
5
- It exists so that projects that depended on the older `react-native-wgpu` name keep working without an immediate code change. New projects should depend on `react-native-webgpu` directly.
6
-
7
- ## Installation
5
+ Please use `react-native-webgpu` instead.
8
6
 
9
7
  ```
10
- npm install react-native-wgpu
8
+ npm install react-native-webgpu
11
9
  ```
12
-
13
- This installs `react-native-webgpu` as a dependency. All imports are forwarded:
14
-
15
- ```ts
16
- import { Canvas } from "react-native-wgpu";
17
- // equivalent to
18
- import { Canvas } from "react-native-webgpu";
19
- ```
20
-
21
- ## Migrating
22
-
23
- Replace the dependency in your `package.json`:
24
-
25
- ```diff
26
- - "react-native-wgpu": "^0.5.11"
27
- + "react-native-webgpu": "^0.5.11"
28
- ```
29
-
30
- and update your imports from `"react-native-wgpu"` to `"react-native-webgpu"`.
@@ -7,8 +7,22 @@ export interface NativeCanvas {
7
7
  height: number;
8
8
  clientWidth: number;
9
9
  clientHeight: number;
10
+ addEventListener(type: string, listener: EventListener): void;
11
+ removeEventListener(type: string, listener: EventListener): void;
12
+ dispatchEvent(event: Event): void;
13
+ setPointerCapture(pointerId: number): void;
14
+ releasePointerCapture(pointerId: number): void;
10
15
  }
11
16
  export type RNCanvasContext = GPUCanvasContext & {
17
+ /**
18
+ * Present the current frame.
19
+ *
20
+ * Call this after `queue.submit()` on every runtime: the main JS runtime, the
21
+ * Reanimated UI runtime, and dedicated worklet runtimes (e.g.
22
+ * `createWorkletRuntime` / `runOnRuntime`, or a Vision Camera frame
23
+ * processor). It runs synchronously on the calling thread, so the frame is
24
+ * presented from whichever thread did the rendering.
25
+ */
12
26
  present: () => void;
13
27
  };
14
28
  export interface CanvasRef {
@@ -1 +1 @@
1
- {"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../../../webgpu/src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgD,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9C,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAAC;IAC1D,gBAAgB,EAAE,MAAM,YAAY,CAAC;CACtC;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,MAAM,GAAI,gCAAgC,WAAW,sBAuCjE,CAAC"}
1
+ {"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../../../webgpu/src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgD,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9C,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IAGrB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9D,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IACjE,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAClC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG;IAC/C;;;;;;;;OAQG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAAC;IAC1D,gBAAgB,EAAE,MAAM,YAAY,CAAC;CACtC;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,MAAM,GAAI,gCAAgC,WAAW,sBAuCjE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import type { ReactNode } from "react";
3
+ interface DeviceContextValue {
4
+ device: GPUDevice | null;
5
+ adapter: GPUAdapter | null;
6
+ }
7
+ interface DeviceProviderProps {
8
+ children?: ReactNode | ReactNode[];
9
+ adapterOptions?: GPURequestAdapterOptions;
10
+ deviceDescriptor?: GPUDeviceDescriptor;
11
+ }
12
+ export declare const GPUDeviceProvider: ({ children, adapterOptions, deviceDescriptor, }: DeviceProviderProps) => React.JSX.Element | null;
13
+ export declare const useMainDevice: () => DeviceContextValue;
14
+ export {};
15
+ //# sourceMappingURL=GPUDeviceProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GPUDeviceProvider.d.ts","sourceRoot":"","sources":["../../../../../webgpu/src/GPUDeviceProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,kBAAkB;IAC1B,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAC5B;AAID,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IACnC,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;CACxC;AAED,eAAO,MAAM,iBAAiB,GAAI,iDAI/B,mBAAmB,6BAQrB,CAAC;AAEF,eAAO,MAAM,aAAa,0BAMzB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const GPUBufferUsage: GPUBufferUsage;
2
+ export declare const GPUTextureUsage: GPUTextureUsage;
3
+ export declare const GPUShaderStage: GPUShaderStage;
4
+ export declare const GPUColorWrite: GPUColorWrite;
5
+ export declare const GPUMapMode: GPUMapMode;
6
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../webgpu/src/constants.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAQ,cAAc,gBAAe,CAAC;AAE7C,eAAO,MAAQ,eAAe,iBAAe,CAAC;AAE9C,eAAO,MAAQ,cAAc,gBAAe,CAAC;AAE7C,eAAO,MAAQ,aAAa,eAAe,CAAC;AAE5C,eAAO,MAAQ,UAAU,YAAe,CAAC"}
@@ -1,27 +1,12 @@
1
- import React from "react";
2
- import type { ReactNode } from "react";
3
1
  import type { CanvasRef, NativeCanvas } from "./Canvas";
4
2
  export declare const warnIfNotHardwareAccelerated: (adapter: GPUAdapter) => void;
5
- interface DeviceContext {
6
- device: GPUDevice | null;
7
- adapter: GPUAdapter | null;
8
- }
9
- declare const DeviceContext: React.Context<DeviceContext | null>;
10
- interface DeviceProviderProps {
11
- children?: ReactNode | ReactNode[];
12
- adapterOptions?: GPURequestAdapterOptions;
13
- deviceDescriptor?: GPUDeviceDescriptor;
14
- }
15
- export declare const GPUDeviceProvider: ({ children, adapterOptions, deviceDescriptor, }: DeviceProviderProps) => React.JSX.Element | null;
16
3
  export declare const useSurface: () => {
17
- ref: React.RefObject<CanvasRef>;
4
+ ref: import("react").RefObject<CanvasRef>;
18
5
  surface: NativeCanvas | null;
19
6
  };
20
- export declare const useMainDevice: () => DeviceContext;
21
- export declare const useCanvasRef: () => React.RefObject<CanvasRef>;
7
+ export declare const useCanvasRef: () => import("react").RefObject<CanvasRef>;
22
8
  export declare const useDevice: (adapterOptions?: GPURequestAdapterOptions, deviceDescriptor?: GPUDeviceDescriptor) => {
23
9
  adapter: GPUAdapter | null;
24
10
  device: GPUDevice | null;
25
11
  };
26
- export {};
27
12
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../../webgpu/src/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,4BAA4B,GAAI,SAAS,UAAU,SAQ/D,CAAC;AAEF,UAAU,aAAa;IACrB,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAC5B;AAED,QAAA,MAAM,aAAa,qCAA4C,CAAC;AAEhE,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IACnC,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;CACxC;AAED,eAAO,MAAM,iBAAiB,GAAI,iDAI/B,mBAAmB,6BAQrB,CAAC;AAEF,eAAO,MAAM,UAAU;;;CAQtB,CAAC;AAEF,eAAO,MAAM,aAAa,qBAMzB,CAAC;AAEF,eAAO,MAAM,YAAY,kCAAgC,CAAC;AAE1D,eAAO,MAAM,SAAS,GACpB,iBAAiB,wBAAwB,EACzC,mBAAmB,mBAAmB;;;CAqBvC,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../../webgpu/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,6 +1,8 @@
1
- import type { GPUDawnTogglesDescriptor, GPUSharedTextureMemory, GPUSharedTextureMemoryDescriptor, NativeCanvas, RNCanvasContext, VideoPlayer, NativeVideoFrame, NativeVideoPixelFormat } from "./types";
1
+ import type { GPUSharedFence, GPUSharedFenceDescriptor, GPUDawnTogglesDescriptor, GPUSharedTextureMemory, GPUSharedTextureMemoryDescriptor, NativeCanvas, RNCanvasContext, VideoPlayer, NativeVideoFrame, NativeVideoPixelFormat } from "./types";
2
2
  export * from "./main";
3
- export type { NativeVideoFrame, VideoPlayer, NativeVideoPixelFormat, CreateVideoPlayerOptions, GPUSharedTextureMemory, GPUSharedTextureMemoryDescriptor, GPUDawnTogglesDescriptor, } from "./types";
3
+ export * from "./constants";
4
+ export * from "./install";
5
+ export type { NativeVideoFrame, VideoPlayer, GPUSharedFence, GPUSharedFenceDescriptor, GPUSharedFenceExportInfo, GPUSharedFenceState, GPUSharedFenceType, GPUSharedTextureMemory, GPUSharedTextureMemoryDescriptor, GPUSharedTextureMemoryEndAccessState, NativeVideoPixelFormat, CreateVideoPlayerOptions, GPUDawnTogglesDescriptor, } from "./types";
4
6
  declare global {
5
7
  interface Navigator {
6
8
  gpu: GPU;
@@ -21,6 +23,7 @@ declare global {
21
23
  };
22
24
  interface GPUDevice {
23
25
  importSharedTextureMemory(descriptor: GPUSharedTextureMemoryDescriptor): GPUSharedTextureMemory;
26
+ importSharedFence(descriptor: GPUSharedFenceDescriptor): GPUSharedFence;
24
27
  }
25
28
  interface GPUDeviceDescriptor {
26
29
  dawnToggles?: GPUDawnTogglesDescriptor;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../webgpu/src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,gCAAgC,EAChC,YAAY,EACZ,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAEjB,cAAc,QAAQ,CAAC;AACvB,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,SAAS;QACjB,GAAG,EAAE,GAAG,CAAC;KACV;IAED,IAAI,SAAS,EAAE,SAAS,CAAC;IAEzB,IAAI,QAAQ,EAAE;QACZ,GAAG,EAAE,GAAG,CAAC;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,YAAY,CAAC;QACt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;QACjB,yBAAyB,CACvB,UAAU,EAAE,gCAAgC,GAC3C,sBAAsB,CAAC;QAC1B,iBAAiB,CAAC,UAAU,EAAE,wBAAwB,GAAG,cAAc,CAAC;KACzE;IAID,UAAU,mBAAmB;QAC3B,WAAW,CAAC,EAAE,wBAAwB,CAAC;KACxC;IAMD,UAAU,4BAA4B;QACpC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC;QAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB;IASD,UAAU,kBAAkB;QAC1B,OAAO,IAAI,IAAI,CAAC;KACjB;IAGD,SAAS,iBAAiB,CACxB,KAAK,EAAE,WAAW,GAAG,eAAe,GACnC,OAAO,CAAC,WAAW,CAAC,CAAC;CACzB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Install WebGPU on the runtime that calls it.
3
+ *
4
+ * The native module installs the WebGPU flag constants (`GPUBufferUsage`,
5
+ * `GPUTextureUsage`, `GPUShaderStage`, `GPUColorWrite`, `GPUMapMode`) as globals
6
+ * on the main JS runtime, but worklet runtimes (Reanimated UI, dedicated worklet
7
+ * runtimes, Vision Camera frame processors) start without them, so referencing
8
+ * the bare global inside a worklet yields `undefined`.
9
+ *
10
+ * Call `installWebGPU()` once at the top of a worklet to make those globals
11
+ * available there, instead of importing each constant by hand:
12
+ *
13
+ * ```tsx
14
+ * import { installWebGPU } from "react-native-webgpu";
15
+ *
16
+ * const work = (device: GPUDevice) => {
17
+ * "worklet";
18
+ * installWebGPU();
19
+ * device.createBuffer({
20
+ * usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ,
21
+ * });
22
+ * };
23
+ * ```
24
+ *
25
+ * The constants are captured into the worklet by closure (the same way a shader
26
+ * string is), so they work on every runtime. Calling it on a runtime that
27
+ * already has the globals (e.g. the main JS runtime) is a safe no-op.
28
+ *
29
+ * This is the explicit entry point for runtime setup; for now it only installs
30
+ * the flag constants, but it is the place where other per-runtime WebGPU setup
31
+ * (e.g. `navigator.gpu`) can be wired in later.
32
+ */
33
+ export declare const installWebGPU: () => void;
34
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../../webgpu/src/install.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,aAAa,YAQzB,CAAC"}
@@ -2,5 +2,6 @@ export * from "../Canvas";
2
2
  export * from "../Offscreen";
3
3
  export * from "../WebGPUViewNativeComponent";
4
4
  export * from "../hooks";
5
+ export * from "../GPUDeviceProvider";
5
6
  export { default as WebGPUModule } from "../NativeWebGPUModule";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../webgpu/src/main/index.tsx"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../webgpu/src/main/index.tsx"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AAErC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
@@ -5,8 +5,22 @@ export interface NativeCanvas {
5
5
  height: number;
6
6
  clientWidth: number;
7
7
  clientHeight: number;
8
+ addEventListener(type: string, listener: EventListener): void;
9
+ removeEventListener(type: string, listener: EventListener): void;
10
+ dispatchEvent(event: Event): void;
11
+ setPointerCapture(pointerId: number): void;
12
+ releasePointerCapture(pointerId: number): void;
8
13
  }
9
14
  export type RNCanvasContext = GPUCanvasContext & {
15
+ /**
16
+ * Present the current frame.
17
+ *
18
+ * Call this after `queue.submit()` on every runtime: the main JS runtime, the
19
+ * Reanimated UI runtime, and dedicated worklet runtimes (e.g.
20
+ * `createWorkletRuntime` / `runOnRuntime`, or a Vision Camera frame
21
+ * processor). It runs synchronously on the calling thread, so the frame is
22
+ * presented from whichever thread did the rendering.
23
+ */
10
24
  present: () => void;
11
25
  };
12
26
  export interface CanvasRef {
@@ -35,6 +49,29 @@ export interface GPUSharedTextureMemoryDescriptor {
35
49
  handle: bigint;
36
50
  label?: string;
37
51
  }
52
+ export type GPUSharedFenceType = "mtl-shared-event" | "sync-fd" | "vk-semaphore-opaque-fd";
53
+ export interface GPUSharedFenceDescriptor {
54
+ type: GPUSharedFenceType;
55
+ handle: bigint;
56
+ label?: string;
57
+ }
58
+ export interface GPUSharedFenceExportInfo {
59
+ type: GPUSharedFenceType;
60
+ handle: bigint;
61
+ }
62
+ export interface GPUSharedFence {
63
+ readonly __brand: "GPUSharedFence";
64
+ label: string;
65
+ export(): GPUSharedFenceExportInfo;
66
+ }
67
+ export interface GPUSharedFenceState {
68
+ fence: GPUSharedFence;
69
+ signaledValue: bigint;
70
+ }
71
+ export interface GPUSharedTextureMemoryEndAccessState {
72
+ initialized: boolean;
73
+ fences: GPUSharedFenceState[];
74
+ }
38
75
  export interface GPUDawnTogglesDescriptor {
39
76
  enabledToggles?: string[];
40
77
  disabledToggles?: string[];
@@ -43,8 +80,8 @@ export interface GPUSharedTextureMemory {
43
80
  readonly __brand: "GPUSharedTextureMemory";
44
81
  label: string;
45
82
  createTexture(descriptor?: GPUTextureDescriptor): GPUTexture;
46
- beginAccess(texture: GPUTexture, initialized: boolean): boolean;
47
- endAccess(texture: GPUTexture): boolean;
83
+ beginAccess(texture: GPUTexture, initialized: boolean, fences?: GPUSharedFenceState[]): void;
84
+ endAccess(texture: GPUTexture): GPUSharedTextureMemoryEndAccessState;
48
85
  }
49
86
  export {};
50
87
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../webgpu/src/types.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAAC;IAC1D,gBAAgB,EAAE,MAAM,YAAY,CAAC;CACtC;AAKD,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,CAAC;AAkBtD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAC7C,OAAO,IAAI,IAAI,CAAC;CACjB;AAKD,MAAM,WAAW,WAAW;IAC1B,eAAe,IAAI,gBAAgB,GAAG,IAAI,CAAC;IAC3C,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IAKvC,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACtC;AAED,MAAM,WAAW,gCAAgC;IAM/C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,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AAE,cAAc,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAID,MAAM,WAAW,oCAAoC;IACnD,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAQD,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAMD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,UAAU,CAAC,EAAE,oBAAoB,GAAG,UAAU,CAAC;IAM7D,WAAW,CACT,OAAO,EAAE,UAAU,EACnB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE,mBAAmB,EAAE,GAC7B,IAAI,CAAC;IAGR,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,oCAAoC,CAAC;CACtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wgpu",
3
- "version": "0.5.14",
3
+ "version": "0.5.16",
4
4
  "description": "Shim that re-exports react-native-webgpu under its previous package name",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -34,10 +34,12 @@
34
34
  },
35
35
  "homepage": "https://github.com/wcandillon/react-native-webgpu#readme",
36
36
  "publishConfig": {
37
- "registry": "https://registry.npmjs.org/"
37
+ "registry": "https://registry.npmjs.org/",
38
+ "access": "public",
39
+ "provenance": true
38
40
  },
39
41
  "dependencies": {
40
- "react-native-webgpu": "*"
42
+ "react-native-webgpu": "0.5.16"
41
43
  },
42
44
  "devDependencies": {
43
45
  "@types/node": "^20.14.7",