Changeset 499 for trunk/src/gl
- Timestamp:
- 06/06/16 18:54:52 (9 years ago)
- Location:
- trunk/src/gl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_context.cc
r493 r499 428 428 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 ); 429 429 } 430 } 431 432 void* nv::gl_context::map_buffer( buffer b, buffer_access ba, size_t offset, size_t length ) 433 { 434 const gl_buffer_info* info = static_cast<const gl_buffer_info*>( m_device->get_buffer_info( b ) ); 435 unsigned int glenum = buffer_type_to_enum( info->type ); 436 glBindBuffer( glenum, info->glid ); 437 void* result = glMapBufferRange( glenum, GLintptr( offset ), GLsizeiptr( length ), buffer_access_to_bitfield( ba ) ); 438 if ( result == nullptr ) 439 { 440 while ( GLenum err = glGetError() ) 441 switch ( err ) 442 { 443 case GL_INVALID_VALUE : NV_LOG_ERROR( "map_buffer failed : GL_INVALID_VALUE" ) break; 444 case GL_INVALID_OPERATION : NV_LOG_ERROR( "map_buffer failed : GL_INVALID_OPERATION " ) break; 445 case GL_OUT_OF_MEMORY : NV_LOG_ERROR( "map_buffer failed : GL_OUT_OF_MEMORY " ) break; 446 default: 447 break; 448 } 449 } 450 return result; 451 } 452 453 void nv::gl_context::unmap_buffer( buffer b ) 454 { 455 const gl_buffer_info* info = static_cast<const gl_buffer_info*>( m_device->get_buffer_info( b ) ); 456 glUnmapBuffer( buffer_type_to_enum( info->type ) ); 430 457 } 431 458 -
trunk/src/gl/gl_enum.cc
r492 r499 287 287 } 288 288 289 290 289 unsigned int nv::output_slot_to_enum( output_slot slot ) 291 290 { … … 307 306 } 308 307 308 309 unsigned int nv::buffer_access_to_bitfield( buffer_access type ) 310 { 311 switch ( type ) 312 { 313 case WRITE_UNSYNCHRONIZED : return GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT; 314 default: return 0; // TODO: throw! 315 } 316 } 309 317 310 318 unsigned int nv::datatype_to_gl_enum( datatype type )
Note: See TracChangeset
for help on using the changeset viewer.