Reland "Rename GrStencilAttachment class to generic GrAttachment"

This is a reland of 6113d50ec48be049c13a6e4bbea191df93e68674

Original change's description:
> 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>

Bug: skia:10727
Change-Id: Ie0ff0885e01c9f0666fb0cfaa765e463dcc6d0a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324277
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@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;