- Timestamp:
- 05/06/16 19:25:05 (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/gl/gl_context.hh
r492 r493 97 97 void enable( unsigned int what, bool value ); 98 98 void set_active_texture( texture_slot slot ); 99 100 bool validate_program( program p ); 99 101 private: 100 102 texture_slot m_active_slot; -
trunk/nv/gl/gl_device.hh
r491 r493 33 33 unsigned glidv; 34 34 unsigned glidf; 35 bool validated; 35 36 }; 36 37 … … 60 61 virtual bool bind_block( program p, const string_view& name, uint32 index ); 61 62 virtual int get_block_location( program p, const string_view& name, bool fatal = true ) const; 62 virtual void prepare_program( program p );63 63 virtual string_view get_shader_header() const { return m_shader_header; } 64 64 virtual ~gl_device(); 65 65 protected: 66 void prepare_program( program p ); 66 67 uniform_base* get_uniform( program p, const string_view& name, bool fatal = true ) const; 67 68 -
trunk/src/gl/gl_context.cc
r492 r493 317 317 glUseProgram( info->glid ); 318 318 gdevice->update_uniforms( info ); 319 } 320 } 319 if ( !info->validated ) 320 { 321 validate_program( p ); 322 } 323 } 324 } 325 326 bool nv::gl_context::validate_program( program p ) 327 { 328 gl_device* gdevice = static_cast<gl_device*>( m_device ); 329 gl_program_info* info = gdevice->m_programs.get( p ); 330 if ( info ) 331 { 332 info->validated = true; 333 const uint32 buffer_size = 1024; 334 char buffer[buffer_size] = { 0 }; 335 int length; 336 int status; 337 glValidateProgram( info->glid ); 338 glGetProgramiv( info->glid, GL_VALIDATE_STATUS, &status ); 339 340 if ( status == GL_FALSE ) 341 { 342 glGetProgramInfoLog( info->glid, buffer_size, &length, buffer ); 343 NV_LOG_ERROR( "Program #", info->glid, " validation error : ", buffer ); 344 return false; 345 } 346 return true; 347 } 348 return false; 349 } 350 321 351 322 352 // void nv::gl_context::bind( buffer b ) -
trunk/src/gl/gl_device.cc
r492 r493 34 34 35 35 info->glid = glCreateProgram(); 36 info->validated = false; 36 37 compile( info, vs_source, fs_source ); 37 38 prepare_program( result ); … … 452 453 } 453 454 454 glValidateProgram( p->glid );455 glGetProgramiv( p->glid, GL_VALIDATE_STATUS, &status );456 457 if ( status == GL_FALSE )458 {459 glGetProgramInfoLog( p->glid, buffer_size, &length, buffer );460 NV_LOG_ERROR( "Program #", p->glid, " validation error : ", buffer );461 //return false;462 }463 455 load_attributes( p ); 464 456 load_uniforms( p );
Note: See TracChangeset
for help on using the changeset viewer.