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

Conversation

@bdero
Copy link
Member

@bdero bdero commented Apr 14, 2023

Part of: flutter/flutter#124819.

Adds an offscreen texture checkerboarding feature with an overridable color picker. By default, it should look the same as our current checkerboarding for Skia. It can be turned on/off at any time while recording commands.

  Canvas canvas;

  canvas.debug_options.offscreen_texture_checkerboard = true;

  // ...draw something that uses offscreen textures...

For hooking this up with the framework, we could either snake a global setting through to the context, or sneak it in through the DL as, say, a scoped SaveLayer option.

Video of checkerboards getting rendered to offscreen textures only:

Screen.Recording.2023-04-14.at.12.29.55.AM.mov

New golden:
Screenshot 2023-04-14 at 12 59 53 AM

@bdero bdero requested a review from chinmaygarde April 14, 2023 08:27
@bdero bdero self-assigned this Apr 14, 2023
@bdero bdero force-pushed the bdero/checkerboard branch from bd97b1a to 9056d73 Compare April 14, 2023 08:31
@flar
Copy link
Contributor

flar commented Apr 14, 2023

I don't think it should be a property of a DL as you might want to render a DL with and without the effect. Making it a property of the Impeller and DlSkCanvas Dispatchers might be a better fit? DlSkCanvas might also want to support it for when we render directly to Skia.


namespace impeller {

using CheckerboardPipeline =
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we conditionally include this shader in flutter runtime mode debug/profile mode only?

Copy link
Member

Choose a reason for hiding this comment

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

+1. If we have a tons of these, we could also put them in a debug folder.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

Consider moving all the checkerboarding stuff into a separate debug options struct. Also, allowing the caller to control checkerboarding maybe something we don't want to do to make checkerboaring more useful in the future.


namespace impeller {

using CheckerboardPipeline =
Copy link
Member

Choose a reason for hiding this comment

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

+1. If we have a tons of these, we could also put them in a debug folder.


Canvas::Canvas() {
Canvas::Canvas()
: checkerboard_color_proc_([]() {
Copy link
Member

Choose a reason for hiding this comment

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

This is perhaps too configurable? Can we just make up this pattern ourselves? Or make this an implementation detail?

Copy link
Member

Choose a reason for hiding this comment

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

I should clarify my thinking here. I was hoping to make the checkerboarding more useful by perhaps having nested save layers be rendered differently (via progressively darkening overlays maybe).

Copy link
Member Author

Choose a reason for hiding this comment

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

Making the color non-configurable/just based on depth SGTM, but what about textures at the same depth? Maybe we can kick that can down the road, but it might make sense to make the edges of checkerboarded textures look distinct by rendering a solid border a few pixels wide.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, should color remain consistent between frames?

It seems that hue should vary within a level, but darkness or opacity changes as you increase the level?

Copy link
Member Author

@bdero bdero Apr 14, 2023

Choose a reason for hiding this comment

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

I made the checkerboards red with 0.25 alpha + get progressively darker based on depth. At level >= 5 it's just black. I can add a little space division identifier in a follow-up and hue shift based on it -- this kind of thing will be useful for other tooling as well, and will be deterministic for multithreaded encoding.

FML_DCHECK(base_pass_->GetSubpassesDepth() == 1u);
}

void Canvas::SetEnableOffscreenCheckerboard(bool enabled) {
Copy link
Member

Choose a reason for hiding this comment

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

We could have this and other debugging options separated into a debug options struct that can be assigned to the canvas.

Copy link
Member Author

@bdero bdero Apr 14, 2023

Choose a reason for hiding this comment

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

Done. PTAL at the new DebugOptions struct.

@bdero bdero force-pushed the bdero/checkerboard branch 2 times, most recently from fb5b058 to 1919f03 Compare April 14, 2023 20:00
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM!

@bdero bdero requested a review from chinmaygarde April 14, 2023 20:53
Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

LGTM.

I am not sure I followed Jims comment about this being a DL property. It doesn't seem to be.

@bdero bdero force-pushed the bdero/checkerboard branch 3 times, most recently from d7088c9 to c754aef Compare April 15, 2023 00:20
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #41199 at sha c754aef

@bdero
Copy link
Member Author

bdero commented Apr 15, 2023

My new debug define isn't present when running the goldens. Gonna hold out on merging this until I work it out later.

@bdero bdero force-pushed the bdero/checkerboard branch from c754aef to 0d4cff8 Compare April 16, 2023 03:10
@bdero bdero force-pushed the bdero/checkerboard branch 2 times, most recently from 3706424 to 74dda19 Compare April 16, 2023 04:06
@bdero
Copy link
Member Author

bdero commented Apr 16, 2023

Oh, it's because the goldens run in release mode. I'll leave the test around, but this can't currently be verified with a golden.

@bdero bdero added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2023
@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #41199 at sha 74dda19

@bdero bdero merged commit a56b8f2 into flutter:main Apr 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 16, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 16, 2023
…124944)

flutter/engine@da0805a...4a998b7

2023-04-16 [email protected] Roll Skia from cc3404330d3b to 03c8e529196d (1 revision) (flutter/engine#41255)
2023-04-16 [email protected] Roll Skia from 2d0b05335104 to cc3404330d3b (1 revision) (flutter/engine#41254)
2023-04-16 [email protected] Roll Fuchsia Linux SDK from hacWN-gQSoWudziIS... to 46T4ZTAt48yPRDEn5... (flutter/engine#41253)
2023-04-16 [email protected] Roll Fuchsia Mac SDK from gI2knJ4Rh0yoK4Syd... to AAx6fLy6ykWVhXvNh... (flutter/engine#41252)
2023-04-16 [email protected] [Impeller] Add offscreen texture checkerboarding (flutter/engine#41199)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from hacWN-gQSoWu to 46T4ZTAt48yP
  fuchsia/sdk/core/mac-amd64 from gI2knJ4Rh0yo to AAx6fLy6ykWV

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
exaby73 pushed a commit to exaby73/flutter_nevercode that referenced this pull request Apr 17, 2023
…lutter#124944)

flutter/engine@da0805a...4a998b7

2023-04-16 [email protected] Roll Skia from cc3404330d3b to 03c8e529196d (1 revision) (flutter/engine#41255)
2023-04-16 [email protected] Roll Skia from 2d0b05335104 to cc3404330d3b (1 revision) (flutter/engine#41254)
2023-04-16 [email protected] Roll Fuchsia Linux SDK from hacWN-gQSoWudziIS... to 46T4ZTAt48yPRDEn5... (flutter/engine#41253)
2023-04-16 [email protected] Roll Fuchsia Mac SDK from gI2knJ4Rh0yoK4Syd... to AAx6fLy6ykWVhXvNh... (flutter/engine#41252)
2023-04-16 [email protected] [Impeller] Add offscreen texture checkerboarding (flutter/engine#41199)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from hacWN-gQSoWu to 46T4ZTAt48yP
  fuchsia/sdk/core/mac-amd64 from gI2knJ4Rh0yo to AAx6fLy6ykWV

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants