Optimize resolveLink.

This changes the program query to resolve the link if required. If the
validation layer is skipped the link is resolved in the gl::Context.
Resolving the link on program query allows us to avoid resolving the
link on most of the gl::Program query APIs.

This improves inlining and particularly affects uniform update. It
fixes a performance regression introduced by the parallel shader
linking extension. Gives a 17% increased score on a uniform benchmark.

Also fixes two missing cases of checking for the extension in our
validation code.

Note that some bugs might still exist when the validation layer is
disabled.

Bug: angleproject:2851
Change-Id: I5d725eede3fa147cedf2ce0129791b3412a97a61
Reviewed-on: https://chromium-review.googlesource.com/1255509
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@google.com>
diff --git a/src/libANGLE/validationES31.cpp b/src/libANGLE/validationES31.cpp
index 2738c43..518f967 100644
--- a/src/libANGLE/validationES31.cpp
+++ b/src/libANGLE/validationES31.cpp
@@ -1419,7 +1419,7 @@
     }
 
     const State &state = context->getGLState();
-    Program *program   = state.getProgram();
+    Program *program   = state.getLinkedProgram();
 
     if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
     {
@@ -1462,7 +1462,7 @@
     }
 
     const State &state = context->getGLState();
-    Program *program   = state.getProgram();
+    Program *program   = state.getLinkedProgram();
 
     if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
     {