From 40e08813e2f92095551ff4a106b3b06cf66b680c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 31 Oct 2016 16:09:29 +0000 Subject: [PATCH] Improved debug output of shaders that use shader defines. --- src/osg/Shader.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/osg/Shader.cpp b/src/osg/Shader.cpp index 53bdb853b..7f4fd8eeb 100644 --- a/src/osg/Shader.cpp +++ b/src/osg/Shader.cpp @@ -625,13 +625,6 @@ void Shader::PerContextShader::compileShader(osg::State& state) } - if (osg::getNotifyLevel()>=osg::INFO) - { - std::string sourceWithLineNumbers = insertLineNumbers(source); - OSG_INFO << "\nCompiling " << _shader->getTypename() - << " source:\n" << sourceWithLineNumbers << std::endl; - } - GLint compiled = GL_FALSE; // OSG_NOTICE<<"Compiling PerContextShader "<getTypename() + << " source:\n" << sourceWithLineNumbers << std::endl; + } + + + _extensions->glShaderSource( _glShaderHandle, 1, &sourceText, NULL ); } else @@ -676,6 +683,13 @@ void Shader::PerContextShader::compileShader(osg::State& state) if (!versionLine.empty()) { + if (osg::getNotifyLevel()>=osg::INFO) + { + std::string sourceWithLineNumbers = insertLineNumbers(versionLine + _defineStr + source); + OSG_INFO << "\nCompiling " << _shader->getTypename() + << " source:\n" << sourceWithLineNumbers << std::endl; + } + // OSG_NOTICE<<"Shader::PerContextShader::compileShader() : Found #version, lineNum = "<=osg::INFO) + { + std::string sourceWithLineNumbers = insertLineNumbers(_defineStr + source); + OSG_INFO << "\nCompiling " << _shader->getTypename() + << " source:\n" << sourceWithLineNumbers << std::endl; + } + const GLchar* sourceText[2]; //OSG_NOTICE<<"glShaderSource() ["<<_defineStr<<"], ["<(_defineStr.c_str());