[osg-users] Pragmatic shader composition - bug
Glenn Waldron
gwaldron at gmail.com
Wed Oct 12 06:57:48 PDT 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161012/9f06d4f4/attachment-0002.htm>
More information about the osg-users
mailing list