intel / fastuidraw

Mozilla Public License 2.0
609 stars 58 forks source link

Remove dependency on gettimeofday() #33

Closed zsx closed 6 years ago

zsx commented 6 years ago

It's not available on Windows, and because only the elapsed time is needed, std::clock() is good enough.

krogueintel commented 6 years ago

Hi,

The times (particular for demos) needs to have how much time has actually passed; std::clock() gives CPU time of the process. However, I suggest using std::chrono::steady_clock() instead.

zsx commented 6 years ago

@krogueintel Hmm, I've looked into the code, and I didn't see it needed the wallclock anywhere. Could you show me the code?

krogueintel commented 6 years ago

The case in gl_program.cpp is needed to know how long it takes (from program time startup) for the uber-shaders to compile; some drivers do a multi-threading thing so CPU time is not actual time.

For demos, the use case is entirely for real (clock time) changes to measuring FPS and performance. As such CPU time is not what is wanted (since usually graphically intense applications are bottle necked by the GPU).

zsx commented 6 years ago

@krogueintel OK, I see. Thanks for the explanation. I'll update this series.

zsx commented 6 years ago

@krogueintel I have respun the series with std::chrono::steady_clock.