Skip to content

[Impeller] GL backend has a race around surface setup and toImage/toImageSync #124635

@dnfield

Description

@dnfield

See #124181

This code:

import 'dart:ui';

void main() async {
  final recorder = PictureRecorder();
  final canvas = Canvas(recorder);

  canvas.drawCircle(Offset.zero, 10, Paint());

  final picture = recorder.endRecording();

  final image = picture.toImageSync(20, 20); // Image was null
  final byteData = await image.toByteData(
    format: ImageByteFormat.png,
  );
  print(byteData!.buffer.asUint32List());
}

May fail even after flutter/engine#41059, because we need to make sure the GL context is current before doing the rendering.

This isn't a problem on Metal or Vulkan, where there's no current context to worry about, so I'd like to land the fix for Metal independently of GLES - especially since that patch is already pretty large and will be looking to cherry pick it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions