This CL fixes 5 bugs related to hoisting image filters:
For image filters the src layer (the one prior to filtering) often needs to be
smaller then the final layer. This requires the saveLayer's optional bounds
to be stored (in SkLayerInfo.h and SkRecordDraw.cpp) and then used in
compute_source_rect and carried around in GrCachedLayer.
The image filters can add an extra offset to the final draw operation.
This is now computed in GrLayerHoister::FilterLayer and carried around in
GrCachedLayer.
Filtered layers must use exact matches. This is now done in GrLayerCache::lock.
The filter cache requires a valid matrix so it can compute the correct offset.
This is now done in GrLayerHoister::FilterLayer.
Filtered layers need to be drawn with drawSprite while unfiltered (and therefore
hopefully atlased) layers can be drawn with drawBitmap. This is now done in
draw_replacement_bitmap.
Committed: https://skia.googlesource.com/skia/+/702eb9622102599d94ab6798e6227cf29f48c2d3
Review URL: https://codereview.chromium.org/803183003
Reason for revert:
Breaking DM
Original issue's description:
> Fix layer hoisting image filter corner cases
>
> This CL fixes 5 bugs related to hoisting image filters:
>
> For image filters the src layer (the one prior to filtering) often needs to be
> smaller then the final layer. This requires the saveLayer's optional bounds
> to be stored (in SkLayerInfo.h and SkRecordDraw.cpp) and then used in
> compute_source_rect and carried around in GrCachedLayer.
>
> The image filters can add an extra offset to the final draw operation.
> This is now computed in GrLayerHoister::FilterLayer and carried around in
> GrCachedLayer.
>
> Filtered layers must use exact matches. This is now done in GrLayerCache::lock.
>
> The filter cache requires a valid matrix so it can compute the correct offset.
> This is now done in GrLayerHoister::FilterLayer.
>
> Filtered layers need to be drawn with drawSprite while unfiltered (and therefore
> hopefully atlased) layers can be drawn with drawBitmap. This is now done in
> draw_replacement_bitmap.
>
> Committed: https://skia.googlesource.com/skia/+/702eb9622102599d94ab6798e6227cf29f48c2d3TBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/790643009
This CL fixes 5 bugs related to hoisting image filters:
For image filters the src layer (the one prior to filtering) often needs to be
smaller then the final layer. This requires the saveLayer's optional bounds
to be stored (in SkLayerInfo.h and SkRecordDraw.cpp) and then used in
compute_source_rect and carried around in GrCachedLayer.
The image filters can add an extra offset to the final draw operation.
This is now computed in GrLayerHoister::FilterLayer and carried around in
GrCachedLayer.
Filtered layers must use exact matches. This is now done in GrLayerCache::lock.
The filter cache requires a valid matrix so it can compute the correct offset.
This is now done in GrLayerHoister::FilterLayer.
Filtered layers need to be drawn with drawSprite while unfiltered (and therefore
hopefully atlased) layers can be drawn with drawBitmap. This is now done in
draw_replacement_bitmap.
Review URL: https://codereview.chromium.org/803183003
Adding the rendering canvas' CTM to the layer hoisting key (i.e., Add support for hoisting layers in pictures drawn with a matrix - https://codereview.chromium.org/748853002/) has increased the cache miss rate due to accumulated floating point error. This CL fixes part of the issue by using the chain of operation indices leading to each saveLayer as the key. The canvas' CTM must still form part of the key but should be less subject to accumulated error.
BUG=skia:2315
Review URL: https://codereview.chromium.org/753253002
This CL alters layer hoisting to defer creation of the free floating layers until they are actually needed (rather than creating _all_ the hoisted layers at the start).
It also fixes a pre vs. post Concat bug with how matrices were being accumulated.
BUG=skia:2315
Review URL: https://codereview.chromium.org/657383004
This CL adds the clip region to the GPU layer hoisting image cache. It also switches back to the old caching behavior of using the entire CTM in the cache key rather then just the upper 2x2. This latter change is to focus more on hoisting rather then caching.
It also includes 2 smaller fixes:
a) layer's that have an image filter are no longer atlased (b.c. doing so complicates applying the image filter)
b) the result of clipping the layer's bounds to the current clip is used as the hoisted layer's size. This reduces the amount of pixels drawn to match a normal (non-hoisted) draw pass.
Review URL: https://codereview.chromium.org/640773004
In the new MultiPictureDraw tests a single hoisted layer is reused multiple times. The previous plot locking scheme allowed GrCachedLayer objects to be aggressively deleted prematurely leaving the reusing GrHoistedLayer objects with dangling pointers.
This CL changes adds a new pseudo-ref to GrCachedLayer. (It can't be a real ref since the cached layers aren't deleted when it goes to 0).
NOTRY=true
Committed: https://skia.googlesource.com/skia/+/5c481666c9678f43e039ad605457be3854cf8de3
Review URL: https://codereview.chromium.org/640323002
This CL reduces the amount of information used in the layer cache key:
- the stop value isn't needed since the start value uniquely identifies the layer in the picture.
- only the upper-left 2x2 portion of the CTM should be used as a key for looking up cached layers.
- individual layers can be redraw in different locations so the final offset cannot be a part of the key.
Since this data is no longer stored in the cached layer, but is still required to draw the cached layer, it is now stored in the per-layer information (i.e., HoistedLayer).
This is split out of (Fix sub-picture layer rendering bugs - https://codereview.chromium.org/597293002/).
BUG=skia:2315
R=egdaniel@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/609403003
The only substantive change in this CL is skipping atlasing
for any layers that are involved in nesting. Prior versions
have allowed nesting layers to be atlased.
--------------------------------------------------------
All times are on Windows with a repeat count of 200.
Format is: <time in ms> (<# of glBindframebuffer calls>)
How to interpret this:
For the boogie page:
both columns should be the same (since boogie has no
nested layers)
without the new API the tiled case doesn't show any real
benefit from hoisting
For the carsvg page:
The nesting change does increase the number of FBO
switches but doesn't kill performance
Because of the location & size of the layers the
tile case does show some improvement (even
without the new API)
boogie
-------
w/o nested change w/ nested change
simple 5.62 (811) N/A
tiled 7.72 (811) N/A
simple w/ hoisting 5.23 (409) 5.77 (409)
(but no caching)
tiled w/ hoisting 7.57 (809) 7.49 (809)
(but no caching)
carsvg
------
w/o nested change w/ nested change
simple 60.37 (141990) N/A
tiled 115.13 (256929) N/A
simple w/ hoisting 41.57 (64570) 42.82 (72279)
(but no caching)
tiled w/ hoisting 84.24 (154352) 84.71 (165630)
(but no caching)
R=bsalomon@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/476833004
This CL makes it possible for pulled-forward-layers to be atlased. It currently has a couple glaring limitations (which is why it is disabled):
1) the atlased layers cannot be purged nor aged out
2) the texture backing the atlas is not pulled from (or returned to) the resource cache
#1 is on hold until we have a recycling rectanizer
A separate major limitation (the non-atlased layers aren't cached) is blocked until we can transmute entries in the resource cache from scratch to non-scratch while potentially preserving their contents.
Committed: https://skia.googlesource.com/skia/+/55e61f0ef4e5c8c34ac107deaadc9b4ffef3111bR=bsalomon@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/354533004
Reason for revert:
Sigh
Original issue's description:
> Begin atlasing
>
> This CL makes it possible for pulled-forward-layers to be atlased. It currently has a couple glaring limitations (which is why it is disabled):
>
> 1) the atlased layers cannot be purged nor aged out
> 2) the texture backing the atlas is not pulled from (or returned to) the resource cache
>
> #1 is on hold until we have a recycling rectanizer
>
> A separate major limitation (the non-atlased layers aren't cached) is blocked until we can transmute entries in the resource cache from scratch to non-scratch while potentially preserving their contents.
>
> Committed: https://skia.googlesource.com/skia/+/55e61f0ef4e5c8c34ac107deaadc9b4ffef3111bR=bsalomon@google.comTBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/359953002
This CL makes it possible for pulled-forward-layers to be atlased. It currently has a couple glaring limitations (which is why it is disabled):
1) the atlased layers cannot be purged nor aged out
2) the texture backing the atlas is not pulled from (or returned to) the resource cache
#1 is on hold until we have a recycling rectanizer
A separate major limitation (the non-atlased layers aren't cached) is blocked until we can transmute entries in the resource cache from scratch to non-scratch while potentially preserving their contents.
R=bsalomon@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/354533004