Skip to content

[GPU 08/20] Integrate GPU canvas images into Uno Skia composition #30

Open

Description

@danwalmsley

Parent epic: #22
Implementation order: 08 of 20.
Depends on: #26, #27, #28.

Outcome

Provide the same retained GPU canvas behavior in Uno without the supplied GLCanvasElement CPU readback path.

Implementation

  • Extend UnoNativeSceneSurface and its composition integration to consume the new image-lease scene contract while retaining shared renderer logic.
  • Add a typed Uno compositor graphics-context/image-import hook. SKCanvasElement's SKCanvas-only callback is not proof of sufficient device/synchronization access; implement a pinned integration extension where required.
  • Draw GPU images in the actual Skia scene with DOM order, clipping, transforms, alpha and RasterizationScale preserved.
  • Do not use GLCanvasElement as the transport: the pinned implementation calls ReadPixels into a WriteableBitmap.
  • Isolate SkiaSharp 3.119.2 ownership from Avalonia's SkiaSharp version. Share the portable scene/native texture contract, never incompatible Skia object pointers.
  • Connect image readiness/reuse to Uno's actual GPU execution completion. Preserve composition-clock scheduling, bounded ordered scene consumption, expose repaint and input behavior.
  • Handle device/context loss, unload/reload, host-window replacement, DPI changes and unsupported host routes.
  • Reuse imported resources by generation, with bounded pools/caches and zero per-draw managed GPU API calls.

Tests

  • Actual Uno windows on win-x64, osx-arm64 and linux-x64 using both native producers.
  • Interleaved DOM/Canvas2D/GPU content, transparency, nested clip/transform, scroll and DPR/resize.
  • Unload/reload, missing renderer, delayed fences, device recreation and repeated engine replacement.
  • Compare common pixel fixtures and resource-lifetime tests with Avalonia; run existing Uno SDK/package tests.

Verification evidence

Provide real presented-pixel results, supported Uno host/backend matrix, framework patch IDs, copy counters and GPU-completion timeline. Show explicitly that GLCanvasElement/WriteableBitmap readback is absent.

Acceptance

  • Both producer APIs compose correctly on the three initial Uno desktop targets.
  • Zero CPU readback/upload during normal presentation.
  • Host GPU completion controls image reuse.
  • Correct clipping/order/DPI/input and no cross-Skia ABI mixing.
  • Existing Uno behavior and clean package consumers remain functional.

Completion requirements

Link the implementation PR, exact test commands, native/runtime/framework revisions and verification artifacts before closing. Follow the epic's architecture and copy/lifetime invariants. Any unavailable mandatory hardware or missing required functionality remains incomplete, not a pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions