Shaders - Using T_Set in some places

This commit is contained in:
Emmanuel BENOîT 2017-11-09 12:14:21 +01:00
parent d83743d072
commit c9155abd12
2 changed files with 12 additions and 9 deletions

2
ebcl

@ -1 +1 @@
Subproject commit cdbc81094d266f007b22825d0e5e836804654381 Subproject commit 9f666eea4946dd3de23203f6c829a540a2708565

View file

@ -2,6 +2,8 @@
#include "shaders.hh" #include "shaders.hh"
#include "globals.hh" #include "globals.hh"
#include <ebcl/Sets.hh>
namespace { namespace {
@ -585,7 +587,8 @@ T_ShaderPipeline T_ShaderManager::pipeline(
void T_ShaderManager::update( ) void T_ShaderManager::update( )
{ {
T_Array< T_String > temp; using namespace ebcl;
T_Set< T_String > temp{ UseTag< ArrayBacked< 64 > >( ) };
T_StringBuilder sb; T_StringBuilder sb;
inputs_.clear( ); inputs_.clear( );
@ -610,12 +613,12 @@ void T_ShaderManager::update( )
} }
// Remove all marked entries // Remove all marked entries
for ( auto const& s : temp ) { for ( auto i = 0u ; i < temp.size( ) ; i ++ ) {
missing_.remove( s ); missing_.remove( temp[ i ] );
} }
temp.clear( );
// Reset programs that need to be updated // Reset programs that need to be updated
temp.clear( );
for ( auto it = updates_.begin( ) ; it.valid( ) ; ) { for ( auto it = updates_.begin( ) ; it.valid( ) ; ) {
auto const* p( programIndex_.get( *it ) ); auto const* p( programIndex_.get( *it ) );
if ( p ) { if ( p ) {
@ -636,8 +639,8 @@ void T_ShaderManager::update( )
} }
// Reset pipelines affected by the programs above // Reset pipelines affected by the programs above
for ( auto const& pName : temp ) { for ( auto i = 0u ; i < temp.size( ) ; i ++ ) {
auto& pipeline( *pipelines_.get( pName ) ); auto& pipeline( *pipelines_.get( temp[ i ] ) );
if ( pipeline.id != 0 ) { if ( pipeline.id != 0 ) {
glDeleteProgramPipelines( 1 , &pipeline.id ); glDeleteProgramPipelines( 1 , &pipeline.id );
pipeline.id = 0; pipeline.id = 0;
@ -658,8 +661,8 @@ void T_ShaderManager::update( )
printf( "%s" , sb.data( ) ); printf( "%s" , sb.data( ) );
// Try to initialise all affected pipelines // Try to initialise all affected pipelines
for ( auto const& pName : temp ) { for ( auto i = 0u ; i < temp.size( ) ; i ++ ) {
initPipeline( *pipelines_.get( pName ) ); initPipeline( *pipelines_.get( temp[ i ] ) );
} }
updates_.clear( ); updates_.clear( );