react-native-skia-webgpu-video 0.1.0-beta.3 → 0.1.0-beta.4

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.
Files changed (65) hide show
  1. package/README.md +39 -32
  2. package/android/BUILD_VALIDATION.md +1 -1
  3. package/android/CMakeLists.txt +3 -2
  4. package/android/cpp/ExportHintSession.cpp +114 -0
  5. package/android/cpp/ExportHintSession.h +35 -0
  6. package/android/cpp/VideoEncoderHostObject.cpp +76 -101
  7. package/android/cpp/VideoEncoderHostObject.h +14 -9
  8. package/android/cpp/VideoFrame.cpp +3 -5
  9. package/android/cpp/cpp-adapter.cpp +7 -4
  10. package/android/src/main/java/com/azzapp/rnskv/GLFrameExtractor.java +3 -9
  11. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionDecoder.java +8 -11
  12. package/android/src/main/java/com/azzapp/rnskv/VideoEncoder.java +68 -28
  13. package/docs/FRAME_PIXEL_FORMAT.md +1 -1
  14. package/docs/MIGRATION.md +1 -1
  15. package/docs/UPSTREAM_NOTES.md +15 -2
  16. package/lib/module/canvas.js +3 -5
  17. package/lib/module/canvas.js.map +1 -1
  18. package/lib/module/exportFrames.js +6 -8
  19. package/lib/module/exportFrames.js.map +1 -1
  20. package/lib/module/exportTarget.js +183 -40
  21. package/lib/module/exportTarget.js.map +1 -1
  22. package/lib/module/exportVideoComposition.js +53 -12
  23. package/lib/module/exportVideoComposition.js.map +1 -1
  24. package/lib/module/frameInterop.js +9 -12
  25. package/lib/module/frameInterop.js.map +1 -1
  26. package/lib/module/gpu.js +0 -2
  27. package/lib/module/gpu.js.map +1 -1
  28. package/lib/module/gpuDevice.js +12 -0
  29. package/lib/module/gpuDevice.js.map +1 -1
  30. package/lib/module/previewLifecycle.js +0 -1
  31. package/lib/module/previewLifecycle.js.map +1 -1
  32. package/lib/module/yuvBlit.js +28 -21
  33. package/lib/module/yuvBlit.js.map +1 -1
  34. package/lib/typescript/src/canvas.d.ts.map +1 -1
  35. package/lib/typescript/src/exportFrames.d.ts +3 -2
  36. package/lib/typescript/src/exportFrames.d.ts.map +1 -1
  37. package/lib/typescript/src/exportTarget.d.ts +53 -14
  38. package/lib/typescript/src/exportTarget.d.ts.map +1 -1
  39. package/lib/typescript/src/exportVideoComposition.d.ts +2 -1
  40. package/lib/typescript/src/exportVideoComposition.d.ts.map +1 -1
  41. package/lib/typescript/src/frameInterop.d.ts.map +1 -1
  42. package/lib/typescript/src/gpu.d.ts.map +1 -1
  43. package/lib/typescript/src/gpuDevice.d.ts +5 -1
  44. package/lib/typescript/src/gpuDevice.d.ts.map +1 -1
  45. package/lib/typescript/src/previewLifecycle.d.ts.map +1 -1
  46. package/lib/typescript/src/types.d.ts +10 -5
  47. package/lib/typescript/src/types.d.ts.map +1 -1
  48. package/lib/typescript/src/yuvBlit.d.ts +16 -14
  49. package/lib/typescript/src/yuvBlit.d.ts.map +1 -1
  50. package/package.json +6 -6
  51. package/patches/react-native-skia+3.7.4.patch +146 -0
  52. package/scripts/skia-canvas-patch.json +22 -258
  53. package/src/canvas.ts +3 -7
  54. package/src/exportFrames.ts +8 -9
  55. package/src/exportTarget.ts +217 -56
  56. package/src/exportVideoComposition.ts +87 -26
  57. package/src/frameInterop.ts +9 -11
  58. package/src/gpu.ts +0 -2
  59. package/src/gpuDevice.ts +26 -1
  60. package/src/previewLifecycle.ts +0 -1
  61. package/src/types.ts +10 -5
  62. package/src/yuvBlit.ts +43 -28
  63. package/android/cpp/EncoderTargets.cpp +0 -226
  64. package/android/cpp/EncoderTargets.h +0 -70
  65. package/patches/react-native-skia+3.7.1.patch +0 -502
@@ -138,13 +138,11 @@ jsi::Value VideoFrame::toJSInternal(jsi::Runtime& runtime) {
138
138
  if (isHardwareBuffer()) {
139
139
  auto owner = acquireHardwareFrame(getNativeHardwareBufferHandle());
140
140
  // An ImageReader frame is the codec's YUV buffer: its picture is the crop
141
- // rectangle, turned for display when WebGPU samples it.
141
+ // rectangle, turned for display and scaled to the frame's size when
142
+ // WebGPU converts it.
142
143
  const bool decodedImage = owner->image != nullptr;
143
- const bool swapped = owner->rotation == 90 || owner->rotation == 270;
144
144
  const bool valid = decodedImage
145
- ? owner->description.format != AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM &&
146
- (swapped ? owner->cropHeight : owner->cropWidth) == width &&
147
- (swapped ? owner->cropWidth : owner->cropHeight) == height
145
+ ? owner->description.format != AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM
148
146
  : owner->description.format == AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM &&
149
147
  owner->description.width == static_cast<uint32_t>(width) &&
150
148
  owner->description.height == static_cast<uint32_t>(height);
@@ -38,12 +38,16 @@ void install(jsi::Runtime& jsiRuntime) {
38
38
  const bool hardware = NativeHardwareBuffer::isEnabled();
39
39
  info.setProperty(runtime, "decodeTransport", jsi::String::createFromAscii(runtime,
40
40
  hardware ? "ahardwarebuffer-rgba-egl" : "cpu-rgba-readback"));
41
- // Export renders into encoder-lent AHardwareBuffers, sampled by the
42
- // encoder's EGL context; CPU readback stays the fallback.
41
+ // Export renders straight into the codec's input Surface through a
42
+ // WebGPU canvas context; the JS export probes it at setup, and CPU
43
+ // readback stays the fallback. Offered with AHardwareBuffer interop,
44
+ // which also samples decoded frames in place: turning interop off
45
+ // selects the readback export, the reference of the pixel checks.
43
46
  info.setProperty(runtime, "encodeTransport", jsi::String::createFromAscii(runtime,
44
- hardware ? "ahardwarebuffer-egl-sample" : "cpu-rgba-upload"));
47
+ hardware ? "webgpu-native-window" : "cpu-rgba-upload"));
45
48
  info.setProperty(runtime, "exportFallback", jsi::String::createFromAscii(runtime, "cpu-rgba-upload"));
46
49
  info.setProperty(runtime, "gpuDirectExport", hardware);
50
+ info.setProperty(runtime, "zeroCopyEncode", hardware);
47
51
  info.setProperty(runtime, "decodeCpuCopiesBeforeSkia", hardware ? 0 : 1);
48
52
  info.setProperty(runtime, "cpuReadbackDecode", !hardware);
49
53
  info.setProperty(runtime, "ownedFrameTransport", jsi::String::createFromAscii(runtime,
@@ -51,7 +55,6 @@ void install(jsi::Runtime& jsiRuntime) {
51
55
  info.setProperty(runtime, "skiaImportTransport", jsi::String::createFromAscii(runtime,
52
56
  hardware ? "native-buffer-webgpu-blit-snapshot" : "cpu-rgba-scoped-copy-webgpu-upload-snapshot"));
53
57
  info.setProperty(runtime, "zeroCopyDecode", false);
54
- info.setProperty(runtime, "zeroCopyEncode", false);
55
58
  return info;
56
59
  }));
57
60
  auto createVideoPlayer = jsi::Function::createFromHostFunction(
@@ -126,8 +126,8 @@ public class GLFrameExtractor implements SurfaceTexture.OnFrameAvailableListener
126
126
  /**
127
127
  * The Surface the codec renders into. With {@code nativeImages}, on API 29+
128
128
  * with hardware buffers, it is an ImageReader's: frames then keep the codec's
129
- * YUV buffer, cropped and turned by {@code rotation} when WebGPU samples it,
130
- * so they must be wanted at the encoded size.
129
+ * YUV buffer, cropped, turned by {@code rotation} and scaled to the frame's
130
+ * size when WebGPU converts it.
131
131
  */
132
132
  @android.annotation.TargetApi(Build.VERSION_CODES.Q)
133
133
  public Surface surfaceFor(int videoWidth, int videoHeight, int rotation, boolean nativeImages) {
@@ -163,13 +163,7 @@ public class GLFrameExtractor implements SurfaceTexture.OnFrameAvailableListener
163
163
  try {
164
164
  if (Build.VERSION.SDK_INT >= 33) awaitProducer(image);
165
165
  Rect crop = image.getCropRect();
166
- boolean swapped = imageRotation == 90 || imageRotation == 270;
167
- int pictureWidth = swapped ? crop.height() : crop.width();
168
- int pictureHeight = swapped ? crop.width() : crop.height();
169
- if (pictureWidth != width || pictureHeight != height) {
170
- throw new IllegalStateException("Decoded image " + pictureWidth + "x" + pictureHeight
171
- + " does not match the requested " + width + "x" + height);
172
- }
166
+ if (crop.isEmpty()) throw new IllegalStateException("Decoded image has an empty crop");
173
167
  HardwareBuffer buffer = image.getHardwareBuffer();
174
168
  if (buffer == null) throw new IllegalStateException("Decoded image has no hardware buffer");
175
169
  long lease;
@@ -676,7 +676,7 @@ public class VideoCompositionDecoder {
676
676
  try {
677
677
  decoder.prepare();
678
678
  decoder.setSurface(slot.extractor.surfaceFor(decoder.getVideoWidth(),
679
- decoder.getVideoHeight(), decoder.getRotation(), wantsNativeImages(item, decoder)));
679
+ decoder.getVideoHeight(), decoder.getRotation(), wantsNativeImages(decoder)));
680
680
  } catch (IOException | RuntimeException e) {
681
681
  decoder.release();
682
682
  throw e;
@@ -685,17 +685,14 @@ public class VideoCompositionDecoder {
685
685
  }
686
686
 
687
687
  /**
688
- * Hardware frames at the encoded size from an 8-bit SDR track skip the GL
689
- * render pass: the codec writes into ImageReader buffers WebGPU samples.
690
- * A capped or explicit size keeps the GL path, which scales while drawing,
691
- * as does `framePixelFormat: 'rgba'`.
688
+ * Hardware frames from an 8-bit SDR track skip the GL render pass: the
689
+ * codec writes into ImageReader buffers, which WebGPU converts at the
690
+ * frame's size, a capped or explicit one included. `framePixelFormat:
691
+ * 'rgba'` keeps the GL path.
692
692
  */
693
- private boolean wantsNativeImages(VideoComposition.Item item, VideoCompositionItemDecoder decoder) {
694
- if (composition.isRgbaFrames() || !composition.isHardwareBufferEnabled() || !decoder.isEightBitSdr())
695
- return false;
696
- int[] size = FrameSize.of(item.getWidth(), item.getHeight(), item.getMaxLongSide(),
697
- decoder.getVideoWidth(), decoder.getVideoHeight(), 0);
698
- return size[0] == decoder.getVideoWidth() && size[1] == decoder.getVideoHeight();
693
+ private boolean wantsNativeImages(VideoCompositionItemDecoder decoder) {
694
+ return !composition.isRgbaFrames() && composition.isHardwareBufferEnabled()
695
+ && decoder.isEightBitSdr();
699
696
  }
700
697
 
701
698
  private void reportOpenError(Exception e) {
@@ -109,6 +109,9 @@ public class VideoEncoder {
109
109
 
110
110
  private Surface inputSurface;
111
111
 
112
+ // Only for CPU readback frames, created on the first one: the GPU export
113
+ // presents to inputSurface through WebGPU instead, and a window has one
114
+ // producer at a time.
112
115
  private EGLResourcesHolder eglResourcesHolder;
113
116
 
114
117
  private TextureRenderer textureRenderer;
@@ -120,6 +123,7 @@ public class VideoEncoder {
120
123
  private long lastPresentationTimeUs = -1;
121
124
  private long submittedFrames;
122
125
  private long writtenFrames;
126
+ private long windowFrames;
123
127
  private static final int MAX_IN_FLIGHT_FRAMES = 4;
124
128
  private static final long MAX_PENDING_SAMPLE_BYTES = 16L * 1024 * 1024;
125
129
  private long pendingSampleBytes;
@@ -211,14 +215,6 @@ public class VideoEncoder {
211
215
  encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
212
216
 
213
217
  inputSurface = encoder.createInputSurface();
214
- eglResourcesHolder = EGLResourcesHolder.createWithWindowedSurface(EGL10.EGL_NO_CONTEXT, inputSurface);
215
- eglResourcesHolder.runWithContextCurrent(() -> {
216
- textureRenderer = new TextureRenderer();
217
- int[] textures = new int[1];
218
- GLES20.glGenTextures(1, textures, 0);
219
- uploadTexture = textures[0];
220
- EGLUtils.configureTexture(GLES20.GL_TEXTURE_2D, uploadTexture);
221
- });
222
218
  encoder.start();
223
219
 
224
220
  try {
@@ -264,8 +260,59 @@ public class VideoEncoder {
264
260
  }
265
261
  }
266
262
 
267
- public void makeGLContextCurrent() {
268
- eglResourcesHolder.makeCurrent();
263
+ /** The codec's input Surface, for the GPU export to present to. */
264
+ public Surface getInputSurface() {
265
+ if (inputSurface == null) {
266
+ throw new IllegalStateException("Encoder has not been prepared");
267
+ }
268
+ return inputSurface;
269
+ }
270
+
271
+ /**
272
+ * Before the GPU export presents a frame to the input Surface: waits for
273
+ * room in the bounded queue and returns the frame's presentation time in
274
+ * microseconds, which the caller sets on the window for the buffer it
275
+ * queues next.
276
+ */
277
+ public long beginWindowFrame(double time) {
278
+ if (!Double.isFinite(time) || time < 0) {
279
+ throw new IllegalArgumentException("Invalid encoder timestamp");
280
+ }
281
+ if (encoder == null) {
282
+ throw new IllegalStateException("Encoder has not been prepared");
283
+ }
284
+ if (eglResourcesHolder != null) {
285
+ throw new IllegalStateException("The encoder's input Surface is already drawn by EGL");
286
+ }
287
+ awaitEncoderCapacity();
288
+ if (audioException != null) {
289
+ throw new RuntimeException("Could not encode composition audio", audioException);
290
+ }
291
+ long timeUS = TimeHelpers.secToUs(time);
292
+ if (timeUS <= lastPresentationTimeUs) {
293
+ throw new IllegalArgumentException("Encoder presentation timestamps must increase");
294
+ }
295
+ return timeUS;
296
+ }
297
+
298
+ /** Once the frame of beginWindowFrame was presented. */
299
+ public void endWindowFrame(long timeUS) {
300
+ lastPresentationTimeUs = timeUS;
301
+ submittedFrames++;
302
+ windowFrames++;
303
+ drainEncoder(false);
304
+ }
305
+
306
+ private void ensureGLContext() {
307
+ if (eglResourcesHolder != null) return;
308
+ eglResourcesHolder = EGLResourcesHolder.createWithWindowedSurface(EGL10.EGL_NO_CONTEXT, inputSurface);
309
+ eglResourcesHolder.runWithContextCurrent(() -> {
310
+ textureRenderer = new TextureRenderer();
311
+ int[] textures = new int[1];
312
+ GLES20.glGenTextures(1, textures, 0);
313
+ uploadTexture = textures[0];
314
+ EGLUtils.configureTexture(GLES20.GL_TEXTURE_2D, uploadTexture);
315
+ });
269
316
  }
270
317
 
271
318
  /** Uploads owned pixels into this encoder's private context, without retaining the input buffer. */
@@ -275,9 +322,13 @@ public class VideoEncoder {
275
322
  if (rgba == null || rgba.remaining() < required || !Double.isFinite(time) || time < 0) {
276
323
  throw new IllegalArgumentException("Invalid encoder RGBA frame or timestamp");
277
324
  }
278
- if (encoder == null || eglResourcesHolder == null) {
325
+ if (encoder == null) {
279
326
  throw new IllegalStateException("Encoder has not been prepared");
280
327
  }
328
+ if (windowFrames > 0) {
329
+ throw new IllegalStateException("The encoder's input Surface is already drawn by WebGPU");
330
+ }
331
+ ensureGLContext();
281
332
  awaitEncoderCapacity();
282
333
  ByteBuffer source = rgba.duplicate();
283
334
  if (bytesPerRow != RgbaLayout.bytesPerRow(sourceWidth)) {
@@ -314,23 +365,6 @@ public class VideoEncoder {
314
365
  });
315
366
  }
316
367
 
317
- /**
318
- * Encodes a GL_TEXTURE_2D of this encoder's context: a hardware buffer the
319
- * export rendered into through WebGPU, imported as an EGLImage natively.
320
- * The caller waited for the renderer's fence and keeps the buffer until the
321
- * reads this draw queues are complete.
322
- */
323
- public void encodeTexture(int texture, double time) {
324
- if (texture <= 0 || !Double.isFinite(time) || time < 0) {
325
- throw new IllegalArgumentException("Invalid encoder texture or timestamp");
326
- }
327
- if (encoder == null || eglResourcesHolder == null) {
328
- throw new IllegalStateException("Encoder has not been prepared");
329
- }
330
- awaitEncoderCapacity();
331
- eglResourcesHolder.runWithContextCurrent(() -> encodeTextureCurrent(texture, time));
332
- }
333
-
334
368
  private void awaitEncoderCapacity() {
335
369
  drainEncoder(false);
336
370
  long deadline = SystemClock.uptimeMillis() + 15_000;
@@ -370,6 +404,12 @@ public class VideoEncoder {
370
404
 
371
405
  public void finishWriting() {
372
406
  drainEncoder(true);
407
+ // A canvas context drops a frame it could not acquire a window buffer
408
+ // for, without an error: every presented frame must have come out.
409
+ if (windowFrames > 0 && writtenFrames != submittedFrames) {
410
+ throw new IllegalStateException("The encoder wrote " + writtenFrames + " of the "
411
+ + submittedFrames + " frames presented to its input Surface");
412
+ }
373
413
  if (audioThread != null) {
374
414
  try {
375
415
  audioThread.join(30_000);
@@ -17,7 +17,7 @@ const composition = { duration, items, framePixelFormat: 'yuv' }; // 'auto' | 'y
17
17
 
18
18
  | | iOS | Android |
19
19
  | --- | --- | --- |
20
- | `yuv` | AVAssetReader sort le NV12 du décodeur. La preview l'importe comme texture externe à chaque frame et le convertit en RGB dans une passe de rendu ; l'export le convertit dans une texture par clip | `ImageReader` (pistes 8 bits SDR à leur taille encodée ; les autres restent en `rgba`), converti en RGB par la même passe |
20
+ | `yuv` | AVAssetReader sort le NV12 du décodeur. La preview l'importe comme texture externe à chaque frame et le convertit en RGB dans une passe de rendu ; l'export le convertit dans une texture par clip | `ImageReader` (pistes 8 bits SDR, à toute taille de frame, plafonnée ou explicite comprise ; les autres restent en `rgba`), converti en RGB et mis à la taille de la frame par la même passe |
21
21
  | `rgba` | VideoToolbox convertit en BGRA ; l'export GPU échantillonne l'IOSurface en place, sans copie | Passe OpenGL vers un `AHardwareBuffer` RGBA |
22
22
  | `auto` (défaut) | `yuv` | `yuv` |
23
23
 
package/docs/MIGRATION.md CHANGED
@@ -67,7 +67,7 @@ Audio is implemented on both native platforms, but the device runs so far (3.0.6
67
67
 
68
68
  Set `configureVideoMemory({ maxBytes })` before allocating sessions. The budget covers tracked resources only; codecs and drivers can retain additional memory. A budget rejection does not silently reduce export dimensions.
69
69
 
70
- On Android with the AHardwareBuffer interop (API 29+, 8-bit SDR H.264/HEVC at the encoded size), the codec writes into an `ImageReader`; WebGPU converts, crops and rotates each YUV buffer, imported once, into an independent Graphite snapshot after a checked GPU fence. Exports skip that snapshot: each clip's frame is converted into a texture of its own and sampled in place, as on iOS. Other sources render through the decoder's private EGL context into an RGBA AHardwareBuffer, or, without the interop, read owned RGBA pixels on the CPU and upload them. All of these avoid Skia's image-count raster-upload cache. CPU Java/JSI backing buffers remain accounted until their aliases and ART/Hermes owners are collected. See the [upstream cache notes](UPSTREAM_NOTES.md#android--éviter-le-cache-dimages-raster-du-provider) and the [3.6.1 verification](../migration/skia-3.6.1/verification.md).
70
+ On Android with the AHardwareBuffer interop (API 29+, 8-bit SDR H.264/HEVC), the codec writes into an `ImageReader`; WebGPU converts, crops, rotates and scales each YUV buffer, imported once, to the frame's size (a `maxLongSide` cap or an explicit `resolution` included) in an independent Graphite snapshot after a checked GPU fence. Exports skip that snapshot: each clip's frame is converted into a texture of its own and sampled in place, as on iOS. Other sources render through the decoder's private EGL context into an RGBA AHardwareBuffer, or, without the interop, read owned RGBA pixels on the CPU and upload them. All of these avoid Skia's image-count raster-upload cache. CPU Java/JSI backing buffers remain accounted until their aliases and ART/Hermes owners are collected. See the [upstream cache notes](UPSTREAM_NOTES.md#android--éviter-le-cache-dimages-raster-du-provider) and the [3.6.1 verification](../migration/skia-3.6.1/verification.md).
71
71
 
72
72
  The optional `createFrameProcessor` export factory creates a processor once per export. Its asynchronous `prepareFrame` runs at the requested composition timestamp and its `dispose` must finish all frame readers. Drive animated effects from that timestamp, not an independent display animation loop.
73
73
 
@@ -1,5 +1,7 @@
1
1
  # Points amont à revoir lors d'une mise à jour Skia
2
2
 
3
+ **Mise à jour du 23 octobre 2026 :** **`react-native-skia@3.7.4`** et **`react-native-webgpu@0.19.0`**, toujours sur Dawn/Graphite 157.0.0. Le patch local passe de 7 fichiers et 62 éditions à 3 fichiers et 8 éditions. `canvas.dispose()` disparaît : en amont, la surface possède son canvas ([#4278](https://github.com/wcandillon/react-native-skia/pull/4278)) et `surface.dispose()` le détache. Le correctif d'`ImageProvider::Make()` est entré en amont par [#4277](https://github.com/wcandillon/react-native-skia/pull/4277). Restent les soumissions vérifiées, réécrites sur le nouveau `DawnContext::submitRecording(recorder, …)`, et `__rnskvTrimRecorderCache`, réduit à un appel de `trimThreadRecorders`. L'export Android rend désormais directement dans la `Surface` d'entrée du codec par `MakeWebGPUCanvasContextFromNativeWindow` ([WebGPU #588](https://github.com/wcandillon/react-native-webgpu/pull/588)), sans EGL. Voir l'[audit](../migration/skia-3.7.4/upstream-audit.md) et la [vérification](../migration/skia-3.7.4/verification.md).
4
+
3
5
  **Mise à jour du 20 octobre 2026 :** **`react-native-skia@3.7.1`**, toujours avec `react-native-webgpu@0.17.0` et Dawn/Graphite 157.0.0. La 3.7.1 ne contient qu'une correction iOS ([#4273](https://github.com/wcandillon/react-native-skia/pull/4273)) : `SkiaView.mm` présente désormais à la pleine fréquence de l'écran sur les appareils ProMotion. Les sept fichiers modifiés par le patch local sont identiques octet pour octet à ceux de la 3.7.0 : le patch s'applique tel quel, seuls sa version et son nom changent. Nos PR amont [#4274](https://github.com/wcandillon/react-native-skia/pull/4274), [#4275](https://github.com/wcandillon/react-native-skia/pull/4275) et [#4276](https://github.com/wcandillon/react-native-skia/pull/4276) sont encore ouvertes : le patch ne rétrécit pas. Vérifié le 20 octobre sur appareils, en Release : iPhone 15 Pro, tests natifs 50/50 et profil smoke 15/15 (l'app déclare Skia 3.7.1, écran à 120 Hz) ; Pixel 8a, contrôle `interop` 10/10 (erreur maximale par canal de 1, comme en 3.7.0, chemins GPU et readback d'accord à l'export) et smoke 15/15. Les mesures d'export de la 3.7.0 restent la référence : le code d'export ne change pas.
4
6
 
5
7
  **Migration du 19 octobre 2026 :** le code et les dépendances déclarées ciblent désormais **`react-native-skia@3.7.0` / `react-native-webgpu@0.17.0`**, sur Graphite **157.0.0** et **`react-native-webgpu-dawn@157.0.0`** (Skia `chrome/m157`). Les deux paquets doivent monter ensemble : Gradle et le podspec refusent deux Dawn différents. Le patch local garde 61 de ses 62 éditions ; seule tombe l'include `<stdexcept>`, désormais présent en amont. Le Dawn 157 demande trois images FIFO à la swapchain Android, ce qui supprime l'attente du thread principal dans `dequeueBuffer` sur Android 10 ; il garde aussi la robustesse des shaders sur Android, nos WGSL compris. L'[audit](../migration/skia-3.7.0/upstream-audit.md) détaille ces changements ; la [vérification](../migration/skia-3.7.0/verification.md) donne les mesures sur iPhone 15 Pro et Pixel 8a. Après une mise à jour, supprimer le bundle JS généré par Gradle avant de construire un APK de qualification : sa tâche ne voit pas le `node_modules` racine.
@@ -97,6 +99,8 @@ Cette architecture pourrait éviter la lecture CPU de la **sortie composée**. E
97
99
 
98
100
  ## Patch distinct : durée de vie et soumissions vérifiées
99
101
 
102
+ **Depuis 3.7.4**, seules les soumissions vérifiées et la réduction du cache du runtime d'export restent dans le patch : la durée de vie du canvas et la factory d'`ImageProvider` sont corrigées en amont (voir la mise à jour du 23 octobre). La suite décrit l'historique du patch.
103
+
100
104
  Ces quatre protections restent nécessaires en **3.4.4**, puis en **3.6.1**, dont les fichiers patchés sont identiques à ceux de 3.4.4 : l'amont n'a ajouté ni `dispose()` de canvas, ni contrôle d'`insertRecording`, ni garde du snapshot nul, et sa factory d'`ImageProvider` n'a pas changé. Le `dispose()` rebasé remet la surface au `Dispatcher` de son thread créateur, comme le fait désormais le destructeur amont du canvas. Le reste de cette section décrit le patch d'origine.
101
105
 
102
106
  Dans Skia 3.0.3 et encore dans les sources 3.0.6, le wrapper `JsiSkCanvas` peut garder une référence propriétaire à la surface dont il provient. Disposer uniquement le wrapper `SkSurface` ne ferme donc pas cette référence tant que le canvas est encore détenu ; attendre le GC pour les surfaces temporaires est insuffisant pour une fermeture déterministe.
@@ -113,7 +117,7 @@ La [source Skia de ce build](https://chromium.googlesource.com/skia/+/2466dcf393
113
117
 
114
118
  Fichiers inspectables :
115
119
 
116
- - [`patches/react-native-skia+3.6.1.patch`](../patches/react-native-skia+3.6.1.patch) : diff du correctif courant, identique à celui de 3.4.4 ; ceux de 3.4.4 et 3.0.6 sont conservés comme historique.
120
+ - [`patches/react-native-skia+3.7.4.patch`](../patches/react-native-skia+3.7.4.patch) : diff du correctif courant ; ceux des versions précédentes sont conservés comme historique.
117
121
  - [`scripts/skia-canvas-patch.json`](../scripts/skia-canvas-patch.json) : version, empreintes avant/après et substitutions attendues.
118
122
  - [`scripts/apply-skia-canvas-patch.mjs`](../scripts/apply-skia-canvas-patch.mjs) : vérifie tout avant toute écriture, accepte un patch déjà appliqué, refuse un paquet différent.
119
123
 
@@ -179,6 +183,15 @@ Le patch ajoute également une méthode privée `__rnskvTrimRecorderCache` : ell
179
183
 
180
184
  Lors d'une mise à jour amont, vérifier séparément la correction de la factory, l'affinité de thread du Recorder, les erreurs de soumission et une éventuelle API officielle de nettoyage. Ne pas remplacer cette politique limitée par une purge globale à chaque frame.
181
185
 
186
+ ## Piste testée : Graphite échantillonne le YUV du décodeur — 24 octobre 2026
187
+
188
+ Sur Android, l'export convertit chaque buffer YUV de l'`ImageReader` en RGBA (une passe WebGPU par frame), puis Skia échantillonne cette texture. Le Skia Graphite précompilé sait échantillonner un `OpaqueYCbCrAndroid` directement, à travers un sampler YCbCr Vulkan (`DawnTextureInfo::fYcbcrVkDescriptor`, `DawnDescriptorToImmutableSamplerInfo`). Un prototype l'a fait marcher sur le Pixel 8a :
189
+ - RN Skia demande `YCbCrVulkanSamplers` et `StaticSamplers` au device, en plus d'`OpaqueYCbCrAndroidForExternalTexture` ;
190
+ - une méthode `Skia.Image.MakeImageFromYCbCrTexture(texture, hardwareBuffer)` lit le descripteur avec `wgpu::Device::GetAHardwareBufferProperties` et enveloppe la texture de `importSharedTextureMemory` ;
191
+ - l'export ouvre l'accès du buffer à l'import et le ferme quand la frame est libérée ; la frame porte le recadrage et la rotation du buffer, comme une frame `direct`.
192
+
193
+ La passe de conversion disparaît (attente GPU d'une frame 8×4K → 1080 : 2,7 → 1,2 ms), mais la durée des exports ne change pas : une fois l'attente GPU différée et les indices ADPF en place, le bloc codec (décodage 4K et encodage) limite le débit. Les octets exportés changent aussi (reconstruction de la chrominance par le sampler), ce qui demanderait une qualification d'image. Le prototype n'a donc pas été gardé ; il reste à reprendre si un cas devient limité par le GPU (plusieurs couches 4K, GPU plus modeste). Mesures : [vérification 3.7.4](../migration/skia-3.7.4/verification.md#améliorations-du-24-octobre).
194
+
182
195
  ## Référence fournie : `enzomanuelmangano/demos`
183
196
 
184
197
  Le [dépôt de démos](https://github.com/enzomanuelmangano/demos) est utile pour choisir des scènes visuelles : transitions, reflets de shader et interactions pilotées par des valeurs partagées. Le [manifest consulté](https://github.com/enzomanuelmangano/demos/blob/main/package.json) fixe encore Skia 2.6.2 et WebGPU 0.5.14 ; ses patches de compatibilité ne sont donc pas une preuve de compatibilité avec le couple désormais ciblé 3.0.6/0.12.1, ni avec le couple mesuré 3.0.3/0.11.0.
@@ -187,4 +200,4 @@ Les idées retenues pour les futurs adaptateurs sont une transition à progressi
187
200
 
188
201
  ## Procédure de mise à jour
189
202
 
190
- Pour chaque nouvelle version Skia : relever le couple Dawn/WebGPU et les versions RN/Reanimated/Worklets compatibles, relire les imports/sorties de buffers, les soumissions vérifiées, la fermeture canvas/snapshot et les budgets/caches Graphite, revoir les empreintes, compiler les deux plateformes, exécuter les tests de pixels/timestamps puis les **65 workloads du catalogue `2026-10-07.1`** (59 historiques, trois lectures continues `copy` et leurs trois équivalents `direct`) et les sessions longues. La configuration iPhone déjà compilée pour la référence 3.0.3 utilise RN 0.86.2, Reanimated 4.5.3 et Worklets 0.11.3 ; ces versions sont conservées pour la migration 3.0.6. Ne pas laisser une plage ouverte sélectionner une autre version sans refaire l'installation native. Documenter la version et le transport effectif dans les résultats. La présence d'un cas dans le catalogue ne signifie pas qu'il a été exécuté sur toutes les cibles. Une correction amont ou des tests de l'hôte verts seuls ne justifient pas de supprimer un garde-fou mémoire.
203
+ Pour chaque nouvelle version Skia : relever le couple Dawn/WebGPU et les versions RN/Reanimated/Worklets compatibles, relire les imports/sorties de buffers, les soumissions vérifiées, la fermeture canvas/snapshot et les budgets/caches Graphite, revoir les empreintes, compiler les deux plateformes, exécuter les tests de pixels/timestamps puis les **67 workloads du catalogue `2026-10-07.1`** (59 historiques, trois lectures continues `copy` et leurs trois équivalents `direct`, plus les deux exports 4K → 4K ajoutés le 24 octobre 2026 sans changer les autres) et les sessions longues. La configuration iPhone déjà compilée pour la référence 3.0.3 utilise RN 0.86.2, Reanimated 4.5.3 et Worklets 0.11.3 ; ces versions sont conservées pour la migration 3.0.6. Ne pas laisser une plage ouverte sélectionner une autre version sans refaire l'installation native. Documenter la version et le transport effectif dans les résultats. La présence d'un cas dans le catalogue ne signifie pas qu'il a été exécuté sur toutes les cibles. Une correction amont ou des tests de l'hôte verts seuls ne justifient pas de supprimer un garde-fou mémoire.
@@ -9,10 +9,8 @@ export const getVideoCanvas = surface => {
9
9
  throw new Error("Skia checked submission patch is missing from the native binary. Apply the patch and rebuild the native app.");
10
10
  }
11
11
  checked.enableCheckedSubmissions();
12
- const canvas = surface.getCanvas();
13
- if (typeof canvas.dispose !== "function") {
14
- throw new Error("Skia canvas lifecycle patch is missing from the native binary. Apply the patch and rebuild the native app.");
15
- }
16
- return canvas;
12
+ // Owned by the surface: its dispose() detaches the canvas, and drawing on
13
+ // it throws from then on.
14
+ return surface.getCanvas();
17
15
  };
18
16
  //# sourceMappingURL=canvas.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getVideoCanvas","surface","checked","enableCheckedSubmissions","Error","canvas","getCanvas","dispose"],"sourceRoot":"../../src","sources":["canvas.ts"],"mappings":";;AAEA;AACA,OAAO,MAAMA,cAAc,GAAIC,OAAkB,IAAe;EAC9D,SAAS;;EACT,MAAMC,OAAO,GAAGD,OAEf;EACD,IAAI,OAAOC,OAAO,CAACC,wBAAwB,KAAK,UAAU,EAAE;IAC1D,MAAM,IAAIC,KAAK,CACb,8GACF,CAAC;EACH;EACAF,OAAO,CAACC,wBAAwB,CAAC,CAAC;EAClC,MAAME,MAAM,GAAGJ,OAAO,CAACK,SAAS,CAAC,CAAC;EAClC,IAAI,OAAOD,MAAM,CAACE,OAAO,KAAK,UAAU,EAAE;IACxC,MAAM,IAAIH,KAAK,CACb,4GACF,CAAC;EACH;EACA,OAAOC,MAAM;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getVideoCanvas","surface","checked","enableCheckedSubmissions","Error","getCanvas"],"sourceRoot":"../../src","sources":["canvas.ts"],"mappings":";;AAEA;AACA,OAAO,MAAMA,cAAc,GAAIC,OAAkB,IAAe;EAC9D,SAAS;;EACT,MAAMC,OAAO,GAAGD,OAEf;EACD,IAAI,OAAOC,OAAO,CAACC,wBAAwB,KAAK,UAAU,EAAE;IAC1D,MAAM,IAAIC,KAAK,CACb,8GACF,CAAC;EACH;EACAF,OAAO,CAACC,wBAAwB,CAAC,CAAC;EAClC;EACA;EACA,OAAOF,OAAO,CAACI,SAAS,CAAC,CAAC;AAC5B,CAAC","ignoreList":[]}
@@ -5,7 +5,7 @@ import { Platform } from "react-native";
5
5
  import { BlendMode, Skia } from "react-native-skia";
6
6
  import { createNativeVideoGpuFrame, getVideoGpuDevice, nativeVideoTextureUsage } from "./gpuDevice.js";
7
7
  import { frameByteSize, releaseVideoMemory, reserveVideoMemory } from "./memory.js";
8
- import { blitNv12Frame, blitYuvFrame, releaseYuvImports, yuvFrameOrigin } from "./yuvBlit.js";
8
+ import { blitNv12Frame, blitYuvFrame, releaseYuvImports, yuvFrameRegion } from "./yuvBlit.js";
9
9
 
10
10
  /** A decoded frame sampled in place, without an owned snapshot: a BGRA
11
11
  * frame's IOSurface on iOS, or for a YUV frame (Android, iOS NV12) its
@@ -106,10 +106,7 @@ const importYuvExportFrame = (imports, frame) => {
106
106
  // iOS NV12: the whole buffer, in decoded orientation.
107
107
  const nv12 = source.format === "nv12";
108
108
  if (nv12 && (entry.nativeFrame.width !== frame.width || entry.nativeFrame.height !== frame.height)) throw new Error("Native video buffer dimensions mismatch");
109
- const origin = nv12 ? {
110
- x: 0,
111
- y: 0
112
- } : yuvFrameOrigin(source.region, rotation, entry.nativeFrame, frame);
109
+ const region = nv12 ? null : yuvFrameRegion(source.region, rotation, entry.nativeFrame);
113
110
  const device = getVideoGpuDevice();
114
111
  target = imports.textures.get(producer);
115
112
  if (target && (target.texture.width !== frame.width || target.texture.height !== frame.height)) {
@@ -141,7 +138,7 @@ const importYuvExportFrame = (imports, frame) => {
141
138
  }
142
139
  // Can throw after submitting: drain below before giving the lease back.
143
140
  submitted = true;
144
- if (nv12) blitNv12Frame(device, entry.nativeFrame, target.texture);else blitYuvFrame(device, imports.yuv, producer, entry.nativeFrame, rotation, origin, frame.width, frame.height, target.texture);
141
+ if (nv12) blitNv12Frame(device, entry.nativeFrame, target.texture);else blitYuvFrame(device, imports.yuv, producer, entry.nativeFrame, rotation, region, target.texture);
145
142
  entry.image = Skia.Image.MakeImageFromGPUTexture(target.texture);
146
143
  if (!entry.image) throw new Error("Cannot wrap the decoded frame");
147
144
  return entry;
@@ -237,8 +234,9 @@ export const releaseExportFrames = imports => {
237
234
 
238
235
  /** The export counterpart of ownVideoFrames on iOS: decoded frames are drawn
239
236
  * in place, and a producer's previous frame is released once its next one is
240
- * imported, since every exported frame ends with a checked GPU wait. Other
241
- * frames, or every frame after a first failed import, use `fallback`. */
237
+ * imported, since the export waits for the GPU to complete a frame before it
238
+ * imports the next one. Other frames, or every frame after a first failed
239
+ * import, use `fallback`. */
242
240
  export const ownExportFrames = (imports, decoded, fallback) => {
243
241
  "worklet";
244
242
 
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","BlendMode","Skia","createNativeVideoGpuFrame","getVideoGpuDevice","nativeVideoTextureUsage","frameByteSize","releaseVideoMemory","reserveVideoMemory","blitNv12Frame","blitYuvFrame","releaseYuvImports","yuvFrameOrigin","convertsYuv","OS","createExportFrameImports","entries","Map","producers","Set","enabled","imported","textures","yuv","canImportInPlace","frame","texture","kind","id","undefined","region","releaseExportFrame","entry","image","dispose","accessing","memory","ended","endAccess","state","fences","fence","destroy","nativeFrame","release","releaseProducerTexture","imports","producer","target","get","reservation","delete","importYuvExportFrame","producerId","source","submitted","nativeBuffer","rotation","nv12","format","width","height","Error","origin","x","y","device","createTexture","size","usage","label","error","set","Image","MakeImageFromGPUTexture","drain","Surface","MakeFromGPUTexture","getCanvas","drawColor","Color","Clear","flush","importExportFrame","pixelFormat","importSharedTextureMemory","handle","beginAccess","releaseExportFrames","keys","ownExportFrames","decoded","fallback","owned","held","current","key","Object","seen","next","console","warn","String","add","aliases","WeakSet","has","crop","values","rest","copying"],"sourceRoot":"../../src","sources":["exportFrames.ts"],"mappings":";;AAAA;AACA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,SAAS,EAAEC,IAAI,QAAQ,mBAAmB;AAOnD,SACEC,yBAAyB,EACzBC,iBAAiB,EACjBC,uBAAuB,QAClB,gBAAa;AACpB,SACEC,aAAa,EACbC,kBAAkB,EAClBC,kBAAkB,QACb,aAAU;AAEjB,SACEC,aAAa,EACbC,YAAY,EACZC,iBAAiB,EACjBC,cAAc,QACT,cAAW;;AAGlB;AACA;AACA;AACA;;AAaA;;AAGA;AACA;;AA4BA;AACA;AACA,MAAMC,WAAW,GAAGb,QAAQ,CAACc,EAAE,KAAK,SAAS;AAE7C,OAAO,MAAMC,wBAAwB,GAAGA,CAAA,KAA0B;EAChE,SAAS;;EACT,OAAO;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IAAI;QACFH,KAAK,CAACS,OAAO,GAAG,CAAC;MACnB,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;IACA,MAAMqC,KAAK;EACb;EACA;EACA,MAAMsC,IAAgC,GAAG,CAAC,CAAC;EAC3C,IAAIC,OAAO,GAAG,KAAK;EACnB,KAAK,MAAM,CAACd,GAAG,EAAEvE,KAAK,CAAC,IAAIwE,MAAM,CAACjF,OAAO,CAAC2E,OAAO,CAAC,EAAE;IAClD,IAAIG,IAAI,CAACY,GAAG,CAACjF,KAAK,CAAC,EAAE;IACrBoF,IAAI,CAACb,GAAG,CAAC,GAAGvE,KAAK;IACjBqF,OAAO,GAAG,IAAI;EAChB;EACA,OAAOA,OAAO,GAAG;IAAE,GAAGjB,KAAK;IAAE,GAAGD,QAAQ,CAACiB,IAAI;EAAE,CAAC,GAAGhB,KAAK;AAC1D,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","BlendMode","Skia","createNativeVideoGpuFrame","getVideoGpuDevice","nativeVideoTextureUsage","frameByteSize","releaseVideoMemory","reserveVideoMemory","blitNv12Frame","blitYuvFrame","releaseYuvImports","yuvFrameRegion","convertsYuv","OS","createExportFrameImports","entries","Map","producers","Set","enabled","imported","textures","yuv","canImportInPlace","frame","texture","kind","id","undefined","region","releaseExportFrame","entry","image","dispose","accessing","memory","ended","endAccess","state","fences","fence","destroy","nativeFrame","release","releaseProducerTexture","imports","producer","target","get","reservation","delete","importYuvExportFrame","producerId","source","submitted","nativeBuffer","rotation","nv12","format","width","height","Error","device","createTexture","size","usage","label","error","set","Image","MakeImageFromGPUTexture","drain","Surface","MakeFromGPUTexture","getCanvas","drawColor","Color","Clear","flush","importExportFrame","pixelFormat","importSharedTextureMemory","handle","beginAccess","releaseExportFrames","keys","ownExportFrames","decoded","fallback","owned","held","current","key","Object","seen","next","console","warn","String","add","aliases","WeakSet","has","crop","values","rest","copying"],"sourceRoot":"../../src","sources":["exportFrames.ts"],"mappings":";;AAAA;AACA,SAASA,QA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