Changeset 392 for trunk/src/gl
- Timestamp:
- 06/11/15 16:23:41 (10 years ago)
- Location:
- trunk/src/gl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_context.cc
r376 r392 713 713 if ( info ) 714 714 { 715 for ( auto u :info->m_engine_uniforms )715 for ( auto& u : *info->m_engine_uniforms ) 716 716 { 717 717 u->set( this, &s ); -
trunk/src/gl/gl_device.cc
r383 r392 17 17 m_shader_header = "#version 120\n"; 18 18 for ( auto& i : get_uniform_factory() ) 19 m_shader_header += "uniform "+datatype_to_glsl_type( i.second->get_datatype() )+" "+ i.first+";\n";19 m_shader_header += "uniform "+datatype_to_glsl_type( i.second->get_datatype() )+" "+ i.first.to_string() +";\n"; 20 20 for ( auto& i : get_link_uniform_factory() ) 21 m_shader_header += "uniform sampler2D "+i.first +";\n";21 m_shader_header += "uniform sampler2D "+i.first.to_string() +";\n"; 22 22 } 23 23 … … 26 26 program result = m_programs.create(); 27 27 gl_program_info* info = m_programs.get( result ); 28 29 info->m_attribute_map = new attribute_map; 30 info->m_engine_uniforms = new engine_uniform_list; 31 info->m_uniform_map = new uniform_map; 28 32 29 33 info->glid = glCreateProgram(); … … 179 183 if ( info ) 180 184 { 181 for ( auto& i : info->m_uniform_map )185 for ( auto& i : *info->m_uniform_map ) 182 186 delete i.second; 183 187 … … 188 192 glDeleteProgram( info->glid ); 189 193 194 delete info->m_attribute_map; 195 delete info->m_engine_uniforms; 196 delete info->m_uniform_map; 197 190 198 m_programs.destroy( p ); 191 199 } … … 200 208 auto& lmap = get_link_uniform_factory(); 201 209 202 for ( auto& i : info->m_uniform_map )210 for ( auto& i : *info->m_uniform_map ) 203 211 { 204 212 auto j = lmap.find( i.first ); … … 211 219 if ( k != map.end() ) 212 220 { 213 info->m_engine_uniforms .push_back( k->second->create( i.second ) );221 info->m_engine_uniforms->push_back( k->second->create( i.second ) ); 214 222 } 215 223 } … … 221 229 const gl_program_info* info = m_programs.get( p ); 222 230 { 223 nv::uniform_map::const_iterator i = info->m_uniform_map .find( name );224 if ( i != info->m_uniform_map .end() )231 nv::uniform_map::const_iterator i = info->m_uniform_map->find( name ); 232 if ( i != info->m_uniform_map->end() ) 225 233 { 226 234 return i->second; … … 240 248 if ( info ) 241 249 { 242 attribute_map::const_iterator i = info->m_attribute_map .find( name );243 if ( i != info->m_attribute_map .end() )250 attribute_map::const_iterator i = info->m_attribute_map->find( name ); 251 if ( i != info->m_attribute_map->end() ) 244 252 { 245 253 return i->second.location; … … 307 315 void nv::gl_device::update_uniforms( gl_program_info* p ) 308 316 { 309 for ( uniform_map::iterator i = p->m_uniform_map.begin(); i != p->m_uniform_map.end(); ++i )310 { 311 uniform_base* ubase = i ->second;317 for ( auto& i : *p->m_uniform_map ) 318 { 319 uniform_base* ubase = i.second; 312 320 if ( ubase->is_dirty() ) 313 321 { … … 354 362 int attr_loc = glGetAttribLocation( p->glid, name.c_str() ); 355 363 356 attribute& attr = p->m_attribute_map[ name ];364 attribute& attr = (*p->m_attribute_map)[ name ]; 357 365 attr.name = name; 358 366 attr.location = attr_loc; … … 393 401 uniform_base* u = uniform_base::create( utype, name, uni_loc, uni_len ); 394 402 NV_ASSERT( u, "Unknown uniform type!" ); 395 p->m_uniform_map[ name ] = u;403 (*p->m_uniform_map)[ name ] = u; 396 404 } 397 405 }
Note: See TracChangeset
for help on using the changeset viewer.