diff --git a/shaders.cc b/shaders.cc index 6def6be..dfc2812 100644 --- a/shaders.cc +++ b/shaders.cc @@ -157,6 +157,7 @@ void T_InputReader_::handleDirective( void T_InputReader_::error( __rd__ std::string const& err ) { + printf( "input error (%d - %s)\n" , line , err.c_str( ) ); input.errors.push_back( T_ShaderInputError{ line , err } ); } @@ -323,6 +324,10 @@ struct T_CodeBuilder_ void include( __rd__ std::string const& name , __rd__ const uint32_t lines ); void next( ); + + void addInputLoaderErrors( + __rd__ T_ShaderInput const* input , + __rd__ std::string const& name ); }; /*----------------------------------------------------------------------------*/ @@ -341,6 +346,7 @@ bool T_CodeBuilder_::buildCode( ) } else { code.type = E_ShaderType( int( main->type ) - 2 ); } + addInputLoaderErrors( main , name ); cname = name; current = main; @@ -409,10 +415,7 @@ void T_CodeBuilder_::include( // Add input loader errors if ( libraries.find( nname ) == libraries.end( ) ) { - for ( auto const& errs : isi->errors ) { - code.errors.push_back( T_ShaderError{ - nname , errs.line , errs.error } ); - } + addInputLoaderErrors( isi , nname ); } libraries.insert( nname ); @@ -437,6 +440,16 @@ void T_CodeBuilder_::next( ) } } +void T_CodeBuilder_::addInputLoaderErrors( + __rd__ T_ShaderInput const* input , + __rd__ std::string const& name ) +{ + for ( auto const& errs : input->errors ) { + code.errors.push_back( T_ShaderError{ + name , errs.line , errs.error } ); + } +} + } // namespace