From 0562eb9c6c98f07732ca96a1dd4e986f1ca089b8 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Mon, 8 May 2017 11:16:39 -0400 Subject: Allow wrapped resources to have unique keys Previously, wrapped resources were never budgeted. Now we explicitly allow wrapped, unbudgeted resources with unique keys. This allows code that wraps (and re-wraps) external resources with a deterministic key to find the same wrapped resource - saving time and ensuring a single wrapped copy, to preserve state on the resource (like texture sampler state). Bug: skia: Change-Id: I1dd7642f1ed8bb6c620029d46203cf5cb6b3c160 Reviewed-on: https://skia-review.googlesource.com/15241 Commit-Queue: Brian Osman Reviewed-by: Robert Phillips Reviewed-by: Brian Salomon --- src/gpu/GrResourceCache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gpu/GrResourceCache.cpp') diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp index 596af6d623..e3373b27f9 100644 --- a/src/gpu/GrResourceCache.cpp +++ b/src/gpu/GrResourceCache.cpp @@ -697,8 +697,8 @@ void GrResourceCache::validate() const { if (uniqueKey.isValid()) { ++fContent; SkASSERT(fUniqueHash->find(uniqueKey) == resource); - SkASSERT(!resource->resourcePriv().refsWrappedObjects()); - SkASSERT(SkBudgeted::kYes == resource->resourcePriv().isBudgeted()); + SkASSERT(SkBudgeted::kYes == resource->resourcePriv().isBudgeted() || + resource->resourcePriv().refsWrappedObjects()); if (scratchKey.isValid()) { SkASSERT(!fScratchMap->has(resource, scratchKey)); -- cgit v1.2.3