Ignore:
Timestamp:
07/23/15 18:14:48 (10 years ago)
Author:
epyon
Message:
  • more std::string removal
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gl/gl_device.cc

    r438 r439  
    212212                for ( auto& i : *info->m_uniform_map )
    213213                {
    214                         auto j = lmap.find( i.first.c_str() );
     214                        auto j = lmap.find( i.first );
    215215                        if ( j != lmap.end() )
    216216                        {
     
    218218                        }                       
    219219
    220                         auto k = map.find( i.first.c_str() );
     220                        auto k = map.find( i.first );
    221221                        if ( k != map.end() )
    222222                        {
     
    227227}
    228228
    229 uniform_base* nv::gl_device::get_uniform( program p, const std::string& name, bool fatal /*= true */ ) const
     229uniform_base* nv::gl_device::get_uniform( program p, const string_view& name, bool fatal /*= true */ ) const
    230230{
    231231        const gl_program_info* info = m_programs.get( p );
     
    238238                if ( fatal )
    239239                {
    240                         NV_LOG_CRITICAL( "gl_device : uniform '", string_view( name.c_str(), name.size() ), "' not found in program!" );
     240                        NV_LOG_CRITICAL( "gl_device : uniform '", name, "' not found in program!" );
    241241                        NV_ABORT( "gl_device : uniform not found!" );
    242242                }
     
    245245}
    246246
    247 int nv::gl_device::get_attribute_location( program p, const std::string& name, bool fatal /*= true */ ) const
     247int nv::gl_device::get_attribute_location( program p, const string_view& name, bool fatal /*= true */ ) const
    248248{
    249249        const gl_program_info* info = m_programs.get( p );
     
    257257                if ( fatal )
    258258                {
    259                         NV_LOG_CRITICAL( "gl_device : attribute '", string_view( name.c_str(), name.size() ), "' not found in program!" );
     259                        NV_LOG_CRITICAL( "gl_device : attribute '", name, "' not found in program!" );
    260260                        NV_ABORT( "gl_device : attribute not found!" );
    261261                }
     
    357357                glGetActiveAttrib( p->glid, i, 128, &attr_nlen, &attr_len, &attr_type, name_buffer );
    358358
    359                 std::string name( name_buffer, size_t( attr_nlen ) );
     359                string_view name( name_buffer, size_t( attr_nlen ) );
    360360
    361361                // skip built-ins
    362362                if ( name.substr(0,3) == "gl_" ) continue;
    363363
    364                 int attr_loc = glGetAttribLocation( p->glid, name.c_str() );
     364                int attr_loc = glGetAttribLocation( p->glid, name.data() );
    365365
    366366                attribute& attr = (*p->m_attribute_map)[ name ];
    367                 attr.name     = name;
    368367                attr.location = attr_loc;
    369368                attr.type     = gl_enum_to_datatype( attr_type );
     
    386385                glGetActiveUniform( p->glid, i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer );
    387386
    388                 std::string name( name_buffer, size_t( uni_nlen ) );
     387                string_view name( name_buffer, size_t( uni_nlen ) );
    389388
    390389                // skip built-ins
    391390                if ( name.substr(0,3) == "gl_" ) continue;
    392391
    393                 int uni_loc = glGetUniformLocation( p->glid, name.c_str() );
     392                int uni_loc = glGetUniformLocation( p->glid, name.data() );
    394393                datatype utype = gl_enum_to_datatype( uni_type );
    395394
    396395                // check for array
    397                 std::string::size_type arrchar = name.find( '[' );
    398                 if ( arrchar != std::string::npos )
     396                size_t arrchar = name.find( '[' );
     397                if ( arrchar != string_view::npos )
    399398                {
    400399                        name = name.substr( 0, arrchar );
    401400                }
    402401
    403                 uniform_base* u = uniform_base::create( utype, name, uni_loc, uni_len );
     402                uniform_base* u = uniform_base::create( utype, uni_loc, uni_len );
    404403                NV_ASSERT( u, "Unknown uniform type!" );
    405404                (*p->m_uniform_map)[ name ] = u;
Note: See TracChangeset for help on using the changeset viewer.