-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an OS method to retrieve a screen's refresh rate #1284
Comments
Related to GodotVR/godot_openvr_fps#6 |
Does Vulkan support this? The comments in this issue seem to suggest it doesn't yet provide a way to sync up with the monitor without using V-Sync. (I'm not familiar with the Vulkan API, though, so maybe I'm misinterpreting things?) Also, we'll need to account for variable refresh rate monitors somehow. |
In my experience, limiting FPS to
In this case, you need to return the highest supported frequency supported by the VRR monitor. It might be worth checking if SDL has anything specific for this in place. |
Hey, I know this is merged already (after all I am coming here from the alpha 2 blog post), but I wonder if it really makes sense to return After all if you call the function, you want to know the monitor frame rate. If the engine is unable to determine this for some reason, I think it would make more sense to also communicate that (by returning Then it is left for the user to do what he wants with the returned value (for example on -1, assume 60). If it always returns 60 otherwise, the user cannot know if that truly is the monitor refresh rate, or calling the function "failed". |
cc @jordigcs I personally don't mind returning The check in the documentation should use |
I think this would be a better way to handle failure as well. I'll get started on that. |
Opened at godotengine/godot#57938 |
This feature was also implemented in |
Related to godotengine/godot#21486, #236 and #1283.
Describe the project you are working on:
The Godot editor 🙂
Describe the problem or limitation you are having in your project:
It is currently impossible to retrieve a screen's refresh rate.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
A method to get the monitor's refresh rate can be helpful in several ways:
_ready()
. Care should be taken about setups that have monitors with different refresh rates.With high-refresh rate displays becoming more and more popular (including on mobile devices), providing the best possible experience on such displays is getting more important.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
This feature has to be implemented in an OS-specific manner. It should preferably return a floating-point value in Hz, although returning an integer value in Hz is also acceptable. If the engine fails to retrieve the monitor refresh rate for any reason, it should return
60
as a fallback since this is the most common refresh rate.I tried to implement this for X11 based on the SDL2 code, but it's easier said than done 🙂
If this enhancement will not be used often, can it be worked around with a few lines of script?:
It might be possible to do this on Linux by calling
xrandr
, but it's not particularly user-friendly. On other platforms (especially mobile platforms), this may not be possible at all.Is there a reason why this should be core and not an add-on in the asset library?:
This might be feasible using a GDNative-based add-on. However, since high refresh rate displays will probably be the norm in a few years' time, it's probably better to support this as a core feature.
The text was updated successfully, but these errors were encountered: