Skia Offscreen Renderer

New build is in the making which should fix all your remaining issues. Framerate should be at stable 60 and for async image writing have a look at the attached patch - modified version of yours which adds a ImageWriter (Async) node. Should probably go to VL.Skia itself.

In any case you’ll need the latest preview build (>= 2021.4.0-0231) to run the patch:
ImageWriter_Async.vl (76.6 KB)

For reference I’ll post the relevant git changelog here as well:

  • All rendering on a thread is now done with exactly one graphics context and the lifetime of images can be controlled via ref counting
  • Replaces all usages of GLControl/SKGLControl with our own SkiaGLControl - patch editor, tooltips and renderer nodes all use the same control now
  • The SkiaGLControl as well as the offscreen renderers use one graphics context per thread. Gets rid of expensive context creation/switching.
  • The default resource limit of a Skia graphics context has been increased from 96MB to 512MB
  • Removes the Renderer (Offscreen Accelerated) node - all rendering is hardware accelerated
  • Adds new nodes Using (RefCount) and Producing (RefCount) to reference count specific resources.
  • The lifetime of the output image of the Renderer (Offscreen) is controlled by a Producing node, while nodes such as FrameDelay, S+H and HoldLatest use a Using node - that combination allows for easy feedback loops of Skia images without having to create unnecessary copies each frame. Note that this pattern could also be extended to other resource types (like OpenCV or Stride).
  • Fixes widget views used by tooltips and IO boxes not being disposed
  • Fixes Synchronizer regions (used by widget viewers) not implementing IDisposable
  • Resize node now using offscreen renderer - this improves the rendering performance of tooltips and IO boxes drastically (FPS going up from ~3 to stable 60)
  • Default value of SKImage is again one single image
  • Image and layer viewers first resize then use new ToRasterImage node - sadly the GPU image can’t be used on another thread (see Perform device to host texture transfer on the IO thread. · Issue #44148 · flutter/flutter · GitHub)
  • GPU image and GL context now get linked - prevents access violation on shutdown
8 Likes