Remove Shader::getSemanticIndex.

This method doesn't really belong to GL, and was only used by the D3D
back-end to compute some attribute indexes. Simplify the code by
moving it into ProgramD3D. Also add the ability for the ShaderImpl to
assert that any pending compiles have resolved.

BUG=angleproject:1156

Change-Id: I0af3d3082ff8c908e6a87b9734989efbefd28808
Reviewed-on: https://chromium-review.googlesource.com/526336
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Shader.cpp b/src/libANGLE/Shader.cpp
index 9b778bf..929aace 100644
--- a/src/libANGLE/Shader.cpp
+++ b/src/libANGLE/Shader.cpp
@@ -74,7 +74,11 @@
     return gl::VariableSortOrder(x.type) < gl::VariableSortOrder(y.type);
 }
 
-ShaderState::ShaderState(GLenum shaderType) : mLabel(), mShaderType(shaderType), mShaderVersion(100)
+ShaderState::ShaderState(GLenum shaderType)
+    : mLabel(),
+      mShaderType(shaderType),
+      mShaderVersion(100),
+      mCompileStatus(CompileStatus::NOT_COMPILED)
 {
     mLocalSize.fill(-1);
 }
@@ -95,7 +99,6 @@
       mType(type),
       mRefCount(0),
       mDeleteStatus(false),
-      mStatus(CompileStatus::NOT_COMPILED),
       mResourceManager(manager)
 {
     ASSERT(mImplementation);
@@ -263,7 +266,7 @@
     mState.mActiveAttributes.clear();
     mState.mActiveOutputVariables.clear();
 
-    mStatus = CompileStatus::COMPILE_REQUESTED;
+    mState.mCompileStatus = CompileStatus::COMPILE_REQUESTED;
     mBoundCompiler.set(context->getCompiler());
 
     // Cache the compile source and options for compilation. Must be done now, since the source
@@ -296,7 +299,7 @@
 
 void Shader::resolveCompile(const Context *context)
 {
-    if (mStatus != CompileStatus::COMPILE_REQUESTED)
+    if (!mState.compilePending())
     {
         return;
     }
@@ -317,7 +320,7 @@
     {
         mInfoLog = sh::GetInfoLog(compilerHandle);
         WARN() << std::endl << mInfoLog;
-        mStatus = CompileStatus::NOT_COMPILED;
+        mState.mCompileStatus = CompileStatus::NOT_COMPILED;
         return;
     }
 
@@ -378,7 +381,7 @@
     ASSERT(!mState.mTranslatedSource.empty());
 
     bool success = mImplementation->postTranslateCompile(mBoundCompiler.get(), &mInfoLog);
-    mStatus      = success ? CompileStatus::COMPILED : CompileStatus::NOT_COMPILED;
+    mState.mCompileStatus = success ? CompileStatus::COMPILED : CompileStatus::NOT_COMPILED;
 }
 
 void Shader::addRef()
@@ -414,7 +417,7 @@
 bool Shader::isCompiled(const Context *context)
 {
     resolveCompile(context);
-    return mStatus == CompileStatus::COMPILED;
+    return mState.mCompileStatus == CompileStatus::COMPILED;
 }
 
 int Shader::getShaderVersion(const Context *context)
@@ -453,30 +456,6 @@
     return mState.getActiveOutputVariables();
 }
 
-int Shader::getSemanticIndex(const Context *context, const std::string &attributeName)
-{
-    resolveCompile(context);
-    if (!attributeName.empty())
-    {
-        const auto &activeAttributes = mState.getActiveAttributes();
-
-        int semanticIndex = 0;
-        for (size_t attributeIndex = 0; attributeIndex < activeAttributes.size(); attributeIndex++)
-        {
-            const sh::ShaderVariable &attribute = activeAttributes[attributeIndex];
-
-            if (attribute.name == attributeName)
-            {
-                return semanticIndex;
-            }
-
-            semanticIndex += gl::VariableRegisterCount(attribute.type);
-        }
-    }
-
-    return -1;
-}
-
 const sh::WorkGroupSize &Shader::getWorkGroupSize(const Context *context)
 {
     resolveCompile(context);