Implement computeScratchKey virtual for GrAttachment.
Was missing this virtual so when we were registering attachments in the
cache we were never setting a scratch key on them.
Bug: skia:10727
Change-Id: Id505fcea17ed83b9f9f33739ded518adbcc2acb7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326440
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrAttachment.cpp b/src/gpu/GrAttachment.cpp
index 562526a..310078a 100644
--- a/src/gpu/GrAttachment.cpp
+++ b/src/gpu/GrAttachment.cpp
@@ -11,6 +11,7 @@
#include "src/gpu/GrBackendUtils.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrDataUtils.h"
+#include "src/gpu/GrGpu.h"
size_t GrAttachment::onGpuMemorySize() const {
GrBackendFormat format = this->backendFormat();
@@ -72,3 +73,11 @@
GrScratchKey::Builder builder(key, kType, 5);
build_key(&builder, caps, format, dimensions, requiredUsage, sampleCnt, isProtected);
}
+
+void GrAttachment::computeScratchKey(GrScratchKey* key) const {
+ if (fSupportedUsages & UsageFlags::kMSAA) {
+ auto isProtected = this->isProtected() ? GrProtected::kYes : GrProtected::kNo;
+ ComputeScratchKey(*this->getGpu()->caps(), this->backendFormat(), this->dimensions(),
+ fSupportedUsages, this->numSamples(), isProtected, key);
+ }
+}