Reverts "[Impeller] Use the scissor to limit all draws by clip coverage. (#51698)" (#51728)

Reverts: flutter/engine#51698
Initiated by: bdero
Reason for reverting: Golden breakage on framework tree -- https://flutter-gold.skia.org/search?issue=145855&crs=github&patchsets=4&corpus=flutter
Original PR Author: bdero

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
Attempts to improve https://github.com/flutter/flutter/issues/145274.

Our new clipping technique paints walls on the depth buffer "in front" of the Entities that will be affected by said clips. So when an intersect clip is drawn (the common case), the clip will cover the whole framebuffer.

Depth is divvied up such that deeper clips get drawn _behind_ shallower clips, and so many clips actually don't end up drawing depth across the whole framebuffer. However, if the app does a lot of transitioning from a huge clips to a small clips, a lot of unnecessary depth churn occurs (very common in Flutter -- this happens with both the app bar and floating action button in the counter template, for example).

Since progressively deeper layers in the clip coverage stack always subset their parent layers, we can reduce waste for small intersect clips by setting the scissor to the clip coverage rect instead of drawing the clip to the whole screen.

Note that this change _does not_ help much with huge/fullscreen clips.

Also, we could potentially improve this further by computing much stricter bounds. Rather than just using clip coverage for the scissor, we could intersect it with the union of all draws affected by the clip at the cost of a bit more CPU churn per draw. I don't think that's enough juice for the squeeze though.

Before (`Play/AiksTest.CanRenderNestedClips/Metal`):

https://github.com/flutter/engine/assets/919017/7858400f-793a-4f7b-a0e4-fa3581198beb

After (`Play/AiksTest.CanRenderNestedClips/Metal`):

https://github.com/flutter/engine/assets/919017/b2f7c96d-a820-454d-91df-f5fae4976e91
4 files changed
tree: a4d270c327b7c7cc2f538477a204e77d644ab9aa
  1. .github/
  2. assets/
  3. benchmarking/
  4. bin/
  5. build/
  6. build_overrides/
  7. ci/
  8. common/
  9. display_list/
  10. docs/
  11. examples/
  12. flow/
  13. flutter_frontend_server/
  14. flutter_vma/
  15. fml/
  16. impeller/
  17. lib/
  18. runtime/
  19. shell/
  20. skia/
  21. sky/
  22. testing/
  23. third_party/
  24. tools/
  25. vulkan/
  26. wasm/
  27. web_sdk/
  28. .ci.yaml
  29. .clang-format
  30. .clang-tidy
  31. .gitattributes
  32. .gitignore
  33. .pylintrc
  34. .style.yapf
  35. analysis_options.yaml
  36. AUTHORS
  37. BUILD.gn
  38. CODEOWNERS
  39. CONTRIBUTING.md
  40. DEPS
  41. Doxyfile
  42. LICENSE
  43. README.md
README.md

Flutter Engine

Flutter CI Status OpenSSF Scorecard SLSA 1

Flutter is Google's SDK for crafting beautiful, fast user experiences for mobile, web, and desktop from a single codebase. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.

The Flutter Engine is a portable runtime for hosting Flutter applications. It implements Flutter's core libraries, including animation and graphics, file and network I/O, accessibility support, plugin architecture, and a Dart runtime and compile toolchain. Most developers will interact with Flutter via the Flutter Framework, which provides a modern, reactive framework, and a rich set of platform, layout and foundation widgets.

If you want to run/contribute to Flutter Web engine, more tooling can be found at felt. This is a tool written to make web engine development experience easy.

If you are new to Flutter, then you will find more general information on the Flutter project, including tutorials and samples, on our Web site at Flutter.dev. For specific information about Flutter's APIs, consider our API reference which can be found at the docs.flutter.dev.

Flutter is a fully open source project, and we welcome contributions. Information on how to get started can be found at our contributor guide.