Shaders - removed __..__ markers

This commit is contained in:
Emmanuel BENOîT 2017-11-04 12:00:58 +01:00
parent 46664170cd
commit 39a4ab132e
2 changed files with 64 additions and 64 deletions

View file

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

View file

@ -21,9 +21,9 @@ struct T_ShaderInputChunk
T_ShaderInputChunk( ) = default; T_ShaderInputChunk( ) = default;
T_ShaderInputChunk( T_ShaderInputChunk(
__rd__ const E_ShaderInputChunk type , const E_ShaderInputChunk type ,
__rd__ std::string text , std::string text ,
__rd__ const uint32_t lines ) const uint32_t lines )
: type( type ) , text( std::move( text ) ) , lines( lines ) : type( type ) , text( std::move( text ) ) , lines( lines )
{ } { }
}; };
@ -68,7 +68,7 @@ struct T_ShaderInput
std::vector< T_ShaderInputError > errors; std::vector< T_ShaderInputError > errors;
std::unordered_map< std::string , T_ShaderUniform > uniforms; 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 >; using P_ShaderInput = std::unique_ptr< T_ShaderInput >;
@ -106,11 +106,11 @@ struct T_ShaderPipeline
void enable( ) const; void enable( ) const;
GLuint id( ) const; GLuint id( ) const;
GLuint program( __rd__ const E_ShaderType program ) const; GLuint program( const E_ShaderType program ) const;
private: private:
explicit T_ShaderPipeline( explicit T_ShaderPipeline(
__rd__ const int32_t index ); const int32_t index );
int32_t smIndex_; int32_t smIndex_;
}; };
@ -131,7 +131,7 @@ struct T_ShaderManager
}; };
T_ShaderPipeline pipeline( T_ShaderPipeline pipeline(
__rd__ std::initializer_list< std::string > shaders ); std::initializer_list< std::string > shaders );
void update( ); void update( );
@ -174,33 +174,33 @@ struct T_ShaderManager
uint32_t newProgramRecord( ); uint32_t newProgramRecord( );
void loadProgram( void loadProgram(
__rd__ const uint32_t pipeline , const uint32_t pipeline ,
__rd__ std::string const& name ); std::string const& name );
bool useExistingProgram( bool useExistingProgram(
__rd__ const uint32_t pipeline , const uint32_t pipeline ,
__rd__ std::string const& name ); std::string const& name );
T_ShaderInput const* getInput( T_ShaderInput const* getInput(
__rd__ std::string const& name ); std::string const& name );
void dereferencePipeline( void dereferencePipeline(
__rd__ const uint32_t index ); const uint32_t index );
void dereferenceProgram( void dereferenceProgram(
__rd__ const uint32_t index , const uint32_t index ,
__rd__ const uint32_t pipeline ); const uint32_t pipeline );
void initPipeline( void initPipeline(
__rw__ T_Pipeline_& pipeline ) const; T_Pipeline_& pipeline ) const;
void initProgram( void initProgram(
__rw__ T_Program_& program ); T_Program_& program );
void parseGLSLError( void parseGLSLError(
__rw__ T_ShaderCode& code , T_ShaderCode& code ,
__rd__ char const* errorLine ); char const* errorLine );
void programUpdated( void programUpdated(
__rd__ std::string const& name ); std::string const& name );
void resetProgram( void resetProgram(
__rw__ T_Program_& program ); T_Program_& program );
}; };