Update CrossContext Image test to fix memory leak

Bug: skia:
Change-Id: I8c0abf16d5eb366cdc5296f8df9f33cc0e8f4cc4
Reviewed-on: https://skia-review.googlesource.com/26662
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2017-07-25 16:26:35 -04:00 committed by Skia Commit-Bot
parent ffc2ec46da
commit 3f475d9482

View File

@ -906,6 +906,14 @@ DEF_GPUTEST(SkImage_MakeCrossContextRelease, reporter, /*factory*/) {
otherTestContext->makeCurrent();
canvas->flush();
// This readPixels call is needed for Vulkan to make sure the ReleaseProc is called.
// Even though we flushed above, this does not guarantee the command buffer will finish
// which is when we call the ReleaseProc. The readPixels forces a CPU sync so we know
// that the command buffer has finished and we've called the ReleaseProc.
SkBitmap bitmap;
bitmap.allocPixels(info);
canvas->readPixels(bitmap, 0, 0);
}
// Case #6: Verify that only one context can be using the image at a time