Shopify / react-native-skia

High-performance React Native Graphics using Skia
https://shopify.github.io/react-native-skia
MIT License
6.98k stars 452 forks source link

fix: ios canvas ProMotion 120hz #2690

Closed SamuelScheit closed 3 weeks ago

SamuelScheit commented 1 month ago

Currently react-native-skia is only rendering with a maximum of 60 fps on iOS, even if the device supports 120 fps.

I've tried to screen record the behaviour, but interestingly enough it seems to render at 120 fps if I'm screen recording. So I resorted to a camera slow mo recording:

Before After

@chrfalch describes the fix in a discussion comment https://github.com/Shopify/react-native-skia/discussions/1275#discussioncomment-4715887:

CAFrameRateRange rate;
rate.maximum = 120;
rate.preferred = 120;
_displayLink.preferredFrameRateRange = rate;

which I applied to the DisplayLink.mm file with a fallback:

_displayLink.preferredFramesPerSecond = 120;

if the iOS version is lower than 15.0.

SamuelScheit commented 1 month ago

I have signed the CLA!

wcandillon commented 3 weeks ago

finally we can merge it :) Thank you for this :)

github-actions[bot] commented 3 weeks ago

:tada: This PR is included in version 1.5.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: