Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] Color and monochrome glyphs should get their own atlases. #116818

Closed
chinmaygarde opened this issue Dec 10, 2022 · 2 comments · Fixed by flutter/engine#41780
Closed
Labels
e: impeller Impeller rendering backend issues and features requests engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list

Comments

@chinmaygarde
Copy link
Member

We assume all glyphs are full color and allocate an 8888 atlas. This is unnecessary in most cases and causes a quadrupling of glyph atlas texture memory.

@chinmaygarde chinmaygarde added engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list e: impeller Impeller rendering backend issues and features requests labels Dec 10, 2022
@chinmaygarde chinmaygarde added this to the Impeller on iOS milestone Dec 10, 2022
@jonahwilliams
Copy link
Member

We only conditionally use a full color atlas if there is at least one bitmap or colr font, but still there is a loss of efficiency if there is a single one. w.r.t. to this issue and issues for path based rendering, I think there is still a decision to make on how to split up a text run if there is a mix of monochrome glyphs, color/bitmap, or large (path based) glyphs

@chinmaygarde chinmaygarde removed this from the Impeller on iOS milestone Mar 1, 2023
auto-submit bot pushed a commit to flutter/engine that referenced this issue May 10, 2023
Creates a separate atlas context and cache for color and alpha bitmap glyphs. Removes SDF shader and uses separate shader for full color glyphs.

Requires #41754

Fixes flutter/flutter#116818
Fixes flutter/flutter#126101

This also fixes #39383 but for light text on a dark background. This problem crops up when we switch to a full color atlas. In this context, the chosen glyph color is important. But with the alpha channel only atlas, its irrelevant.

See diff:

![image](https://user-images.githubusercontent.com/8975114/236598809-f4434764-cd16-4489-9644-4e9a370de7ee.png)

Example app:

```dart
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

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

void main() =>
  runApp(
    Container(
      alignment: Alignment.center,
     child: Text(
      '''
 (Unicode Conference)� ا�ذ� س�ع�د �� 10-12 آذار 1997 ب�د��ة ��ا����ت�س� أ��ا��ا. � س�ج�ع ا��ؤت�ر ب�� خبراء �� �ا�ة �طاعات ا�ص�اعة ع�� ا�شب�ة ا�عا���ة ا�تر��ت �������د� ح�ث ستت�� ع�� ا�صع�د�� ا�د��� �ا��ح�� ع�� حد س�اء ��ا�شة سب� استخدا� �����د �� ا��ظ� ا��ائ�ة ����ا �خص ا�تطب��ات ا�حاس�ب�ة� ا�خط�ط� تص��� ا��ص�ص �ا�ح�سبة �تعددة ا��غات.

������������� � � � �''',
textDirection: TextDirection.rtl, style: TextStyle(fontSize: 24, color: Colors.white),
     ),
    ),
  );

```
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
e: impeller Impeller rendering backend issues and features requests engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants