From Michael Platings, To address performance bottleneck that occurs when using large number of uniforms introduced a name to uniqued ID scheme for Uniforms so comparisons can be done on a uint rather than a string.

This commit is contained in:
Robert Osfield
2010-11-25 12:30:38 +00:00
parent 4b4e02e45b
commit cdfbb7a753
5 changed files with 48 additions and 14 deletions

View File

@@ -452,7 +452,7 @@ bool Program::getGlProgramInfoLog(unsigned int contextID, std::string& log) cons
return getPCP( contextID )->getInfoLog( log );
}
const Program::ActiveVarInfoMap& Program::getActiveUniforms(unsigned int contextID) const
const Program::ActiveUniformMap& Program::getActiveUniforms(unsigned int contextID) const
{
return getPCP( contextID )->getActiveUniforms();
}
@@ -609,13 +609,13 @@ void Program::PerContextProgram::linkProgram(osg::State& state)
if( loc != -1 )
{
_uniformInfoMap[reinterpret_cast<char*>(name)] = ActiveVarInfo(loc,type,size);
_uniformInfoMap[Uniform::getNameID(reinterpret_cast<const char*>(name))] = ActiveVarInfo(loc,type,size);
OSG_INFO << "\tUniform \"" << name << "\""
<< " loc="<< loc
<< " size="<< size
<< " type=" << Uniform::getTypename((Uniform::Type)type)
<< std::endl;
<< " loc="<< loc
<< " size="<< size
<< " type=" << Uniform::getTypename((Uniform::Type)type)
<< std::endl;
}
}
delete [] name;