summaryrefslogtreecommitdiff
path: root/indra/llrender/llglslshader.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-10-11 00:26:03 -0500
committerDave Parks <davep@lindenlab.com>2011-10-11 00:26:03 -0500
commit3211c6e3089b03d73f2e260be4037304660f834d (patch)
tree5ed0bb2ae02b44109a31786b0e9c6c3ac84d3490 /indra/llrender/llglslshader.cpp
parentcffcb414f57bcdc7de862d791f8f9c1fea91a7fb (diff)
SH-2240 WIP on removing lots of string comparisons that were added to deal with exploding amounts of non-built-in GL state
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rw-r--r--indra/llrender/llglslshader.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index ddadf07d73..bbb62ea3c1 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -320,7 +320,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
for (S32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedUniforms.size(); i++)
{
if ( (mUniform[i] == -1)
- && (LLShaderMgr::instance()->mReservedUniforms[i].compare(0, length, name, LLShaderMgr::instance()->mReservedUniforms[i].length()) == 0))
+ && (LLShaderMgr::instance()->mReservedUniforms[i] == name))
{
//found it
mUniform[i] = location;
@@ -334,7 +334,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
for (U32 i = 0; i < uniforms->size(); i++)
{
if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1)
- && ((*uniforms)[i].compare(0, length, name, (*uniforms)[i].length()) == 0))
+ && ((*uniforms)[i] == name))
{
//found it
mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location;
@@ -762,8 +762,12 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c
}
}
+static LLFastTimer::DeclareTimer FTM_UNIFORM_LOCATION("Get Uniform Location");
+
GLint LLGLSLShader::getUniformLocation(const string& uniform)
{
+ LLFastTimer t(FTM_UNIFORM_LOCATION);
+
GLint ret = -1;
if (mProgramObject > 0)
{
@@ -783,13 +787,19 @@ GLint LLGLSLShader::getUniformLocation(const string& uniform)
}
}
- /*if (gDebugGL)
+ return ret;
+}
+
+GLint LLGLSLShader::getUniformLocation(U32 index)
+{
+ LLFastTimer t(FTM_UNIFORM_LOCATION);
+
+ GLint ret = -1;
+ if (mProgramObject > 0)
{
- if (ret == -1 && ret != glGetUniformLocationARB(mProgramObject, uniform.c_str()))
- {
- llerrs << "Uniform map invalid." << llendl;
- }
- }*/
+ llassert(index < mUniform.size());
+ return mUniform[index];
+ }
return ret;
}