Robert, Yes, I think you are correct. Glenn Waldron
On Wed, Oct 12, 2016 at 10:46 AM, Robert Osfield <[email protected]> wrote: > HI Glen, > > Could it be the line: > > if (source[source.size()-1]!='\n') source.push_back('\n'); > > Is actually wrong and should be: > > if (versionLine[versionLine.versionLine.size()-1]!='\n') > versionLine.push_back('\n'); > > So rather than adding this, it should replace the original line > appending the \n to the source line. > > Robert. > > On 12 October 2016 at 14:57, Glenn Waldron <[email protected]> wrote: > > Robert, > > I was trying to use the pragmatic shader comp in OSG 3.4 and ran into the > > following bug. > > > > osg::Shader attempts to extract the "#version" string and insert the new > > #define statements between the #version line and the rest of the source. > > However, if the #version line ends in a CRLF combination (\r\n), the LF > is > > stripped and never replaced -- this causes the NVIDIA driver to report an > > illegal version string. > > > > I was able to fix it by checking for a LF and appending it if it's > missing. > > > > In Shader::PerContextShader::compileShader, I inserted this line: > > > > if ((end_of_line-start_of_line)>=8 && source.compare(start_of_line, 8, > > "#version")==0) > > { > > versionLine = source.substr(start_of_line, > end_of_line-start_of_line+1); > > if (versionLine.back() != '\n') versionLine.push_back('\n'); // > FIX > > BY INSERTING THIS LINE > > if (source[source.size()-1]!='\n') source.push_back('\n'); > > .... > > > > Let me know if you think this fix makes sense to put in the master. > Thanks. > > > > Glenn Waldron > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-users- > openscenegraph.org > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

