aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Derek Sollenberger <djsollen@google.com>2018-03-29 13:40:02 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-29 18:08:15 +0000
commitcf6da8c0f29877249a55949efd8b952b5b9bc01d (patch)
tree9f4bcd3033dd85d378da916e7f45ab583524c595 /tests
parent9c6f6a52764281f6c61c2daf21f4737df5df53c7 (diff)
Dump additional details about the gpu resources.
GpuResources now dump optional string values that describe the type and category of the resource. The type provides a description of the kind of resource it is (e.g. texture, buffer object, stencil, etc.) and the category describes what the resource is currently tasked to do (e.g. path masks, images, scratch, etc.) This CL also refactors the dump logic in an attempt to consolidate duplicated code into GrGpuResources.cpp. Bug: b/74435803 Change-Id: I83cae825f41e6450a21398ab3ecea349c7c61c15 Reviewed-on: https://skia-review.googlesource.com/115989 Commit-Queue: Derek Sollenberger <djsollen@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ResourceCacheTest.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index c56bd01564..11dcdd43b6 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -340,6 +340,7 @@ private:
}
size_t onGpuMemorySize() const override { return fSize; }
+ const char* getResourceType() const override { return "Test"; }
TestResource* fToDelete;
size_t fSize;
@@ -1661,19 +1662,24 @@ static void test_tags(skiatest::Reporter* reporter) {
GrResourceCache* cache = mock.cache();
GrGpu* gpu = context->contextPriv().getGpu();
+ // tag strings are expected to be long lived
+ std::vector<SkString> tagStrings;
+
SkString tagStr;
int tagIdx = 0;
int currTagCnt = 0;
for (int i = 0; i < kNumResources; ++i, ++currTagCnt) {
+
sk_sp<GrGpuResource> resource(new TestResource(gpu));
GrUniqueKey key;
if (currTagCnt == tagIdx) {
tagIdx += 1;
currTagCnt = 0;
tagStr.printf("tag%d", tagIdx);
+ tagStrings.emplace_back(tagStr);
}
- make_unique_key<1>(&key, i, tagStr.c_str());
+ make_unique_key<1>(&key, i, tagStrings.back().c_str());
resource->resourcePriv().setUniqueKey(key);
}
SkASSERT(kLastTagIdx == tagIdx);