diff --git a/shaders.cc b/shaders.cc index 7f59eae..772e135 100644 --- a/shaders.cc +++ b/shaders.cc @@ -71,8 +71,8 @@ struct T_InputReader_ std::string accumulator{ }; uint32_t accumLines{ 0 }; - T_InputReader_( __rd__ FILE* const file , - __rw__ T_ShaderInput& input ) + T_InputReader_( FILE* const file , + T_ShaderInput& input ) : file( file ) , input( input ) { } ~T_InputReader_( ); @@ -80,12 +80,12 @@ struct T_InputReader_ void read( ); void handleDirective( - __rd__ T_Tokens_ const& tokens ); + T_Tokens_ const& tokens ); void parseInputDirective( - __rd__ T_Tokens_ const& tokens ); + T_Tokens_ const& tokens ); void error( - __rd__ std::string const& err ); + std::string const& err ); void nl( ); void addAccumulated( ); }; @@ -125,7 +125,7 @@ void T_InputReader_::read( ) /*----------------------------------------------------------------------------*/ void T_InputReader_::handleDirective( - __rd__ T_Tokens_ const& tokens ) + T_Tokens_ const& tokens ) { auto const& directive( tokens[ 0 ] ); @@ -173,7 +173,7 @@ void T_InputReader_::handleDirective( } void T_InputReader_::parseInputDirective( - __rd__ T_Tokens_ const& tokens ) + T_Tokens_ const& tokens ) { if ( tokens.size( ) != 4 ) { error( "invalid arguments" ); @@ -212,7 +212,7 @@ void T_InputReader_::parseInputDirective( /*----------------------------------------------------------------------------*/ void T_InputReader_::error( - __rd__ std::string const& err ) + std::string const& err ) { input.errors.push_back( T_ShaderInputError{ line , err } ); @@ -241,7 +241,7 @@ void T_InputReader_::addAccumulated( ) /*= T_ShaderInput ============================================================*/ bool T_ShaderInput::load( - __rd__ std::string const& path ) + std::string const& path ) { type = E_ShaderInput::CHUNK; chunks.clear( ); @@ -266,19 +266,19 @@ T_ShaderPipeline::T_ShaderPipeline( ) { } T_ShaderPipeline::T_ShaderPipeline( - __rd__ T_ShaderPipeline const& other ) + T_ShaderPipeline const& other ) : T_ShaderPipeline( other.smIndex_ ) { } T_ShaderPipeline::T_ShaderPipeline( - __rw__ T_ShaderPipeline&& other ) noexcept + T_ShaderPipeline&& other ) noexcept : T_ShaderPipeline( ) { std::swap( other.smIndex_ , smIndex_ ); } T_ShaderPipeline::T_ShaderPipeline( - __rd__ const int32_t index ) + const int32_t index ) : smIndex_( index ) { if ( smIndex_ >= 0 ) { @@ -294,7 +294,7 @@ T_ShaderPipeline::~T_ShaderPipeline( ) } T_ShaderPipeline& T_ShaderPipeline::operator=( - __rd__ T_ShaderPipeline const& other ) + T_ShaderPipeline const& other ) { if ( this != &other ) { if ( smIndex_ >= 0 ) { @@ -309,7 +309,7 @@ T_ShaderPipeline& T_ShaderPipeline::operator=( } T_ShaderPipeline& T_ShaderPipeline::operator=( - __rw__ T_ShaderPipeline&& other ) noexcept + T_ShaderPipeline&& other ) noexcept { if ( this != &other ) { if ( smIndex_ >= 0 ) { @@ -344,7 +344,7 @@ GLuint T_ShaderPipeline::id( ) const } GLuint T_ShaderPipeline::program( - __rd__ const E_ShaderType program ) const + const E_ShaderType program ) const { if ( !valid( ) ) { return 0; @@ -394,22 +394,22 @@ struct T_CodeBuilder_ uint32_t cpos{ 0 }; std::string cname; - T_CodeBuilder_( __rd__ F_GetInput_ loader , - __rd__ std::string const& name , - __rw__ T_Code_& code ) + T_CodeBuilder_( F_GetInput_ loader , + std::string const& name , + T_Code_& code ) : loader( loader ) , name( name ) , code( code ) , main( loader( name ) ) { } bool buildCode( ); - void appendChunk( __rd__ T_ShaderInputChunk const& chunk ); - void include( __rd__ std::string const& name , - __rd__ const uint32_t lines ); + void appendChunk( T_ShaderInputChunk const& chunk ); + void include( std::string const& name , + const uint32_t lines ); void next( ); void addInputLoaderErrors( - __rd__ T_ShaderInput const* input , - __rd__ std::string const& name ); + T_ShaderInput const* input , + std::string const& name ); }; /*----------------------------------------------------------------------------*/ @@ -447,7 +447,7 @@ bool T_CodeBuilder_::buildCode( ) } void T_CodeBuilder_::appendChunk( - __rd__ T_ShaderInputChunk const& chunk ) + T_ShaderInputChunk const& chunk ) { code.sources.push_back( cname ); code.counts.push_back( chunk.lines ); @@ -457,8 +457,8 @@ void T_CodeBuilder_::appendChunk( } void T_CodeBuilder_::include( - __rd__ std::string const& nname , - __rd__ const uint32_t lines ) + std::string const& nname , + const uint32_t lines ) { const auto prevPos( pos[ cname ] ); pos[ cname ] += lines; @@ -523,8 +523,8 @@ void T_CodeBuilder_::next( ) } void T_CodeBuilder_::addInputLoaderErrors( - __rd__ T_ShaderInput const* input , - __rd__ std::string const& name ) + T_ShaderInput const* input , + std::string const& name ) { for ( auto const& errs : input->errors ) { code.errors.push_back( T_ShaderError{ @@ -539,7 +539,7 @@ void T_CodeBuilder_::addInputLoaderErrors( T_ShaderPipeline T_ShaderManager::pipeline( - __rd__ std::initializer_list< std::string > shaders ) + std::initializer_list< std::string > shaders ) { if ( shaders.size( ) < 1 || shaders.size( ) > 5 ) { return {}; @@ -662,8 +662,8 @@ uint32_t T_ShaderManager::newProgramRecord( ) void T_ShaderManager::loadProgram( - __rd__ const uint32_t pipeline , - __rd__ std::string const& name ) + const uint32_t pipeline , + std::string const& name ) { if ( useExistingProgram( pipeline , name ) ) { return; @@ -682,8 +682,8 @@ void T_ShaderManager::loadProgram( } bool T_ShaderManager::useExistingProgram( - __rd__ const uint32_t pipeline , - __rd__ std::string const& name ) + const uint32_t pipeline , + std::string const& name ) { auto pos( programIndex_.find( name ) ); if ( pos == programIndex_.end( ) ) { @@ -697,7 +697,7 @@ bool T_ShaderManager::useExistingProgram( T_ShaderInput const* T_ShaderManager::getInput( - __rd__ std::string const& name ) + std::string const& name ) { auto pos( inputs_.find( name ) ); if ( pos != inputs_.end( ) ) { @@ -713,7 +713,7 @@ T_ShaderInput const* T_ShaderManager::getInput( void T_ShaderManager::dereferencePipeline( - __rd__ const uint32_t index ) + const uint32_t index ) { auto& pipeline( pipelines_[ index ] ); assert( pipeline.references > 0 ); @@ -737,8 +737,8 @@ void T_ShaderManager::dereferencePipeline( void T_ShaderManager::dereferenceProgram( - __rd__ const uint32_t index , - __rd__ const uint32_t pipeline ) + const uint32_t index , + const uint32_t pipeline ) { auto& program( programs_[ index ] ); auto& refs( program.references ); @@ -753,7 +753,7 @@ void T_ShaderManager::dereferenceProgram( void T_ShaderManager::initPipeline( - __rw__ T_Pipeline_& pipeline ) const + T_Pipeline_& pipeline ) const { assert( pipeline.id == 0 ); @@ -800,7 +800,7 @@ void T_ShaderManager::initPipeline( void T_ShaderManager::initProgram( - __rw__ T_Program_& program ) + T_Program_& program ) { assert( program.id == 0 ); @@ -879,8 +879,8 @@ void T_ShaderManager::initProgram( } void T_ShaderManager::parseGLSLError( - __rw__ T_ShaderCode& code , - __rd__ char const* errorLine ) + T_ShaderCode& code , + char const* errorLine ) { assert( !code.sources.empty( ) ); @@ -905,13 +905,13 @@ void T_ShaderManager::parseGLSLError( } void T_ShaderManager::programUpdated( - __rd__ std::string const& name ) + std::string const& name ) { updates_.insert( name ); } void T_ShaderManager::resetProgram( - __rw__ T_Program_& program ) + T_Program_& program ) { if ( program.watch ) { program.watch.reset( ); diff --git a/shaders.hh b/shaders.hh index e17e132..a3ac8cb 100644 --- a/shaders.hh +++ b/shaders.hh @@ -21,9 +21,9 @@ struct T_ShaderInputChunk T_ShaderInputChunk( ) = default; T_ShaderInputChunk( - __rd__ const E_ShaderInputChunk type , - __rd__ std::string text , - __rd__ const uint32_t lines ) + const E_ShaderInputChunk type , + std::string text , + const uint32_t lines ) : type( type ) , text( std::move( text ) ) , lines( lines ) { } }; @@ -68,7 +68,7 @@ struct T_ShaderInput std::vector< T_ShaderInputError > errors; std::unordered_map< std::string , T_ShaderUniform > uniforms; - bool load( __rd__ std::string const& path ); + bool load( std::string const& path ); }; using P_ShaderInput = std::unique_ptr< T_ShaderInput >; @@ -106,11 +106,11 @@ struct T_ShaderPipeline void enable( ) const; GLuint id( ) const; - GLuint program( __rd__ const E_ShaderType program ) const; + GLuint program( const E_ShaderType program ) const; private: explicit T_ShaderPipeline( - __rd__ const int32_t index ); + const int32_t index ); int32_t smIndex_; }; @@ -131,7 +131,7 @@ struct T_ShaderManager }; T_ShaderPipeline pipeline( - __rd__ std::initializer_list< std::string > shaders ); + std::initializer_list< std::string > shaders ); void update( ); @@ -174,33 +174,33 @@ struct T_ShaderManager uint32_t newProgramRecord( ); void loadProgram( - __rd__ const uint32_t pipeline , - __rd__ std::string const& name ); + const uint32_t pipeline , + std::string const& name ); bool useExistingProgram( - __rd__ const uint32_t pipeline , - __rd__ std::string const& name ); + const uint32_t pipeline , + std::string const& name ); T_ShaderInput const* getInput( - __rd__ std::string const& name ); + std::string const& name ); void dereferencePipeline( - __rd__ const uint32_t index ); + const uint32_t index ); void dereferenceProgram( - __rd__ const uint32_t index , - __rd__ const uint32_t pipeline ); + const uint32_t index , + const uint32_t pipeline ); void initPipeline( - __rw__ T_Pipeline_& pipeline ) const; + T_Pipeline_& pipeline ) const; void initProgram( - __rw__ T_Program_& program ); + T_Program_& program ); void parseGLSLError( - __rw__ T_ShaderCode& code , - __rd__ char const* errorLine ); + T_ShaderCode& code , + char const* errorLine ); void programUpdated( - __rd__ std::string const& name ); + std::string const& name ); void resetProgram( - __rw__ T_Program_& program ); + T_Program_& program ); };