Remove a level of indirection with GrProcessorKeyBuilder

Bug: skia:11372
Change-Id: Icb36f665ae9ce39b32d7626b3114c3303923f33e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379583
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp
index ff06088..7fb875b 100644
--- a/src/gpu/GrProgramDesc.cpp
+++ b/src/gpu/GrProgramDesc.cpp
@@ -165,15 +165,15 @@
     // bindings in use or other descriptor field settings) it should be set
     // to a canonical value to avoid duplicate programs with different keys.
 
-    desc->key().reset();
-    GrProcessorKeyBuilder b(&desc->key());
+    GrProcessorKeyBuilder* b = desc->key();
+    b->reset();
 
     const GrPrimitiveProcessor& primitiveProcessor = programInfo.primProc();
-    b.addString([&](){ return primitiveProcessor.name(); });
-    primitiveProcessor.getGLSLProcessorKey(*caps.shaderCaps(), &b);
-    primitiveProcessor.getAttributeKey(&b);
-    if (!gen_pp_meta_key(primitiveProcessor, caps, &b)) {
-        desc->key().reset();
+    b->addString([&](){ return primitiveProcessor.name(); });
+    primitiveProcessor.getGLSLProcessorKey(*caps.shaderCaps(), b);
+    primitiveProcessor.getAttributeKey(b);
+    if (!gen_pp_meta_key(primitiveProcessor, caps, b)) {
+        b->reset();
         return false;
     }
 
@@ -181,8 +181,8 @@
     int numColorFPs = 0, numCoverageFPs = 0;
     for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
         const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i);
-        if (!gen_frag_proc_and_meta_keys(fp, caps, &b)) {
-            desc->key().reset();
+        if (!gen_frag_proc_and_meta_keys(fp, caps, b)) {
+            b->reset();
             return false;
         }
         if (pipeline.isColorFragmentProcessor(i)) {
@@ -199,34 +199,34 @@
         origin = pipeline.dstProxyView().origin();
         originIfDstTexture = &origin;
     }
-    b.addString([&](){ return xp.name(); });
-    xp.getGLSLProcessorKey(*caps.shaderCaps(), &b, originIfDstTexture, pipeline.dstSampleType());
-    if (!gen_xp_meta_key(xp, &b)) {
-        desc->key().reset();
+    b->addString([&](){ return xp.name(); });
+    xp.getGLSLProcessorKey(*caps.shaderCaps(), b, originIfDstTexture, pipeline.dstSampleType());
+    if (!gen_xp_meta_key(xp, b)) {
+        b->reset();
         return false;
     }
 
     if (programInfo.requestedFeatures() & GrProcessor::CustomFeatures::kSampleLocations) {
         SkASSERT(pipeline.isHWAntialiasState());
-        b.add32(renderTarget->getSamplePatternKey());
+        b->add32(renderTarget->getSamplePatternKey());
     }
 
     // Add "header" metadata
-    b.addBits(16, pipeline.writeSwizzle().asKey(), "writeSwizzle");
-    b.addBits( 1, numColorFPs,    "numColorFPs");
-    b.addBits( 2, numCoverageFPs, "numCoverageFPs");
+    b->addBits(16, pipeline.writeSwizzle().asKey(), "writeSwizzle");
+    b->addBits(1, numColorFPs,    "numColorFPs");
+    b->addBits(2, numCoverageFPs, "numCoverageFPs");
     // If we knew the shader won't depend on origin, we could skip this (and use the same program
     // for both origins). Instrumenting all fragment processors would be difficult and error prone.
-    b.addBits( 2, GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(programInfo.origin()), "origin");
-    b.addBits( 1, static_cast<uint32_t>(programInfo.requestedFeatures()), "requestedFeatures");
-    b.addBits( 1, pipeline.snapVerticesToPixelCenters(), "snapVertices");
+    b->addBits(2, GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(programInfo.origin()), "origin");
+    b->addBits(1, static_cast<uint32_t>(programInfo.requestedFeatures()), "requestedFeatures");
+    b->addBits(1, pipeline.snapVerticesToPixelCenters(), "snapVertices");
     // The base descriptor only stores whether or not the primitiveType is kPoints. Backend-
     // specific versions (e.g., Vulkan) require more detail
-    b.addBits( 1, (programInfo.primitiveType() == GrPrimitiveType::kPoints), "isPoints");
+    b->addBits(1, (programInfo.primitiveType() == GrPrimitiveType::kPoints), "isPoints");
 
     // Put a clean break between the "common" data written by this function, and any backend data
     // appended later. The initial key length will just be this portion (rounded to 4 bytes).
-    b.flush();
+    b->flush();
     desc->fInitialKeyLength = desc->keyLength();
 
     return true;