Skip to content

[WASM] Repaint only damaged regions on WebGL #26040

Open

Description

@MartinZikmund

What would you like to be added? 💡

WebAssembly's WebGL host should repaint only the damaged regions of a frame, like the other Skia hosts already do, instead of repainting the whole canvas every frame.

Today WasmGLGraphicsContext.PreservesContents is always false, so the compositor's damage-region path never runs on WASM WebGL (the default WASM backend). The onscreen canvas is also created with antialias: 1 (4x MSAA) and a depth buffer, though Skia uses neither: it does its own coverage AA, and it is told the surface has 0 samples.

Why is this needed? 🤔

On low-powered devices (weak, fill-rate- and bandwidth-bound GPUs), the full-canvas repaint and the MSAA resolve cap the frame rate even for tiny animations. Measured on SamplesApp's Progress/ProgressRing at 2560x1600, with Chrome forced onto SwiftShader as a weak-GPU proxy:

fps
current (MSAA canvas, full repaint) 23-25
MSAA dropped, still full repaint 47
preserved drawing buffer + damage repaint 101-107

With a weak CPU as well (SwiftShader + 4x CPU throttle): 26.6 to 38.7 fps when interpreted, 26.7 to 65.9 fps with profiled AOT.

For which platforms 📱💻🖥️

WebAssembly

Anything else we need to know? 💬

Retaining frames through an offscreen FBO and blitFramebuffer was measured too, and it is slower (18.6 fps): the full-canvas copy outweighs the savings. preserveDrawingBuffer avoids that copy.

The damage clip itself (SkiaPresentSession.ClipToDamage) was antialiased and fractional, which blends cleared and redrawn edge pixels with the retained ones on every host that keeps frames.

Activity

  1. self-assigned this
    on Nov 4, 2026
  2. added
    kind/enhancement
    platform/wasm 🌐
    triage/untriaged
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/enhancementplatform/wasm 🌐triage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions