aboutsummaryrefslogtreecommitdiff
path: root/dm
diff options
context:
space:
mode:
authorBrian Salomon <bsalomon@google.com>2019-01-10 10:23:44 -0500
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2019-01-10 16:10:59 +0000
commit559c617137517ece202d0f7cdb6b1cd0a715cf2e (patch)
tree37cfdf1a07146416705836390461887297b48939 /dm
parentcc10c4342ee16696a8ed2634008e7cc4fe3f3c0a (diff)
downloadskqp-559c617137517ece202d0f7cdb6b1cd0a715cf2e.tar.gz
Reuse GrTexture instances when the same GrBackendTexture is used to
repeatedly fulfill a promise SkImage. Bug: skia:8613 Change-Id: I35c76435d630d2daa034e0c3efb59666bfd6882a Reviewed-on: https://skia-review.googlesource.com/c/175820 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'dm')
-rw-r--r--dm/DMSrcSink.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 46c16756a9..37fed6efee 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1975,7 +1975,10 @@ Error ViaDDL::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString
// This is here bc this is the first point where we have access to the context
promiseImageHelper.uploadAllToGPU(context);
- // We draw N times, with a clear between.
+ // We draw N times, with a clear between. Between each run we invalidate and delete half of
+ // the textures backing promise images. So half the images exercise reusing a cached
+ // GrTexture and the other half exercise the case whem the client provides a different
+ // backing texture in fulfill.
for (int replay = 0; replay < fNumReplays; ++replay) {
if (replay > 0) {
// Clear the drawing of the previous replay
@@ -1994,6 +1997,11 @@ Error ViaDDL::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString
// This drops the promiseImageHelper's refs on all the promise images if we're in
// the last run.
promiseImageHelper.reset();
+ } else {
+ // This ought to ensure that all promise image textures from the last pass are
+ // released.
+ context->contextPriv().getGpu()->testingOnly_flushGpuAndSync();
+ promiseImageHelper.replaceEveryOtherPromiseTexture(context);
}
// Fourth, synchronously render the display lists into the dest tiles