Frederic Bouvier writes:
> 
> Quoting Andy Ross:
> 
> > * Hopefully in a CPU-friendly way.  I know that older versions of
> >   the NVidia drivers did this by spinning in a polling loop
> >   inside the driver.  I'm not sure if this has been fixed or not.
> 
> >From my experience, the latest non-beta Windows NVidia driver seems to eat 
> >CPU
> even with sync to vblank enabled. The CPU usage is always 100%.

Buried in the PPE sources is a 'hackish' but portable way to 
limit CPU usage if the desired framerate is met

  /*
    Frame Rate Limiter.

    This prevents any one 3D window from updating faster than
    about 60Hz.  This saves a ton of CPU time on fast machines.

    ! I THINK I MUNGED THE VALUE FOR ulMilliSecondSleep() NHV !
  */

  static ulClock *ck = NULL ;

  if ( frame_rate_limiter )
  {
     if ( ck == NULL )
     {
       ck = new ulClock ;
       ck -> update () ;
     }

     int t_ms = (int) ( ck->getDeltaTime() * 1000.0 ) ; /* Convert to ms */

     if ( t_ms < 16 )
       ulMilliSecondSleep ( 16 - t_ms ) ;
  }

Cheers

Norman

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to