Metal: Lazily grab the shader lib for provoking vertex helper

Metal's ProvokingVertexHelper would query the display's default shader
library in the constructor which is called during context creation.
Lazily query the default shader library so that context creation is
unblocked.

Bug: chromium:1385510
Change-Id: I32ce3bdac7f92b7e098a69fa557aa8385eac7076
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4189016
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
diff --git a/src/libANGLE/renderer/metal/ProvokingVertexHelper.h b/src/libANGLE/renderer/metal/ProvokingVertexHelper.h
index 040f580..1c0d7a3 100644
--- a/src/libANGLE/renderer/metal/ProvokingVertexHelper.h
+++ b/src/libANGLE/renderer/metal/ProvokingVertexHelper.h
@@ -52,7 +52,6 @@
     mtl::ComputeCommandEncoder *getComputeCommandEncoder();
 
   private:
-    id<MTLLibrary> mProvokingVertexLibrary;
     mtl::BufferPool mIndexBuffers;
     mtl::ProvokingVertexComputePipelineCache mPipelineCache;
     mtl::ProvokingVertexComputePipelineDesc mCachedDesc;
diff --git a/src/libANGLE/renderer/metal/ProvokingVertexHelper.mm b/src/libANGLE/renderer/metal/ProvokingVertexHelper.mm
index f8be05c..2bd5606 100644
--- a/src/libANGLE/renderer/metal/ProvokingVertexHelper.mm
+++ b/src/libANGLE/renderer/metal/ProvokingVertexHelper.mm
@@ -102,8 +102,6 @@
 ProvokingVertexHelper::ProvokingVertexHelper(ContextMtl *context)
     : mIndexBuffers(false), mPipelineCache(this)
 {
-    id<MTLLibrary> mtlLib   = context->getDisplay()->getDefaultShadersLib();
-    mProvokingVertexLibrary = mtlLib;
     mIndexBuffers.initialize(context, kInitialIndexBufferSize, mtl::kIndexBufferOffsetAlignment, 0);
 }
 
@@ -158,17 +156,18 @@
     const mtl::ProvokingVertexComputePipelineDesc &pipelineDesc,
     id<MTLFunction> *shaderOut)
 {
-    uint indexBufferKey = buildIndexBufferKey(pipelineDesc);
-    auto fcValues       = mtl::adoptObjCObj([[MTLFunctionConstantValues alloc] init]);
+    id<MTLLibrary> provokingVertexLibrary = context->getDisplay()->getDefaultShadersLib();
+    uint indexBufferKey                   = buildIndexBufferKey(pipelineDesc);
+    auto fcValues = mtl::adoptObjCObj([[MTLFunctionConstantValues alloc] init]);
     [fcValues setConstantValue:&indexBufferKey type:MTLDataTypeUInt withName:@"fixIndexBufferKey"];
     if (pipelineDesc.generateIndices)
     {
-        return CreateMslShader(context, mProvokingVertexLibrary, @"genIndexBuffer", fcValues.get(),
+        return CreateMslShader(context, provokingVertexLibrary, @"genIndexBuffer", fcValues.get(),
                                shaderOut);
     }
     else
     {
-        return CreateMslShader(context, mProvokingVertexLibrary, @"fixIndexBuffer", fcValues.get(),
+        return CreateMslShader(context, provokingVertexLibrary, @"fixIndexBuffer", fcValues.get(),
                                shaderOut);
     }
 }