<div dir="ltr">Robert,<div>Yes, I think you are correct.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Glenn Waldron</div></div></div></div>
<br><div class="gmail_quote">On Wed, Oct 12, 2016 at 10:46 AM, Robert Osfield <span dir="ltr"><<a href="mailto:robert.osfield@gmail.com" target="_blank">robert.osfield@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">HI Glen,<br>
<br>
Could it be the line:<br>
<span class=""><br>
if (source[source.size()-1]!='\n'<wbr>) source.push_back('\n');<br>
<br>
</span>Is actually wrong and should be:<br>
<br>
if (versionLine[versionLine.<wbr>versionLine.size()-1]!='\n')<br>
versionLine.push_back('\n');<br>
<br>
So rather than adding this, it should replace the original line<br>
appending the \n to the source line.<br>
<br>
Robert.<br>
<div><div class="h5"><br>
On 12 October 2016 at 14:57, Glenn Waldron <<a href="mailto:gwaldron@gmail.com">gwaldron@gmail.com</a>> wrote:<br>
> Robert,<br>
> I was trying to use the pragmatic shader comp in OSG 3.4 and ran into the<br>
> following bug.<br>
><br>
> osg::Shader attempts to extract the "#version" string and insert the new<br>
> #define statements between the #version line and the rest of the source.<br>
> However, if the #version line ends in a CRLF combination (\r\n), the LF is<br>
> stripped and never replaced -- this causes the NVIDIA driver to report an<br>
> illegal version string.<br>
><br>
> I was able to fix it by checking for a LF and appending it if it's missing.<br>
><br>
> In Shader::PerContextShader::<wbr>compileShader, I inserted this line:<br>
><br>
> if ((end_of_line-start_of_line)>=<wbr>8 && source.compare(start_of_line, 8,<br>
> "#version")==0)<br>
> {<br>
> versionLine = source.substr(start_of_line, end_of_line-start_of_line+1);<br>
> if (versionLine.back() != '\n') versionLine.push_back('\n'); // FIX<br>
> BY INSERTING THIS LINE<br>
> if (source[source.size()-1]!='\n'<wbr>) source.push_back('\n');<br>
> ....<br>
><br>
> Let me know if you think this fix makes sense to put in the master. Thanks.<br>
><br>
> Glenn Waldron<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> osg-users mailing list<br>
> <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
> <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
><br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
</blockquote></div><br></div>