| 324 | } |
| 325 | |
| 326 | std::string ShaderPreprocessor::readStream( std::istream &input, const fs::path &sourcePath, int lineNumberStart, int versionNumber, set<fs::path> &includeTree ) |
| 327 | { |
| 328 | // go through each line and process includes |
| 329 | string line; |
| 330 | int lineNumber = lineNumberStart; |
| 331 | stringstream output; |
| 332 | |
| 333 | while( getline( input, line ) ) { |
| 334 | std::string includeFilePath; |
| 335 | if( findIncludeStatement( line, &includeFilePath ) ) { |
| 336 | int numIncludesBefore = (int)includeTree.size(); |
| 337 | output << parseRecursive( includeFilePath, sourcePath.parent_path(), versionNumber, includeTree ); |
| 338 | output << getLineDirective( sourcePath, lineNumber, numIncludesBefore, versionNumber ); |
| 339 | } |
| 340 | else |
| 341 | output << line << "\n"; |
| 342 | |
| 343 | lineNumber++; |
| 344 | } |
| 345 | |
| 346 | return output.str(); |
| 347 | } |
| 348 | |
| 349 | std::string ShaderPreprocessor::getLineDirective( const fs::path &sourcePath, int lineNumber, int sourceStringNumber, int versionNumber ) const |
| 350 | { |
nothing calls this directly
no test coverage detected