[Webkit-unassigned] [Bug 173434] Support for 120Hz requestAnimationFrame

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Nov 7 16:08:46 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=173434

--- Comment #18 from jdspugh <jdspugh at gmail.com> ---
@mksl My code snippet will run a game's simulation logic at the specified rate e.g. 240 fps. The render rate will depend on the device: 30/60/120 fps etc. So the game will function the same i.e. not speed up or slow down on devices with different refresh rates but the number of simulation updates the user sees will depend on the device's refresh rate.

Even though the above code overcomes the problem of simulating games on devices with different refresh rates, I still believe there must be a way for the game to specify its preferred refresh rate. So something like requestAnimationFrame(fn,refreshRate), as proposed, is necessary.

For reference, and to spur on this discussion and implementation: Since the last message I posted I've been coding on the Oculus Quest 2. It already provides a way to query the available refresh rates and set your desired refresh rate. It's incredibly pleasing and relieving to see this actually works in practise and I've been getting 120fps on the device from my WebXR code. For VR applications the refresh rate is way more critical which, I guess, is why the discussion and implementation of this feature has been accelerated and arrived on these devices already. This is how to code setting the device's maximum frame rate:

---
const gRenderer = new WebGLRenderer()
gRenderer.xr.addEventListener('sessionstart', event => {
  const gXrSession = gRenderer.xr.getSession()
  if (gXrSession.supportedFrameRates) { gXrSession.updateTargetFrameRate(Math.max(...gXrSession.supportedFrameRates)) }
  ...
}
---

gXrSession.supportedFrameRates on the Oculus Quest 2 return a Float32Array with the values [60, 72, 80, 90, 120]

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211108/6b5e052d/attachment.htm>


More information about the webkit-unassigned mailing list