Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
4 changes: 1 addition & 3 deletions impeller/aiks/experimental_canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ void ExperimentalCanvas::SaveLayer(
// Validation failures are logged in FlipBackdrop.
return;
}
FlushPendingClips();

backdrop_filter_contents = backdrop_filter_proc(
FilterInput::Make(std::move(input_texture)),
Expand Down Expand Up @@ -468,8 +469,6 @@ void ExperimentalCanvas::SaveLayer(
clip_coverage_stack_.PushSubpass(subpass_coverage, GetClipHeight());

if (backdrop_filter_contents) {
FlushPendingClips();

// Render the backdrop entity.
Entity backdrop_entity;
backdrop_entity.SetContents(std::move(backdrop_filter_contents));
Expand Down Expand Up @@ -759,7 +758,6 @@ void ExperimentalCanvas::AddRenderEntityToCurrentPass(Entity entity,
if (!input_texture) {
return;
}

FlushPendingClips();

// The coverage hint tells the rendered Contents which portion of the
Expand Down
8 changes: 5 additions & 3 deletions impeller/display_list/dl_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ namespace impeller {
// The watchdog object allocated here will automatically double-check
// the depth usage at any exit point to the function, or any other
// point at which it falls out of scope.
#define AUTO_DEPTH_WATCHER(d) \
DepthWatcher _watcher(__FILE__, __LINE__, GetCanvas(), d)
#define AUTO_DEPTH_WATCHER(d) \
DepthWatcher _watcher(__FILE__, __LINE__, GetCanvas(), \
paint_.mask_blur_descriptor.has_value(), d)

// While the AUTO_DEPTH_WATCHER macro will check the depth usage at
// any exit point from the dispatch function, sometimes the dispatch
Expand All @@ -75,11 +76,12 @@ struct DepthWatcher {
DepthWatcher(const std::string& file,
int line,
const impeller::Canvas& canvas,
bool has_mask_blur,
int allowed)
: file_(file),
line_(line),
canvas_(canvas),
allowed_(allowed),
allowed_(has_mask_blur ? allowed : (allowed + 1)),
Copy link
Contributor

Choose a reason for hiding this comment

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

That looks OK. We might fail to trigger on some ops that don't use MF if an MF is accidentally set, but we won't get spurious failures at least. In the long run I actually think we want to consolidate the depth accounting in Impeller. We need to do a pre-pass to manage the text cache and to plan the ordering of ops, so we could just as easily compute depths as well during that phase. Then the accounting is all in (basically) one class where it can't get out of synch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's not a bad idea, plus if we do any sort of sorting we'll have a prepass anyway - and the text cache isn't going away anytime soon.

old_depth_(canvas.GetOpDepth()),
old_max_(canvas.GetMaxOpDepth()) {}

Expand Down