Restructed check for whether to print out shaders to make it easier to toggle on/off

This commit is contained in:
Robert Osfield 2016-11-03 17:33:38 +00:00
parent 44c11a856b
commit 4600acb3b7

View File

@ -628,12 +628,13 @@ void Shader::PerContextShader::compileShader(osg::State& state)
GLint compiled = GL_FALSE;
// OSG_NOTICE<<"Compiling PerContextShader "<<this<<" ShaderDefine="<<getDefineString()<<std::endl;
bool printOutShaders = osg::getNotifyLevel()>=osg::INFO;//NOTICE;
if (_defineStr.empty())
{
const GLchar* sourceText = reinterpret_cast<const GLchar*>(source.c_str());
if (osg::getNotifyLevel()>=osg::INFO)
if (printOutShaders)
{
std::string sourceToCompile;
if (!_defineStr.empty()) sourceToCompile += _defineStr;
@ -644,8 +645,6 @@ void Shader::PerContextShader::compileShader(osg::State& state)
<< " source:\n" << sourceWithLineNumbers << std::endl;
}
_extensions->glShaderSource( _glShaderHandle, 1, &sourceText, NULL );
}
else
@ -683,10 +682,10 @@ void Shader::PerContextShader::compileShader(osg::State& state)
if (!versionLine.empty())
{
if (osg::getNotifyLevel()>=osg::INFO)
if (printOutShaders)
{
std::string sourceWithLineNumbers = insertLineNumbers(versionLine + _defineStr + source);
OSG_INFO << "\nCompiling " << _shader->getTypename()
OSG_NOTICE << "\nCompiling " << _shader->getTypename()
<< " source:\n" << sourceWithLineNumbers << std::endl;
}
@ -700,10 +699,10 @@ void Shader::PerContextShader::compileShader(osg::State& state)
}
else
{
if (osg::getNotifyLevel()>=osg::INFO)
if (printOutShaders)
{
std::string sourceWithLineNumbers = insertLineNumbers(_defineStr + source);
OSG_INFO << "\nCompiling " << _shader->getTypename()
OSG_NOTICE << "\nCompiling " << _shader->getTypename()
<< " source:\n" << sourceWithLineNumbers << std::endl;
}