Rename GrStencilAttachment class to generic GrAttachment
Additional this adds a UsageFlags member to the new GrAttachment
class.
Bug: skia:10727
Change-Id: Ifc0bfffd959f5fbc46bfcdf269e1b2a933929753
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323107
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 19cf88e..93d91af 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -12,6 +12,7 @@
#include "include/private/GrSingleOwner.h"
#include "src/core/SkConvertPixels.h"
#include "src/core/SkMathPriv.h"
+#include "src/gpu/GrAttachment.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrDataUtils.h"
#include "src/gpu/GrGpu.h"
@@ -23,7 +24,6 @@
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrSemaphore.h"
-#include "src/gpu/GrStencilAttachment.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/SkGr.h"
@@ -491,7 +491,7 @@
bool GrResourceProvider::attachStencilAttachment(GrRenderTarget* rt, int numStencilSamples) {
SkASSERT(rt);
- GrStencilAttachment* stencil = rt->getStencilAttachment();
+ GrAttachment* stencil = rt->getStencilAttachment();
if (stencil && stencil->numSamples() == numStencilSamples) {
return true;
}
@@ -505,13 +505,13 @@
height = SkNextPow2(height);
}
#endif
- GrStencilAttachment::ComputeSharedStencilAttachmentKey(
- rt->dimensions(), numStencilSamples, &sbKey);
- auto stencil = this->findByUniqueKey<GrStencilAttachment>(sbKey);
+ GrAttachment::ComputeSharedAttachmentUniqueKey(
+ rt->dimensions(), GrAttachment::UsageFlags::kStencil, numStencilSamples, &sbKey);
+ auto stencil = this->findByUniqueKey<GrAttachment>(sbKey);
if (!stencil) {
// Need to try and create a new stencil
- stencil.reset(this->gpu()->createStencilAttachmentForRenderTarget(
- rt, rt->dimensions(), numStencilSamples));
+ stencil = this->gpu()->makeStencilAttachmentForRenderTarget(rt, rt->dimensions(),
+ numStencilSamples);
if (!stencil) {
return false;
}
@@ -520,7 +520,7 @@
rt->attachStencilAttachment(std::move(stencil));
}
- if (GrStencilAttachment* stencil = rt->getStencilAttachment()) {
+ if (GrAttachment* stencil = rt->getStencilAttachment()) {
return stencil->numSamples() == numStencilSamples;
}
return false;