diff options
author | Robert Phillips <robertphillips@google.com> | 2018-02-01 15:14:55 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-01 20:45:38 +0000 |
commit | 9e441eebf3cb2dd897495731ba8baaa00fb09bce (patch) | |
tree | ba8797e78c85e77d2addc7dd5749cf1fc899cf43 /tests/DeferredDisplayListTest.cpp | |
parent | 7c3c390126a573ef4c0f971c16bbcf1519fbe6e8 (diff) |
Fix SkSurfaceCharacterization unit test for DDL
Change-Id: I0a6ad85b9ff45d332e413f335b65ea644c0af6a1
Reviewed-on: https://skia-review.googlesource.com/102324
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/DeferredDisplayListTest.cpp')
-rw-r--r-- | tests/DeferredDisplayListTest.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index 2c507f10f9..049b97154c 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -92,6 +92,12 @@ private: DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); + // Create a bitmap that we can readback into + SkImageInfo imageInfo = SkImageInfo::Make(64, 64, kRGBA_8888_SkColorType, + kPremul_SkAlphaType); + SkBitmap bitmap; + bitmap.allocPixels(imageInfo); + std::unique_ptr<SkDeferredDisplayList> ddl; // First, create a DDL using the stock SkSurface parameters @@ -116,6 +122,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { ddl = r.detach(); REPORTER_ASSERT(reporter, s->draw(ddl.get())); + s->readPixels(imageInfo, bitmap.getPixels(), bitmap.rowBytes(), 0, 0); } // Then, alter each parameter in turn and check that the DDL & surface are incompatible @@ -159,15 +166,22 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { context->setResourceCacheLimits(maxResourceCount, maxResourceBytes/2); REPORTER_ASSERT(reporter, !s->draw(ddl.get())); + // DDL TODO: once proxies/ops can be de-instantiated we can re-enable these tests. + // For now, DDLs are drawn once. +#if 0 // resource limits >= those at characterization time are accepted context->setResourceCacheLimits(2*maxResourceCount, maxResourceBytes); REPORTER_ASSERT(reporter, s->draw(ddl.get())); + s->readPixels(imageInfo, bitmap.getPixels(), bitmap.rowBytes(), 0, 0); context->setResourceCacheLimits(maxResourceCount, 2*maxResourceBytes); REPORTER_ASSERT(reporter, s->draw(ddl.get())); + s->readPixels(imageInfo, bitmap.getPixels(), bitmap.rowBytes(), 0, 0); context->setResourceCacheLimits(maxResourceCount, maxResourceBytes); REPORTER_ASSERT(reporter, s->draw(ddl.get())); + s->readPixels(imageInfo, bitmap.getPixels(), bitmap.rowBytes(), 0, 0); +#endif } // Make sure non-GPU-backed surfaces fail characterization |