Hi Robert,
Sorry for the late response, but the fix works for me.

Cheers
Sebastian
Hi Sebastian,

Thanks for the testing and fix, rather than always add in the '\n' I've changed the code to do a check whether the '\n' is present, if not add it:

versionLine = source.substr(start_of_line, end_of_line-start_of_line+1); if (source[source.size()-1]!='\n') source.push_back('\n');

I've checked this into svn/trunk, also attached the file. Could you try this out?

Robert.


On 4 March 2015 at 15:05, Sebastian Messerschmidt <[email protected] <mailto:[email protected]>> wrote:

    Hi Robert,

    If I put a complex version line line
    #version 400 compatibility
    at the beginning of my shader's source a non-valid shader code is
    produced.

    I've dived into the problem and found that finding the end line
    terminator is non-robust in this case.
    It determines the line's end with find_first_of("\n\r", ...)
    This will cause the string for the version to end up having "\r"
    as the last character, thus not a newline.

    A quick fix is to add a newline (\n) to the version line, as done
    in the attached submission against trunk revision.

    I didn't spot this in my first tests, as I'm using some own
    code/include injection adding extra newlines for the version.


    Cheers
    Sebastian



    _______________________________________________
    osg-users mailing list
    [email protected]
    <mailto:[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

Reply via email to