Cleanup program building a bit

This CL:
   now passes the GrProgramDesc as a const&
   returns GrGLProgram as an sk_sp
   makes the parameter ordering more consistent
   makes GrVkPipelineState no longer ref-counted

This is pulled out of the DDL pre-compile CL which touches this portion of the code.

Bug: skia:9455
Change-Id: Id4d06f93450e276de5a2662be330ae9523026244
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268777
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/mtl/GrMtlPipelineStateBuilder.mm b/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
index 4c209ec..300d346 100644
--- a/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
+++ b/src/gpu/mtl/GrMtlPipelineStateBuilder.mm
@@ -25,24 +25,25 @@
 #error This file must be compiled with Arc. Use -fobjc-arc flag
 #endif
 
-GrMtlPipelineState* GrMtlPipelineStateBuilder::CreatePipelineState(GrMtlGpu* gpu,
-                                                                   GrRenderTarget* renderTarget,
-                                                                   const GrProgramInfo& programInfo,
-                                                                   GrProgramDesc* desc) {
+GrMtlPipelineState* GrMtlPipelineStateBuilder::CreatePipelineState(
+                                                                GrMtlGpu* gpu,
+                                                                GrRenderTarget* renderTarget,
+                                                                const GrProgramDesc& desc,
+                                                                const GrProgramInfo& programInfo) {
     GrAutoLocaleSetter als("C");
-    GrMtlPipelineStateBuilder builder(gpu, renderTarget, programInfo, desc);
+    GrMtlPipelineStateBuilder builder(gpu, renderTarget, desc, programInfo);
 
     if (!builder.emitAndInstallProcs()) {
         return nullptr;
     }
-    return builder.finalize(renderTarget, programInfo, desc);
+    return builder.finalize(renderTarget, desc, programInfo);
 }
 
 GrMtlPipelineStateBuilder::GrMtlPipelineStateBuilder(GrMtlGpu* gpu,
                                                      GrRenderTarget* renderTarget,
-                                                     const GrProgramInfo& programInfo,
-                                                     GrProgramDesc* desc)
-        : INHERITED(renderTarget, programInfo, desc)
+                                                     const GrProgramDesc& desc,
+                                                     const GrProgramInfo& programInfo)
+        : INHERITED(renderTarget, desc, programInfo)
         , fGpu(gpu)
         , fUniformHandler(this)
         , fVaryingHandler(this) {
@@ -91,8 +92,8 @@
     // Here we shear off the Mtl-specific portion of the Desc in order to create the
     // persistent key. This is because Mtl only caches the MSL code, not the fully compiled
     // program, and that only depends on the base GrProgramDesc data.
-    sk_sp<SkData> key = SkData::MakeWithoutCopy(this->desc()->asKey(),
-                                                this->desc()->initialKeyLength());
+    sk_sp<SkData> key = SkData::MakeWithoutCopy(this->desc().asKey(),
+                                                this->desc().initialKeyLength());
     sk_sp<SkData> data = GrPersistentCacheUtils::PackCachedShaders(isSkSL ? kSKSL_Tag : kMSL_Tag,
                                                                    shaders,
                                                                    inputs, kGrShaderTypeCount);
@@ -103,7 +104,6 @@
         const SkSL::String& shader,
         SkSL::Program::Kind kind,
         const SkSL::Program::Settings& settings,
-        GrProgramDesc* desc,
         SkSL::String* msl,
         SkSL::Program::Inputs* inputs) {
     id<MTLLibrary> shaderLibrary = GrGenerateMtlShaderLibrary(fGpu, shader,
@@ -388,8 +388,8 @@
 }
 
 GrMtlPipelineState* GrMtlPipelineStateBuilder::finalize(GrRenderTarget* renderTarget,
-                                                        const GrProgramInfo& programInfo,
-                                                        GrProgramDesc* desc) {
+                                                        const GrProgramDesc& desc,
+                                                        const GrProgramInfo& programInfo) {
     auto pipelineDescriptor = [[MTLRenderPipelineDescriptor alloc] init];
     id<MTLLibrary> shaderLibraries[kGrShaderTypeCount];
 
@@ -414,7 +414,7 @@
         // Here we shear off the Mtl-specific portion of the Desc in order to create the
         // persistent key. This is because Mtl only caches the MSL code, not the fully compiled
         // program, and that only depends on the base GrProgramDesc data.
-        sk_sp<SkData> key = SkData::MakeWithoutCopy(desc->asKey(), desc->initialKeyLength());
+        sk_sp<SkData> key = SkData::MakeWithoutCopy(desc.asKey(), desc.initialKeyLength());
         cached = persistentCache->load(*key);
         if (cached) {
             reader.setMemory(cached->data(), cached->size());
@@ -446,14 +446,12 @@
                                                      *sksl[kVertex_GrShaderType],
                                                      SkSL::Program::kVertex_Kind,
                                                      settings,
-                                                     desc,
                                                      &shaders[kVertex_GrShaderType],
                                                      &inputs[kVertex_GrShaderType]);
         shaderLibraries[kFragment_GrShaderType] = this->generateMtlShaderLibrary(
                                                        *sksl[kFragment_GrShaderType],
                                                        SkSL::Program::kFragment_Kind,
                                                        settings,
-                                                       desc,
                                                        &shaders[kFragment_GrShaderType],
                                                        &inputs[kFragment_GrShaderType]);