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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to