[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] frame timing and continous scaling



I have a usecase where I need to measure how long a frame took (in total JS+GPU+pre/post frame overhead) for dynamic scaling.

What I currently do for that is measure a moving average of interframe times and adjust a scaling factor (gauss-seidel relaxed) to 30 fps.

This method does not work to hit framerates of 60 (or whatever the UA wants to limit to) because it exhibits hysteresis since it doesn't know how far it is above 60fps (and because the UA immediately steps down to 30fps if it can't hit 60).

Here are the things that won't work:
  1. Use performance.now:
    1. intraframe: Does not work because doesn't capture GPU processing end and does not capture pre/post frame overhead
    2. interframe: Does not work because of UA fps limiting
  2. Use timer queries:
    1. intraframe: Does not work because it doesn't capture pre/post frame overhead
    2. interframe: Does not work because of UA fps limiting
  3. Use performance.mark: That's just performance.now with labels
  4. Toggle off FPS limiting: does not work in a production setting (development only measure)
Would it be possible to add an API to navigator.performance?