Closed claudeha closed 3 years ago
Adding an empty line at the start of the file switches the direction of this off-by-one: after.frag.txt before.frag.txt
insert #line 2
at line 2 corrects off-by-one frag
my attempt to get this sorted out is in void Preprocessor::parseSource() roughly the first 200 lines
Found the cause...
case: hasIncludes, !hasVertexCode, vers > 200, the inserted #line directive must account for how many #include statements
See commit
if the value is less than 0 it will prepend, if the value is greater than line count it will append.
Here is my error line test suite, after making the adjustment these tests all get the right line numbers testing errors in vertex and fragment parts of main shader and buffershader...
the script is hardcoded for paths but not hard to figure out, in Fragmentarium folder I have FragMTestSuite/Error-Line-Tests/ that contains all of the frags and the script so in my setup I cd to where Fragmentarium executable lives and run the script like...
sh ./FragMTestSuite/Error-Line-Tests/errorLineTest.sh ./Fragmentarium-2.5.4
...passing it the name of the executable I want to test.
Describe the bug Sometimes (not always) the error line reported by the shader compiler is off by one.
To Reproduce Steps to reproduce the behavior:
Expected behavior Error line matches the error text.
Desktop (please complete the following information):
Additional context It doesn't always occur. May be driver dependent?
Attachments This one works as expected: not-off-by-one.zip This one has error off by one: off-by-one.zip