react-native-webgpu 0.21.4 → 0.23.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.
- package/README.md +15 -2
- package/android/CMakeLists.txt +10 -8
- package/android/build.gradle +111 -20
- package/android/cpp/AndroidAnimationFrameSource.h +136 -0
- package/android/cpp/AndroidPlatformContext.h +55 -0
- package/android/cpp/cpp-adapter.cpp +148 -2
- package/android/src/main/java/com/webgpu/WebGPUModule.java +21 -4
- package/android/src/main/java/com/webgpu/WebGPUNativeBufferView.java +370 -0
- package/android/src/main/java/com/webgpu/WebGPUNativeBufferViewManager.java +56 -0
- package/android/src/main/java/com/webgpu/WebGPUTextureView.java +21 -0
- package/android/src/main/java/com/webgpu/WebGPUVideoPlayer.java +1 -1
- package/android/src/main/java/com/webgpu/WebGPUView.java +19 -3
- package/android/src/main/java/com/webgpu/WebGPUViewManager.java +10 -0
- package/android/src/main/java/com/webgpu/WebGPUViewPackage.java +2 -2
- package/android/src/newarch/com/webgpu/WebGPUNativeBufferViewManagerSpec.java +24 -0
- package/apple/AppleAnimationFrameSource.mm +208 -0
- package/apple/ApplePlatformContext.h +6 -0
- package/apple/ApplePlatformContext.mm +73 -0
- package/apple/MetalLayerColorSpace.h +17 -0
- package/apple/MetalLayerColorSpace.mm +36 -57
- package/apple/MetalView.h +4 -0
- package/apple/MetalView.mm +14 -0
- package/apple/NativeBufferFenceWait.mm +88 -0
- package/apple/RNWGUIKit.h +4 -1
- package/apple/WebGPUModule.mm +26 -1
- package/apple/WebGPUNativeBufferView.h +15 -0
- package/apple/WebGPUNativeBufferView.mm +200 -0
- package/apple/WebGPUView.h +2 -1
- package/apple/WebGPUView.mm +6 -0
- package/binaries.json +156 -0
- package/cpp/jsi/NativeObject.h +12 -5
- package/cpp/rnwgpu/AnimationFrames.cpp +576 -0
- package/cpp/rnwgpu/AnimationFrames.h +233 -0
- package/cpp/rnwgpu/CanvasColorSpace.h +16 -0
- package/cpp/rnwgpu/NativeBufferViewRegistry.cpp +396 -0
- package/cpp/rnwgpu/NativeBufferViewRegistry.h +163 -0
- package/cpp/rnwgpu/PlatformContext.h +20 -0
- package/cpp/rnwgpu/RNWebGPUManager.cpp +17 -4
- package/cpp/rnwgpu/SurfaceRegistry.h +26 -30
- package/cpp/rnwgpu/api/GPUAdapter.cpp +1 -1
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +41 -3
- package/cpp/rnwgpu/api/GPUCanvasContext.h +7 -3
- package/cpp/rnwgpu/api/GPUDevice.cpp +16 -131
- package/cpp/rnwgpu/api/GPUDevice.h +0 -18
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +35 -3
- package/cpp/rnwgpu/api/GPUExternalTexture.h +4 -4
- package/cpp/rnwgpu/api/GPUQueue.cpp +1 -1
- package/cpp/rnwgpu/api/GPUQueue.h +1 -1
- package/cpp/rnwgpu/api/GPUSharedFence.h +1 -0
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +11 -5
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +21 -2
- package/cpp/rnwgpu/api/GPUTexture.h +18 -0
- package/cpp/rnwgpu/api/NativeFrameFeatures.h +1 -1
- package/cpp/rnwgpu/api/NativeFrameImport.cpp +20 -17
- package/cpp/rnwgpu/api/NativeFrameImport.h +31 -20
- package/cpp/rnwgpu/api/RNWebGPU.h +201 -3
- package/cpp/rnwgpu/api/VideoFrame.h +5 -4
- package/cpp/rnwgpu/api/VideoFrameBlit.h +2 -2
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +21 -14
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +17 -9
- package/cpp/rnwgpu/async/RuntimeContext.cpp +21 -4
- package/cpp/rnwgpu/async/RuntimeContext.h +8 -0
- package/lib/commonjs/Canvas.js +33 -1
- package/lib/commonjs/Canvas.js.map +1 -1
- package/lib/commonjs/NativeBufferView.js +131 -0
- package/lib/commonjs/NativeBufferView.js.map +1 -0
- package/lib/commonjs/NativeBufferViewNativeComponent.js +10 -0
- package/lib/commonjs/NativeBufferViewNativeComponent.js.map +1 -0
- package/lib/commonjs/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/commonjs/WebGPUViewNativeComponent.web.js +2 -0
- package/lib/commonjs/WebGPUViewNativeComponent.web.js.map +1 -1
- package/lib/commonjs/animationFrame.js +91 -0
- package/lib/commonjs/animationFrame.js.map +1 -0
- package/lib/commonjs/index.js +16 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/main/index.js +12 -0
- package/lib/commonjs/main/index.js.map +1 -1
- package/lib/commonjs/mock.js +30 -1
- package/lib/commonjs/mock.js.map +1 -1
- package/lib/commonjs/video.js +14 -4
- package/lib/commonjs/video.js.map +1 -1
- package/lib/module/Canvas.js +33 -1
- package/lib/module/Canvas.js.map +1 -1
- package/lib/module/NativeBufferView.js +122 -0
- package/lib/module/NativeBufferView.js.map +1 -0
- package/lib/module/NativeBufferViewNativeComponent.js +4 -0
- package/lib/module/NativeBufferViewNativeComponent.js.map +1 -0
- package/lib/module/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/module/WebGPUViewNativeComponent.web.js +2 -0
- package/lib/module/WebGPUViewNativeComponent.web.js.map +1 -1
- package/lib/module/animationFrame.js +83 -0
- package/lib/module/animationFrame.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/main/index.js +1 -0
- package/lib/module/main/index.js.map +1 -1
- package/lib/module/mock.js +21 -0
- package/lib/module/mock.js.map +1 -1
- package/lib/module/video.js +11 -2
- package/lib/module/video.js.map +1 -1
- package/lib/typescript/lib/commonjs/Canvas.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Canvas.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/NativeBufferView.d.ts +48 -0
- package/lib/typescript/lib/commonjs/NativeBufferView.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/NativeBufferViewNativeComponent.d.ts +5 -0
- package/lib/typescript/lib/commonjs/NativeBufferViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.web.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/animationFrame.d.ts +54 -0
- package/lib/typescript/lib/commonjs/animationFrame.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/mock.d.ts +12 -0
- package/lib/typescript/lib/commonjs/mock.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/video.d.ts +3 -2
- package/lib/typescript/lib/commonjs/video.d.ts.map +1 -1
- package/lib/typescript/lib/module/Canvas.d.ts +3 -1
- package/lib/typescript/lib/module/Canvas.d.ts.map +1 -1
- package/lib/typescript/lib/module/NativeBufferView.d.ts +14 -0
- package/lib/typescript/lib/module/NativeBufferView.d.ts.map +1 -0
- package/lib/typescript/lib/module/NativeBufferViewNativeComponent.d.ts +3 -0
- package/lib/typescript/lib/module/NativeBufferViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.web.d.ts.map +1 -1
- package/lib/typescript/lib/module/animationFrame.d.ts +3 -0
- package/lib/typescript/lib/module/animationFrame.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +1 -0
- package/lib/typescript/lib/module/main/index.d.ts +1 -0
- package/lib/typescript/lib/module/mock.d.ts +14 -0
- package/lib/typescript/lib/module/mock.d.ts.map +1 -1
- package/lib/typescript/lib/module/video.d.ts +3 -2
- package/lib/typescript/lib/module/video.d.ts.map +1 -1
- package/lib/typescript/src/Canvas.d.ts +17 -1
- package/lib/typescript/src/Canvas.d.ts.map +1 -1
- package/lib/typescript/src/NativeBufferView.d.ts +99 -0
- package/lib/typescript/src/NativeBufferView.d.ts.map +1 -0
- package/lib/typescript/src/NativeBufferViewNativeComponent.d.ts +13 -0
- package/lib/typescript/src/NativeBufferViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +2 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts +2 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts.map +1 -1
- package/lib/typescript/src/animationFrame.d.ts +59 -0
- package/lib/typescript/src/animationFrame.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +18 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/main/index.d.ts +1 -0
- package/lib/typescript/src/main/index.d.ts.map +1 -1
- package/lib/typescript/src/mock.d.ts +11 -0
- package/lib/typescript/src/mock.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +32 -31
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/video.d.ts +12 -4
- package/lib/typescript/src/video.d.ts.map +1 -1
- package/package.json +8 -2
- package/react-native-webgpu.podspec +1 -1
- package/src/Canvas.tsx +67 -1
- package/src/NativeBufferView.tsx +199 -0
- package/src/NativeBufferViewNativeComponent.ts +20 -0
- package/src/WebGPUViewNativeComponent.ts +4 -0
- package/src/WebGPUViewNativeComponent.web.ts +6 -0
- package/src/animationFrame.ts +82 -0
- package/src/index.tsx +45 -39
- package/src/main/index.tsx +1 -0
- package/src/mock.ts +35 -0
- package/src/types.ts +61 -87
- package/src/video.ts +20 -7
- package/cpp/rnwgpu/api/GPUNativeBufferExternalTexture.h +0 -60
- package/cpp/rnwgpu/api/GPUNativeBufferTexture.h +0 -52
- package/cpp/rnwgpu/api/GPUNativeBufferWrapper.cpp +0 -144
- package/cpp/rnwgpu/api/GPUNativeBufferWrapper.h +0 -143
- package/cpp/rnwgpu/api/descriptors/GPUNativeBufferTextureDescriptor.h +0 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGPUViewNativeComponent.web.d.ts","sourceRoot":"","sources":["../../../module/WebGPUViewNativeComponent.web.js"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.web.d.ts","sourceRoot":"","sources":["../../../module/WebGPUViewNativeComponent.web.js"],"names":[],"mappings":"AAIA,gHAyBC;kBA7BiB,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animationFrame.d.ts","sourceRoot":"","sources":["../../../module/animationFrame.js"],"names":[],"mappings":"AA0DO,6DAON;AAQM,wDAQN"}
|
|
@@ -45,6 +45,18 @@ export function Canvas({ android: _android, ref, ...props }: {
|
|
|
45
45
|
}): React.FunctionComponentElement<Omit<import("react-native").ViewProps, "ref"> & {
|
|
46
46
|
ref?: React.Ref<import("react-native").ViewInstance> | undefined;
|
|
47
47
|
}>;
|
|
48
|
+
export function NativeBufferView({ resizeMode: _resizeMode, onPixelSizeChange: _onPixelSizeChange, ref, ...props }: {
|
|
49
|
+
[x: string]: any;
|
|
50
|
+
resizeMode: any;
|
|
51
|
+
onPixelSizeChange: any;
|
|
52
|
+
ref: any;
|
|
53
|
+
}): React.FunctionComponentElement<Omit<import("react-native").ViewProps, "ref"> & {
|
|
54
|
+
ref?: React.Ref<import("react-native").ViewInstance> | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
export function useNativeBufferSize(_debounceMs: any): {
|
|
57
|
+
size: null;
|
|
58
|
+
onPixelSizeChange: () => undefined;
|
|
59
|
+
};
|
|
48
60
|
export function useCanvasRef(): React.RefObject<null>;
|
|
49
61
|
export function useSurface(): {
|
|
50
62
|
ref: React.RefObject<null>;
|
|
@@ -62,6 +74,8 @@ export function useMainDevice(): never;
|
|
|
62
74
|
export function importDevice(_pointer: any): never;
|
|
63
75
|
export function adoptTexture(_pointer: any): never;
|
|
64
76
|
export function installWebGPU(): undefined;
|
|
77
|
+
export function requestAnimationFrame(callback: any): number;
|
|
78
|
+
export function cancelAnimationFrame(handle: any): void;
|
|
65
79
|
export namespace WebGPUModule {
|
|
66
80
|
function install(): boolean;
|
|
67
81
|
}
|
|
@@ -1 +1 @@
|
|
|
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;;
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../module/mock.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEO;;;;;;GAaN;AAEM;;;;;;;GAaN;AACM;;;EAGL;AACK,sDAA6C;AAC7C;;;EAGL;AACK,0DAAoD;AACpD;;;EAGL;AACK;;QAEe;AACf,uCAEN;AACM,mDAEN;AACM,mDAEN;AACM,2CAAqC;AACrC,6DAAoF;AACpF,wDAA8E;;IAE1E,4BAAW;;kBAlIJ,OAAO"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export function createVideoPlayer(source: any, options: any): import("../../src").VideoPlayer;
|
|
2
|
-
export function
|
|
3
|
-
export function createTestVideoFrame(width: any, height: any): import("../../src").
|
|
2
|
+
export function createNativeBufferFromPointer(pointer: any): import("../../src").NativeBuffer;
|
|
3
|
+
export function createTestVideoFrame(width: any, height: any): import("../../src").NativeBuffer;
|
|
4
|
+
export function createNativeBuffer(width: any, height: any, options: any): import("../../src").NativeBuffer;
|
|
4
5
|
//# sourceMappingURL=video.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../module/video.js"],"names":[],"mappings":"AAgCO,8FAA0H;AAQ1H,
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../module/video.js"],"names":[],"mappings":"AAgCO,8FAA0H;AAQ1H,8FAA+H;AAO/H,gGAAkH;AASlH,4GAA8H"}
|
|
@@ -73,7 +73,23 @@ export interface CanvasProps extends ViewProps {
|
|
|
73
73
|
* options, see {@link AndroidCanvasProps}. Ignored on iOS and web.
|
|
74
74
|
*/
|
|
75
75
|
android?: AndroidCanvasProps;
|
|
76
|
+
/**
|
|
77
|
+
* The primaries the canvas's values are in, as `colorSpace` in
|
|
78
|
+
* `context.configure()`: `"srgb"` (the default) or `"display-p3"`. On iOS
|
|
79
|
+
* and macOS the layer is tagged with it when the canvas mounts, on the main
|
|
80
|
+
* thread: pass the same value to `configure()` (a mismatch is reported in
|
|
81
|
+
* development). A change on a mounted canvas is ignored, with a warning in
|
|
82
|
+
* development; remount the canvas (with a `key`) to change it. Android
|
|
83
|
+
* ignores it; on the web, `configure()` applies it.
|
|
84
|
+
*/
|
|
85
|
+
colorSpace?: PredefinedColorSpace;
|
|
86
|
+
/**
|
|
87
|
+
* What happens to values above 1.0 on an `rgba16float` canvas, as
|
|
88
|
+
* `toneMapping` in `context.configure()`. Read when the canvas mounts, like
|
|
89
|
+
* {@link CanvasProps.colorSpace}.
|
|
90
|
+
*/
|
|
91
|
+
toneMapping?: GPUCanvasToneMapping;
|
|
76
92
|
ref?: React.Ref<CanvasRef>;
|
|
77
93
|
}
|
|
78
|
-
export declare const Canvas: ({ android, ref, ...props }: CanvasProps) => React.JSX.Element;
|
|
94
|
+
export declare const Canvas: ({ android, colorSpace, toneMapping, ref, ...props }: CanvasProps) => React.JSX.Element;
|
|
79
95
|
//# sourceMappingURL=Canvas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,SAAS,CAAC;AAG1D,YAAY,EAAE,SAA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M,kBAAkB,GAC5B,aAAa,GAAG,aAAa,GAAG,oBAAoB,CAAC;AAEvD,sEAAsE;AACtE,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,yDAAyD;AACzD,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,WAAW,EAAE,aAAa,CAAC;IAC3B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,gEAAgE;AAChE,MAAM,WAAW,8BAA8B;IAC7C;;;;;OAKG;IACH,WAAW,EAAE,oBAAoB,CAAC;CACnC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC1B,uBAAuB,GACvB,uBAAuB,GACvB,8BAA8B,CAAC;AAEnC,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C;;;OAGG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;CAC5B;AA4KD,eAAO,MAAM,MAAM,GAAI,qDAMpB,WAAW,sBAqDb,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
|
+
import type { GPUSharedFenceState, NativeBuffer } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* How a {@link NativeBufferView} fits a buffer whose size differs from its
|
|
6
|
+
* own (in physical pixels), for instance while the producer catches up with
|
|
7
|
+
* a resize. A buffer of exactly the view's size is shown 1:1 in every mode.
|
|
8
|
+
*
|
|
9
|
+
* - `stretch` (the default): scaled to the bounds, ignoring the aspect ratio.
|
|
10
|
+
* - `contain`: scaled to fit inside the bounds, keeping the aspect ratio.
|
|
11
|
+
* - `cover`: scaled to fill the bounds, keeping the aspect ratio; the excess
|
|
12
|
+
* is cropped.
|
|
13
|
+
* - `topLeft`: not scaled; anchored at the top left corner and cropped.
|
|
14
|
+
*/
|
|
15
|
+
export type NativeBufferResizeMode = "stretch" | "contain" | "cover" | "topLeft";
|
|
16
|
+
/** A size in physical pixels. */
|
|
17
|
+
export interface NativeBufferPixelSize {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}
|
|
21
|
+
export interface NativeBufferViewRef {
|
|
22
|
+
/**
|
|
23
|
+
* The id to pass to `RNWebGPU.presentNativeBuffer(viewId, frame, done)`,
|
|
24
|
+
* for instance from a worklet.
|
|
25
|
+
*/
|
|
26
|
+
readonly viewId: number;
|
|
27
|
+
/**
|
|
28
|
+
* Displays `frame` once the GPU work that wrote it is done: `done` is what
|
|
29
|
+
* `GPUSharedTextureMemory.endAccess()` returned for that work (its
|
|
30
|
+
* `fences`), and the view waits for every fence. Without it, the buffer is
|
|
31
|
+
* shown right away. On Android, the view also waits for the frame's own
|
|
32
|
+
* acquire fence, if any. Returns immediately; the view shows the buffer on
|
|
33
|
+
* the next vsync after that.
|
|
34
|
+
*
|
|
35
|
+
* The buffer must not be written again while it is displayed: render the
|
|
36
|
+
* next content into another buffer and present that one. The view keeps
|
|
37
|
+
* its own reference on the buffer, so a buffer from `createNativeBuffer()`
|
|
38
|
+
* can be released right after this call.
|
|
39
|
+
*
|
|
40
|
+
* Frames from a pool (a `VideoPlayer`, a camera, a decoder) are different:
|
|
41
|
+
* the pool reuses the buffer for a later frame once the frame is released,
|
|
42
|
+
* even while the view still shows it, and the view then shows a later or
|
|
43
|
+
* half-written frame. Copy such a frame into a buffer from
|
|
44
|
+
* `createNativeBuffer()` (for instance by drawing it with WebGPU) and
|
|
45
|
+
* present the copy.
|
|
46
|
+
*/
|
|
47
|
+
present(frame: NativeBuffer, done?: {
|
|
48
|
+
fences: GPUSharedFenceState[];
|
|
49
|
+
} | null): void;
|
|
50
|
+
}
|
|
51
|
+
export interface NativeBufferViewProps extends ViewProps {
|
|
52
|
+
/** See {@link NativeBufferResizeMode}. Defaults to `"stretch"`. */
|
|
53
|
+
resizeMode?: NativeBufferResizeMode;
|
|
54
|
+
/**
|
|
55
|
+
* The view's size in physical pixels: the size to render at for a sharp,
|
|
56
|
+
* 1:1 display. Called on mount and on every size change, with the
|
|
57
|
+
* rounding the platform's layout applied. See {@link useNativeBufferSize}
|
|
58
|
+
* to re-render only once a resize settles.
|
|
59
|
+
*/
|
|
60
|
+
onPixelSizeChange?: (size: NativeBufferPixelSize) => void;
|
|
61
|
+
ref?: React.Ref<NativeBufferViewRef>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Displays a native buffer (an `AHardwareBuffer` on Android, an `IOSurface`
|
|
65
|
+
* on Apple platforms) with no swap chain, no canvas context and no GPU device
|
|
66
|
+
* on the display side. Meant for content that is static or updated
|
|
67
|
+
* occasionally; animated content belongs in a `Canvas`.
|
|
68
|
+
*
|
|
69
|
+
* The view never allocates buffers. It reports its size in physical pixels
|
|
70
|
+
* ({@link NativeBufferViewProps.onPixelSizeChange}), and any producer
|
|
71
|
+
* (WebGPU, Skia, a camera, a decoder) renders into a buffer and presents it
|
|
72
|
+
* through the ref (frames from a camera or a decoder are copied first, see
|
|
73
|
+
* {@link NativeBufferViewRef.present}). With WebGPU:
|
|
74
|
+
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* const frame = createNativeBuffer(size.width, size.height);
|
|
77
|
+
* const memory = device.importSharedTextureMemory({ source: frame });
|
|
78
|
+
* const texture = memory.createTexture();
|
|
79
|
+
* memory.beginAccess(texture, false);
|
|
80
|
+
* // ... render into texture and submit ...
|
|
81
|
+
* ref.current.present(frame, memory.endAccess(texture));
|
|
82
|
+
* texture.destroy();
|
|
83
|
+
* memory.destroy();
|
|
84
|
+
* frame.release();
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare const NativeBufferView: ({ resizeMode, onPixelSizeChange, ref, ...props }: NativeBufferViewProps) => React.JSX.Element;
|
|
88
|
+
/**
|
|
89
|
+
* Tracks the pixel size of a {@link NativeBufferView}, settling resizes:
|
|
90
|
+
* the first size is reported right away, later ones once the view has kept
|
|
91
|
+
* the same size for `debounceMs` (during an animated resize the view
|
|
92
|
+
* stretches what it shows meanwhile). Pass `onPixelSizeChange` to the view
|
|
93
|
+
* and render a buffer of `size` whenever it changes.
|
|
94
|
+
*/
|
|
95
|
+
export declare const useNativeBufferSize: (debounceMs?: number) => {
|
|
96
|
+
size: NativeBufferPixelSize | null;
|
|
97
|
+
onPixelSizeChange: (next: NativeBufferPixelSize) => void;
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=NativeBufferView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeBufferView.d.ts","sourceRoot":"","sources":["../../../src/NativeBufferView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,sBAAsB,GAChC,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9C,iCAAiC;AACjC,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CACL,KAAK,EAAE,YAAY,EACnB,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,mBAAmB,EAAE,CAAA;KAAE,GAAG,IAAI,GAC9C,IAAI,CAAC;CACT;AAED,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,mEAAmE;IACnE,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC1D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB,GAAI,kDAK9B,qBAAqB,sBAwCvB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,mBAAgB;;8BAMzC,qBAAqB;CAoC/B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CodegenTypes, ViewProps } from "react-native";
|
|
2
|
+
type PixelSizeChangeEvent = Readonly<{
|
|
3
|
+
width: CodegenTypes.Int32;
|
|
4
|
+
height: CodegenTypes.Int32;
|
|
5
|
+
}>;
|
|
6
|
+
export interface NativeProps extends ViewProps {
|
|
7
|
+
viewId: CodegenTypes.Int32;
|
|
8
|
+
resizeMode?: CodegenTypes.WithDefault<"stretch" | "contain" | "cover" | "topLeft", "stretch">;
|
|
9
|
+
onPixelSizeChange?: CodegenTypes.DirectEventHandler<PixelSizeChangeEvent>;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=NativeBufferViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeBufferViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/NativeBufferViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5D,KAAK,oBAAoB,GAAG,QAAQ,CAAC;IACnC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAC1B,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC;CAC5B,CAAC,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAE5C,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC;IAC3B,UAAU,CAAC,EAAE,YAAY,CAAC,WAAW,CACnC,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC3C,SAAS,CACV,CAAC;IACF,iBAAiB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;CAC3E;;AAGD,wBAA6E"}
|
|
@@ -5,6 +5,8 @@ export interface NativeProps extends ViewProps {
|
|
|
5
5
|
androidOpaque?: CodegenTypes.WithDefault<boolean, false>;
|
|
6
6
|
androidZOrderOnTop?: CodegenTypes.WithDefault<boolean, false>;
|
|
7
7
|
androidZOrderMediaOverlay?: CodegenTypes.WithDefault<boolean, false>;
|
|
8
|
+
appleDisplayP3?: CodegenTypes.WithDefault<boolean, false>;
|
|
9
|
+
appleExtendedDynamicRange?: CodegenTypes.WithDefault<boolean, false>;
|
|
8
10
|
}
|
|
9
11
|
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
10
12
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC;IAE9B,kBAAkB,CAAC,EAAE,YAAY,CAAC,WAAW,CAC3C,aAAa,GAAG,aAAa,GAAG,oBAAoB,EACpD,aAAa,CACd,CAAC;IACF,aAAa,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzD,kBAAkB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9D,yBAAyB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;CACtE;;AAGD,wBAAiE"}
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC;IAE9B,kBAAkB,CAAC,EAAE,YAAY,CAAC,WAAW,CAC3C,aAAa,GAAG,aAAa,GAAG,oBAAoB,EACpD,aAAa,CACd,CAAC;IACF,aAAa,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzD,kBAAkB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9D,yBAAyB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAGrE,cAAc,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1D,yBAAyB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;CACtE;;AAGD,wBAAiE"}
|
|
@@ -6,6 +6,8 @@ export interface NativeProps extends ViewProps {
|
|
|
6
6
|
androidOpaque?: boolean;
|
|
7
7
|
androidZOrderOnTop?: boolean;
|
|
8
8
|
androidZOrderMediaOverlay?: boolean;
|
|
9
|
+
appleDisplayP3?: boolean;
|
|
10
|
+
appleExtendedDynamicRange?: boolean;
|
|
9
11
|
}
|
|
10
12
|
export default function WebGPUViewNativeComponent(props: NativeProps): React.JSX.Element;
|
|
11
13
|
//# sourceMappingURL=WebGPUViewNativeComponent.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGPUViewNativeComponent.web.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI5D,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC;IAE9B,kBAAkB,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,oBAAoB,CAAC;IAC1E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAGD,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,KAAK,EAAE,WAAW,GACjB,KAAK,CAAC,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.web.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI5D,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC;IAE9B,kBAAkB,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,oBAAoB,CAAC;IAC1E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAGpC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAGD,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,KAAK,EAAE,WAAW,GACjB,KAAK,CAAC,GAAG,CAAC,OAAO,CAyBnB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `requestAnimationFrame`, paced by the display, on any runtime.
|
|
3
|
+
*
|
|
4
|
+
* Drop-in for the global one in a render loop:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { requestAnimationFrame } from "react-native-webgpu";
|
|
8
|
+
*
|
|
9
|
+
* const render = (timestamp: number) => {
|
|
10
|
+
* draw(timestamp);
|
|
11
|
+
* context.present();
|
|
12
|
+
* requestAnimationFrame(render);
|
|
13
|
+
* };
|
|
14
|
+
* requestAnimationFrame(render);
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* React Native's global `requestAnimationFrame` is a timer: on Android it
|
|
18
|
+
* makes the next frame of the display only when it is requested before that
|
|
19
|
+
* frame starts, which leaves a loop that requests its next frame at the end
|
|
20
|
+
* of its work about 6 ms of a 120 Hz frame (past that, it drops to 60 fps),
|
|
21
|
+
* and on iOS it runs at 60 Hz. On a worklet runtime of your own
|
|
22
|
+
* (`createWorkletRuntime`), the global one polls every 16 ms (about 48 fps).
|
|
23
|
+
* This one follows the display wherever it is called:
|
|
24
|
+
*
|
|
25
|
+
* - On the React Native runtime, each frame of the display runs the callbacks
|
|
26
|
+
* requested before it, with the frame's time.
|
|
27
|
+
* - On a worklet runtime of your own, the runtime waits on its thread for the
|
|
28
|
+
* next frame of the display (the rest of the current frame at most), then
|
|
29
|
+
* runs them. Nothing else runs on the runtime during that wait.
|
|
30
|
+
* - On the Reanimated UI runtime, it is worklets' `requestAnimationFrame`,
|
|
31
|
+
* which is paced by the display already.
|
|
32
|
+
*
|
|
33
|
+
* Like a browser's, a callback requested while the frame's callbacks run gets
|
|
34
|
+
* the next frame, and every callback of a frame gets the same timestamp: the
|
|
35
|
+
* time the frame started, on the clock of `performance.now()`. The callbacks
|
|
36
|
+
* run once per frame of the display. A loop that overruns its frame runs
|
|
37
|
+
* again in the frame it overran into rather than waiting for the frame after.
|
|
38
|
+
* On the React Native runtime that run goes behind whatever waits there
|
|
39
|
+
* (React's updates, the app's other tasks), and the run after it waits for a
|
|
40
|
+
* frame of the display: the runtime is never the loop's alone.
|
|
41
|
+
*
|
|
42
|
+
* On the React Native runtime and on a worklet runtime of your own, no frame
|
|
43
|
+
* comes while the app is not in the foreground (the host activity is paused
|
|
44
|
+
* on Android, the app is not active on iOS): a loop stops with the app, and
|
|
45
|
+
* starts again when it is back.
|
|
46
|
+
*
|
|
47
|
+
* On iPhone, an app only gets more than 60 Hz with
|
|
48
|
+
* `CADisableMinimumFrameDurationOnPhone` set to true in its Info.plist. On
|
|
49
|
+
* macOS and on web, this is the runtime's own `requestAnimationFrame`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const requestAnimationFrame: (callback: (timestamp: number) => void) => number;
|
|
52
|
+
/**
|
|
53
|
+
* Cancels a callback requested with this package's `requestAnimationFrame`,
|
|
54
|
+
* on the runtime it was requested on. Not interchangeable with the global
|
|
55
|
+
* `cancelAnimationFrame`: each cancels the handles of its own
|
|
56
|
+
* `requestAnimationFrame`.
|
|
57
|
+
*/
|
|
58
|
+
export declare const cancelAnimationFrame: (handle: number) => void;
|
|
59
|
+
//# sourceMappingURL=animationFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animationFrame.d.ts","sourceRoot":"","sources":["../../../src/animationFrame.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,KACpC,MAMF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,KAAG,IAOrD,CAAC"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import "./main/installNative";
|
|
2
|
-
import type {
|
|
2
|
+
import type { GPUDrawElementImageDestination, GPUDrawElementImageSource, GPUSharedFence, GPUSharedFenceDescriptor, GPUSharedFenceState, CreateNativeBufferOptions, GPUDawnTogglesDescriptor, GPUNativeExternalTextureDescriptor, GPUSharedTextureMemory, GPUSharedTextureMemoryDescriptor, GPUCopyExternalNativeFrameSourceInfo, NativeCanvas, RNCanvasContext, VideoPlayer, NativeBuffer, NativeBufferPixelFormat } from "./types";
|
|
3
3
|
export * from "./main";
|
|
4
4
|
export * from "./constants";
|
|
5
5
|
export { installWebGPU } from "./install";
|
|
6
|
-
export
|
|
6
|
+
export { requestAnimationFrame, cancelAnimationFrame } from "./animationFrame";
|
|
7
|
+
export type { NativeBuffer, VideoPlayer, GPUSharedFence, GPUSharedFenceDescriptor, GPUSharedFenceExportInfo, GPUSharedFenceState, GPUSharedFenceType, GPUSharedTextureMemory, GPUSharedTextureMemoryDescriptor, GPUSharedTextureMemoryEndAccessState, NativeBufferPixelFormat, CreateVideoPlayerOptions, GPUCopyExternalNativeFrameSourceInfo, GPUDawnTogglesDescriptor, GPUNativeExternalTextureDescriptor, NativeBufferColorSpace, GPUExtent2D, GPUDrawElementImageDestination, GPUDrawElementImageSource, GPUDrawElementImageSourceView, CreateNativeBufferOptions, } from "./types";
|
|
7
8
|
declare global {
|
|
8
9
|
interface Navigator {
|
|
9
10
|
gpu: GPU;
|
|
10
11
|
}
|
|
11
12
|
var navigator: Navigator;
|
|
13
|
+
var __webgpuAnimationFrames: {
|
|
14
|
+
request: (callback: (timestamp: number) => void) => number;
|
|
15
|
+
cancel: (handle: number) => void;
|
|
16
|
+
} | undefined;
|
|
12
17
|
var RNWebGPU: {
|
|
13
18
|
gpu: GPU;
|
|
14
19
|
fabric: boolean;
|
|
@@ -19,13 +24,20 @@ declare global {
|
|
|
19
24
|
destroyContext: (contextId: number) => void;
|
|
20
25
|
DecodeToUTF8: (buffer: NodeJS.ArrayBufferView | ArrayBuffer) => string;
|
|
21
26
|
createImageBitmap: typeof createImageBitmap;
|
|
22
|
-
loadVideoFrame: (path: string) =>
|
|
23
|
-
createTestVideoFrame: (width: number, height: number, pixelFormat?:
|
|
24
|
-
|
|
27
|
+
loadVideoFrame: (path: string) => NativeBuffer;
|
|
28
|
+
createTestVideoFrame: (width: number, height: number, pixelFormat?: NativeBufferPixelFormat) => NativeBuffer;
|
|
29
|
+
createNativeBufferFromPointer: (pointer: bigint) => NativeBuffer;
|
|
25
30
|
importDevice: (pointer: bigint) => GPUDevice;
|
|
26
31
|
adoptTexture: (pointer: bigint) => GPUTexture;
|
|
27
|
-
createVideoPlayer: (source: string, pixelFormat?:
|
|
32
|
+
createVideoPlayer: (source: string, pixelFormat?: NativeBufferPixelFormat) => VideoPlayer;
|
|
28
33
|
writeTestVideoFile: () => string;
|
|
34
|
+
createNativeBuffer: (width: number, height: number, options?: CreateNativeBufferOptions) => NativeBuffer;
|
|
35
|
+
allocateNativeBufferViewId: () => number;
|
|
36
|
+
retainNativeBufferView: (viewId: number) => void;
|
|
37
|
+
releaseNativeBufferView: (viewId: number) => void;
|
|
38
|
+
presentNativeBuffer: (viewId: number, frame: NativeBuffer, done?: {
|
|
39
|
+
fences: GPUSharedFenceState[];
|
|
40
|
+
} | null) => void;
|
|
29
41
|
};
|
|
30
42
|
interface GPUTexture {
|
|
31
43
|
readonly nativePointer: bigint;
|
|
@@ -34,8 +46,6 @@ declare global {
|
|
|
34
46
|
importExternalTexture(descriptor: GPUNativeExternalTextureDescriptor): GPUExternalTexture;
|
|
35
47
|
importSharedTextureMemory(descriptor: GPUSharedTextureMemoryDescriptor): GPUSharedTextureMemory;
|
|
36
48
|
importSharedFence(descriptor: GPUSharedFenceDescriptor): GPUSharedFence;
|
|
37
|
-
createNativeBufferTexture(source: NativeVideoFrame, descriptor?: GPUNativeBufferTextureDescriptor): GPUNativeBufferTexture;
|
|
38
|
-
createNativeBufferExternalTexture(source: NativeVideoFrame, descriptor?: GPUNativeBufferExternalTextureDescriptor): GPUNativeBufferExternalTexture;
|
|
39
49
|
}
|
|
40
50
|
interface GPUQueue {
|
|
41
51
|
drawElementImageToTexture(source: GPUDrawElementImageSource, destination: GPUDrawElementImageDestination): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAQA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EACV,8BAA8B,EAC9B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAQA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EACV,8BAA8B,EAC9B,yBAAyB,EACzB,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,kCAAkC,EAClC,sBAAsB,EACtB,gCAAgC,EAChC,oCAAoC,EACpC,YAAY,EACZ,eAAe,EACf,WAAW,EACX,YAAY,EACZ,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,YAAY,EACV,YAAY,EACZ,WAAW,EACX,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,gCAAgC,EAChC,oCAAoC,EACpC,uBAAuB,EACvB,wBAAwB,EACxB,oCAAoC,EACpC,wBAAwB,EACxB,kCAAkC,EAClC,sBAAsB,EACtB,WAAW,EACX,8BAA8B,EAC9B,yBAAyB,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AmB;QAC3B,WAAW,CAAC,EAAE,wBAAwB,CAAC;QAOvC,6BAA6B,CAAC,EAAE,OAAO,CAAC;KACzC;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,EACpC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/main/index.tsx"],"names":[],"mappings":"AAKA,OAAO,iBAAiB,CAAC;AAoDzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/main/index.tsx"],"names":[],"mappings":"AAKA,OAAO,iBAAiB,CAAC;AAoDzB,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { CanvasProps } from "./Canvas";
|
|
4
|
+
import type { NativeBufferViewProps } from "./NativeBufferView";
|
|
4
5
|
export * from "./formats";
|
|
5
6
|
export declare const GPUBufferUsage: GPUBufferUsage;
|
|
6
7
|
export declare const GPUTextureUsage: GPUTextureUsage;
|
|
@@ -11,6 +12,14 @@ export type { AndroidBackingView, AndroidCanvasProps, AndroidHardwareBufferViewP
|
|
|
11
12
|
export declare const Canvas: ({ android: _android, ref, ...props }: CanvasProps) => React.FunctionComponentElement<Omit<import("react-native").ViewProps, "ref"> & {
|
|
12
13
|
ref?: React.Ref<import("react-native").ViewInstance> | undefined;
|
|
13
14
|
}>;
|
|
15
|
+
export type { NativeBufferPixelSize, NativeBufferResizeMode, NativeBufferViewProps, NativeBufferViewRef, } from "./NativeBufferView";
|
|
16
|
+
export declare const NativeBufferView: ({ resizeMode: _resizeMode, onPixelSizeChange: _onPixelSizeChange, ref, ...props }: NativeBufferViewProps) => React.FunctionComponentElement<Omit<import("react-native").ViewProps, "ref"> & {
|
|
17
|
+
ref?: React.Ref<import("react-native").ViewInstance> | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const useNativeBufferSize: (_debounceMs?: number) => {
|
|
20
|
+
size: null;
|
|
21
|
+
onPixelSizeChange: () => undefined;
|
|
22
|
+
};
|
|
14
23
|
export declare const useCanvasRef: () => React.RefObject<null>;
|
|
15
24
|
export declare const useSurface: () => {
|
|
16
25
|
ref: React.RefObject<null>;
|
|
@@ -28,6 +37,8 @@ export declare const useMainDevice: () => never;
|
|
|
28
37
|
export declare const importDevice: (_pointer: bigint) => GPUDevice;
|
|
29
38
|
export declare const adoptTexture: (_pointer: bigint) => GPUTexture;
|
|
30
39
|
export declare const installWebGPU: () => undefined;
|
|
40
|
+
export declare const requestAnimationFrame: (callback: (timestamp: number) => void) => number;
|
|
41
|
+
export declare const cancelAnimationFrame: (handle: number) => void;
|
|
31
42
|
export declare const WebGPUModule: {
|
|
32
43
|
install: () => boolean;
|
|
33
44
|
};
|
|
@@ -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;AAGvC,OAAO,KAAK,EAAE,WAAW,EAAiC,MAAM,UAAU,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;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAahE,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,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,gBAAgB,GAAI,mFAK9B,qBAAqB;;EAQvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,cAAc,MAAM;;;CAGtD,CAAC;AAEH,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,qBAAqB,GAAI,UAAU,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,WAC/B,CAAC;AAE7C,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,SACV,CAAC;AAE1C,eAAO,MAAM,YAAY;;CAA2B,CAAC"}
|
|
@@ -28,16 +28,16 @@ export interface CanvasRef {
|
|
|
28
28
|
getContext(contextName: "webgpu"): RNCanvasContext | null;
|
|
29
29
|
getNativeSurface: () => NativeCanvas;
|
|
30
30
|
}
|
|
31
|
-
export type
|
|
32
|
-
export interface
|
|
31
|
+
export type NativeBufferPixelFormat = "bgra8" | "nv12";
|
|
32
|
+
export interface NativeBuffer {
|
|
33
33
|
readonly handle: bigint;
|
|
34
34
|
readonly width: number;
|
|
35
35
|
readonly height: number;
|
|
36
|
-
readonly pixelFormat:
|
|
36
|
+
readonly pixelFormat: NativeBufferPixelFormat;
|
|
37
37
|
readonly acquireFenceFd: bigint | null;
|
|
38
38
|
release(): void;
|
|
39
39
|
}
|
|
40
|
-
export interface
|
|
40
|
+
export interface NativeBufferColorSpace {
|
|
41
41
|
matrix?: "identity" | "rec601" | "rec709" | "rec2020";
|
|
42
42
|
range?: "identity" | "narrow" | "full";
|
|
43
43
|
primaries?: "srgb" | "rec709" | "rec601" | "rec2020" | "display-p3";
|
|
@@ -48,32 +48,13 @@ export type GPUExtent2D = {
|
|
|
48
48
|
height: number;
|
|
49
49
|
} | [number, number];
|
|
50
50
|
export interface GPUNativeExternalTextureDescriptor extends Omit<GPUExternalTextureDescriptor, "source"> {
|
|
51
|
-
source:
|
|
52
|
-
sourceColorSpace?:
|
|
51
|
+
source: NativeBuffer | GPUTexture;
|
|
52
|
+
sourceColorSpace?: NativeBufferColorSpace;
|
|
53
53
|
cropOrigin?: GPUOrigin2D;
|
|
54
54
|
cropSize?: GPUExtent2D;
|
|
55
55
|
}
|
|
56
|
-
export type GPUNativeBufferExternalTextureDescriptor = Omit<GPUNativeExternalTextureDescriptor, "source">;
|
|
57
|
-
export interface GPUNativeBufferTextureDescriptor {
|
|
58
|
-
usage?: GPUTextureUsageFlags;
|
|
59
|
-
label?: string;
|
|
60
|
-
}
|
|
61
|
-
export interface GPUNativeBufferWrapper {
|
|
62
|
-
label: string;
|
|
63
|
-
beginAccess(fences?: GPUSharedFenceState[]): void;
|
|
64
|
-
endAccess(): GPUSharedFenceState | null;
|
|
65
|
-
destroy(): void;
|
|
66
|
-
}
|
|
67
|
-
export interface GPUNativeBufferTexture extends GPUNativeBufferWrapper {
|
|
68
|
-
readonly __brand: "GPUNativeBufferTexture";
|
|
69
|
-
readonly texture: GPUTexture;
|
|
70
|
-
}
|
|
71
|
-
export interface GPUNativeBufferExternalTexture extends GPUNativeBufferWrapper {
|
|
72
|
-
readonly __brand: "GPUNativeBufferExternalTexture";
|
|
73
|
-
readonly externalTexture: GPUExternalTexture;
|
|
74
|
-
}
|
|
75
56
|
export interface VideoPlayer {
|
|
76
|
-
copyLatestFrame():
|
|
57
|
+
copyLatestFrame(): NativeBuffer | null;
|
|
77
58
|
play(): void;
|
|
78
59
|
pause(): void;
|
|
79
60
|
release(): void;
|
|
@@ -88,14 +69,14 @@ export interface VideoPlayer {
|
|
|
88
69
|
readonly frameRate: number;
|
|
89
70
|
}
|
|
90
71
|
export interface GPUCopyExternalNativeFrameSourceInfo {
|
|
91
|
-
source:
|
|
72
|
+
source: NativeBuffer;
|
|
92
73
|
origin?: GPUOrigin2D;
|
|
93
74
|
flipY?: boolean;
|
|
94
75
|
rotation?: 0 | 90 | 180 | 270;
|
|
95
76
|
mirrored?: boolean;
|
|
96
77
|
}
|
|
97
78
|
export interface CreateVideoPlayerOptions {
|
|
98
|
-
pixelFormat?:
|
|
79
|
+
pixelFormat?: NativeBufferPixelFormat;
|
|
99
80
|
}
|
|
100
81
|
export type GPUDrawElementImageSourceView = number | {
|
|
101
82
|
current: unknown;
|
|
@@ -111,10 +92,15 @@ export interface GPUDrawElementImageSource {
|
|
|
111
92
|
export interface GPUDrawElementImageDestination extends GPUCopyExternalImageDestInfo {
|
|
112
93
|
size?: GPUExtent3DStrict;
|
|
113
94
|
}
|
|
114
|
-
export
|
|
115
|
-
handle: bigint;
|
|
95
|
+
export type GPUSharedTextureMemoryDescriptor = {
|
|
116
96
|
label?: string;
|
|
117
|
-
}
|
|
97
|
+
} & ({
|
|
98
|
+
source: NativeBuffer;
|
|
99
|
+
handle?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
handle: bigint;
|
|
102
|
+
source?: undefined;
|
|
103
|
+
});
|
|
118
104
|
export type GPUSharedFenceType = "mtl-shared-event" | "sync-fd" | "vk-semaphore-opaque-fd";
|
|
119
105
|
export interface GPUSharedFenceDescriptor {
|
|
120
106
|
type: GPUSharedFenceType;
|
|
@@ -151,5 +137,20 @@ export interface GPUSharedTextureMemory {
|
|
|
151
137
|
endAccess(texture: GPUTexture): GPUSharedTextureMemoryEndAccessState;
|
|
152
138
|
destroy(): void;
|
|
153
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* The options of `createNativeBuffer()`. The buffer holds premultiplied
|
|
142
|
+
* pixels.
|
|
143
|
+
*/
|
|
144
|
+
export interface CreateNativeBufferOptions {
|
|
145
|
+
/**
|
|
146
|
+
* Defaults to the preferred canvas format of the platform:
|
|
147
|
+
* `"rgba8unorm"` on Android, `"bgra8unorm"` on Apple platforms.
|
|
148
|
+
* `"rgba16float"` works on both; it gives more precision, not extended
|
|
149
|
+
* range: a `NativeBufferView` shows values in [0, 1] and clamps the rest.
|
|
150
|
+
*/
|
|
151
|
+
format?: "rgba8unorm" | "bgra8unorm" | "rgba16float";
|
|
152
|
+
/** The primaries of the values. Defaults to `"srgb"`. */
|
|
153
|
+
colorSpace?: PredefinedColorSpace;
|
|
154
|
+
}
|
|
154
155
|
export {};
|
|
155
156
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../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;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,M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