Add Texture usage to GrAttachment.
This is not used anywhere yet, just starting to get the framework all
set up.
Bug: skia:10727
Change-Id: Ie321bb850e4c0eecd5e557b8a7828ee941ba7d2c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378377
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrAttachment.cpp b/src/gpu/GrAttachment.cpp
index f465153..6db517d 100644
--- a/src/gpu/GrAttachment.cpp
+++ b/src/gpu/GrAttachment.cpp
@@ -29,6 +29,7 @@
SkISize dimensions,
GrAttachment::UsageFlags requiredUsage,
int sampleCnt,
+ GrMipmapped mipmapped,
GrProtected isProtected) {
SkASSERT(!dimensions.isEmpty());
@@ -51,12 +52,13 @@
SkISize dimensions,
UsageFlags requiredUsage,
int sampleCnt,
+ GrMipmapped mipmapped,
GrProtected isProtected,
GrUniqueKey* key) {
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey::Builder builder(key, kDomain, 5);
- build_key(&builder, caps, format, dimensions, requiredUsage, sampleCnt, isProtected);
+ build_key(&builder, caps, format, dimensions, requiredUsage, sampleCnt, mipmapped, isProtected);
}
void GrAttachment::ComputeScratchKey(const GrCaps& caps,
@@ -64,20 +66,20 @@
SkISize dimensions,
UsageFlags requiredUsage,
int sampleCnt,
+ GrMipmapped mipmapped,
GrProtected isProtected,
GrScratchKey* key) {
static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
- SkASSERT(sampleCnt > 1);
-
GrScratchKey::Builder builder(key, kType, 5);
- build_key(&builder, caps, format, dimensions, requiredUsage, sampleCnt, isProtected);
+ build_key(&builder, caps, format, dimensions, requiredUsage, sampleCnt, mipmapped, isProtected);
}
void GrAttachment::computeScratchKey(GrScratchKey* key) const {
- if (fSupportedUsages & UsageFlags::kColorAttachment) {
+ if (!SkToBool(fSupportedUsages & UsageFlags::kStencilAttachment)) {
auto isProtected = this->isProtected() ? GrProtected::kYes : GrProtected::kNo;
ComputeScratchKey(*this->getGpu()->caps(), this->backendFormat(), this->dimensions(),
- fSupportedUsages, this->numSamples(), isProtected, key);
+ fSupportedUsages, this->numSamples(), this->mipmapped(), isProtected,
+ key);
}
}