File tree Expand file tree Collapse file tree
packages/react-native-vision-camera/src/specs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,11 +6,10 @@ import type { UInt64 } from 'react-native-nitro-modules'
66 * This is a shared contract between libraries to interact
77 * with native buffers without natively typed bindings.
88 *
9- * Consumers, like react-native-skia or react-native-wgpu
10- * can accept a `NativeBuffer`-shaped object that has a
11- * {@linkcode pointer} and a {@linkcode release} function
12- * to unwrap the native buffer from it, load it as a GPU
13- * Texture, and release it once it has been rendered.
9+ * Consumers, like react-native-skia or react-native-wgpu,
10+ * can use the {@linkcode pointer} to unwrap the native buffer,
11+ * load it as a GPU Texture, and release it once it has been
12+ * rendered via the {@linkcode release} function.
1413 *
1514 * @example
1615 * ```ts
Original file line number Diff line number Diff line change @@ -362,12 +362,14 @@ export interface Frame
362362 * const device = ... // WebGPU device
363363 * if (frame.hasNativeBuffer) {
364364 * const nativeBuffer = frame.getNativeBuffer()
365- * const image = device.importExternalTexture({
366- * source: nativeBuffer,
365+ * const videoFrame = RNWebGPU.createVideoFrameFromNativeBuffer(nativeBuffer.pointer)
366+ * const externalTexture = device.importExternalTexture({
367+ * source: videoFrame,
367368 * label: 'camera-frame'
368369 * })
369- * // Render `image` via Skia APIs
370- * image.dispose()
370+ * // After submitting commands that sample `externalTexture`:
371+ * externalTexture.destroy()
372+ * videoFrame.release()
371373 * nativeBuffer.release()
372374 * }
373375 * ```
You can’t perform that action at this time.
0 commit comments