From c9155abd12a5ed80b75dc8397f144ad891a844db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Thu, 9 Nov 2017 12:14:21 +0100 Subject: [PATCH] Shaders - Using T_Set in some places --- ebcl | 2 +- shaders.cc | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ebcl b/ebcl index cdbc810..9f666ee 160000 --- a/ebcl +++ b/ebcl @@ -1 +1 @@ -Subproject commit cdbc81094d266f007b22825d0e5e836804654381 +Subproject commit 9f666eea4946dd3de23203f6c829a540a2708565 diff --git a/shaders.cc b/shaders.cc index 75ae0a0..8d80501 100644 --- a/shaders.cc +++ b/shaders.cc @@ -2,6 +2,8 @@ #include "shaders.hh" #include "globals.hh" +#include + namespace { @@ -585,7 +587,8 @@ T_ShaderPipeline T_ShaderManager::pipeline( void T_ShaderManager::update( ) { - T_Array< T_String > temp; + using namespace ebcl; + T_Set< T_String > temp{ UseTag< ArrayBacked< 64 > >( ) }; T_StringBuilder sb; inputs_.clear( ); @@ -610,12 +613,12 @@ void T_ShaderManager::update( ) } // Remove all marked entries - for ( auto const& s : temp ) { - missing_.remove( s ); + for ( auto i = 0u ; i < temp.size( ) ; i ++ ) { + missing_.remove( temp[ i ] ); } + temp.clear( ); // Reset programs that need to be updated - temp.clear( ); for ( auto it = updates_.begin( ) ; it.valid( ) ; ) { auto const* p( programIndex_.get( *it ) ); if ( p ) { @@ -636,8 +639,8 @@ void T_ShaderManager::update( ) } // Reset pipelines affected by the programs above - for ( auto const& pName : temp ) { - auto& pipeline( *pipelines_.get( pName ) ); + for ( auto i = 0u ; i < temp.size( ) ; i ++ ) { + auto& pipeline( *pipelines_.get( temp[ i ] ) ); if ( pipeline.id != 0 ) { glDeleteProgramPipelines( 1 , &pipeline.id ); pipeline.id = 0; @@ -658,8 +661,8 @@ void T_ShaderManager::update( ) printf( "%s" , sb.data( ) ); // Try to initialise all affected pipelines - for ( auto const& pName : temp ) { - initPipeline( *pipelines_.get( pName ) ); + for ( auto i = 0u ; i < temp.size( ) ; i ++ ) { + initPipeline( *pipelines_.get( temp[ i ] ) ); } updates_.clear( );