Optimize uniform handling by storing both decorated and undecorated names. Use a…

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
parent a3b4ab4c
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 754
#define BUILD_REVISION 759
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
//
// 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 @@ class VertexShader;
// 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 Uniform
// 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 @@ class Program
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 @@ class Program
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();
......
......@@ -3446,7 +3446,7 @@ int __stdcall glGetUniformLocation(GLuint program, const GLchar* name)
return error(GL_INVALID_OPERATION, -1);
}
return programObject->getUniformLocation(name, false);
return programObject->getUniformLocation(name);
}
}
catch(std::bad_alloc&)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment