Encapulate the ESSL compiler into a GL object that is per-context.

 * Allows for multiple contexts have to have different client versions, caps
   and extensions without causing shader compilation failures.

BUG=angle:823

Change-Id: I523679e90be031b0b7fa385d46d6839b1cf3029f
Reviewed-on: https://chromium-review.googlesource.com/227710
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 755b265..36757a5 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -11,6 +11,7 @@
 
 #include "common/utilities.h"
 #include "common/platform.h"
+#include "libANGLE/Compiler.h"
 #include "libANGLE/Buffer.h"
 #include "libANGLE/Display.h"
 #include "libANGLE/Fence.h"
@@ -118,6 +119,8 @@
     mResetStatus = GL_NO_ERROR;
     mResetStrategy = (notifyResets ? GL_LOSE_CONTEXT_ON_RESET_EXT : GL_NO_RESET_NOTIFICATION_EXT);
     mRobustAccess = robustAccess;
+
+    mCompiler = new Compiler(mRenderer->createCompiler(getData()));
 }
 
 Context::~Context()
@@ -160,6 +163,8 @@
     {
         mResourceManager->release();
     }
+
+    SafeDelete(mCompiler);
 }
 
 void Context::makeCurrent(egl::Surface *surface)
@@ -759,6 +764,11 @@
     return mState.getSamplerTexture(sampler, type);
 }
 
+Compiler *Context::getCompiler() const
+{
+    return mCompiler;
+}
+
 void Context::getBooleanv(GLenum pname, GLboolean *params)
 {
     switch (pname)
@@ -1606,11 +1616,6 @@
                                       dstX0, dstY0, dstX1, dstY1, mask, filter);
 }
 
-void Context::releaseShaderCompiler()
-{
-    mRenderer->releaseShaderCompiler();
-}
-
 void Context::initCaps(GLuint clientVersion)
 {
     mCaps = mRenderer->getRendererCaps();