Implement GetFragDataLocation, often used by applications with MRT shaders in GLSL ES version 300.

TRAC #22704

Signed-off-by: Geoff Lang
Signed-off-by: Nicolas Capens
Authored-by: Jamie Madill
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index 4dd1de1..8c83988 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -372,6 +372,25 @@
     return mUniformBlocks[blockIndex];
 }
 
+GLint ProgramBinary::getFragDataLocation(const char *name) const
+{
+    std::string baseName(name);
+    unsigned int arrayIndex;
+    arrayIndex = parseAndStripArrayIndex(&baseName);
+
+    for (auto locationIt = mOutputVariables.begin(); locationIt != mOutputVariables.end(); locationIt++)
+    {
+        const VariableLocation &outputVariable = locationIt->second;
+
+        if (outputVariable.name == baseName && (arrayIndex == GL_INVALID_INDEX || arrayIndex == outputVariable.element))
+        {
+            return static_cast<GLint>(locationIt->first);
+        }
+    }
+
+    return -1;
+}
+
 template <typename T>
 bool ProgramBinary::setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType)
 {