Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Sep 28, 2023

This implements a portion of impeller canvas recorder that just prints log statements to understand what is getting rendered in impeller when executing code from the framework. Eventually this should get moved to the displaylist layer when we have golden and interactive tests at that layer.

This was useful for me to debug a fidelity issue, the hope is that others will find it useful and can expand it as necessary. Eventually the recordings can be used to generate tests.

design doc: go/impeller-canvas-recorder

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke gaaclarke marked this pull request as ready for review September 28, 2023 21:45
@gaaclarke
Copy link
Member Author

Copy link
Contributor

@matanlurey matanlurey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks super useful and I have no notes!

@gaaclarke gaaclarke merged commit 150d1b6 into flutter:main Sep 29, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 29, 2023
auto-submit bot pushed a commit that referenced this pull request Oct 4, 2023
…s not set. (#46476)

Internal bug: b/303067268

#46376 is causing a breakage to the internal engine build because of https://github.com/flutter/engine/blob/150d1b6ab51f34c07e21fc32ef76e4842edd4d04/impeller/aiks/canvas_recorder.h#L58-L62. Internally, we do not set `IMPELLER_TRACE_CANVAS`.

It looks like the cause is that the internal toolchain causes the `static_assert` to be compiled even though the template is not instantiated.

@chingjun helped me to figure out the following:

https://stackoverflow.com/questions/5246049/c11-static-assert-and-template-instantiation points us to the spec. In the later version (ISO/IEC 14882:2017(E)):

> The program is ill-formed, no diagnostic required, if ... no valid specialization can be generated for a template or a substatement of a constexpr if statement (9.4.1) within a template and the template is not instantiated,

<details>

<summary>The relevant section</summary>

![The relevant section of the spec](https://github.com/flutter/engine/assets/7111741/4503efcd-9479-4c7a-b4a1-7302dea1653b)

</details>

Interpretation: the compiler can either choose to emit the error caused by the `static_assert` or not. Currently the compiler used by the build here on LUCI does not; internally it does.

For example, the following links shows that simply changing the Clang version affects whether the error appears or not for a minimal template.

- ok: https://godbolt.org/z/n9nYrcvcP
- not ok: https://godbolt.org/z/fWcvdcn35

Hence, `#ifdef` out the class instead of using a `static_assert` for more consistent behavior across these two toolchains.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
This implements a portion of impeller canvas recorder that just prints
log statements to understand what is getting rendered in impeller when
executing code from the framework. Eventually this should get moved to
the displaylist layer when we have golden and interactive tests at that
layer.

This was useful for me to debug a fidelity issue, the hope is that
others will find it useful and can expand it as necessary. Eventually
the recordings can be used to generate tests.

design doc:
[go/impeller-canvas-recorder](http://goto.google.com/impeller-canvas-recorder)

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
…s not set. (#46476)

Internal bug: b/303067268

#46376 is causing a breakage to the internal engine build because of https://github.com/flutter/engine/blob/150d1b6ab51f34c07e21fc32ef76e4842edd4d04/impeller/aiks/canvas_recorder.h#L58-L62. Internally, we do not set `IMPELLER_TRACE_CANVAS`.

It looks like the cause is that the internal toolchain causes the `static_assert` to be compiled even though the template is not instantiated.

@chingjun helped me to figure out the following:

https://stackoverflow.com/questions/5246049/c11-static-assert-and-template-instantiation points us to the spec. In the later version (ISO/IEC 14882:2017(E)):

> The program is ill-formed, no diagnostic required, if ... no valid specialization can be generated for a template or a substatement of a constexpr if statement (9.4.1) within a template and the template is not instantiated,

<details>

<summary>The relevant section</summary>

![The relevant section of the spec](https://github.com/flutter/engine/assets/7111741/4503efcd-9479-4c7a-b4a1-7302dea1653b)

</details>

Interpretation: the compiler can either choose to emit the error caused by the `static_assert` or not. Currently the compiler used by the build here on LUCI does not; internally it does.

For example, the following links shows that simply changing the Clang version affects whether the error appears or not for a minimal template.

- ok: https://godbolt.org/z/n9nYrcvcP
- not ok: https://godbolt.org/z/fWcvdcn35

Hence, `#ifdef` out the class instead of using a `static_assert` for more consistent behavior across these two toolchains.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants