Repository navigation
First non-beta release. It moves the library from Skia 3.7.4 to Skia 3.10.0 / WebGPU 0.21.3 (Dawn 158), and fixes a preview regression that this upgrade path brought in.
Requires react-native-skia@3.10.0 and react-native-webgpu@0.21.3.
Install
npm install --save-exact react-native-skia@3.10.0 react-native-webgpu@0.21.3 react-native-reanimated@4.5.3 react-native-worklets@0.11.3
npm install --save-exact react-native-skia-webgpu-video@0.1.0
npx --no-install skia-video-patch-canvasAdd the last command to your app's postinstall, then rebuild the native app; see the README. The archive attached here is the same package, installable by URL.
The rough part: Skia 3.9 and the 4K preview
Getting past Skia 3.8 took more than a version bump.
- What broke. With Skia 3.9.1, a native-size 4K60 preview on an iPhone 15 Pro fell from about 355 to about 240 of 360 frames (40 draws/s instead of 60). A 44 Mb/s 4K30 clip dropped frames one run out of two. The same sources scaled to 1920 were fine, and exports were not affected.
- Where it came from. A bisection on the device put it in 3.9.1, not 3.9.0: Skia now presents one recording per vsync (wcandillon/react-native-skia#4386). Our preview waited for the GPU on the UI thread after every draw and every frame import (
flush(true)). That wait covers the whole Graphite context that Skia's views share, presentation included. With the new presentation, it stretched until the UI thread missed one vsync in three. - What did not work. Moving the wait to the next vsync gained nothing: a blocking wait at every vsync costs a vsync wherever it sits. Submitting imports without any wait ran out of the video memory budget on 4K BGRA frames (33 MB each).
- The fix (#28). Draws and imports are submitted without waiting. Each decoder buffer goes back to the decoder when the GPU reports its copy done (
onSubmittedWorkDone). Imports in flight are bounded: 2 at most, each within a sixteenth of the memory budget. The draw still waits whenafterDrawFramehands back a context of yours. - The result. 4K60 now runs at 355–358 of 360 frames and about 120 draws/s on the iPhone, twice the 60 that Skia 3.8.1 allowed. A 3×4K preview on the Pixel 8a goes from 30 to 55 draws/s.
- And once more with 3.10 (#31, #32). Removing the preview's GPU snapshot copies made the 4K preview in
rgbafaster again: 25 → 37 draws/s, 164 → 220 frames of 360. It also broke every 4K → 4K export: when a released 4K producer left no import texture, the GPU wait threw "Video import drain surface is unavailable". The iPhone frame-sync profile caught it before release, and #32 fixes it. The four 4K → 4K exports pass again, every frame exact, at the same times as before.
Other changes since v0.1.0-beta.4
- Skia 3.9:
readPixelsis asynchronous, with no destination buffer. The export's CPU readback fallback awaits the pixels before encoding them. - iOS
yuvframes convert Display P3 / DCI-P3 and sRGB tracks to Rec.709, asrgbaalways did. On a P3 clip,yuvandrgbanow differ by a mean of 0.8 levels instead of 5.7. framePixelFormat: 'rgba'is deprecated (documentation only; it still works). iOS exports run as fast inyuv, colors match, andrgbakeeps fewer frames in a 4K60 preview and takes 2.7 times the memory.- Skia 3.9.2: our patch marks checked submissions as GPU work (
RNSkGpuActivity::Scope), so the new background pipeline warmup (#4398) does not compile while an export is running. - Skia 3.10.0: Dawn 158 (Skia m158). The patch applies as it is.
- Preview without GPU snapshot copies (#31): a decoded frame goes straight into a texture of its producer, and the composition draws into two surfaces in turn, shown through
surface.asImage(). This removes two full-frame GPU copies per preview frame. No public API change;currentFramealternates between two image objects. - After upgrading, run
npx --no-install skia-video-patch-canvasagain and rebuild the native app.
Verified for this release
- iPhone 15 Pro, Release, Skia 3.10.0:
- Native tests: 56 passed, 2 skipped.
- Smoke profile: 5/5.
- Frame-sync profile: every export exact, preview at ~120 draws/s in
yuv. Export times are the same as on 3.9.1, within ±1%.
- Pixel 8a: last verified on Skia 3.9.1 (interop, smoke, frame sync, export A/B). It has not been rerun on 3.10.0.
Not yet qualified
- Memory over long sessions (last checked on 3.0.6).
- HDR beyond the HLG to SDR conversion, audible output and A/V synchronization.
- One iPhone preview case, a sampled 4K60 preview, skips 2 frames of about 330; every frame it draws is exact.
- Known Pixel 8a issues, all predating beta.3: a seek while playing a 4K sequence leaves the clock stalled, and a paused seek into a 120-clip lazy montage does not show its frame.
Full changelog: v0.1.0-beta.4...v0.1.0
SHA-256 of the archive: 40287a79a168dcb1429d3bf806cdc4699a2c9423110d82bf774616ef028b9aa2