aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-03-10 20:14:05 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-10 20:14:19 +0000
commita6953f2a079a64848499709b9c635405f53566e3 (patch)
tree47b1bceee61925c448baa86ed95a4fd75275ca62 /tests
parent4d1955c43aaab045511b74a495dfbea4ef0057c5 (diff)
Revert "Treat cross context images as Ganesh-created resources"
This reverts commit cccda60aca592d2320d79e2871e057778b2688ab. Reason for revert: Android and Windows bot failures. Original change's description: > Treat cross context images as Ganesh-created resources > > Always create them budgeted, and register them with the cache (not as > wrapped resources). > > BUG=skia: > > Change-Id: Id18ecf6e9e512db4be21b4f2bfd8e8c060bbe805 > Reviewed-on: https://skia-review.googlesource.com/9497 > Commit-Queue: Brian Osman <brianosman@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: Ib7bebcad33037dd206c9b06b5cb6c503b00accba Reviewed-on: https://skia-review.googlesource.com/9541 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/CrossContextImageTest.cpp17
-rw-r--r--tests/ResourceCacheTest.cpp21
2 files changed, 4 insertions, 34 deletions
diff --git a/tests/CrossContextImageTest.cpp b/tests/CrossContextImageTest.cpp
index 82eb2d591e..e37b095c93 100644
--- a/tests/CrossContextImageTest.cpp
+++ b/tests/CrossContextImageTest.cpp
@@ -140,24 +140,9 @@ DEF_GPUTEST(CrossContextImage_SharedContextSameThread, reporter, /*factory*/) {
REPORTER_ASSERT(reporter, ccid != nullptr);
ContextInfo info2 = factory.getSharedContextInfo(info.grContext());
- GrContext* ctx2 = info2.grContext();
- int resourceCountBefore = 0, resourceCountAfter = 0;
- size_t resourceBytesBefore = 0, resourceBytesAfter = 0;
- if (ctx2) {
- ctx2->getResourceCacheUsage(&resourceCountBefore, &resourceBytesBefore);
- }
-
- auto image = SkImage::MakeFromCrossContextImageData(ctx2, std::move(ccid));
+ auto image = SkImage::MakeFromCrossContextImageData(info2.grContext(), std::move(ccid));
REPORTER_ASSERT(reporter, image != nullptr);
- if (ctx2) {
- // MakeFromCrossContextImageData should have imported the texture back into our
- // cache, so we should see an uptick.
- ctx2->getResourceCacheUsage(&resourceCountAfter, &resourceBytesAfter);
- REPORTER_ASSERT(reporter, resourceCountAfter == resourceCountBefore + 1);
- REPORTER_ASSERT(reporter, resourceBytesAfter > resourceBytesBefore);
- }
-
// JPEG encode -> decode won't round trip the image perfectly
assert_equal(reporter, testImage.get(), image.get(),
SkEncodedImageFormat::kJPEG == format ? 2 : 0);
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 24545369cb..a2064ae557 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -208,13 +208,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
return;
}
- GrBackendObject texHandles[3];
+ GrBackendObject texHandles[2];
static const int kW = 100;
static const int kH = 100;
texHandles[0] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig);
texHandles[1] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig);
- texHandles[2] = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kRGBA_8888_GrPixelConfig);
context->resetContext();
@@ -231,40 +230,26 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI
sk_sp<GrTexture> adopted(context->resourceProvider()->wrapBackendTexture(
desc, kAdopt_GrWrapOwnership));
- desc.fTextureHandle = texHandles[2];
- sk_sp<GrTexture> adoptedAndCached(context->resourceProvider()->wrapBackendTexture(
- desc, kAdoptAndCache_GrWrapOwnership));
-
- REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr &&
- adoptedAndCached != nullptr);
- if (!borrowed || !adopted || !adoptedAndCached) {
+ REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr);
+ if (!borrowed || !adopted) {
return;
}
borrowed.reset(nullptr);
adopted.reset(nullptr);
- adoptedAndCached.reset(nullptr);
context->flush();
bool borrowedIsAlive = gpu->isTestingOnlyBackendTexture(texHandles[0]);
bool adoptedIsAlive = gpu->isTestingOnlyBackendTexture(texHandles[1]);
- bool adoptedAndCachedIsAlive = gpu->isTestingOnlyBackendTexture(texHandles[2]);
REPORTER_ASSERT(reporter, borrowedIsAlive);
REPORTER_ASSERT(reporter, !adoptedIsAlive);
- REPORTER_ASSERT(reporter, adoptedAndCachedIsAlive); // Still alive because it's in the cache
gpu->deleteTestingOnlyBackendTexture(texHandles[0], !borrowedIsAlive);
gpu->deleteTestingOnlyBackendTexture(texHandles[1], !adoptedIsAlive);
- // We can't delete texHandles[2] - we've given control of the lifetime to the context/cache
context->resetContext();
-
- // Purge the cache. This should force texHandles[2] to be deleted
- context->getResourceCache()->purgeAllUnlocked();
- adoptedAndCachedIsAlive = gpu->isTestingOnlyBackendTexture(texHandles[2]);
- REPORTER_ASSERT(reporter, !adoptedAndCachedIsAlive);
}
class TestResource : public GrGpuResource {