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>
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 69b2a22..814dc9b 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -906,6 +906,14 @@
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