Use shared gpu memory size for all GrAttachments.
Bug: skia:10727
Change-Id: I07ad4684c7a09963aa4be60e08877dde1c5ca192
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325663
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrAttachment.cpp b/src/gpu/GrAttachment.cpp
index 35fdbf2..562526a 100644
--- a/src/gpu/GrAttachment.cpp
+++ b/src/gpu/GrAttachment.cpp
@@ -8,7 +8,19 @@
#include "src/gpu/GrAttachment.h"
#include "include/private/GrResourceKey.h"
+#include "src/gpu/GrBackendUtils.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrDataUtils.h"
+
+size_t GrAttachment::onGpuMemorySize() const {
+ GrBackendFormat format = this->backendFormat();
+ SkImage::CompressionType compression = GrBackendFormatToCompressionType(format);
+
+ uint64_t size = GrNumBlocks(compression, this->dimensions());
+ size *= GrBackendFormatBytesPerBlock(this->backendFormat());
+ size *= this->numSamples();
+ return size;
+}
static void build_key(GrResourceKey::Builder* builder,
const GrCaps& caps,