Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: tests/SurfaceTest.cpp

Issue 715333003: Revert of Replace GrResourceCache with GrResourceCache2. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/ResourceCacheTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SurfaceTest.cpp
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 1913fcb1467cb6d53e7f73d16f55fe3688927a91..69c8b845ece6227761d900a1944b9d08f3a8aee0 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -321,6 +321,33 @@
}
#if SK_SUPPORT_GPU
+static void TestSurfaceInCache(skiatest::Reporter* reporter,
+ SurfaceType surfaceType,
+ GrContext* context) {
+ context->freeGpuResources();
+ int resourceCount;
+
+ context->getResourceCacheUsage(&resourceCount, NULL);
+ REPORTER_ASSERT(reporter, 0 == resourceCount);
+ SkAutoTUnref<SkSurface> surface(createSurface(surfaceType, context));
+ // Note: the stencil buffer is always cached, so kGpu_SurfaceType uses
+ // one cached resource, and kGpuScratch_SurfaceType uses two.
+ int expectedCachedResources = surfaceType == kGpuScratch_SurfaceType ? 2 : 1;
+ context->getResourceCacheUsage(&resourceCount, NULL);
+ REPORTER_ASSERT(reporter, expectedCachedResources == resourceCount);
+
+ // Verify that all the cached resources are locked in cache.
+ context->freeGpuResources();
+ context->getResourceCacheUsage(&resourceCount, NULL);
+ REPORTER_ASSERT(reporter, expectedCachedResources == resourceCount);
+
+ // Verify that all the cached resources are unlocked upon surface release
+ surface.reset(0);
+ context->freeGpuResources();
+ context->getResourceCacheUsage(&resourceCount, NULL);
+ REPORTER_ASSERT(reporter, 0 == resourceCount);
+}
+
static void Test_crbug263329(skiatest::Reporter* reporter,
SurfaceType surfaceType,
GrContext* context) {
@@ -426,6 +453,8 @@
}
GrContext* context = factory->get(glCtxType);
if (context) {
+ TestSurfaceInCache(reporter, kGpu_SurfaceType, context);
+ TestSurfaceInCache(reporter, kGpuScratch_SurfaceType, context);
Test_crbug263329(reporter, kGpu_SurfaceType, context);
Test_crbug263329(reporter, kGpuScratch_SurfaceType, context);
TestSurfaceCopyOnWrite(reporter, kGpu_SurfaceType, context);
« no previous file with comments | « tests/ResourceCacheTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698