Ignore:
Timestamp:
01/26/16 18:59:46 (9 years ago)
Author:
epyon
Message:
  • massive update (need to start doing atomics again) :/
File:
1 edited

Legend:

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

    r477 r485  
    340340}
    341341
     342bool nv::gl_device::bind_block( program p, const string_view& name, uint32 index )
     343{
     344        const gl_program_info* info = m_programs.get( p );
     345        if ( info )
     346        {
     347                int id = get_block_location( p, name, false );
     348                if ( id < 0 ) return false;
     349                glUniformBlockBinding( info->glid, unsigned( id ), index );
     350                return true;
     351        }
     352        return false;
     353}
     354
    342355int nv::gl_device::get_block_location( program p, const string_view& name, bool fatal /*= true */ ) const
    343356{
     357        const gl_program_info* info = m_programs.get( p );
     358        if ( info )
     359        {
     360                int result = glGetUniformBlockIndex( info->glid, name.data() );
     361                if ( result >= 0 ) return result;
     362                if ( fatal )
     363                {
     364                        NV_LOG_CRITICAL( "gl_device : block '", name, "' not found in program!" );
     365                        NV_ABORT( "gl_device : block not found!" );
     366                }
     367        }
    344368        return -1;
    345369}
Note: See TracChangeset for help on using the changeset viewer.