Changeset 473 for trunk/src/gl
- Timestamp:
- 10/09/15 14:06:56 (10 years ago)
- Location:
- trunk/src/gl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_context.cc
r469 r473 205 205 { 206 206 glBindFramebuffer( framebuffer_slot_to_enum(ft), 0 ); 207 } 208 } 209 210 void nv::gl_context::bind( buffer b, uint32 index, size_t offset /*= 0*/, size_t size /*= 0 */ ) 211 { 212 const gl_buffer_info* info = static_cast< const gl_buffer_info* >( m_device->get_buffer_info( b ) ); 213 if ( info ) 214 { 215 if ( size == 0 ) 216 glBindBufferBase( buffer_type_to_enum( info->type ), index, info->glid ); 217 else 218 glBindBufferRange( buffer_type_to_enum( info->type ), index, info->glid, offset, size ); 207 219 } 208 220 } … … 339 351 else 340 352 glTexImage2D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum(format.format) ), size.x, size.y, 0, nv::image_format_to_enum(format.format), nv::datatype_to_gl_enum(format.type), data ); 353 } 354 } 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 else 365 glBindBufferRange( glenum, index, info->glid, offset, size ); 366 glBufferSubData( glenum, GLintptr( offset ), GLsizeiptr( size ), data ); 341 367 } 342 368 } … … 750 776 } 751 777 752 void gl_context::draw( primitive prim, const render_state& rs, program p, vertex_array va, nv::size_t count )778 void gl_context::draw( primitive prim, const render_state& rs, program p, vertex_array va, nv::size_t count, nv::size_t first ) 753 779 { 754 780 apply_render_state( rs ); … … 760 786 if ( info->index.is_valid() ) 761 787 { 762 glDrawElements( primitive_to_enum(prim), static_cast<GLsizei>( count ), datatype_to_gl_enum( info->index_type ), 0);788 glDrawElements( primitive_to_enum(prim), static_cast<GLsizei>( count ), datatype_to_gl_enum( info->index_type ), reinterpret_cast< const void* >( get_datatype_info( info->index_type ).size * first ) ); 763 789 } 764 790 else 765 791 { 766 glDrawArrays( primitive_to_enum(prim), 0, static_cast<GLsizei>( count ) );792 glDrawArrays( primitive_to_enum(prim), first, static_cast<GLsizei>( count ) ); 767 793 } 768 794 unbind( va ); -
trunk/src/gl/gl_device.cc
r471 r473 337 337 } 338 338 } 339 return -1; 340 } 341 342 int nv::gl_device::get_block_location( program p, const string_view& name, bool fatal /*= true */ ) const 343 { 339 344 return -1; 340 345 } … … 450 455 { 451 456 int params; 457 int bparams; 452 458 glGetProgramiv( p->glid, GL_ACTIVE_UNIFORMS, ¶ms ); 459 glGetProgramiv( p->glid, GL_ACTIVE_UNIFORM_BLOCKS, &bparams ); 453 460 454 461 for ( unsigned i = 0; i < unsigned( params ); ++i ) … … 479 486 NV_ASSERT( u, "Unknown uniform type!" ); 480 487 (*p->m_uniform_map)[ name ] = u; 488 } 489 490 for ( unsigned i = 0; i < unsigned( bparams ); ++i ) 491 { 492 int uni_len; 493 char name_buffer[128]; 494 495 glGetActiveUniformBlockName( p->glid, i, 128, &uni_len, name_buffer ); 496 NV_LOG_INFO( string_view( name_buffer, size_t( uni_len ) ) ); 481 497 } 482 498 } -
trunk/src/gl/gl_enum.cc
r472 r473 168 168 switch( type ) 169 169 { 170 case VERTEX_BUFFER : return GL_ARRAY_BUFFER; 171 case INDEX_BUFFER : return GL_ELEMENT_ARRAY_BUFFER; 170 case VERTEX_BUFFER : return GL_ARRAY_BUFFER; 171 case INDEX_BUFFER : return GL_ELEMENT_ARRAY_BUFFER; 172 case UNIFORM_BUFFER : return GL_UNIFORM_BUFFER; 172 173 NV_RETURN_COVERED_DEFAULT( 0 ); 173 174 }
Note: See TracChangeset
for help on using the changeset viewer.