-
Notifications
You must be signed in to change notification settings - Fork 6k
Defer decisions about RasterCache actions until after Preroll is complete #31892
Changes from 1 commit
9f44aad
bb6a4cc
51ae333
bb86e3a
98b4ad6
2a0fbc3
9a71e09
0f60777
d53733e
4600cd6
7626d11
d88aff2
45b28cf
57a8d16
e4eb2a0
7e5af26
879ee10
2c038e9
829e9f4
91cf4e9
ba5694e
45448d4
dc089ad
2f1eb2f
473288b
a80a037
fd82489
d3883c6
3e1ed6c
a25e920
fd3bc8e
cdc123d
d8d373a
9e0e52b
9b68847
7c7fc4c
91f7278
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,7 +68,6 @@ void ImageFilterLayer::Preroll(PrerollContext* context, | |
|
|
||
| set_paint_bounds(child_bounds); | ||
|
|
||
| transformed_filter_ = nullptr; | ||
| transformed_filter_ = filter_->makeWithLocalMatrix(matrix); | ||
JsouLiang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (transformed_filter_) { | ||
| layer_raster_cache_item_->MarkCacheChildren(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is false then you need to turn this flag off.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Everytime when we entry the void LayerRasterCacheItem::PrerollSetup(PrerollContext* context,
const SkMatrix& matrix) {
cache_state_ = CacheState::kNone;
...
}I think if the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I disagree. transformed_filter_ being null has nothing to do with the cache item being in any state. It will be null if Skia can't handle the operation and for no other reason. if the transform is the reason that Skia can't handle the operation then the status of whether transformed_filter_ is null could change any time the matrix changes and yet this code will only ever set "can_cache_children_" to true and never return it to false.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we can create a transformed filter then we can cache the children, otherwise we cannot. The ability to create the transformed filter can vary frame to frame independently of other factors about whether or not we can cache the layer.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I know the void LayerRasterCacheItem::PrerollFinalize(PrerollContext* context,
const SkMatrix& matrix) {
....
if (num_cache_attempts_ >= layer_cached_threshold_) {
// the layer can be cached
cache_state_ = CacheState::kCurrent;
context->raster_cache->MarkSeen(key_id_, matrix_);
} else {
num_cache_attempts_++;
....
}if the transformed_filter is not null and render_count less than 3, we cache children void LayerRasterCacheItem::PrerollFinalize(PrerollContext* context,
const SkMatrix& matrix) {
if (num_cache_attempts_ >= layer_cached_threshold_) {
// the layer can be cached
...
} else {
num_cache_attempts_++;
// access current layer
if (can_cache_children_) {
...
}
}
}if the layer is not match any branch, we will cache none. So for ImageFilterLayer if any logic which is I miss?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The creation of the transformed_filter can succeed or fail independently each time Preroll is called. The success on one frame has nothing to do with the success on a subsequent frame. It needs to be checked every frame and the value of "can_cache_children" must match the success for the current frame. On some frames it will be true, on others it will be false and can go back and forth between true and false as many times as it exists in the layer tree. LayerCacheItem can only set the value to false in the initializer and then it can only be set to true after that by using "MarkCacheChildren". There is no way to set the value to false once it is set to true, but if a subsequent frame fails to create the transformed filter, then we need a way to reflect that by setting can_cache_children to false. How do we do that?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aha, Sorry, It's my mistake |
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.