Optimize uniform handling by storing both decorated and undecorated names. Use a consistent naming scheme to clarify decorated/undecorated name usage.

TRAC #16567
Bug=136
Signed-off-by: Daniel Koch
Author: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@759 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Program.h b/src/libGLESv2/Program.h
index 8085522..9a20f7a 100644
--- a/src/libGLESv2/Program.h
+++ b/src/libGLESv2/Program.h
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
@@ -28,12 +28,15 @@
 // Helper struct representing a single shader uniform
 struct Uniform
 {
-    Uniform(GLenum type, const std::string &name, unsigned int arraySize);
+    Uniform(GLenum type, const std::string &_name, unsigned int arraySize);
 
     ~Uniform();
 
+    bool isArray();
+
     const GLenum type;
-    const std::string name;
+    const std::string _name;   // Decorated name
+    const std::string name;    // Undecorated name
     const unsigned int arraySize;
 
     unsigned char *data;
@@ -47,7 +50,7 @@
 // Struct used for correlating uniforms/elements of uniform arrays to handles
 struct UniformLocation
 {
-    UniformLocation(const std::string &name, unsigned int element, unsigned int index);
+    UniformLocation(const std::string &_name, unsigned int element, unsigned int index);
 
     std::string name;
     unsigned int element;
@@ -75,7 +78,7 @@
     GLint getSamplerMapping(SamplerType type, unsigned int samplerIndex);
     TextureType getSamplerTextureType(SamplerType type, unsigned int samplerIndex);
 
-    GLint getUniformLocation(const char *name, bool decorated);
+    GLint getUniformLocation(std::string name);
     bool setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
     bool setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
     bool setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
@@ -165,8 +168,8 @@
     void appendToInfoLog(const char *info, ...);
     void resetInfoLog();
 
-    static std::string decorate(const std::string &string);     // Prepend an underscore
-    static std::string undecorate(const std::string &string);   // Remove leading underscore
+    static std::string decorate(const std::string &name);      // Prepend an underscore
+    static std::string undecorate(const std::string &_name);   // Remove leading underscore
 
     static unsigned int issueSerial();