|
有些显卡shader里数组变量名称好像不加"[0]",代码这样修改是否妥当?
program.cpp:
735
736 GLint loc = _extensions->glGetUniformLocation( _glProgramHandle, name );
if( loc != -1 )
{
_uniformInfoMap[Uniform::getNameID(reinterpret_cast<const char*>(name))] = ActiveVarInfo(loc,type,size);
//add by mikeywj
std::string strName(name);
if(strName.length()>3 && strName.substr(strName.length()-3,3).compare("[0]")==0)
{
_uniformInfoMap[Uniform::getNameID(strName.substr(0,strName.length()-3))] = ActiveVarInfo(loc,type,size);
OSG_INFO << "\tUniform \"" << name << "\"/\""<<strName.substr(0,strName.length()-3).c_str()<<"\""
<< " loc="<< loc
<< " size="<< size
<< " type=" << Uniform::getTypename((Uniform::Type)type)
<< std::endl;
}
else
{
OSG_INFO << "\tUniform \"" << name << "\""
<< " loc="<< loc
<< " size="<< size
<< " type=" << Uniform::getTypename((Uniform::Type)type)
<< std::endl;
}
} |
|