Changeset 485 for trunk/src/gl


Ignore:
Timestamp:
01/26/16 18:59:46 (9 years ago)
Author:
epyon
Message:
  • massive update (need to start doing atomics again) :/
Location:
trunk/src/gl
Files:
2 edited

Legend:

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

    r473 r485  
    354354}
    355355
    356 void nv::gl_context::update( buffer b, uint32 index, const void* data, size_t offset, size_t size )
    357 {
    358         const gl_buffer_info* info = static_cast<const gl_buffer_info*>( m_device->get_buffer_info( b ) );
    359         if ( info )
    360         {
    361                 GLenum glenum = buffer_type_to_enum( info->type );
    362                 if ( size == 0 )
    363                         glBindBufferBase( glenum, index, info->glid );
    364                 else
    365                         glBindBufferRange( glenum, index, info->glid, offset, size );
    366                 glBufferSubData( glenum, GLintptr( offset ), GLsizeiptr( size ), data );
    367         }
    368 }
     356// void nv::gl_context::update( buffer b, uint32 index, const void* data, size_t offset, size_t size )
     357// {
     358//      const gl_buffer_info* info = static_cast<const gl_buffer_info*>( m_device->get_buffer_info( b ) );
     359//      if ( info )
     360//      {
     361//              GLenum glenum = buffer_type_to_enum( info->type );
     362//              if ( size == 0 )
     363//                      glBindBufferBase( glenum, index, info->glid );
     364//              else
     365//                      glBindBufferRange( glenum, index, info->glid, offset, size );
     366//              glBufferSubData( glenum, GLintptr( offset ), GLsizeiptr( size ), data );
     367//      }
     368// }
    369369
    370370void gl_context::update( buffer b, const void* data, nv::size_t offset, nv::size_t size )
  • 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.