Changeset 485 for trunk/src/gl
- Timestamp:
- 01/26/16 18:59:46 (9 years ago)
- Location:
- trunk/src/gl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_context.cc
r473 r485 354 354 } 355 355 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 else365 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 // } 369 369 370 370 void gl_context::update( buffer b, const void* data, nv::size_t offset, nv::size_t size ) -
trunk/src/gl/gl_device.cc
r477 r485 340 340 } 341 341 342 bool 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 342 355 int nv::gl_device::get_block_location( program p, const string_view& name, bool fatal /*= true */ ) const 343 356 { 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 } 344 368 return -1; 345 369 }
Note: See TracChangeset
for help on using the changeset viewer.