aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrGpuResource.h
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 /include/gpu/GrGpuResource.h
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 'include/gpu/GrGpuResource.h')
-rw-r--r--include/gpu/GrGpuResource.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index 70c94c0e55..2da8085908 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -249,6 +249,15 @@ public:
**/
virtual void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
+ /**
+ * Describes the type of gpu resource that is represented by the implementing
+ * class (e.g. texture, buffer object, stencil). This data is used for diagnostic
+ * purposes by dumpMemoryStatistics().
+ *
+ * The value returned is expected to be long lived and will not be copied by the caller.
+ */
+ virtual const char* getResourceType() const = 0;
+
static uint32_t CreateUniqueID();
protected:
@@ -280,11 +289,24 @@ protected:
void didChangeGpuMemorySize() const;
/**
- * Allows subclasses to add additional backing information to the SkTraceMemoryDump. Called by
- * onMemoryDump. The default implementation adds no backing information.
+ * Allows subclasses to add additional backing information to the SkTraceMemoryDump.
**/
virtual void setMemoryBacking(SkTraceMemoryDump*, const SkString&) const {}
+ /**
+ * Returns a string that uniquely identifies this resource.
+ */
+ SkString getResourceName() const;
+
+ /**
+ * A helper for subclasses that override dumpMemoryStatistics(). This method using a format
+ * consistent with the default implementation of dumpMemoryStatistics() but allows the caller
+ * to customize various inputs.
+ */
+ void dumpMemoryStatisticsPriv(SkTraceMemoryDump* traceMemoryDump, const SkString& resourceName,
+ const char* type, size_t size) const;
+
+
private:
/**
* Called by the registerWithCache if the resource is available to be used as scratch.