Skip to content

[Impeller] Large scale transforms prevent glyph atlas population. #136112

@tvolkert

Description

@tvolkert

Steps to reproduce

Run the following on macOS with --enable-impeller:

import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';

void main() {
  runApp(
    const Directionality(
      textDirection: TextDirection.ltr,
      child: _BugReport(
        child: Text('foo', style: TextStyle(fontSize: 300)),
      ),
    ),
  );
}

class _BugReport extends SingleChildRenderObjectWidget {
  const _BugReport({required super.child});

  @override
  _RenderBugReport createRenderObject(BuildContext context) => _RenderBugReport();
}

class _RenderBugReport extends RenderBox with RenderObjectWithChildMixin<RenderBox> {
  @override
  void performLayout() {
    size = constraints.biggest;
    child!.layout(constraints);
  }

  @override
  void paint(PaintingContext context, Offset offset) {
    // Modified from `makePerspectiveMatrix(0.001, 1.0, 1.0, 10.0)..translate(0.0, 0.0, -7000.0)`
    Matrix4 transform = Matrix4(
      2000,  0,       0,      0,
      0,     2000,    0,      0,
      0,        0,   -1,   9000,
      0,        0,   -1,   7000,
    );
    context.pushTransform(false, offset, transform, paintChild);
  }

  void paintChild(PaintingContext context, Offset offset) {
    context.paintChild(child!, offset);
  }
}

Expected results

You expect to see the "foo" text on a black screen. This is what you see when you run using Skia.

Actual results

Nothing is rendered, and the following error shows up in the console:

[ERROR:flutter/impeller/base/validation.cc(49)] Break on 'ImpellerValidationBreak' to inspect point of failure: Could not create valid atlas.
[ERROR:flutter/impeller/base/validation.cc(49)] Break on 'ImpellerValidationBreak' to inspect point of failure: Cannot render glyphs without prepared atlas.
[ERROR:flutter/impeller/base/validation.cc(49)] Break on 'ImpellerValidationBreak' to inspect point of failure: Failed to render entity.
[ERROR:flutter/shell/platform/embedder/embedder_external_view_embedder.cc(198)] Could not render into the embedder supplied render target.

Flutter version

[✓] Flutter (Channel main, 3.16.0-6.0.pre.29, on macOS 13.6 22G120 darwin-arm64, locale en)
    • Flutter version 3.16.0-6.0.pre.29 on channel main at /Users/tvolkert/project/flutter/flutter
    • Upstream repository [email protected]:flutter/flutter.git
    • Framework revision 5207a309e8 (8 minutes ago), 2023-10-07 02:51:32 -0400
    • Engine revision 8711c1fd21
    • Dart version 3.3.0 (build 3.3.0-0.0.dev)
    • DevTools version 2.28.1

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