aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-03-08 09:49:58 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-08 15:36:11 +0000
commit26b50a4cda53661c59ae37c7fd1c873d099f2236 (patch)
tree5b58a81e93e49fc189641eb66022381b7eda7430 /tests
parentf7778979343998e4c10df8ebe43f02e60c700f0d (diff)
Add testing only helper to flush and sync gpu.
The use case for this is mostly for Vulkan where we need to make sure the gpu is done with resources before we delete or use them in some way. Previously we used readPixels to do this which was just an ugly hack. Bug: skia: Change-Id: I7949ebc695032533675133aabca0e32840b417ba Reviewed-on: https://skia-review.googlesource.com/113122 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/GrMipMappedTest.cpp11
-rw-r--r--tests/ImageTest.cpp10
2 files changed, 6 insertions, 15 deletions
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 1462648a78..484b7bfd4f 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -203,14 +203,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
}
// Must make sure the uses of the backend texture have finished (we possibly have a
- // queued up copy) before we delete the backend texture. Thus we use readPixels here
- // just to force the synchronization.
- sk_sp<GrSurfaceContext> surfContext =
- context->contextPriv().makeWrappedSurfaceContext(genProxy);
-
- SkBitmap bitmap;
- bitmap.allocPixels(imageInfo);
- surfContext->readPixels(imageInfo, bitmap.getPixels(), 0, 0, 0, 0);
+ // queued up copy) before we delete the backend texture.
+ context->flush();
+ gpu->testingOnly_flushGpuAndSync();
gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 619b52d6e2..49ab65b6a7 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -939,13 +939,9 @@ static void test_cross_context_image(skiatest::Reporter* reporter, const GrConte
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);
+ // This is specifically here for vulkan to guarantee the command buffer will finish
+ // which is when we call the ReleaseProc.
+ otherCtx->contextPriv().getGpu()->testingOnly_flushGpuAndSync();
}
// Case #6: Verify that only one context can be using the image at a time